What modules are there in linux?

青灯夜游
Release: 2022-04-14 18:42:07
Original
3794 people have browsed it

Linux has five major modules: 1. The process scheduling module, which is mainly used to manage and control the processor used by the process; 2. The inter-process communication module, which is mainly used to control the synchronization between different processes in user space. , Data sharing and exchange; 3. Memory management module, using advanced virtual storage mechanism to realize storage management of multi-process; 4. File system module, etc.

What modules are there in linux?

#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

The Linux kernel contains five major sub-modules: process scheduling module, inter-process communication module, memory management module, file system module, and network interface module.

What modules are there in linux?

1. Process Scheduling Module

 Linux uses process as the basic unit of system resource allocation, and Adopt dynamic priority process advanced algorithm to ensure the rationality of each process using the processor. The process scheduling module mainly manages and controls the processor used by the process.

【Process Creation】:

 When programming in the Linux environment, the fork()/vfork() function is generally used (fork is to create a child process, and copies the memory data of the parent process to the child process; vfork creates a child process, and uses ) to share the memory data of the parent process to create a new process, of course, that is in user space function, it will call the clone() system call in the kernel, and the clone() function will continue to call do_fork() to complete the creation of the process.

fork()/vfork()/_clone--->clone()--->do_fork()--->copy_process()
Copy after login

【Process Cancellation】:

After the process terminates, the kernel needs to be notified so that the kernel can release the resources owned by the process, including memory, open files, and others. Resources, such as semaphores. The general way to terminate a process is to call the exit() library function, which releases the resources allocated by the C function library, executes each function registered by the programmer, and ends the system call that reclaims the process from the system. .

【Process Switching】:

 Process switching is also called task switching and context switching. It is the behavior where, in order to control the execution of a process, the kernel suspends the process currently running on the CPU and resumes the execution of some previously suspended process.
  In essence, each process switch consists of two parts:

  • Switch the page global directory to install a new address space;
  • Switch the kernel mode stack And hardware context, because the hardware context provides all the information needed by the kernel to execute the new process, including CPU registers, mainly completed by the switch_to() function.

【Process Scheduling】:

In modern Linux, the scheduling algorithm can be selected within a fixed time (independent of the number of runnable processes) The process to run. First of all, we must know that processes can be divided into real-time processes and ordinary processes. Each LInux process is always scheduled according to the following scheduling types: First-in-first-out real-time process, time slice rotation real-time process, ordinary time-sharing process. Scheduling algorithms differ significantly depending on whether the process is a normal process or a real-time process.


2. Inter-process communication module

Inter-process communication is mainly used to control the user space between different processes synchronization, data sharing and exchange. Since different user processes have different process spaces, communication between processes must be achieved with the help of kernel relay. Normally, a process is suspended while it is waiting for a hardware operation to complete. When the hardware operation is completed, the process is resumed, and what coordinates this process is the inter-process communication mechanism

The inter-process communication module ensures that Linux supports a variety of inter-process communication mechanisms, including pipes, named pipes, and message queues , semaphore and shared memory, etc.


3. Memory management module

The memory management module of Linux adopts the advanced virtual storage mechanism. Implement storage management for multiple processes. It provides very reliable storage protection measures and grants different permissions to processes. Users cannot directly access the system's programs and data, ensuring the security of the system. At the same time, each user process is assigned an independent virtual address space.


4. File system module

The file system module of Linux adopts advanced virtual file system (VFS) technology , shields the differences between various file systems, provides a unified interface for processing various different file systems, and supports more than 90 different physical file systems. At the same time, Linux treats various hardware devices as special files and manages the devices in the same way as files, which is very convenient and effective.


5. Network interface module

 Linux has the most powerful network function. The network interface module implements network communication between computers through the Socket (Socket) mechanism, and uses the network layer model to provide support for multiple network protocols and network hardware devices.

   The network interface provides the implementation of various network standards and support for various network hardware. Network interfaces are generally divided into network protocols and network drivers. The network protocol part is responsible for implementing every possible network transport protocol. Network device drivers are mainly responsible for communicating with hardware devices. Every possible network hardware device has a corresponding device driver

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of What modules are there in linux?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template