Cognitive Scaffold

Preparing your thinking workspace

arrow_back_ios_new
MENTAL MODEL · M6232

Semaphore

Semaphore
BusinessHigh supportManagement
Included
account_tree

Version 1.0.0 · Updated 2026-07-28

CORE DEFINITION

A semaphore is a synchronization object that maintains a count between zero and a specified maximum. When a thread performs a wait operation on the semaphore, the count is decremented by one; when a thread performs a release operation, the count is incremented by one. When the count is zero, threads waiting on the semaphore will not succeed until the semaphore becomes signaled. If the count is greater than zero, the semaphore is in a signaled state; if the count equals zero, it is in a nonsignaled state. The concept of the semaphore was invented by Dutch computer scientist Edsger W. Dijkstra and is widely used in various operating systems. In a system, each process is given a semaphore representing its current state; processes that do not have control are forced to stop at specific points and wait for a signal to proceed.

SCAFFOLDING EFFECT

psychology

Reduce cognitive load

A semaphore is a synchronization object that maintains a count between zero and a specified maximum. When a thread performs a wait operation on the semaphore, the count is decremented by one; when a thread performs a release operation, the count is incremented by one. When the count is zero, threads waiting on the semaphore will not succeed until the semaphore becomes signaled.

anchor

Anchor fast decisions

Proposed by Dijkstra, it is a counter protected by atomic operations: P (wait, decrement by 1, if <0 then block), V (signal, increment by 1, if there are waiters then wake). Used for mutual exclusion (binary semaphore = lock) and counting resources (N-valued semaphore controls concurrency). The core is "safely coordinating access under contention".

MINIMUM ACTION

In progress 0/4

Practice this model in one real situation:

Check to track your progress (stored locally)
Learning progress0%
account_treeGenealogyexpand_more
menu_bookReferencesexpand_more

Source support: Explicit

  • link
    zh.wikipedia.orghttps://zh.wikipedia.org/wiki/%E4%BF%A1%E5%8F%B7%E9%87%8FZH · Explicit
    verified

RELATED MODELS