Critical Section - Kernel Level Critical Sections

Kernel Level Critical Sections

Typically, critical sections prevent process and thread migration between processors and the preemption of processes and threads by interrupts and other processes and threads.

Critical sections often allow nesting. Nesting allows multiple critical sections to be entered and exited at little cost.

If the scheduler interrupts the current process or thread in a critical section, the scheduler will either allow the currently executing process or thread to run to completion of the critical section, or it will schedule the process or thread for another complete quantum. The scheduler will not migrate the process or thread to another processor, and it will not schedule another process or thread to run while the current process or thread is in a critical section.

Similarly, if an interrupt occurs in a critical section, the interrupt's information is recorded for future processing, and execution is returned to the process or thread in the critical section. Once the critical section is exited, and in some cases the scheduled quantum completes, the pending interrupt will be executed. The concept of scheduling quantum applies to "Round Robin" and similar scheduling policies.

Since critical sections may execute only on the processor on which they are entered, synchronization is only required within the executing processor. This allows critical sections to be entered and exited at almost zero cost. No interprocessor synchronization is required, only instruction stream synchronization. Most processors provide the required amount of synchronization by the simple act of interrupting the current execution state. This allows critical sections in most cases to be nothing more than a per processor count of critical sections entered.

Performance enhancements include executing pending interrupts at the exit of all critical sections and allowing the scheduler to run at the exit of all critical sections. Furthermore, pending interrupts may be transferred to other processors for execution.

Critical sections should not be used as a long-lived locking primitive. They should be short enough that the critical section will be entered, executed, and exited without any interrupts occurring, neither from hardware much less the scheduler.

Kernel Level Critical Sections are the base of the software lockout issue.

Read more about this topic:  Critical Section

Famous quotes containing the words kernel, level, critical and/or sections:

    After night’s thunder far away had rolled
    The fiery day had a kernel sweet of cold
    Edward Thomas (1878–1917)

    Helping children at a level of genuine intellectual inquiry takes imagination on the part of the adult. Even more, it takes the courage to become a resource in unfamiliar areas of knowledge and in ones for which one has no taste. But parents, no less than teachers, must respect a child’s mind and not exploit it for their own vanity or ambition, or to soothe their own anxiety.
    Dorothy H. Cohen (20th century)

    From whichever angle one looks at it, the application of racial theories remains a striking proof of the lowered demands of public opinion upon the purity of critical judgment.
    Johan Huizinga (1872–1945)

    That we can come here today and in the presence of thousands and tens of thousands of the survivors of the gallant army of Northern Virginia and their descendants, establish such an enduring monument by their hospitable welcome and acclaim, is conclusive proof of the uniting of the sections, and a universal confession that all that was done was well done, that the battle had to be fought, that the sections had to be tried, but that in the end, the result has inured to the common benefit of all.
    William Howard Taft (1857–1930)