FACTOID # 113: In Denmark, more than 50% of the tax collected is personal income tax. In the Netherlands, personal income tax makes up less than 15%.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

SEARCH ALL

FACTS & STATISTICS    Advanced view

Search encyclopedia, statistics and forums:

 

 

(* = Graphable)

 

 


Encyclopedia > Critical section

In computer programming a critical section is a piece of code that can only be executed by one process or thread at a time. It will usually terminate in fixed time, and a process will only have to wait a fixed time to enter it. Some synchronisation mechanism is required at the entry and exit of the critical section to ensure exclusive use, for example a semaphore. Wikibooks has more about this subject: Computer programming Computer programming (often simply programming) is the craft of implementing one or more interrelated abstract algorithms using a particular programming language to produce a concrete computer program. ... CODE is a visual programming language and system for parallel programming, letting users compose sequential programs into parallel ones. ... In computing, a process is, roughly speaking, a task being run by a computer, often simultaneously with many other tasks. ... Synchronization is coordination with respect to time. ... A semaphore is a protected variable (or abstract data type) and constitutes the classic method for restricting access to shared resources (e. ...


By carefully controlling which variables are modified inside and outside the critical section (usually, by accessing important state only from within), concurrent access to that state is prevented.


Application Level Critical Sections

Fill me in!


What are some user level API's for critical sections? These should include settings for processor affinity and process or thread premption. Most are probably slow, using heavy weight synchronization primitives. There may be some using user level scheduler plugins or libraries that provide user level threading within a single process across one or more processors.


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 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, these pending interrupt will be executed.


Since critical sections may execute only on the processor on which they are entered, sychronization 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 synchonization. Most proessors provide the required amount of syncronization 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. Further more, pending interrupts may be transfered to other processors for execution.


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


  Results from FactBites:
 
Critical section - Wikipedia, the free encyclopedia (121 words)
In computer programming a critical section is a piece of code that can only be executed by one process or thread at a time.
Some synchronisation mechanism is required at the entry and exit of the critical section to ensure exclusive use, for example a semaphore.
By carefully controlling which variables are modified inside and outside the critical section (usually, by accessing important state only from within), concurrent access to that state is prevented.
  More results at FactBites »


 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments
Please enter the 5-letter protection code

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms.