• ↑↓ pour naviguer
  • pour ouvrir
  • pour sélectionner
  • ⌘ ⌥ ↵ pour ouvrir dans un panneau
  • ←→ pour naviguer
  • esc pour rejeter
⌘ '
raccourcis clavier

The Problem

When a process finishes using a resource, it needs to release it and wake up any waiting processes. We need an atomic operation that increments the semaphore.

Core Idea

The signal() operation (V operation) increments the semaphore value atomically. If there are waiting processes (S ≤ 0), one is woken up.

How It Works

  1. Atomically increment semaphore value: S = S + 1
  2. If S ≤ 0 after increment: a process was waiting, wake it up
  3. If S > 0 after increment: no one was waiting
  4. Woken process can now acquire the resource
signal_op Before Before: S = -1 (1 process waiting) Signal signal(S) S = S + 1 Before->Signal After After: S = 0 (wake up 1) Signal->After S <= 0 NoWait After: S = 2 (no waiters) Signal->NoWait S > 0

Key Properties

  • Must be atomic (no interruption)
  • Wakes up at most one waiting process
  • Releases resource back to pool
  • Also called V (verhogen = to release) or up operation

Connections

Edge Cases & Gotchas

  • Calling signal() without holding resource is a bug
  • Must be atomic — can’t be interrupted
  • Forgetting signal() causes deadlock (resource never released)