Synchronization (computer science): Difference between revisions

Content deleted Content added
Citation bot (talk | contribs)
Add: publisher, date, authors 1-3. | Use this bot. Report bugs. | Suggested by Dominic3203 | Category:Concurrency (computer science) | #UCB_Category 19/44
m Spinlock: Changed heading to match other headings in the section, and tweaked the grammar for readability. This section is still loosely worded and can use more clarity.
Line 64:
==Implementation==
 
===SpinlockSpinlocks===
{{Main article|Spinlock}}
Another effective way of implementing synchronization is by using spinlocks. Before accessing any shared resource or piece of code, every processor checks a flag. If the flag is reset, then the processor sets the flag and continues executing the thread. But, if the flag is set (locked), the threads would keep spinning in a loop and keep checking if the flag is set or not. But, spinlocksSpinlocks are effective only if the flag is reset for lower cycles; otherwise, it can lead to performance issues as it wastes many processor cycles waiting.<ref>{{Cite book|title=Embedded Software Development with ECos|last=Massa|first=Anthony|publisher=Pearson Education Inc|year=2003|isbn=0-13-035473-2}}</ref>
 
===Barriers===