Linux can be re-entered into kernel

Source: Internet
Author: User

The Linux kernel is reentrant, which means that several processes may be executing in kernel mode at the same time. (Of course, a single-processor system, at a certain time there will only be one process execution, but many will block in the kernel mode) These processes will share the CPU, I/O devices and other system resources, to the user feel like running at the same time.

provides a way to re-enter code:

The functions you write only affect local variables, not the global data structure. Such a function is called a reentrant function. However, due to the need to access shared resources such as I/O devices, the kernel also has non-reentrant functions. The reentrant kernel is not confined to such reentrant functions, but the reentrant kernel can contain a non-reentrant Linux lock mechanism to ensure that only one process can execute the non-reentrant code, that is, the sharing of ticks, in a certain time, to implement the Reentrant kernel.

In an interrupt processing routine, there should be no non-reentrant code, because non-reentrant code can cause the processing process to wait, causing the interrupt to not be processed in a timely manner, or even causing the system to deadlock without further code execution. The interrupt handling routine, in addition to being temporarily aborted by a higher-priority interrupt, should be executed in sequence.

Exception-handling routines, interrupt-handling routines, and nesting of these routines do not change the process execution context when they abort other kernel control processes, that is, the state of the aborted process is saved only when the process is in the user state.

If a hardware interrupt occurs, you can re-enter the kernel to suspend the currently executing process, even if the process is in the kernel state. This capability is important because it increases the throughput of the device controller that is making the interrupt. Once the device has made an interrupt, it waits until the CPU responds. If the kernel responds quickly, the device controller can perform other tasks when the CPU processing is interrupted.

One of the key technologies for implementing a reentrant kernel is synchronization technology. if the kernel controls the link and is blocked by access to one of the kernel data structures, the other kernel control paths are not allowed to operate on the same data structure, otherwise the two control paths will destroy the stored information and cause the kernel control link path to perform indeterminate.

Linux can be re-entered into kernel

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.