This project demonstrates the implementation of classic synchronization algorithms in Java, including Dekker's, Lamport's, and Peterson's algorithms, along with an example of a semaphore. These implementations are designed to help understand the basics of process synchronization and mutual exclusion in concurrent programming.
- Dekker's Algorithm: Ensures mutual exclusion between two threads.
- Lamport's Bakery Algorithm: A more general algorithm that allows for mutual exclusion among N threads.
- Peterson's Algorithm: Simplifies Dekker's approach for two threads, ensuring mutual exclusion with a simpler logic.
- Semaphore Example: Demonstrates the use of semaphores to control access to a shared resource by multiple threads.
- Java JDK 11 or later
- Your favorite IDE or text editor
- Clone the repository:
git clone https://your-repository-url-here.git](https://github.com/Floressek/concurrentLab_algorythms)
- Navigate to the cloned directory:
cd java-synchronization-algorithms
- Compile the Java files (example):
javac Zadanie_1/Dekker.java Zadanie_2/Peterson.java Zadanie_3/Lamport.java Zadanie_4/SemaphoreExample.java
- Run the compiled Java classes (example):
java Zadanie_1.Dekker
java Zadanie_2.Peterson
java Zadanie_3.Lamport
java Zadanie_4.SemaphoreExample
Contributions are welcome! Please feel free to submit a pull request.
This project is open-sourced under the MIT License. See the LICENSE file for more details.