Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Semaphore (programming)
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
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!
==Semaphores vs. mutexes== A [[mutex]] is a [[Mutual exclusion#Types of mutual exclusion devices|locking mechanism]] that sometimes uses the same basic implementation as the binary semaphore. However, they differ in how they are used. While a binary semaphore may be colloquially referred to as a mutex, a true mutex has a more specific use-case and definition, in that only the [[Task (computing)|task]] that locked the mutex is supposed to unlock it. This constraint aims to handle some potential problems of using semaphores: # [[Priority inversion]]: If the mutex knows who locked it and is supposed to unlock it, it is possible to promote the priority of that task whenever a higher-priority task starts waiting on the mutex. # Premature task termination: Mutexes may also provide deletion safety, where the task holding the mutex cannot be accidentally deleted. {{citation needed|date=May 2019}} (This is also a cost; if the mutex can prevent a task from being reclaimed, then a garbage collector has to monitor the mutex.) # Termination deadlock: If a mutex-holding task terminates for any reason, the [[Real-time operating system|OS]] can release the mutex and signal waiting tasks of this condition. # Recursion deadlock: a task is allowed to lock a [[reentrant mutex]] multiple times as it unlocks it an equal number of times. # Accidental release: An error is raised on the release of the mutex if the releasing task is not its owner.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Semaphore (programming)
(section)
Add topic