Week 6
Homework
UPC exercises 1.1 — 1.7
Assigned: 2/18
Due: 2/27
Exam Reminder
Exam next Wednesday, March 6
handout: sample questions from a previous exam
Review session next Monday, March 4
Lecture Notes
Semaphores
Two operations:
wait(s)
Traditional: P(s)
Definition:
< await (s > 0) s = s - 1; >
signal(s)
Traditional: V(s)
Definition:
< s = s + 1; >
wait(s) and signal(s) work the same for binary and counting (general) semaphores
binary semaphore: value is always either
1
or
0
general semaphore: value is nonnegative
Class exercise
The Bear and the Honeybees (handout)
split binary semaphores
technique: pass the baton
The Water Molecule Problem (handout)
solve using counting semaphores
solve using a single mutex
Semaphores
Ben-Ari Ch 6
slides:
PDF
begin slide 105