Peterson's Solution

What is Peterson's Solution?

Peterson's solution is a classic solution to the critical section problem. The critical section problem ensures that no two processes change or modify a resource's value simultaneously.

There are three sections except for the critical sections: the entry section,exit section, and the remainder section.
The process entering the critical region must pass the entry region in which they request entry to the critical section. The process exiting the critical section must pass the exit region. The remaining code left after execution is in the remainder section.



Advantages of Peterson's Solution

Disadvantages of Peterson's Solution

Solution

  • Peterson's solution provides a solution to the following problems,
  • It ensures that if a process is in the critical section, no other process must be allowed to enter it. This property is termed mutual exclusion.
  • If more than one process wants to enter the critical section, the process that should enter the critical region first must be established. This is termed progress.
  • There is a limit to the number of requests that processors can make to enter the critical region, provided that a process has already requested to enter and is waiting. This is termed bounding.
  • It provides platform neutrality as this solution is developed to run in user mode, which doesn't require any permission from the kernel.