Anonymous user menu

Peterson’s Algorithm | Peterson’s Solution

Peterson’s Solution:
 Peterson’s Algorithm is a simple algorithm that can be run by two processes to ensure mutual exclusion for one resource.
 It does not require any special hardware.
 It uses busy waiting technique.
 Peterson's Solution is a concurrent programming algorithm for mutual exclusion that allows two or more processes to share a single-use resource without conflict, using only shared memory for communication.
Peterson’s Algorithm:
 The algorithm uses two variables, flag and turn.
 The variable turn indicates whose turn it is to enter the critical section.
 If turn == i, then process Pi is allowed.
 The flag array is used to indicate if a process is ready to enter the critical section.
 Flag[i] = true implies that process Pi is ready.


What to read next

Please Go through all these linksW3Schools – HTML Tutorial

DefinitionFiber optics is the technology used to transmit information as pulses of light through strands of fiber made of glass or plastic over long