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!
===Important observations=== When used to control access to a [[pool (computer science)|pool]] of resources, a semaphore tracks only ''how many'' resources are free. It does not keep track of ''which'' of the resources are free. Some other mechanism (possibly involving more semaphores) may be required to select a particular free resource. The paradigm is especially powerful because the semaphore count may serve as a useful trigger for a number of different actions. The librarian above may turn the lights off in the study hall when there are no students remaining, or may place a sign that says the rooms are very busy when most of the rooms are occupied. The success of the protocol requires applications to follow it correctly. Fairness and safety are likely to be compromised (which practically means a program may behave slowly, act erratically, [[hang (computing)|hang]], or [[crash (computing)|crash]]) if even a single process acts incorrectly. This includes: * requesting a resource and forgetting to release it; * releasing a resource that was never requested; * holding a resource for a long time without needing it; * using a resource without requesting it first (or after releasing it). Even if all processes follow these rules, ''multi-resource [[deadlock (computer science)|deadlock]]'' may still occur when there are different resources managed by different semaphores and when processes need to use more than one resource at a time, as illustrated by the [[dining philosophers problem]].
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)