Car park simulation (in Linux)
Budget: $40 – $60 USD
Write a multithreaded car park simulator program in C as follows in Linux:
1. Three drive-in threads (simulating in-valets) shall randomly move cars into the car park
2. Three drive-out threads (simulating out-valets) shall randomly take cars out of the car park
3. A monitor thread shall periodically print out a map of the car park showing the parking slots and the identities of the currently parked cars in the occupied slots.
You can do this by using one monitoring thread, 3 producer threads (simulating arrivals), and 3 consumer threads (simulating departures) with a bounded buffer (simulating the car park) of integers (simulating cars and car identities). The capacity of the car park (the buffer size) should be supplied to your program as a command-line parameter.
1. Three drive-in threads (simulating in-valets) shall randomly move cars into the car park
2. Three drive-out threads (simulating out-valets) shall randomly take cars out of the car park
3. A monitor thread shall periodically print out a map of the car park showing the parking slots and the identities of the currently parked cars in the occupied slots.
You can do this by using one monitoring thread, 3 producer threads (simulating arrivals), and 3 consumer threads (simulating departures) with a bounded buffer (simulating the car park) of integers (simulating cars and car identities). The capacity of the car park (the buffer size) should be supplied to your program as a command-line parameter.