This is for my Comp. Architecture class, but I know the subject it is prevalent in Programming as well.
I'm having a hard time understanding a question for my class. We might have a question on it for our test so I'm hoping someone might be able to explain this to me.
I've tried googling for examples, but everything that comes up is program related. My book gives no examples, just explains what an up and down does.
Q: Make a table showing which of the processes P1, P2, and P3 are running and which are blocked as a function of time from 0 to 1000 msec.
All three processes perform up and down instructions on the same semaphore. When two processes are blocked and an
up is done, the process with
the lower number is restarted, that is, P1 gets preferance over P2 and P3, and so on. Initially, all three are running and the semaphore is 1.
At t=100 P1 does a down
At t=200 P1 does a down
At t=300 P2 does an up
At t=400 P3 does a down
At t=500 P1 does a down
At t=600 P2 does an up
At t=700 P1 does a down
At t=800 P1 does an up
At t=900 P1 does an up
Solution:
