Don't miss an insight. Subscribe to Techopedia for free.


Black-White Bakery Algorithm

What Does Black-White Bakery Algorithm Mean?

The black-white bakery algorithm is an enhancement to Lamport’s bakery algorithm that satisfies all the conditions of a mutual exclusive algorithm. This algorithm preserves the original Lamport algorithm while using a finite number of atomic registers of bounded size and satisfies FIFO fairness. It is also adaptive and satisfies local spinning. The black-white bakery algorithm is designed to provide a software based solution to mutual exclusion.


Techopedia Explains Black-White Bakery Algorithm

The black-white bakery algorithm primarily bounds the unbounded nature of the Lamport bakery algorithm by adding an additional bit, which will have a value of either white or black. It is the first algorithm (using only atomic registers) that satisfies both FIFO and local-spinning, and it is the first bounded space algorithm that satisfies both FIFO and adaptivity. It works on the same principle by satisfying the FIFO procedure but bounds the atomic registers through a series of different steps. It works by assigning each process a turn number and each ticket a color. Each process must wait to enter the critical section until its colored ticket number is the lowest in its group. If the color and ticket number of two processes are same, the process with the smaller identifier will enter critical state.


Related Terms