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, 22.06.2019 02:00
Think about some of the most memorable and forgettable games ever created. they can be games that were discussed in this unit or otherwise. what are some of the consistent factors that made certain games memorable to you? what were some of the consistent factors that made certain games forgettable to you? why? explain.
Answers: 1
question
Computers and Technology, 22.06.2019 10:30
Think about a recent customer service experience - either positive or negative. write a brief summary of that experience. now think about those four characteristics we look for in customer service representatives. how did the representative in your example stack up? write down your answer and give specific examples.
Answers: 1
question
Computers and Technology, 24.06.2019 09:00
Technician a says that a new replacement part is always good. technician b says that sometimes recent repair work will be the cause of a complaint. who is correct? a. both technicians a and b b. technician a c. technician b d. neither technician a nor b
Answers: 3
question
Computers and Technology, 24.06.2019 12:50
Write a new lc-3 trap subroutine (i.e. a subroutine that will be invoked via the trap instruction) that will receive a numeric digit entered at the keyboard (i.e. an ascii character), echo it to the screen, and return in r0 the corresponding numeric value: so if the user types the digit '7', the character '7' will appear on the screen, but the value returned in r0 will be b0000 0000 0000 0111 (#7) you may not use any trap calls in your code - you must implement the "polling" code that interrogates the keyboard status and data registers. ; getnum_tsr ; a subroutine for obtaining a numeric value ; given ascii numeric digit input to keyboard. ; the numeric digit is echoed to the console (e.g. '7' = b0000 0000 0011 0111), ; but the value returned in r0 is the actual numeric value ; corresponding to the digit (e.g. b0000 0000 0000 0111 =
Answers: 3
You know the right answer?
Simulate the traffic at the intersection of two one-way streets using semaphores. The traffic must o...
Questions
Questions on the website: 13722360