Question
----Operating system___ C language Cars arrive at the intersection along the roads marked A, B, and C, and proceed to take a left or a
----Operating system___ C language
Cars arrive at the intersection along the roads marked A, B, and C, and proceed to take a left or a right turn. Thus Car A taking a right turn goes to road B and taking a left turn goes to road C, etc. The intersection has no traffic light or any other traffic control signs. Each car knows the road it is on and the turn it wants to take. Cars along each road come in one at a time and execute a procedure LEFT or RIGHT to go left or right respectively, passing the identity of the road it is coming from as an argument. ( Thus car coming on road B and wanting to take a left will execute LEFT(B) ).
A. Design the procedures LEFT and RIGHT using semaphores. The correct solution should support maximal parallelism, assure that no deadlocks occur, and there is no starvation. Of course there should be no collisions of the cars.
B. How many semaphore variables does your solution require and why?
C. What is the maximum number of cars that can be in the intersection in your solution?
C. What is the maximum number of cars that can be in the intersection in your solution?
4 B 4 BStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started