Szymański's algorithm
Szymanski's Algorithm is a mutual exclusion algorithm devised by computer scientist Dr. Boleslaw Szymanski, which has many favorable properties including linear waiting[1].
The algorithm is modeled on a waiting room. All processes which request entry into the critical section at roughly the same time enter the waiting room; the last "closes the door" to prevent any new processes entering. The processes then enter the critical section one by one (or in larger groups if the critical section permits this) and once all these processes have left the critical section, the door is reopened and the next batch of processes may enter.
The implementation consists of each process having a flag variable which is written by that process and read by all others (this single-writer property is desirable for efficiency reasons). The status of the "door" is computed by reading the flags of all processes.
References
- ^ Szymanski, Boleslaw K. (1988). "A simple solution to Lamport's concurrent programming problem with linear wait". ICS '88: Proceedings of the 2nd international conference on Supercomputing. St. Malo, France: ACM: 621–626. doi:http://doi.acm.org/10.1145/55364.55425. ISBN 0-89791-272-1.
{{cite journal}}
: Check|doi=
value (help); External link in
(help)|doi=