Pages 199-202 of Concurrent Programming1
1Chapter 7 of
The file is intended for on-screen viewing free of charge; use of this
material in any other format is subject to a fee. The file is provided for
individual non-commercial use only. On-line edition copyright (c) 1996 by
Addison-Wesley Publishing Company. Permission is granted to print or
photocopy (this document) for a fee of $0.02 per page, per copy, payable to
Addison-Wesley Longman Publishing. All other rights reserved.
- Raphael Finkel.
Advanced Programming Language Design.
A binary semaphore
s consists of an integer value
v and a queue
q. There are two atomic operations
on a binary semaphore.
P(s): if v = 1
v = 0
add this process to q
block this process
V(s): if q is empty
v = 1
remove a process from q
unblock the removed process