(en.wikipedia.org) Semaphore (programming) - Wikipedia

ROAM_REFS: https://en.wikipedia.org/wiki/Semaphore_(programming)

In computer science, a semaphore is a variable or abstract data type used to control access to a common resource by multiple threads and avoid critical section problems in a concurrent system such as a multitasking operating system. Semaphores are a type of synchronization primitive. A trivial semaphore is a plain variable that is changed (for example, incremented or decremented, or toggled) depending on programmer-defined conditions.

A useful way to think of a semaphore as used in a real-world system is as a record of how many units of a particular resource are available, coupled with operations to adjust that record safely (i.e., to avoid race conditions) as units are acquired or become free, and, if necessary, wait until a unit of the resource becomes available.

Though semaphores are useful for preventing race conditions, they do not guarantee their absence. Semaphores that allow an arbitrary resource count are called counting semaphores, while semaphores that are restricted to the values 0 and 1 (or locked/unlocked, unavailable/available) are called binary semaphores and are used to implement locks.

The semaphore concept was invented by Dutch computer scientist Edsger Dijkstra in 1962 or 1963, when Dijkstra and his team were developing an operating system for the Electrologica X8. That system eventually became known as the THE multiprogramming system.

Local Graph

org-roam 8858e904-2bb2-402f-aca1-ad2d254806f2 (en.wikipedia.org) Semaphore (program... //en.wikipedia.org/wiki/Computer_science https://en.wikipedia.org/wiki/Computer_science 8858e904-2bb2-402f-aca1-ad2d254806f2->//en.wikipedia.org/wiki/Computer_science //en.wikipedia.org/wiki/Variable_(programming) https://en.wikipedia.org/wiki/Variable_(programming) 8858e904-2bb2-402f-aca1-ad2d254806f2->//en.wikipedia.org/wiki/Variable_(programming) //en.wikipedia.org/wiki/Abstract_data_type https://en.wikipedia.org/wiki/Abstract_data_type 8858e904-2bb2-402f-aca1-ad2d254806f2->//en.wikipedia.org/wiki/Abstract_data_type //en.wikipedia.org/wiki/Process_(computing) https://en.wikipedia.org/wiki/Process_(computing) 8858e904-2bb2-402f-aca1-ad2d254806f2->//en.wikipedia.org/wiki/Process_(computing) //en.wikipedia.org/wiki/Critical_section https://en.wikipedia.org/wiki/Critical_section 8858e904-2bb2-402f-aca1-ad2d254806f2->//en.wikipedia.org/wiki/Critical_section //en.wikipedia.org/wiki/Concurrent_computing https://en.wikipedia.org/wiki/Concurrent_computing 8858e904-2bb2-402f-aca1-ad2d254806f2->//en.wikipedia.org/wiki/Concurrent_computing //en.wikipedia.org/wiki/Computer_multitasking https://en.wikipedia.org/wiki/Computer_multitasking 8858e904-2bb2-402f-aca1-ad2d254806f2->//en.wikipedia.org/wiki/Computer_multitasking //en.wikipedia.org/wiki/Synchronization_(computer_science) https://en.wikipedia.org/wiki/Synchronization_(computer_science) 8858e904-2bb2-402f-aca1-ad2d254806f2->//en.wikipedia.org/wiki/Synchronization_(computer_science) //en.wikipedia.org/wiki/Race_condition https://en.wikipedia.org/wiki/Race_condition 8858e904-2bb2-402f-aca1-ad2d254806f2->//en.wikipedia.org/wiki/Race_condition //en.wikipedia.org/wiki/Lock_(computer_science) https://en.wikipedia.org/wiki/Lock_(computer_science) 8858e904-2bb2-402f-aca1-ad2d254806f2->//en.wikipedia.org/wiki/Lock_(computer_science) //en.wikipedia.org/wiki/Dutch_people https://en.wikipedia.org/wiki/Dutch_people 8858e904-2bb2-402f-aca1-ad2d254806f2->//en.wikipedia.org/wiki/Dutch_people //en.wikipedia.org/wiki/Computer_scientist https://en.wikipedia.org/wiki/Computer_scientist 8858e904-2bb2-402f-aca1-ad2d254806f2->//en.wikipedia.org/wiki/Computer_scientist //en.wikipedia.org/wiki/Edsger_Dijkstra https://en.wikipedia.org/wiki/Edsger_Dijkstra 8858e904-2bb2-402f-aca1-ad2d254806f2->//en.wikipedia.org/wiki/Edsger_Dijkstra //en.wikipedia.org/wiki/Operating_system https://en.wikipedia.org/wiki/Operating_system 8858e904-2bb2-402f-aca1-ad2d254806f2->//en.wikipedia.org/wiki/Operating_system //en.wikipedia.org/wiki/Electrologica_X8 https://en.wikipedia.org/wiki/Electrologica_X8 8858e904-2bb2-402f-aca1-ad2d254806f2->//en.wikipedia.org/wiki/Electrologica_X8 //en.wikipedia.org/wiki/THE_multiprogramming_system https://en.wikipedia.org/wiki/THE_multiprogramming_system 8858e904-2bb2-402f-aca1-ad2d254806f2->//en.wikipedia.org/wiki/THE_multiprogramming_system 2a07e4ea-610b-4c9a-bb84-d961fb2450e5 Code and Coffee Book Club 2a07e4ea-610b-4c9a-bb84-d961fb2450e5->8858e904-2bb2-402f-aca1-ad2d254806f2