Operating System - Critical Section Problem
<<Previous - Process Synchronization
Critical section is a code segment in which each process may modify the common variables, update the table, write the files and so on. The critical section allows only one process to run at a given time. Suppose if another process wants to enter in its critical section, it must wait until the running process exits from the section.
Solution to critical section problem is nothing but designing a protocol that can be used by the cooperating processes. This protocol format contains several sections that are:
Entry section
Entry section gives permission to the process to enter into its critical section.
Critical section
Critical section allows only one process to execute.
Exit section
Exit section follows the critical section.
Remainder section
Remainder section contains the remaining code.
Solution to the Critical Section Problem
There are 3 conditions that must be satisfied by a solution to the critical-section problem.:
1. Mutual Exclusion
At a given point in time, only one process should execute in its critical section.
2. Progress
If no process is in its critical section and if any of the processes want to enter in its critical section, then that process is allowed to enter in their critical section, provided there is not much delay.
3. Bounded waiting
After a process has made a request for entering critical section and before the request is granted, There is a limit for number of times that other processes are allowed to enter the critical section. Usually, the limit is one time
<<Previous - Process Synchronization