© Thomas
Kunz 2000
SCE 574
213
Semaphore Operations
(atomic)
wait(S):
S.count--;
if (S.count<0) {
block this process
place this process in S.queue
}
signal(S):
S.count++;
if (S.count<=0) {
remove a process P from S.queue
place P on ready list
}
S.count may be initialized to a
nonnegative value (often = 1)