CS 222: Operating Systems › Lesson 5 of 10

Synchronization: Locks, Semaphores, Monitors

Lesson 5 · OKSTEM College · AS Computer Science

Synchronization: Locks, Semaphores, Monitors

Work through the concepts, then test yourself with the knowledge check.

Interactive Lab

Knowledge Check

A semaphore's wait() (P) operation:

That is the signal() / V() operation.
Correct — if count drops below 0 the process blocks.
Semaphores generalize mutexes; wait() acquires, not releases.
wait() may block a thread, but it doesn't terminate it.
📖 Quick Recap

P() (from Dutch 'proberen' = to try): decrement. V() (from 'verhogen' = to increment): increment. Mnemonics: P=probe/wait, V=signal/post.

📖 Quick Recap

Acquiring (locking) a resource is the wait()/P() operation. Releasing is signal()/V(). Mutex unlock = signal() on a binary semaphore.

📖 Quick Recap

A blocked thread is suspended (in BLOCKED state) — it will resume when the semaphore is signaled. Termination is a separate operation.

← PreviousNext →