Actually, regarding this question, the guy is right, you could do everything with the lock. The clerk locks the thread, and the supervisor checks the cone and returns unlocking the semaphore. If there was a problem (Cone disapproved) then the clerk can go back to the queue. With the scheme proposed by the lecturer, the clerk makes kind of busy wait (not really busy wait, but like it), taking the supervisor and not releasing it until he approves the cone. He basically hijacks the supervisor!
the question @ about 30.00 is right becouse if the lock is 1 so its opened it cant be 2 so no 2 clerks can be in the office at the same time so basically requested is the same is lock and requested isnt needed.
@alililiff Sorry for replying to an old post, but you're wrong. Requested is the exact opposite of lock and is therefor needed. The manager needs to start working when the lock turns 0, but you can't test for that in this implementation. You can only make the manager wait for a semaphore to be higher then 0. To go without "requested" you would need a semaphore wait function that waited untill a semaphore became non-zero and then did nothing to the semaphore.
This has been flagged as spam show
This has become a headache for me.
grunder20 1 month ago
This has been flagged as spam show
want to know more about this stuff
grunder20 2 months ago
Actually, regarding this question, the guy is right, you could do everything with the lock. The clerk locks the thread, and the supervisor checks the cone and returns unlocking the semaphore. If there was a problem (Cone disapproved) then the clerk can go back to the queue. With the scheme proposed by the lecturer, the clerk makes kind of busy wait (not really busy wait, but like it), taking the supervisor and not releasing it until he approves the cone. He basically hijacks the supervisor!
esepecesito 5 months ago
The TA does the "make sense?" thing too! He has a bright future!
EuclidsElements 2 years ago 12
This guy is not so good as Jerry is ,but he is still good :)
grigoriyz 2 years ago 2
the question @ about 30.00 is right becouse if the lock is 1 so its opened it cant be 2 so no 2 clerks can be in the office at the same time so basically requested is the same is lock and requested isnt needed.
alililiff 3 years ago
@alililiff Sorry for replying to an old post, but you're wrong. Requested is the exact opposite of lock and is therefor needed. The manager needs to start working when the lock turns 0, but you can't test for that in this implementation. You can only make the manager wait for a semaphore to be higher then 0. To go without "requested" you would need a semaphore wait function that waited untill a semaphore became non-zero and then did nothing to the semaphore.
imorio 1 year ago