Linux process/kernel model

Source: Internet
Author: User

The kernel must implement a set of services and corresponding interfaces, and the application can use these interfaces instead of dealing directly with the hardware.

The Linux kernel consists of the following 5 subsystems: Process scheduling, memory management, virtual file system, interprocess communication, and device driver.

In this composition, the most core is process management, process scheduling and interprocess communication.

In a Linux system, any application-level program that we write, whether it's the upper or middle-tier code, or even the lowest-level driver code, can run on the system in the form of a process. The CPU can run in both the user state and the kernel state.

In the Linux process/kernel model, each process is the only mirror that executes on the machine, they are exclusive to the system service, and when the process needs to access the system service, it makes the system call (request to the kernel), and the hardware switches the rights mode from user state to kernel mode. The kernel process will then be forced back to user mode by hardware. When a program executes in user mode, it does not have direct access to kernel data structures or kernel programs.

A process is a dynamic entity, and its life in the system is limited. The Linux kernel is a thread-dispatched unit.

Task: A collection of processes that can contain one or more processes.

Async: Two events occur without any association, and the occurrence of one thing does not change with the occurrence of another event.

Synchronization: There are sequential points between two events, and an event must occur after an event.

For example, when a program accesses a hardware resource, another program accesses the hardware resource, and the latter program waits for the previous one, and we say that the two programs access the hardware resource synchronously. (synchronization does not occur at the same time as two events)

The kernel is not a process, but a manager of the process.

How the kernel routines are activated: 1. The process invokes the system call; 2.CPU is the exception signal from the executing process, which indicates that unconventional conditions such as invalid instruction occur; 3. The peripheral device emits an interrupt signal to the CPU, and each interrupt signal is handled by a kernel program called an interrupt handler handle, and the interrupt is executed asynchronously with the CPU. 4. Kernel threads are scheduled to execute.

differences between exceptions and interrupts:

The same point: will cause the CPU to stop the current process into a specialized processing routine.

Difference: The exception is synchronous, it must happen after an error, and the interrupt is asynchronous, it happens randomly.

Linux process/kernel model

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.