Skip to content

LefterisXris/Lamport-s-Bakery-Algorithm-Java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Lamport's Bakery Algorithm.

This is a Java implementation of Bakery Algorithm. For more information about this algorithm please visit Wikipedia.

How to use it:

Just compile the code and run it. By default, the test is to create 5 threads that each has to loop 200 times and increase a global counter (same for all threads). The expected result should be 200 * 5 = 1000. You can change those values from the variables "numberOfThreads" and "countToThis".

The main "work" of the algorithm is inside the method "lock". There, only one thread will manage to exit the loops and it will keep the lock until it runs the unlock method.

About

Implementation of Bakery algorithm for mutual exclusion.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages