Critical Section Routine (CSR)
Definition - What does Critical Section Routine (CSR) mean?
Critical section routine (CSR) is a section of code for which a process obtains an exclusive lock so that no other process may execute it simultaneously. Often, one or more processes execute simultaneously in an operating system, forcing these processes to compete with each other for access to files and resources. Only one process should be allowed to access the resource while part of the code related to the resource is executed.
To ensure that a process in the CSR does not fail while other processes are waiting, a time limit is set by the process management component. Thus, a process can have access to an exclusive lock for only a limited amount of time.
Techopedia explains Critical Section Routine (CSR)
The main requirements for implementing a CSR are:
- Mutual Exclusion: When a process is executing in a CSR, no other process can enter.
- Progress Condition: If no process is executing in a CSR and there are some processes that wish to enter it, they can do so in a definite amount of time. One of the processes enters the CSR while others wait.
- Bounded Waiting: When a process requests to enter a CSR and before the request is granted, there must be an upper limit on the number of processes waiting to enter the CSR during this period to ensure that no process starves and every process in the waiting queue gets a turn to enter the CSR.
The CSR, in a certain piece of code, can be identified though the following properties:
- Code is characterized by a read-write-update sequence of operations.
- Sections of the code alter variables in another code, which performs a read-write-update sequence of operation.
- The presence of code that accesses a data structure of some other code by modifying it, or code that uses a data structure that could be modified by some other process.
The concept of critical section can be applied to hardware that uses the interrupts facility. Whenever a process enters a critical section, all interrupts on the processor should be disabled so that other processes cannot request a lock on the resource. Similarly, when a process finishes execution, interrupts are enabled again. Another approach is to use a semaphore, a special variable that acts like a signal to direct the execution or termination of a process.
Join thousands of others with our weekly newsletter
The 4th Era of IT Infrastructure: Superconverged Systems:
Approaches and Benefits of Network Virtualization:
Free E-Book: Public Cloud Guide:
Free Tool: Virtual Health Monitor:
Free 30 Day Trial – Turbonomic: