Synchronization Primitives: Difference between revisions

Jump to navigation Jump to search
m
Formating and link fixes
[unchecked revision][unchecked revision]
No edit summary
m (Formating and link fixes)
Line 8:
* Shared readers/Single writer approach of resource locking: many process may be reading a table at the same time, but only one can write at a time and it should prevent readers to access the table until the table has returned to a consistent state.
 
': ''Note: A good synchronizatorsynchronization implementation should not only guarantee *'''''correctness*''''', but also *'''''fairness*''''' (all process have equal chance to get the access) and *'''''non-starvation*''''' (any waiting process will eventually have the resource).'''
 
 
== Semaphores ==
 
Semaphores are one of the oldest and most widely used methods of ensuring [[Mutual Exclusion]] between two or more processes. A semaphore is a special integer variable which is (usually) initialized to 1, and can only altered by a pair of functions. Each of these functions, historically called _p_''p'' and ''v'' (from the Dutch words ''proberen'', to test, and ''verhogen'', to increment), must be an [[Atomic Actionoperation]]. Each semaphore has an associated queue for processes waiting on the resource it guards.
 
The function ''p'', also called <tt>wait()</tt> (or <tt>test()</tt>), decrements the value of the semaphore, and if the semaphore is negative, puts the process on the waiting queue until the semaphore is released by the process holding it.
Line 64:
==See Also==
===Threads===
*[[Topic:9440|Userland only Semaphores|Forum:5901]]
*[[Topic:10363|Spinlocks that disable interrupts |Forum:7532]]
*[[Topic:9699|SMP compatibility|Forum:6377]]
*[[Topic:14261|Mutex Implementation]]
*[[Topic:11903|Mutexs, Spinlocks and all that jazz]]
*[[Topic:7500|Spinlocks & Semaphores]]
 
[[Category:IPC]]
50

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu