home *** CD-ROM | disk | FTP | other *** search
-
- The Semaphore Functions
-
-
- WAIT
- - Input: a semaphore name
- Output: none
- - if semaphore's value = 1,
- then
- - set value to 0
- - return
- else
- - remove this task from ready list
- - place this task in the queue waiting upon this semaphore
- - switch to another task
-
- SIGNAL
- - Input: a semaphore name
- Output: none
- - if there are processes waiting upon this semaphore,
- then
- - remove one from the queue and add it to the ready list
- - return
- else
- - set the semaphore's value = 1
-