Computers and Technology

Simulate the traffic at the intersection of two one-way streets using semaphores. The traffic must obey the following rules: • Only one car can be crossing at any given time.
• When a car reaches the intersection and no other cars are approaching from the other direction, then the car must be allowed to proceed immediately.
• Cars arriving from both directions simultaneously must take turns in crossing.
The solution should obey the following principles:
• A car approaching from one direction is modeled by incrementing a corresponding counter (Ex: ns for north-south, ew for east-west).
• A busy flag indicates whether the intersection is free or whether a car is currently crossing.
• When busy is true, a car blocks on a semaphore corresponding to the car's direction.
• A blocked car is unblocked when the currently crossing car leaves the intersection.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 24.06.2019 13:00, angelynb1497
Your mom wants to purchase a laptop computer. she said she wants her new computer to be able to play her dvds so she can listen to music and wants to know what type of optical drives will play her disk. which type of drive should she look for?
Answers: 1
image
Computers and Technology, 24.06.2019 15:00, firdausmohammed80
Universal windows platform is designed for which windows 10 version?
Answers: 1
image
Computers and Technology, 24.06.2019 18:30, HavenShort3075
These factors limit the ability to attach files to e-mail messages. location of sender recipient's ability to open file size of file type of operating system used
Answers: 1
image
Computers and Technology, 24.06.2019 22:10, mikaylaaaaa
How many different ways are there to order the eight jobs in the queue so that job usu comes somewhere before cdp in the queue (although not necessarily immediately before) and cdp comes somewhere before bbd (again, not necessarily immediately before)?
Answers: 1
Do you know the correct answer?
Simulate the traffic at the intersection of two one-way streets using semaphores. The traffic must o...

Questions in other subjects:

Konu
Mathematics, 02.08.2021 14:30
Konu
Mathematics, 02.08.2021 14:30
Konu
Mathematics, 02.08.2021 14:30
Konu
History, 02.08.2021 14:30