Difference between revisions of "Semaphore (programming)"
Karl Jones (Talk | contribs) (First) |
Karl Jones (Talk | contribs) (Abstract_data_type) |
||
Line 1: | Line 1: | ||
− | In [[computer science]], particularly in [[Operating system|operating systems]], a '''semaphore''' is a variable or abstract data type that is used for controlling access, by multiple processes, to a common resource in a parallel programming or a multi user environment. | + | In [[computer science]], particularly in [[Operating system|operating systems]], a '''semaphore''' is a [[Variable (computer science)|variable]] or [[abstract data type]] that is used for controlling access, by multiple processes, to a common resource in a parallel programming or a multi user environment. |
A useful way to think of a semaphore is as a record of how many units of a particular resource are available, coupled with operations to safely (i.e., without race conditions) adjust that record as units are required or become free, and, if necessary, wait until a unit of the resource becomes available. | A useful way to think of a semaphore is as a record of how many units of a particular resource are available, coupled with operations to safely (i.e., without race conditions) adjust that record as units are required or become free, and, if necessary, wait until a unit of the resource becomes available. |
Revision as of 08:59, 1 June 2015
In computer science, particularly in operating systems, a semaphore is a variable or abstract data type that is used for controlling access, by multiple processes, to a common resource in a parallel programming or a multi user environment.
A useful way to think of a semaphore is as a record of how many units of a particular resource are available, coupled with operations to safely (i.e., without race conditions) adjust that record as units are required or become free, and, if necessary, wait until a unit of the resource becomes available.
Semaphores are a useful tool in the prevention of race conditions; however, their use is by no means a guarantee that a program is free from these problems.
Semaphores which allow an arbitrary resource count are called counting semaphores, while semaphores which are restricted to the values 0 and 1 (or locked/unlocked, unavailable/available) are called binary semaphores.
The semaphore concept was invented by Dutch computer scientist Edsger Dijkstra in 1962 or 1963.
External links
- Semaphore (programming) @ Wikipedia