Added: 3 years ago
From: StanfordUniversity
Views: 12,841
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:
see all

All Comments (7)

Sign In or Sign Up now to post a comment!
  • 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 TA does the "make sense?" thing too! He has a bright future!

  • This guy is not so good as Jerry is ,but he is still good :)

  • 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.

Loading...
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more