subject

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.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 24.06.2019 01:30
How can you make your column headings stand out?
Answers: 1
question
Computers and Technology, 24.06.2019 08:30
Why might you choose to create a functional resume
Answers: 1
question
Computers and Technology, 24.06.2019 14:00
Which describes careers that have similar education requirements but different qualifications? product safety engineers and materials engineers industrial safety engineers and industrial health engineers quality control systems managers and inspectors industrial safety and health engineers and hand packers
Answers: 3
question
Computers and Technology, 24.06.2019 19:30
Can someone who is skilled at coding create me a java chess game. don't copy from online source codes. make it original ! : d
Answers: 1
You know the right answer?
Simulate the traffic at the intersection of two one-way streets using semaphores. The traffic must o...
Questions
question
Mathematics, 28.09.2019 02:50
question
Mathematics, 28.09.2019 02:50
question
History, 28.09.2019 02:50
Questions on the website: 13722360