Lecture Notes for Concurrent Programming

24 June 2003 - Using Semaphores


This code isn't close to being correct. Remember that the wait queue wq is a priority queue ordered by increasing time-of-use. Only if the new requester had the shortest time-of-use would it be at the front of wa; otherwise, it would appear somewhere within wq and setting me would be correspondingly more complicated than just calling wq.top().

The important point is that the denied requester must allocate itself some space in the wait queue before it releases mutual exclusion on the allocator and then hang itself on the wait queue after it releases mutual exclusion.


This page last modified on 25 June 2003.