Show in graph
OS

Software → Operating Systems

Semaphore

A synchronization primitive that controls access to a shared resource using a counter.

Motivation

Semaphore solves the problem of limiting access to a finite number of shared resources.

Where it fits

Semaphore belongs to synchronization and operating systems.

Mental model

A semaphore is like a counter of permits: tasks acquire a permit before proceeding and release it afterward.

Common mistakes

  • Using semaphores where a simple mutex would be clearer.
  • Forgetting that semaphore counts must represent real capacity.

Semaphore connects to synchronization, concurrency, resource pooling, and backpressure.