What is Process Synchronization?

How does Process Synchronization work?

For Example, process A changes the data in a memory location while process B is trying to read the data from the same memory location. There is a high probability that data read by the second process will be erroneous.

Sections of a Program

  • Entry Section: It is part of the process which decides the entry of a particular process.
  • Critical Section: This part allows one process to enter and modify the shared variable.
  • Exit Section: The exit section allows the other process that is waiting in the Entry Section, to enter into the Critical Sections. It also checks that a process that finished its execution should be removed through this Section.
  • Remainder Section: All other parts of the Code, which is not in the Critical, Entry, and Exit Section, are known as the Remainder Section.

Critical Section Problem

A critical section is a segment of code that can be accessed by a signal process at a specific point in time. The section consists of shared data resources that are required to be accessed by other processes.

  • The entry to the critical section is handled by the wait() function, and it is represented as P().
  • The exit from a critical section is controlled by the signal() function, represented as V().

Rules for Critical Section

The critical section need must enforce all three rules:

  • Mutual Exclusion: If a process P is executing in its critical section then no other process can be executing in their critical sections
  • Progress: If no process is executing in its critical section and some process wishes to enter their critical section then only those process that is not executing in their remainder sections can participate in deciding which process will enter its critical section next and this selection cannot be done indefinitely.
  • Bound Waiting: There exists a bound or a limit on the number of times other processes are to enter their critical sections after a process has made a request to enter its critical section and before that request is granted.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store