This project demonstrates the classic Producer-Consumer problem using Java. The Producer-Consumer problem is a synchronization problem that involves ensuring that producers (who produce data and add it to a buffer) and consumers (who take data from the buffer) operate without running into race conditions. This project uses Java's synchronized methods. It features a graphical user interface (GUI) to simulate the production and consumption of products.
- Producers can add data to the buffer while there is an empty scpace .
- Consumers can consume data from the buffer if they exist.
- The GUI allows users to:
- Add new producer.
- Add new consumer.
- Remove a producer.
- Remove a consumer.
- View the number of producer and consumer existe.
-
Open a terminal or command prompt.
-
Clone the repository using the following command:
git clone https://github.com/yourusername/producer-consumer-java.git cd producer-consumer-java
sudo apt update
sudo apt install default-jdk
-
Navigate to the project directory:
cd producer-consumer-java
-
Compile the project:
make
-
Run the project:
make run
make clean
- Buffer Full or Empty:
- If the buffer is full, producing a new data will fail, and a message will be displayed.
- If the buffer is empty, consuming a data will fail, and a message will be displayed.
For further assistance, please contact:
- Emails: [email protected] [email protected]