Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Semaphore (programming)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{about|the computer programming term|other uses|Semaphore (disambiguation)}} {{short description|Variable used in a concurrent system}} In [[computer science]], a '''semaphore''' is a [[variable (programming)|variable]] or [[abstract data type]] used to control access to a common resource by multiple [[process (computing)|threads]] and avoid [[critical section]] problems in a [[concurrent computing|concurrent]] system such as a [[Computer multitasking|multitasking]] operating system. Semaphores are a type of [[Synchronization (computer science)|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 condition|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 [[Lock (computer science)|locks]]. The semaphore concept was invented by [[Dutch people|Dutch]] [[computer scientist]] [[Edsger Dijkstra]] in 1962 or 1963,<ref name="ReferenceA">{{Cite EWD|35|Over de sequentialiteit van procesbeschrijvingen}} (undated, 1962 or 1963)</ref> when Dijkstra and his team were developing an [[operating system]] for the [[Electrologica X8]]. That system eventually became known as the [[THE multiprogramming system]].
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)