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:

    We should never stand upon ceremony with sincerity. We should never cheat and insult and banish one another by our meanness, if there were present the kernel of worth and friendliness. We should not meet thus in haste.
    Henry David Thoreau (1817–1862)

    ... when you do get a job everybody says, “Well, they wanted a black woman,” which necessarily puts you on a level where you have to prove yourself above being a woman and being black.... Now, I would say, in certain situations, it helped me simply because I was mildly attractive, not because I was black or a woman. That gets you more mileage than anything else.... God help you if you’re not an attractive woman.
    Theresa Brown (b. 1957)

    Productive collaborations between family and school, therefore, will demand that parents and teachers recognize the critical importance of each other’s participation in the life of the child. This mutuality of knowledge, understanding, and empathy comes not only with a recognition of the child as the central purpose for the collaboration but also with a recognition of the need to maintain roles and relationships with children that are comprehensive, dynamic, and differentiated.
    Sara Lawrence Lightfoot (20th century)

    ... many of the things which we deplore, the prevalence of tuberculosis, the mounting record of crime in certain sections of the country, are not due just to lack of education and to physical differences, but are due in great part to the basic fact of segregation which we have set up in this country and which warps and twists the lives not only of our Negro population, but sometimes of foreign born or even of religious groups.
    Eleanor Roosevelt (1884–1962)