Project information
- Category: Program
- Project date: November 2022
- Project URL: Traffic Control System
Details
This project is made to be a reflection of a traffic control system.
The goal of this project is to implement this system with pthread lock(s) and semaphores.
What was known about this traffic control system is that it controls traffic at an intersection where cars can come from the North, South, East, or West.
This was implemented in the project through semaphores and pthreads where each car, which can come from any direction, has its own thread.
The layout of this project is a little different in terms of format, and the time at which each car arrives and exits. I set it to have each car randomly pick an action
to take at the intersection to save time on having to create each car's individual actions. I did this so that when testing I can pick out however many cars I want to
go through the intersection and see if they perform the actions required within a reasonable time frame (as seen in outputs screenshots).
Overall, the output is not
identical, but cars from different directions are able to pass through the intersections in a reasonable amount of time, going either straightforward, turning left or
right, then exiting.
The output displays the car ID, the car's original direction, the car's target direction, the actions they perform in order, and the time in double.