665 B
665 B
Logic
Initial State:
- Lifts all at the bottom of the building
- People all outside the building
- not waiting on an arrow
- not in a lift
State 1:
These are performed simulataneously
- Lift Thread
- Lift waits for a short amount of time (to allow people to enter the building)
- If no one is in the lift, it calls
get_into_lift()
get_into_lift()
checks if someone is waiting on the up arrow semaphore- Two things must then happen:
- First, the lift must update the lift that currently is on that floor
- Second, the lift must signal to a passenger that it may enter.
- Person Thread 1.