Semaphores
Goal
-
Understand how to implement Acquire and Release for user programs and understand
semaphores
Reading Assignments
Discussion Topics
- Using pseudo-code to show how to implement Block
and Unblock system calls. Your
solution should work on multiprocessors.
-
The classical definition of P (or Down) and V (or Up) in pseudo-code is:
P(s) {
while (s <= 0)
;
s--;
}
V(s) {
s++;
}
This definition assumes that the modifications to semaphore s are executed
indivisibly. Real implementations do not implement semaphore primitives this
way, since busy wait is inefficient. Show your idea in pseudo-code how to
implement the semaphore primitives using minimal busy wait. You are
allowed to use the Block and Unblock system calls above. Note that your
solution should work on multiprocessors.