Peterson’s Algorithm

What Does Peterson’s Algorithm Mean?

Peterson’s algorithm is a concurrent programming algorithm developed by Gary L. Peterson in a 1981 paper. It is known as a simple algorithm when compared to others. Peterson proved the algorithm using both the 2-process case and the N-process case.

Advertisements

Peterson’s algorithm is used for mutual exclusion and allows two processes to share a single-use resource without conflict. It uses only shared memory for communication. Peterson’s formula originally worked only with two processes, but has since been generalized for more than two.

Techopedia Explains Peterson’s Algorithm

Just as in Dekker’s algorithm, turn variables (turn) and status flags (flag) are conditions or variables that are used in Peterson’s algorithm. Because of these two conditions, and because of waiting for a turn only if other flags are set, the need to clear and reset flags is avoided. After a flag is set, the turn is immediately given away when using Peterson’s algorithm.

Mutual exclusion, no progress and bounded waiting are three essential criteria used to solve the critical section problem when using the algorithm.

Advertisements

Related Terms

Margaret Rouse
Technology Expert

Margaret is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages.