Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Critical section
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Kernel-level critical sections === Typically, critical sections prevent thread and [[process migration]] between processors and the [[Preemption (computing)|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 [[Scheduling (computing)|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 information is recorded for future processing, and execution is returned to the process or thread in the critical section.{{cn|date=April 2025}} Once the critical section is exited, and in some cases the scheduled quantum completed, the pending interrupt will be executed. The concept of scheduling quantum applies to "[[Round-robin scheduling|round-robin]]" and similar [[Scheduling (computing)|scheduling policies]]. Since critical sections may [[Execution (computers)|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 no cost. No inter-processor synchronization is required. Only instruction stream synchronization is needed.<ref>{{Cite journal |last=Dubois, Scheurich |first=Michel, Christoph |year=1988 |title=Synchronization, Coherence, and Event Ordering in Multiprocessors |journal=Survey and Tutorial Series |volume=21 |issue=2 |pages=9β21 |doi=10.1109/2.15 |s2cid=1749330}}</ref> Most processors provide the required amount of synchronization by 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-lasting locking primitive. Critical sections should be kept short enough so they can be entered, executed, and exited without any interrupts occurring from the [[Computer hardware|hardware]] and the scheduler. Kernel-level critical sections are the base of the [[software lockout]] issue.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)