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
Mutual exclusion
(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!
===Software solutions=== In addition to hardware-supported solutions, some software solutions exist that use [[busy waiting]] to achieve mutual exclusion. Examples include: * [[Dekker's algorithm]] * [[Peterson's algorithm]] * [[Lamport's bakery algorithm]]<ref>{{cite journal|last=Lamport|first=Leslie|title=A new solution of Dijkstra's concurrent programming problem|journal=Communications of the ACM|date=August 1974|volume=17|issue=8|pages=453–455|doi=10.1145/361082.361093|s2cid=8736023|doi-access=free}}</ref> * [[Szymański's algorithm]] * Taubenfeld's black-white bakery algorithm<ref name="Taubenfeld:2004" /> * [[Maekawa's algorithm]] These algorithms do not work if [[out-of-order execution]] is used on the platform that executes them. Programmers have to specify strict ordering on the memory operations within a thread.<ref>{{cite journal|last=Holzmann|first=Gerard J.|author2=Bosnacki, Dragan|title=The Design of a Multicore Extension of the SPIN Model Checker|journal=IEEE Transactions on Software Engineering|date=1 October 2007|volume=33|issue=10|pages=659–674|doi=10.1109/TSE.2007.70724|s2cid=9080331|url=https://pure.tue.nl/ws/files/2357048/Metis212904.pdf |archive-url=https://ghostarchive.org/archive/20221009/https://pure.tue.nl/ws/files/2357048/Metis212904.pdf |archive-date=2022-10-09 |url-status=live}}</ref> It is often preferable to use synchronization facilities provided by an [[operating system]]'s multithreading library, which will take advantage of hardware solutions if possible but will use software solutions if no hardware solutions exist. For example, when the operating system's [[lock (computer science)|lock]] library is used and a thread tries to acquire an already acquired lock, the operating system could suspend the thread using a [[context switch]] and swap it out with another thread that is ready to be run, or could put that processor into a low power state if there is no other thread that can be run. Therefore, most modern mutual exclusion methods attempt to reduce [[Latency (engineering)|latency]] and busy-waits by using queuing and context switches. However, if the time that is spent suspending a thread and then restoring it can be proven to be always more than the time that must be waited for a thread to become ready to run after being blocked in a particular situation, then [[spinlock]]s are an acceptable solution (for that situation only).{{citation needed|date=August 2015}}
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
Mutual exclusion
(section)
Add topic