FOR FREE MATERIALS

Process Synchronization as a solution of Critical Section

 

To synchronize processes, we put extra code before Critical Section is called entry and after Critical Section(CS) is called exit. This synchronization mechanism avoids critical section problems or race conditions.

 

Example: Process Synchronization as a solution of critical section problem

 

 

Note: Non- Critical Section (NCS): The portion of the program text, where the independent code of the processes will be placed.

 

This synchronization procedure using entry and exit code before and after Critical Section (CS) ensures that if one process is inside its Critical Section then no other processes are allowed to go inside its own Critical Section or at a time only one process is allowed to go inside the Critical Section.

 

So, to avoid race condition, only one process should be allowed in the Critical Section.

 

Synchronization mechanism:

  • # Mutual exclusion ensure that there is no problem of race condition among processes
  • # Process should not be allowed to access the critical section directly.
  • # Process must be request permission to enter the CS.
  • # Entry section must ensure the "Mutual Exclusion" principal
  • # Process must notify when leaving the region.
  • # Exit section informs the availability of the critical section to other waiting processes.