This project implements a classic Producer-Consumer Problem in Java, simulating a busy Car Wash and Gas Station with synchronized resource management. The simulation models a service station with limited service bays and a fixed-size waiting area for vehicles.
| Team Member | Main Role | Responsibilities |
|---|---|---|
| Shahd | ServiceStation | Main class setup, resource initialization, thread management |
| Kenzy | Semaphore Class | Custom semaphore implementation with synchronization |
| Gaeza | Car Class (Producer) | Car arrival logic, queue entry, semaphore acquisition |
| Amina | Pump Class (Consumer) | Service logic, car processing, resource release |
| Shrouq | Support & Logging | Queue validation, message logging, simulation timing |
- ServiceStation - Main class initializing semaphores, queue, and thread pools
- Semaphore - Custom implementation using
synchronized,wait(), andnotify() - Car - Producer threads representing arriving vehicles
- Pump - Consumer threads representing service bays
- Bounded Buffer pattern for the waiting queue (size: 1-10)
- Semaphores for controlling access to shared resources
- Mutex for ensuring thread-safe queue operations
- Proper resource acquisition/release sequencing
- Thread-safe queue management using semaphores
- Multiple service bays working concurrently
- Real-time simulation logging with detailed messages
- Configurable waiting area and pump counts
- Queue size validation (1-10 vehicles)
- Realistic service time simulation