Knowledge

Monitor (synchronization)

Source đź“ť

5021: 5334: 4368: 1143:, but as long as the code is properly designed for concurrency and depending on the threading implementation, it is often also acceptable to release the lock before signalling. Depending on the threading implementation, the ordering of this can have scheduling-priority ramifications. (Some authors instead advocate a preference for releasing the lock before signalling.) A threading implementation should document any special constraints on this ordering. 4985:
assumed a regular non-thread-safe queue and was using a standalone mutex and condition variables, without these details of the monitor abstracted away as is the case here. In this example, when the "wait" operation is called, it must somehow be supplied with the thread-safe stack's mutex, such as if the "wait" operation is an integrated part of the "monitor class". Aside from this kind of abstracted functionality, when a "raw" monitor is used, it will
36: 2741: 1754: 545:
exiting the busy-wait and calling "dequeue", then the second consumer will attempt to dequeue from an empty queue leading to an error. Likewise, if a producer makes the queue full in-between another producer's exiting the busy-wait and calling "enqueue", then the second producer will attempt to add to a full queue leading to an error.
267:
full. Whenever the queue is full of tasks, then we need the producer threads to block until there is room from consumer threads dequeueing tasks. On the other hand, whenever the queue is empty, then we need the consumer threads to block until more tasks are available due to producer threads adding them.
925:
blocked for a long time on processing their current tasks and the queue is full, producers are always busy-waiting. This is a wasteful mechanism. What is needed is a way to make producer threads block until the queue is non-full, and a way to make consumer threads block until the queue is non-empty.
4984:
Note that, in this example, the thread-safe stack is internally providing a mutex, which, as in the earlier producer/consumer example, is shared by both condition variables, which are checking different conditions on the same concurrent data. The only difference is that the producer/consumer example
4561:
In either case ("signal and urgent wait" or "signal and wait"), when a condition variable is signaled and there is at least one thread waiting on the condition variable, the signaling thread hands occupancy over to the signaled thread seamlessly, so that no other thread can gain occupancy in between.
189:
Upon calling one of the methods, a thread must wait until no other thread is executing any of the thread-safe object's methods before starting execution of its method. Note that without this mutual exclusion, two threads could cause money to be lost or gained for no reason. For example, two threads
924:
This method assures that an inconsistent state does not occur, but wastes CPU resources due to the unnecessary busy-waiting. Even if the queue is empty and producer threads have nothing to add for a long time, consumer threads are always busy-waiting unnecessarily. Likewise, even if consumers are
2261:
might wake up a thread of the wrong type whose condition has not yet been met, and that thread would go back to sleep without a thread of the correct type getting signaled. For example, a producer might make the queue full and wake up another producer instead of a consumer, and the woken producer
544:
methods read this shared state as well. If producer/consumer threads are allowed to be interleaved during the calls to enqueue/dequeue, then inconsistent state of the queue can be exposed leading to race conditions. In addition, if one consumer makes the queue empty in-between another consumer's
266:
of tasks with a maximum size, with one or more threads being "producer" threads that add tasks to the queue, and one or more other threads being "consumer" threads that take tasks out of the queue. The queue is assumed to be non–thread-safe itself, and it can be empty, full, or between empty and
97:
is a synchronization construct that prevents threads from concurrently accessing a shared object's state and allows them to wait for the state to change. They provide a mechanism for threads to temporarily give up exclusive access in order to wait for some condition to be met, before regaining
1167:
because a thread waiting for the wrong condition might be woken up and then immediately go back to sleep without waking up a thread waiting for the correct condition that just became true. Otherwise, if the predicate condition is one-to-one with the condition variable associated with it, then
2244:
A variant of this solution could use a single condition variable for both producers and consumers, perhaps named "queueFullOrEmptyCV" or "queueSizeChangedCV". In this case, more than one condition is associated with the condition variable, such that the condition variable represents a weaker
1289:
which blocks until the queue is non-empty. It would (usually) never make sense to have different mutexes for the same condition variable, but this classic example shows why it often certainly makes sense to have multiple condition variables using the same mutex. A mutex used by one or more
1191:
is the same for all threads using the monitor and must be protected with mutual exclusion from all other threads that might cause the condition to be changed or that might read it while the thread in question causes it to be changed, but there may be different threads that want to wait for a
4356:. With a blocking condition variable, the signaling thread must wait outside the monitor (at least) until the signaled thread relinquishes occupancy of the monitor by either returning or by again waiting on a condition variable. Monitors using blocking condition variables are often called 148:. By using one or more condition variables it can also provide the ability for threads to wait on a certain condition (thus using the above definition of a "monitor"). For the rest of this article, this sense of "monitor" will be referred to as a "thread-safe object/class/module". 5385:
operation. Whenever a thread leaves the monitor (by returning or waiting), the assertions of all waiting threads are evaluated until one is found to be true. In such a system, condition variables are not needed, but the assertions must be explicitly coded. The contract for wait is
238:. Theoretically, it works and will not deadlock, but issues arise. It is hard to decide an appropriate amount of waiting time: too small and the thread will hog the CPU, too big and it will be apparently unresponsive. What is needed is a way to signal the thread when the condition 233:
will not work, as mutual exclusion will prevent any other thread from entering the monitor to make the condition true. Other "solutions" exist such as having a loop that unlocks the monitor, waits a certain amount of time, locks the monitor and checks for the condition
190:
withdrawing 1000 from the account could both return true, while causing the balance to drop by only 1000, as follows: first, both threads fetch the current balance, find it greater than 1000, and subtract 1000 from it; then, both threads store the balance and return.
962:. While a thread is waiting on a condition variable, that thread is not considered to occupy the monitor, and so other threads may enter the monitor to change the monitor's state. In most types of monitors, these other threads may signal the condition variable 5562:
A number of libraries have been written that allow monitors to be constructed in languages that do not support them natively. When library calls are used, it is up to the programmer to explicitly mark the start and end of code executed with mutual exclusion.
4717:(When the condition variable can be queried as to the number of threads waiting on its queue, more sophisticated contracts can be given. For example, a useful pair of contracts, allowing occupancy to be passed without establishing the invariant, is: 1803:
Having introduced the usage of condition variables, let us use it to revisit and solve the classic bounded producer/consumer problem. The classic solution is to use two monitors, comprising two condition variables sharing one lock on the queue:
1159:, is a similar operation that wakes up all threads in c's wait-queue. This empties the wait-queue. Generally, when more than one predicate condition is associated with the same condition variable, the application will require 5244:
may be true for some waiting thread. Every iteration of such a loop past the first represents a lost notification; thus with nonblocking monitors, one must be careful to ensure that too many notifications cannot be lost.
2240:
This ensures concurrency between the producer and consumer threads sharing the task queue, and blocks the threads that have nothing to do rather than busy-waiting as shown in the aforementioned approach using spin-locks.
1096:'s queue. As soon as the first thread in question is switched back to, its program counter will be at step 1c, and it will sleep and be unable to be woken up again, violating the invariant that it should have been on 1073:
The atomicity of the operations within step 1 is important to avoid race conditions that would be caused by a preemptive thread switch in-between them. One failure mode that could occur if these were not atomic is a
5360:
Rather than having explicit condition variables, each monitor (i.e., object) is equipped with a single wait queue in addition to its entrance queue. All waiting is done on this single wait queue and all
4435:
The implementation of each operation is as follows. (We assume that each operation runs in mutual exclusion to the others; thus restarted threads do not begin executing until the operation is complete.)
5054:
The meaning of various operations are given here. (We assume that each operation runs in mutual exclusion to the others; thus restarted threads do not begin executing until the operation is complete.)
2708:
read-modify-write primitive and a waiting primitive. The read-modify-write primitive (usually test-and-set or compare-and-swap) is usually in the form of a memory-locking instruction provided by the
2262:
would go back to sleep. In the complementary case, a consumer might make the queue empty and wake up another consumer instead of a producer, and the consumer would go back to sleep. Using
536:
methods likely have instructions to update the queue's member variables such as its size, beginning and ending positions, assignment and allocation of queue elements, etc. In addition, the
1007:
is true before proceeding. While the thread is waiting, it does not occupy the monitor. The function, and fundamental contract, of the "wait" operation, is to do the following steps:
5170:
ing thread gives up occupancy until the notified thread is selected to re-enter the monitor. Between these times there could be activity by other occupants. Thus it is common for
4481:.q (t is called "the signaled thread") add this thread to s restart t (so t will occupy the monitor next) block this thread schedule: 1084:'s sleep-queue and have released the mutex, but a preemptive thread switch occurred before the thread went to sleep, and another thread called a signal operation (see below) on 1131:'s sleep-queue to the "ready queue", or another queue for it to be executed. It is usually considered a best practice to perform the "signal" operation before releasing mutex 557:", in which a mutex is used to protect the critical sections of code and busy-waiting is still used, with the lock being acquired and released in between each busy-wait check. 948:. Conceptually a condition variable is a queue of threads, associated with a mutex, on which a thread may wait for some condition to become true. Thus each condition variable 1287: 1242: 292:
between threads on the same processor or by simultaneously-running threads on multiple processors, then there is a risk of exposing inconsistent state and causing
5449: 5325:
that it made such a condition true. It makes sense in this case to allow each waiting thread into the monitor (one at a time) to check if its assertion is true.
2245:
condition than the conditions being checked by individual threads. The condition variable represents threads that are waiting for the queue to be non-full
110:
is explicitly 'signalled' when the object's state is modified, temporarily passing the mutex to another thread 'waiting' on the conditional variable.
5248:
As an example of "hinting," consider a bank account in which a withdrawing thread will wait until the account has sufficient funds before proceeding
5009:
condition variables), signaling does not cause the signaling thread to lose occupancy of the monitor. Instead the signaled threads are moved to the
5437:, and invented a queueing mechanism. Hoare refined the rules of process resumption. Brinch Hansen created the first implementation of monitors, in 2759: 1772: 528:
This code has a serious problem in that accesses to the queue can be interrupted and interleaved with other threads' accesses to the queue. The
2712:, but can also be composed of non-locking instructions on single-processor devices when interrupts are disabled. The waiting primitive can be a 186:. The lock, which is initially unlocked, is locked at the start of each public method, and is unlocked at each return from each public method. 284:
that must be synchronized by mutual exclusion. If code and processor instructions in critical sections of code that access the queue could be
5321:
In this example, the condition being waited for is a function of the amount to be withdrawn, so it is impossible for a depositing thread to
1102:'s sleep-queue when it slept. Other race conditions depend on the ordering of steps 1a and 1b, and depend on where a context switch occurs. 3287:// *** Now running "otherThread" (which is now "currentThread")! The original thread is now "sleeping". *** 3080:// *** Now running "otherThread" (which is now "currentThread")! The original thread is now "sleeping". *** 278:
during the course of the queue access that should never be exposed between threads. Thus, any code that accesses the queue constitutes a
4489:
there is a thread on e select and remove one thread from e and restart it (this thread will occupy the monitor next)
4485:
there is a thread on s select and remove one thread from s and restart it (this thread will occupy the monitor next)
5551: 6115: 5714: 2723:
Here is an example pseudocode implementation of parts of a threading system and mutexes and Mesa-style condition variables, using
1244:
which blocks until the queue is non-full. The "consumer" threads will want to wait on a different monitor using the same mutex
932:
which involve busy-waiting in order to get the lock, but in order to solve this problem of wasted CPU resources, we assume that
5995: 5955: 5633: 203:
For many applications, mutual exclusion is not enough. Threads attempting an operation may need to wait until some condition
5821: 46: 5851: 4500:
routine selects the next thread to occupy the monitor or, in the absence of any candidate threads, unlocks the monitor.
6640: 6037: 5759:. International Conference on Software Engineering. Los Alamitos, CA, USA: IEEE Computer Society Press. pp. 47–52. 5581: 17: 5345:
language, each object may be used as a monitor. Methods requiring mutual exclusion must be explicitly marked with the
1180:
As a design rule, multiple condition variables can be associated with the same mutex, but not vice versa. (This is a
1056:
Steps 1a and 1b can occur in either order, with 1c usually occurring after them. While the thread is sleeping and in
6758: 6665: 5867: 5425:
Brinch Hansen and Hoare developed the monitor concept in the early 1970s, based on earlier ideas of their own and of
2777: 1790: 4818:
We conclude this section with an example of a thread-safe class using a blocking monitor that implements a bounded,
1045:
Once this thread is subsequently notified/signaled (see below) and resumed, then automatically re-acquire the mutex
4429: 6748: 6613: 6438: 6237: 4550:.q (t is called "the signaled thread") restart t (so t will occupy the monitor next) 6077: 2589:// Release "queueLock", enqueue this thread onto "queueFullOrEmptyCV" and sleep this thread. 2424:// Release "queueLock", enqueue this thread onto "queueFullOrEmptyCV" and sleep this thread. 1192:
different condition on the same variable requiring the same mutex to be used. In the producer-consumer example
6331: 5465: 5370: 3263:// Restore the registers from currentThread/otherThread, including a jump to the stored PC of the other thread 3056:// Restore the registers from currentThread/otherThread, including a jump to the stored PC of the other thread 6461: 6421: 6108: 5538: 5517: 5490: 1294:
use condition variables (and which simply acquires/releases it without any wait/signal operations), if those
4425: 6753: 6431: 6426: 5430: 4592: 2709: 271: 5809: 2475:// non-full and non-empty now that the latter is guaranteed, so that a consumer thread will take the task. 2130:// Release "queueLock", enqueue this thread onto "queueEmptyCV" and sleep this thread. 1000:
associated with the monitor. This operation is called by a thread that needs to wait until the assertion
6706: 6544: 5527: 5507: 5496: 5342: 3161:// the "resume" label below. Getting the register values is platform-dependent and may involve 2939:// the "resume" label below. Getting the register values is platform-dependent and may involve 1965:// Release "queueLock", enqueue this thread onto "queueFullCV" and sleep this thread. 2616:// Critical section that takes a task off of the queue (note that we are holding "queueLock"). 2157:// Critical section that takes a task off of the queue (note that we are holding "queueLock"). 1409:
The following is the same pseudocode but with more verbose comments to better explain what is going on:
6321: 5459: 4507:
as the signaler must wait, but is given priority over threads on the entrance queue. An alternative is
2640:// non-full and non-empty now that the former is guaranteed, so that a producer thread will add a task. 1127:
is true. Depending on the type and implementation of the monitor, this moves one or more threads from
3947:// System call to disable interrupts on this core so that threadSleep() doesn't get interrupted by 3728:// System call to disable interrupts on this core so that threadSleep() doesn't get interrupted by 3548:// System call to disable interrupts on this core so that threadSleep() doesn't get interrupted by 3368:// System call to disable interrupts on this core so that threadSleep() doesn't get interrupted by 6529: 6524: 6047: 5657: 5502: 3164:// reading the current stack frame, JMP/CALL instructions, etc. (The details are beyond this scope.) 2942:// reading the current stack frame, JMP/CALL instructions, etc. (The details are beyond this scope.) 2451:// Critical section that adds the task to the queue (note that we are holding "queueLock"). 1992:// Critical section that adds the task to the queue (note that we are holding "queueLock"). 145: 137: 125: 6569: 6534: 6501: 6151: 6101: 5671: 5521: 5485: 4989:
have to include a mutex and a condition variable, with a unique mutex for each condition variable.
2755: 1768: 121: 53: 3296:// This is where another contextSwitch() call needs to set PC to when switching context back here. 3089:// This is where another contextSwitch() call needs to set PC to when switching context back here. 6471: 6443: 6381: 6366: 6346: 6282: 6124: 5590: 5442: 3134:// doesn't get interrupted by the thread-switching timer which would call contextSwitchISR(). 997: 179: 99: 3266:// (at "resume" below). Again, the details of how this is done are beyond this scope. 3059:// (at "resume" below). Again, the details of how this is done are beyond this scope. 6448: 6376: 6326: 6161: 5666: 5546: 5369:
operations apply to this queue. This approach has been adopted in other languages, for example
4822: 2717: 1253: 259: 3131:// Must be holding "threadingSystemBusy" and disabled interrupts so that this method 2637:// Wake up all producer and consumer threads that are waiting for the queue to be respectively 2472:// Wake up all producer and consumer threads that are waiting for the queue to be respectively 2266:
ensures that some thread of the right type will proceed as expected by the problem statement.
1211: 6727: 6630: 6476: 6456: 6401: 6056: 5779: 2610:// When this thread is awoken, re-acquire "queueLock" for the next predicate check. 2445:// When this thread is awoken, re-acquire "queueLock" for the next predicate check. 2151:// When this thread is awoken, re-acquire "queueLock" for the next predicate check. 1986:// When this thread is awoken, re-acquire "queueLock" for the next predicate check. 953: 5448:
Monitors (and Concurrent Pascal) were soon used to structure process synchronization in the
4815:
is entirely up to the programmer; he or she simply needs to be consistent about what it is.
3218:// Instead, it has already been placed onto a mutex's or condition variable's queue. 1663:// This code might make cv's condition false, and/or make other condition variables' 6539: 6496: 6491: 6481: 6391: 5706: 1181: 129: 90: 8: 6579: 6564: 6559: 6416: 6301: 6247: 5830:, p. 325-329, §Chapter 11 Item 81: Prefer concurrency utilities to wait and notify. 2840:// Implements a spin-lock on just the synchronized state of the threading system itself. 270:
As the queue is a concurrent object shared between threads, accesses to it must be made
6701: 6680: 6589: 6486: 6336: 6229: 6181: 6143: 6071: 5906: 5798: 5730: 5684: 5622: 4584: 3476:// Context switches may now occur here, making the client caller's predicate false. 2924:// Ensure this interrupt can't happen again which would foul up the context switch: 5110:
there is a thread on e select and remove one thread from e and restart it
3260:// Replace the global current-thread pointer value so it is ready for the next thread. 3125:// On current CPU core, a synchronous context switch to another thread without putting 3053:// Replace the global current-thread pointer value so it is ready for the next thread. 57: 6371: 6214: 6204: 6199: 6171: 6166: 6033: 5951: 5863: 5843: 5802: 5702: 5629: 5480: 5475: 5438: 4349: 4151:// Internal spin-lock while other threads on any core are accessing this object's 3953:// Done outside threadSleep() for more efficiency so that this thread will be sleeped 3917:// Internal spin-lock while other threads on any core are accessing this object's 3734:// Done outside threadSleep() for more efficiency so that this thread will be sleeped 3698:// Internal spin-lock while other threads on any core are accessing this object's 3554:// Done outside threadSleep() for more efficiency so that this thread will be sleeped 3518:// Internal spin-lock while other threads on any core are accessing this object's 3374:// Done outside threadSleep() for more efficiency so that this thread will be sleeped 3338:// Internal spin-lock while other threads on any core are accessing this object's 2013:// Wake up one or all consumer threads that are waiting for the queue to be non-empty 163: 160: 152: 5910: 2655:// Do not use "signal" (as it might wake up another consumer thread only). 2490:// Do not use "signal" (as it might wake up another producer thread only). 2178:// Wake up one or all producer threads that are waiting for the queue to be non-full 1639:// End this loop iteration and re-check the "while" loop condition to make 1070:. Thus, the thread sleeps and later wakes up in the middle of the "wait" operation. 6670: 6411: 6356: 6277: 6267: 6257: 6252: 6003: 5896: 5855: 5788: 5734: 5722: 5688: 5676: 5576: 3215:// Unlike contextSwitchISR(), we will not place currentThread back into readyQueue. 1723:// Release the mutex so that notified thread(s) and others can enter their critical 1516:// the lock inside the "wait" call in the last iteration of this loop, or 1465:// "acquire", we are asking, "Does the condition/predicate/assertion 1295: 1010: 280: 141: 133: 5117:
As a variation on this scheme, the notified thread may be moved to a queue called
4010:// Note that "currentThread" still needs to be handled by threadSleep(). 1657:// Critical section of code goes here, which has a precondition that our predicate 1501:// If this is not the first time the "while" condition is being checked, 1438:// (blocked) and placed on m's sleep queue. (Mutex "m" shall not be 1290:
condition variables (one or more monitors) may also be shared with code that does
140:. The defining characteristic of a monitor is that its methods are executed with 6660: 6606: 6584: 6361: 6316: 6287: 6262: 6242: 6189: 6156: 6132: 5333: 5061:
the monitor is locked add this thread to e block this thread
5020: 4443:
the monitor is locked add this thread to e block this thread
2705: 1672:// predicates (who share mutex m) have been made true or may have been made true, 1651:// We are still holding the lock, either from before entering the monitor or from 1344:// While the condition/predicate/assertion that we are waiting for is not true... 1298:
do not happen to require waiting for a certain condition on the concurrent data.
1063: 263: 5757:
ICSE '76 Proceedings of the 2nd international conference on Software engineering
4923:
size < capacity A := value ; size := size + 1
3137:// After returning from this method, must clear "threadingSystemBusy". 6645: 6506: 6209: 6194: 6087: 6081: 5585: 5469: 5426: 4367: 4345: 3950:// the thread-switching timer on this core which would call contextSwitchISR(). 3731:// the thread-switching timer on this core which would call contextSwitchISR(). 3551:// the thread-switching timer on this core which would call contextSwitchISR(). 3371:// the thread-switching timer on this core which would call contextSwitchISR(). 553:
One naive approach to achieve synchronization, as alluded to above, is to use "
293: 156: 5848:
HOPL-II: The second ACM SIGPLAN conference on History of programming languages
4386:
We assume there are two queues of threads associated with each monitor object
2661:// Release "queueLock" until we need it again to take the next task. 2249:
ones waiting for it to be non-empty. However, doing this would require using
2202:// Release "queueLock" until we need it again to take the next task. 1531:// "no" -- the condition is not ready yet. Otherwise, the answer is: 6742: 6466: 6311: 6272: 6219: 5726: 5564: 5556: 4819: 2496:// Release "queueLock" until we need it again to add the next task. 2319:// A single condition variable for when the queue is not ready for any thread 2037:// Release "queueLock" until we need it again to add the next task. 5925: 5614: 4055:// Now we are woken up, which must be because "held" became false. 4004:// Put "currentThread" on this lock's queue so that it will be 1717:// One or more threads have been woken up but will block as soon as they try 1513:// true between the time that I was woken up and the time that I re-acquired 1504:// then we are asking the question, "Now that another thread using this 1193: 174:
While a thread is executing a method of a thread-safe object, it is said to
6722: 6685: 6574: 6549: 6341: 6093: 6060: 6051: 5752: 5353: 5347: 4154:// "held" and "threadQueue", or "readyQueue". 3920:// "held" and "threadQueue", or "readyQueue". 3701:// "held" and "threadQueue", or "readyQueue". 3521:// "held" and "threadQueue", or "readyQueue". 3341:// "held" and "threadQueue", or "readyQueue". 2331:// Not safe to use regular "signal" because it is associated with 2016:// now that it is guaranteed, so that a consumer thread will take the task. 1507:// monitor has notified me and woken me up and I have been context-switched 208: 5901: 5884: 5859: 5793: 5774: 5680: 5043:— a terminology we will follow here. It is also common to provide a 6675: 6650: 6635: 6554: 6386: 3185:// Store the registers in the "currentThread" object in memory. 2963:// Store the registers in the "currentThread" object in memory. 2253:
in all the threads using the condition variable and cannot use a regular
1519:// did some other thread cause the condition to become false again in the 1037:
sleep this thread. (Context is synchronously yielded to another thread.)
136:
in order to safely allow access to a method or variable by more than one
5302:
balance >= amount balance := balance - amount }
5047:
operation that moves all threads waiting on a condition variable to the
3212:// Set the next PC to the "resume" label below in this method. 2990:// Set the next PC to the "resume" label below in this method. 2181:// now that it is guaranteed, so that a producer thread will add a task. 1669:// Call signal or broadcast, depending on which condition variables' 1510:// back to, did the condition/predicate/assertion we are waiting on stay 898:// Drop the queue lock until we need it again to take off the next task. 859:// Re-acquire the lock for the next call to "queue.isEmpty()". 249: 144:: At each point in time, at most one thread may be executing any of its 5818:, p. 311-316, §Item 11: Synchronize access to shared mutable data. 5652: 2730: 1067: 709:// Re-acquire the lock for the next call to "queue.isFull()". 5314:
amount >= 0 { balance := balance + amount
2322:// i.e. for producer threads waiting for the queue to become non-full 1875:// become non-full. Its associated lock is also "queueLock". 1854:// A condition variable for consumer threads waiting for the queue to 1534:// the latter. This was a spurious wakeup, some other thread occurred 1435:// thread is holding this mutex, then this thread will be put to sleep 6655: 5655:(October 1974). "Monitors: an operating system structuring concept". 3158:// For Program Counter (PC), we will need the instruction location of 2936:// For Program Counter (PC), we will need the instruction location of 2716:
loop or an OS-provided primitive that prevents the thread from being
2713: 2269:
Here is the variant using only one condition variable and broadcast:
1872:// A condition variable for producer threads waiting for the queue to 1462:// The first time we execute the while loop condition after the above 6046:
Monitors: an operating system structuring concept, C. A. R. Hoare –
5971: 1537:// first and caused the condition to become false again, and we must 1432:// sections that read or write this same concurrent data. If another 1429:// run simultaneously on different cores while executing in critical 1202:. The "producer" threads will want to wait on a monitor using lock 936:
is not a spin-lock and properly uses a blocking lock queue itself.)
308:
and no synchronization, making the code subject to race conditions:
5542: 5512: 5429:. Brinch Hansen published the first monitor notation, adopting the 5095:.q (t is called "the notified thread") move t to e 4526:
operation that combines signaling with returning from a procedure.
3899:// Thread-unsafe queue of blocked threads. Elements are (Thread*). 2843:// This is used with test-and-set as the synchronization primitive. 1456:// Now, we are holding the lock and can check the condition for the 1426:// to ensure that no two threads can be preemptively interleaved or 1420:// Acquire the advisory mutex (lock) associated with the concurrent 748:// Drop the queue lock until we need it again to add the next task. 98:
exclusive access and resuming their task. A monitor consists of a
5773:
Buhr, Peter A.; Fortier, Michel; Coffin, Michael H. (March 1995).
3446:// Thread sleeps ... Thread gets woken up from a signal/broadcast. 2873:// On the current CPU core, preemptively switch to another thread. 2325:// and consumer threads waiting for the queue to become non-empty. 1857:// become non-empty. Its associated lock is "queueLock". 1609:// broadcast that wakes us up, meaning that we have been taken out 1603:// true, and another thread using this monitor (m, cv) does either 1066:
to be executed is at step 2, in the middle of the "wait" function/
4965:
size <= capacity size := size - 1 ;
4181:// System call to disable interrupts on this core for efficiency. 3011:// Put this thread back onto the ready queue for later execution. 2813:// Thread-unsafe queue of ready threads. Elements are (Thread*). 2550:// Acquire "queueLock" for the initial predicate check. 2385:// Acquire "queueLock" for the initial predicate check. 2091:// Acquire "queueLock" for the initial predicate check. 1926:// Acquire "queueLock" for the initial predicate check. 1567:// release(m) // Atomically release lock "m" so other 1528:// If this is the first iteration of the loop, then the answer is 694:// needing queueLock to run so that a consumer might take a task. 4493:
unlock the monitor (the monitor will become unoccupied)
1743: 1600:// At some future time, the condition we are waiting for becomes 844:// needing queueLock to run so that a producer might add a task. 841:// Drop the lock temporarily to allow a chance for other threads 691:// Drop the lock temporarily to allow a chance for other threads 5532: 5434: 184:
at each point in time, at most one thread may occupy the object
5846:(1993). "Monitors and concurrent Pascal: a personal history". 3245:// Remove and get the next thread to run from the ready queue. 3038:// Remove and get the next thread to run from the ready queue. 1621:// become false again, or the condition may toggle one or more 1561:// Temporarily prevent any other thread on any core from doing 4417:, which is a queue for threads waiting on condition variable 4199:// (Release should only be performed while the lock is held.) 3155:// Get all of the registers of the currently-running process. 2933:// Get all of the registers of the currently-running process. 1618:// During this time, other threads may cause the condition to 976:
Thus there are three main operations on condition variables:
6055:
Monitor classification P.A. Buhr, M. Fortier, M.H. Coffin –
5455:
Programming languages that have supported monitors include:
2304:// A mutex for the ring-buffer of tasks. (Not a spin-lock.) 2517:// Method representing each consumer thread's behavior: 2337:// Method representing each producer thread's behavior: 2058:// Method representing each consumer thread's behavior: 1878:// Method representing each producer thread's behavior: 1839:// A mutex for the ring-buffer of tasks. (Not a spin-lock.) 757:// Method representing each consumer thread's behavior: 592:// Method representing each producer thread's behavior: 427:// Method representing each consumer thread's behavior: 328:// Method representing each producer thread's behavior: 69: 5768: 5766: 3401:// (Specifically, this thread must be the one holding it.) 2837:// Assume this variable is per-core. (Others are shared.) 2565:// Critical section that checks if the queue is non-empty. 2106:// Critical section that checks if the queue is non-empty. 1365:// Wait on this monitor's lock and condition variable. 61: 5184:
For this reason, it is usually necessary to enclose each
2795:// Assume "ThreadQueue" supports random access. 2400:// Critical section that checks if the queue is non-full. 1941:// Critical section that checks if the queue is non-full. 5926:"The Solo operating system: a Concurrent Pascal program" 4714:
do not depend on the contents or lengths of any queues.
1196:, the queue must be protected by a unique mutex object, 65: 5850:. History of Programming Languages. New York, NY, USA: 5763: 5328: 4403:
In addition we assume that for each condition variable
1120:, is called by a thread to indicate that the assertion 182:. Thread-safe objects are implemented to enforce that 4428:
and, in some implementations, may be guaranteed to be
1468:// we are waiting for happen to already be true?" 1034:'s "wait-queue" (a.k.a. "sleep-queue") of threads, and 5065:lock the monitor leave the monitor: schedule 4447:lock the monitor leave the monitor: schedule 4178:// N.B.: "threadingSystemBusy" is now true. 3944:// N.B.: "threadingSystemBusy" is now true. 3737:// right after going on the condition-variable queue. 3725:// N.B.: "threadingSystemBusy" is now true. 3557:// right after going on the condition-variable queue. 3545:// N.B.: "threadingSystemBusy" is now true. 3377:// right after going on the condition-variable queue. 3365:// N.B.: "threadingSystemBusy" is now true. 1606:// a signal that happens to wake this thread up, or a 1486:// "p" is any expression (e.g. variable or 1256: 1214: 250:
Case study: classic bounded producer/consumer problem
4546:.q select and remove one such thread t from 4477:.q select and remove one such thread t from 2731:
Sample Mesa-monitor implementation with Test-and-Set
1636:// acquire(m) // Lock "m" is re-acquired. 299: 4371:A Hoare style monitor with two condition variables 4304:// Turn pre-emptive switching back on on this core. 4130:// Turn pre-emptive switching back on on this core. 3842:// Turn pre-emptive switching back on on this core. 3662:// Turn pre-emptive switching back on on this core. 3470:// Turn pre-emptive switching back on on this core. 3116:// Turn pre-emptive switching back on on this core. 2750:
may be too technical for most readers to understand
1763:
may be too technical for most readers to understand
1498:// executing this "while" loop condition! 1492:// evaluates to boolean. This itself is a critical 5621: 5024:A Mesa style monitor with two condition variables 4992: 2870:// Context-switch interrupt service routine (ISR): 1573:// // can operate, move this thread to cv's 1495:// section, so you *MUST* be holding the lock when 1281: 1236: 6078:Monitors: An Operating System Structuring Concept 5772: 6740: 4808:It is important to note here that the assertion 4007:// considered "sleeping" on this lock. 3848:// The woken threads are not given any priority. 2328:// Its associated lock is "queueLock". 1630:// This thread is switched back to on some core. 1184:correspondence.) This is because the predicate 5091:.q select and remove one thread t from 4583:operation. This is summarized by the following 4503:The resulting signaling discipline is known as 4339: 1582:// // true, and sleep this thread. Re-enable 1522:// meantime thus making this a spurious wakeup? 1489:// function-call) that checks the condition and 5351:keyword. Blocks of code may also be marked by 4576:operation, it will be true at the end of each 3668:// The woken thread is not given any priority. 2334:// multiple predicate conditions (assertions). 1576:// // wait-queue so that it will be notified 6109: 5945: 5923: 5885:"Structured multiprogramming (Invited Paper)" 5882: 5746: 5744: 5612: 5381:Another approach to signaling is to omit the 2699: 1744:Solving the bounded producer/consumer problem 1371:// ... Critical section of code goes here ... 254:A classic concurrency problem is that of the 6123: 6030:"Effective Java: Programming Language Guide" 5707:"The programming language Concurrent Pascal" 5493:(Delphi 2009 and above, via TObject.Monitor) 5057:enter the monitor: enter the method 4439:enter the monitor: enter the method 2370:// Producer makes some new task to be added. 1911:// Producer makes some new task to be added. 1675:// and the monitor semantic type being used. 1648:// The condition we are waiting for is true! 1389:// cv2 might be the same as cv or different. 802:// Acquire lock for initial busy-wait check. 652:// Acquire lock for initial busy-wait check. 637:// Producer makes some new task to be added. 373:// Producer makes some new task to be added. 304:A naĂŻve approach is to design the code with 1579:// // sometime when the condition becomes 6116: 6102: 5741: 5441:. Hoare demonstrated their equivalence to 5035:With nonblocking condition variables, the 4424:All queues are typically guaranteed to be 1654:// the last execution of "wait". 826:// Busy-wait until the queue is non-empty. 481:// Busy-wait until the queue is non-empty. 27:Object or module in concurrent programming 5900: 5792: 5670: 5132:It is possible to associate an assertion 4399:is a queue of threads that have signaled. 3128:// the current thread on the ready queue. 2778:Learn how and when to remove this message 2762:, without removing the technical details. 2676:// Go off and do something with the task. 2217:// Go off and do something with the task. 1791:Learn how and when to remove this message 1775:, without removing the technical details. 913:// Go off and do something with the task. 676:// Busy-wait until the queue is non-full. 517:// Go off and do something with the task. 397:// Busy-wait until the queue is non-full. 6050:, v.17 n.10, p. 549–557, Oct. 1974 5332: 5019: 4366: 3299:// Return to where otherThread left off. 3092:// Return to where otherThread left off. 2289:// A thread-unsafe ring-buffer of tasks. 1824:// A thread-unsafe ring-buffer of tasks. 1624:// times, or it may happen to stay true. 1423:// data that is shared between threads, 1306:The proper basic usage of a monitor is: 939: 589:// A mutex for the ring-buffer of tasks. 574:// A thread-unsafe ring-buffer of tasks. 325:// A thread-unsafe ring-buffer of tasks. 5948:The Architecture of Concurrent Programs 4703:In these contracts, it is assumed that 3956:// right after going on the lock queue. 2727:and a first-come, first-served policy: 1570:// // code using this concurrent data 1028:move this thread from the "running" to 274:, because the queue can be put into an 47:instructions, advice, or how-to content 14: 6741: 5842: 5750: 5701: 5087:: if there is a thread waiting on 5080:.q schedule block this thread 4462:.q schedule block this thread 2918:// Can't switch context right now. 1594:// Context switch occurs on this core. 1585:// // other threads and cores to do 928:(N.B.: Mutexes themselves can also be 193: 6097: 6027: 5827: 5815: 5651: 5584:- a later development of monitors by 5376: 2760:make it understandable to non-experts 1773:make it understandable to non-experts 5996:"What's the "sync.Cond" | dtyler.io" 5972:"sync - The Go Programming Language" 5838: 5836: 5647: 5645: 5608: 5606: 5329:Implicit condition variable monitors 5150:is sure to be true upon return from 2734: 1747: 1642:// sure the predicate is still true. 1090:moving the first thread back out of 198: 29: 5462:since Ada 95 (as protected objects) 2792:// Basic parts of threading system: 1404:// Release this monitor's lock. 1323:// Acquire this monitor's lock. 1250:but a different condition variable 169: 56:so that it is more encyclopedic or 24: 6032:(third ed.). Addison-Wesley. 6021: 5582:Communicating sequential processes 5468:(and other languages that use the 5102:: move all threads waiting on 2704:Monitors are implemented using an 1078:, in which the thread could be on 25: 6770: 6072:Java Monitors (lucid explanation) 6065: 5933:Software: Practice and Experience 5924:Brinch Hansen, Per (April 1976). 5833: 5642: 5603: 5499:(via the wait and notify methods) 300:Incorrect without synchronization 5883:Brinch Hansen, Per (July 1972). 5215:is some condition stronger than 5159:. However, one must ensure that 5013:queue. There is no need for the 4515:queue and signaler waits on the 4295:// Must be an atomic assignment. 4121:// Must be an atomic assignment. 3833:// Must be an atomic assignment. 3653:// Must be an atomic assignment. 3461:// Must be an atomic assignment. 3107:// Must be an atomic assignment. 2739: 1752: 1301: 883:// Take a task off of the queue. 502:// Take a task off of the queue. 159:, and were first implemented in 34: 6614:Enterprise Integration Patterns 5988: 5964: 5939: 5917: 5166:is preserved from the time the 4999:nonblocking condition variables 4993:Nonblocking condition variables 4522:Some implementations provide a 2257:. This is because the regular 2031:// Or: broadcast(queueEmptyCV); 1588:// // operations on m and cv. 548: 5876: 5695: 5318:balanceMayBeBigEnough } } 5298:balanceMayBeBigEnough 5188:operation in a loop like this 2720:until it is ready to proceed. 2196:// Or: broadcast(queueFullCV); 1417:// About to enter the monitor. 973:is true in the current state. 13: 1: 5405:the state of the monitor 5287:amount >= 0 { 5139:with each condition variable 4792:the state of the monitor 4736:the state of the monitor 4669:the state of the monitor 4628:the state of the monitor 4569:is true at the start of each 4542:there is a thread waiting on 4473:there is a thread waiting on 733:// Add the task to the queue. 418:// Add the task to the queue. 5240:are treated as "hints" that 5106:.q to e schedule : 4931:size <= capacity 4354:blocking condition variables 4340:Blocking condition variables 4184:systemCall_disableInterrupts 3959:systemCall_disableInterrupts 3740:systemCall_disableInterrupts 3560:systemCall_disableInterrupts 3380:systemCall_disableInterrupts 2927:systemCall_disableInterrupts 2658:// End of critical sections. 2493:// End of critical sections. 2199:// End of critical sections. 2034:// End of critical sections. 992:is a condition variable and 7: 6707:Portland Pattern Repository 5946:Brinch Hansen, Per (1977). 5624:Operating System Principles 5613:Brinch Hansen, Per (1973). 5570: 4973:size < capacity 4957:theStackIsNotEmpty 4298:systemCall_enableInterrupts 4124:systemCall_enableInterrupts 3836:systemCall_enableInterrupts 3656:systemCall_enableInterrupts 3464:systemCall_enableInterrupts 3110:systemCall_enableInterrupts 1172:may be more efficient than 966:to indicate that assertion 178:the object, by holding its 10: 6775: 5420: 5275:balanceMayBeBigEnough 5121:, which has priority over 5039:operation is often called 4915:theStackIsNotFull 4344:The original proposals by 2700:Synchronization primitives 1612:// of cv's wait-queue. 151:Monitors were invented by 6715: 6694: 6623: 6598: 6515: 6400: 6300: 6228: 6180: 6142: 6131: 6048:Communications of the ACM 5889:Communications of the ACM 5076:: add this thread to 4505:"signal and urgent wait," 4458:: add this thread to 1564:// operations on m or cv. 1282:{\displaystyle c_{empty}} 1208:and a condition variable 256:bounded producer/consumer 6759:Software design patterns 6332:Event-based asynchronous 6125:Software design patterns 5775:"Monitor classification" 5751:Howard, John H. (1976). 5727:10.1109/TSE.1975.6312840 5596: 5129:for further discussion. 4860:size <= capacity 4838:capacity := 10 2789: 2271: 1806: 1411: 1308: 1237:{\displaystyle c_{full}} 1137:that is associated with 1062:'s wait-queue, the next 559: 310: 6238:Chain of responsibility 5753:"Signaling in monitors" 5715:IEEE Trans. Softw. Eng. 5591:Semaphore (programming) 5005:condition variables or 4605:leave the monitor: 4598:enter the monitor: 3122:// Thread sleep method: 1711:// Or: broadcast(cv_x); 944:The solution is to use 6749:Programming constructs 6377:Scheduled-task pattern 6327:Double-checked locking 6088:Signalling in Monitors 6028:Bloch, Joshua (2018). 5547:Object-Oriented Turing 5338: 5264:balance := 0 5125:. See Howard and Buhr 5032: 4877:size <= capacity */ 4587:. In these contracts, 4383: 4362:signal-and-urgent-wait 1414:// ... (previous code) 1386:// Or: broadcast(cv2); 1283: 1238: 952:is associated with an 258:, in which there is a 113:Another definition of 91:concurrent programming 6728:Architectural pattern 6631:Christopher Alexander 6057:ACM Computing Surveys 5902:10.1145/361454.361473 5860:10.1145/155360.155361 5794:10.1145/214037.214100 5780:ACM Computing Surveys 5681:10.1145/355620.361161 5567:is one such library. 5450:Solo operating system 5336: 5023: 5007:"signal and continue" 4904:value) { 4895:size < capacity */ 4801:(See Howard and Buhr 4511:in which there is no 4393:is the entrance queue 4370: 1284: 1239: 6540:Dependency injection 6497:Inversion of control 6492:Data transfer object 6392:Thread-local storage 5337:A Java style monitor 5291:balance < amount 5273:NonblockingCondition 5268:balance >= 0 4946:pop() { 1254: 1212: 132:that wraps around a 6754:Concurrency control 6545:Intercepting filter 5615:"7.2 Class Concept" 5522:threading.Condition 5114:unlock the monitor 4935:theStackIsNotEmpty 4867:theStackIsNotEmpty 4852:size := 0 4407:, there is a queue 4283:threadingSystemBusy 4169:threadingSystemBusy 4109:threadingSystemBusy 3935:threadingSystemBusy 3821:threadingSystemBusy 3716:threadingSystemBusy 3641:threadingSystemBusy 3536:threadingSystemBusy 3449:threadingSystemBusy 3356:threadingSystemBusy 3095:threadingSystemBusy 2903:threadingSystemBusy 2858:threadingSystemBusy 1666:// predicates true. 946:condition variables 940:Condition variables 194:Condition variables 54:rewrite the content 6702:The Hillside Group 6487:Data access object 6337:Guarded suspension 6322:Binding properties 5844:Hansen, Per Brinch 5377:Implicit signaling 5339: 5033: 4977:theStackIsNotFull 4885:theStackIsNotFull 4509:"signal and wait," 4430:first in first out 4384: 2649:queueFullOrEmptyCV 2604:queueFullOrEmptyCV 2484:queueFullOrEmptyCV 2439:queueFullOrEmptyCV 2313:queueFullOrEmptyCV 1279: 1234: 1019:release the mutex 276:inconsistent state 108:condition variable 104:condition variable 18:Condition variable 6736: 6735: 6530:Business delegate 6462:Publish–subscribe 6296: 6295: 5957:978-0-13-044628-2 5950:. Prentice Hall. 5854:. pp. 1–35. 5635:978-0-13-637843-3 5628:. Prentice Hall. 5481:Concurrent Pascal 5476:Concurrent Euclid 5439:Concurrent Pascal 5222:. The operations 4883:BlockingCondition 4865:BlockingCondition 4591:is the monitor's 4524:signal and return 4350:Per Brinch Hansen 4316:ConditionVariable 3686:ConditionVariable 3506:ConditionVariable 3326:ConditionVariable 2788: 2787: 2780: 1801: 1800: 1793: 1296:critical sections 199:Problem statement 164:Concurrent Pascal 153:Per Brinch Hansen 102:and at least one 87: 86: 16:(Redirected from 6766: 6535:Composite entity 6412:Front controller 6152:Abstract factory 6140: 6139: 6118: 6111: 6104: 6095: 6094: 6043: 6015: 6014: 6012: 6011: 6002:. Archived from 5992: 5986: 5985: 5983: 5982: 5968: 5962: 5961: 5943: 5937: 5936: 5930: 5921: 5915: 5914: 5904: 5880: 5874: 5873: 5840: 5831: 5825: 5819: 5813: 5807: 5806: 5796: 5770: 5761: 5760: 5748: 5739: 5738: 5711: 5699: 5693: 5692: 5674: 5649: 5640: 5639: 5627: 5619: 5610: 5577:Mutual exclusion 5310:amount) 5283:amount) 5243: 5239: 5238: 5230: 5229: 5221: 5214: 5200: 5176: 5165: 5158: 5157: 5149: 5142: 5138: 5124: 5120: 5105: 5101: 5094: 5090: 5086: 5079: 5075: 5069:from the method 5050: 5031: 5027: 5016: 5012: 4908:size = capacity 4814: 4798: 4787: 4780: 4772: 4762: 4751: 4745: 4732: 4725: 4713: 4706: 4700: 4694: 4681: 4675: 4665: 4659: 4649: 4643: 4637: 4624: 4617: 4611: 4604: 4590: 4582: 4575: 4568: 4558:from the method 4549: 4545: 4534: 4518: 4514: 4499: 4480: 4476: 4468: 4461: 4457: 4451:from the method 4420: 4416: 4414: 4406: 4398: 4392: 4378: 4374: 4335: 4332: 4329: 4326: 4323: 4320: 4317: 4314: 4311: 4308: 4305: 4302: 4299: 4296: 4293: 4290: 4287: 4284: 4281: 4278: 4275: 4272: 4269: 4266: 4263: 4260: 4257: 4254: 4251: 4248: 4245: 4242: 4239: 4236: 4233: 4230: 4227: 4224: 4221: 4218: 4215: 4212: 4209: 4206: 4203: 4200: 4197: 4194: 4191: 4188: 4185: 4182: 4179: 4176: 4173: 4170: 4167: 4164: 4161: 4158: 4155: 4152: 4149: 4146: 4143: 4140: 4137: 4134: 4131: 4128: 4125: 4122: 4119: 4116: 4113: 4110: 4107: 4104: 4101: 4098: 4095: 4092: 4089: 4086: 4083: 4080: 4077: 4074: 4071: 4068: 4065: 4062: 4059: 4056: 4053: 4050: 4047: 4044: 4041: 4038: 4035: 4032: 4029: 4026: 4023: 4020: 4017: 4014: 4011: 4008: 4005: 4002: 3999: 3996: 3993: 3990: 3987: 3984: 3981: 3978: 3975: 3972: 3969: 3966: 3963: 3960: 3957: 3954: 3951: 3948: 3945: 3942: 3939: 3936: 3933: 3930: 3927: 3924: 3921: 3918: 3915: 3912: 3909: 3906: 3903: 3900: 3897: 3894: 3891: 3888: 3885: 3882: 3879: 3876: 3873: 3870: 3867: 3864: 3861: 3858: 3855: 3852: 3849: 3846: 3843: 3840: 3837: 3834: 3831: 3828: 3825: 3822: 3819: 3816: 3813: 3810: 3807: 3804: 3801: 3798: 3795: 3792: 3789: 3786: 3783: 3780: 3777: 3774: 3771: 3768: 3765: 3762: 3759: 3756: 3753: 3750: 3747: 3744: 3741: 3738: 3735: 3732: 3729: 3726: 3723: 3720: 3717: 3714: 3711: 3708: 3705: 3702: 3699: 3696: 3693: 3690: 3687: 3684: 3681: 3678: 3675: 3672: 3669: 3666: 3663: 3660: 3657: 3654: 3651: 3648: 3645: 3642: 3639: 3636: 3633: 3630: 3627: 3624: 3621: 3618: 3615: 3612: 3609: 3606: 3603: 3600: 3597: 3594: 3591: 3588: 3585: 3582: 3579: 3576: 3573: 3570: 3567: 3564: 3561: 3558: 3555: 3552: 3549: 3546: 3543: 3540: 3537: 3534: 3531: 3528: 3525: 3522: 3519: 3516: 3513: 3510: 3507: 3504: 3501: 3498: 3495: 3492: 3489: 3486: 3483: 3480: 3477: 3474: 3471: 3468: 3465: 3462: 3459: 3456: 3453: 3450: 3447: 3444: 3441: 3438: 3435: 3432: 3429: 3426: 3423: 3420: 3417: 3414: 3411: 3408: 3405: 3402: 3399: 3396: 3393: 3390: 3387: 3384: 3381: 3378: 3375: 3372: 3369: 3366: 3363: 3360: 3357: 3354: 3351: 3348: 3345: 3342: 3339: 3336: 3333: 3330: 3327: 3324: 3321: 3318: 3315: 3312: 3309: 3306: 3303: 3300: 3297: 3294: 3291: 3288: 3285: 3282: 3279: 3276: 3273: 3270: 3269:restoreRegisters 3267: 3264: 3261: 3258: 3255: 3252: 3249: 3246: 3243: 3240: 3237: 3234: 3231: 3228: 3225: 3222: 3219: 3216: 3213: 3210: 3207: 3204: 3201: 3198: 3195: 3192: 3189: 3186: 3183: 3180: 3177: 3174: 3171: 3168: 3165: 3162: 3159: 3156: 3153: 3150: 3147: 3144: 3141: 3138: 3135: 3132: 3129: 3126: 3123: 3120: 3117: 3114: 3111: 3108: 3105: 3102: 3099: 3096: 3093: 3090: 3087: 3084: 3081: 3078: 3075: 3072: 3069: 3066: 3063: 3062:restoreRegisters 3060: 3057: 3054: 3051: 3048: 3045: 3042: 3039: 3036: 3033: 3030: 3027: 3024: 3021: 3018: 3015: 3012: 3009: 3006: 3003: 3000: 2997: 2994: 2991: 2988: 2985: 2982: 2979: 2976: 2973: 2970: 2967: 2964: 2961: 2958: 2955: 2952: 2949: 2946: 2943: 2940: 2937: 2934: 2931: 2928: 2925: 2922: 2919: 2916: 2913: 2910: 2907: 2904: 2901: 2898: 2895: 2892: 2889: 2886: 2883: 2882:contextSwitchISR 2880: 2877: 2874: 2871: 2868: 2865: 2862: 2859: 2856: 2853: 2850: 2847: 2844: 2841: 2838: 2835: 2832: 2829: 2826: 2823: 2820: 2817: 2814: 2811: 2808: 2805: 2802: 2799: 2796: 2793: 2783: 2776: 2772: 2769: 2763: 2743: 2742: 2735: 2695: 2692: 2689: 2686: 2683: 2680: 2677: 2674: 2671: 2668: 2665: 2662: 2659: 2656: 2653: 2650: 2647: 2644: 2641: 2638: 2635: 2632: 2629: 2626: 2623: 2620: 2617: 2614: 2611: 2608: 2605: 2602: 2599: 2596: 2593: 2590: 2587: 2584: 2581: 2578: 2575: 2572: 2569: 2566: 2563: 2560: 2557: 2554: 2551: 2548: 2545: 2542: 2539: 2536: 2533: 2530: 2527: 2524: 2521: 2518: 2515: 2512: 2509: 2506: 2503: 2500: 2497: 2494: 2491: 2488: 2485: 2482: 2479: 2476: 2473: 2470: 2467: 2464: 2461: 2458: 2455: 2452: 2449: 2446: 2443: 2440: 2437: 2434: 2431: 2428: 2425: 2422: 2419: 2416: 2413: 2410: 2407: 2404: 2401: 2398: 2395: 2392: 2389: 2386: 2383: 2380: 2377: 2374: 2371: 2368: 2365: 2362: 2359: 2356: 2353: 2350: 2347: 2344: 2341: 2338: 2335: 2332: 2329: 2326: 2323: 2320: 2317: 2314: 2311: 2308: 2305: 2302: 2299: 2296: 2293: 2290: 2287: 2284: 2281: 2278: 2275: 2236: 2233: 2230: 2227: 2224: 2221: 2218: 2215: 2212: 2209: 2206: 2203: 2200: 2197: 2194: 2191: 2188: 2185: 2182: 2179: 2176: 2173: 2170: 2167: 2164: 2161: 2158: 2155: 2152: 2149: 2146: 2143: 2140: 2137: 2134: 2131: 2128: 2125: 2122: 2119: 2116: 2113: 2110: 2107: 2104: 2101: 2098: 2095: 2092: 2089: 2086: 2083: 2080: 2077: 2074: 2071: 2068: 2065: 2062: 2059: 2056: 2053: 2050: 2047: 2044: 2041: 2038: 2035: 2032: 2029: 2026: 2023: 2020: 2017: 2014: 2011: 2008: 2005: 2002: 1999: 1996: 1993: 1990: 1987: 1984: 1981: 1978: 1975: 1972: 1969: 1966: 1963: 1960: 1957: 1954: 1951: 1948: 1945: 1942: 1939: 1936: 1933: 1930: 1927: 1924: 1921: 1918: 1915: 1912: 1909: 1906: 1903: 1900: 1897: 1894: 1891: 1888: 1885: 1882: 1879: 1876: 1873: 1870: 1867: 1864: 1861: 1858: 1855: 1852: 1849: 1846: 1843: 1840: 1837: 1834: 1831: 1828: 1825: 1822: 1819: 1816: 1813: 1810: 1796: 1789: 1785: 1782: 1776: 1756: 1755: 1748: 1739: 1736: 1733: 1730: 1727: 1724: 1721: 1720:// to acquire m. 1718: 1715: 1712: 1709: 1706: 1703: 1700: 1697: 1694: 1691: 1688: 1685: 1682: 1679: 1676: 1673: 1670: 1667: 1664: 1661: 1660:// must be true. 1658: 1655: 1652: 1649: 1646: 1643: 1640: 1637: 1634: 1631: 1628: 1625: 1622: 1619: 1616: 1613: 1610: 1607: 1604: 1601: 1598: 1595: 1592: 1589: 1586: 1583: 1580: 1577: 1574: 1571: 1568: 1565: 1562: 1559: 1556: 1553: 1550: 1547: 1544: 1541: 1538: 1535: 1532: 1529: 1526: 1523: 1520: 1517: 1514: 1511: 1508: 1505: 1502: 1499: 1496: 1493: 1490: 1487: 1484: 1481: 1478: 1475: 1472: 1469: 1466: 1463: 1460: 1457: 1454: 1451: 1448: 1445: 1442: 1441:// a spin-lock.) 1439: 1436: 1433: 1430: 1427: 1424: 1421: 1418: 1415: 1405: 1402: 1399: 1396: 1393: 1390: 1387: 1384: 1381: 1378: 1375: 1372: 1369: 1366: 1363: 1360: 1357: 1354: 1351: 1348: 1345: 1342: 1339: 1336: 1333: 1330: 1327: 1324: 1321: 1318: 1315: 1312: 1288: 1286: 1285: 1280: 1278: 1277: 1249: 1243: 1241: 1240: 1235: 1233: 1232: 1207: 1201: 1190: 1158: 1152:, also known as 1151: 1142: 1136: 1130: 1126: 1119: 1113:, also known as 1112: 1101: 1095: 1089: 1083: 1061: 1050: 1033: 1024: 1006: 995: 991: 985: 972: 965: 961: 951: 920: 917: 914: 911: 908: 905: 902: 899: 896: 893: 890: 887: 884: 881: 878: 875: 872: 869: 866: 863: 860: 857: 854: 851: 848: 845: 842: 839: 836: 833: 830: 827: 824: 821: 818: 815: 812: 809: 806: 803: 800: 797: 794: 791: 788: 785: 782: 779: 776: 773: 770: 767: 764: 761: 758: 755: 752: 749: 746: 743: 740: 737: 734: 731: 728: 725: 722: 719: 716: 713: 710: 707: 704: 701: 698: 695: 692: 689: 686: 683: 680: 677: 674: 671: 668: 665: 662: 659: 656: 653: 650: 647: 644: 641: 638: 635: 632: 629: 626: 623: 620: 617: 614: 611: 608: 605: 602: 599: 596: 593: 590: 587: 584: 581: 578: 575: 572: 569: 566: 563: 524: 521: 518: 515: 512: 509: 506: 503: 500: 497: 494: 491: 488: 485: 482: 479: 476: 473: 470: 467: 464: 461: 458: 455: 452: 449: 446: 443: 440: 437: 434: 431: 428: 425: 422: 419: 416: 413: 410: 407: 404: 401: 398: 395: 392: 389: 386: 383: 380: 377: 374: 371: 368: 365: 362: 359: 356: 353: 350: 347: 344: 341: 338: 335: 332: 329: 326: 323: 320: 317: 314: 290:context switches 281:critical section 170:Mutual exclusion 142:mutual exclusion 82: 79: 73: 38: 37: 30: 21: 6774: 6773: 6769: 6768: 6767: 6765: 6764: 6763: 6739: 6738: 6737: 6732: 6711: 6690: 6681:Douglas Schmidt 6661:Ward Cunningham 6619: 6607:Design Patterns 6594: 6585:Method chaining 6517: 6511: 6472:Service locator 6403: 6396: 6367:Read–write lock 6303: 6292: 6283:Template method 6224: 6176: 6134: 6127: 6122: 6068: 6040: 6024: 6022:Further reading 6019: 6018: 6009: 6007: 5994: 5993: 5989: 5980: 5978: 5970: 5969: 5965: 5958: 5944: 5940: 5928: 5922: 5918: 5881: 5877: 5870: 5841: 5834: 5826: 5822: 5814: 5810: 5771: 5764: 5749: 5742: 5709: 5700: 5696: 5665:(10): 549–557. 5653:Hoare, C. A. R. 5650: 5643: 5636: 5617: 5611: 5604: 5599: 5573: 5427:Edsger Dijkstra 5423: 5418: 5417: 5411: 5401: 5394: 5379: 5331: 5319: 5241: 5236: 5232: 5227: 5223: 5220: 5216: 5212: 5209: 5198: 5175: 5171: 5164: 5160: 5155: 5151: 5148: 5144: 5140: 5137: 5133: 5122: 5118: 5115: 5103: 5099: 5092: 5088: 5084: 5077: 5073: 5048: 5029: 5025: 5014: 5010: 4995: 4982: 4889:associated with 4871:associated with 4813: 4809: 4799: 4796: 4785: 4778: 4771: 4767: 4760: 4749: 4744: 4740: 4730: 4723: 4712: 4708: 4704: 4701: 4698: 4693: 4689: 4679: 4673: 4663: 4658: 4654: 4647: 4641: 4636: 4632: 4622: 4615: 4609: 4602: 4588: 4580: 4573: 4567: 4563: 4559: 4547: 4543: 4532: 4519:queue instead. 4516: 4512: 4497: 4494: 4478: 4474: 4466: 4459: 4455: 4418: 4412: 4411: 4404: 4396: 4390: 4376: 4372: 4342: 4337: 4336: 4333: 4330: 4327: 4324: 4321: 4318: 4315: 4312: 4309: 4306: 4303: 4300: 4297: 4294: 4291: 4288: 4285: 4282: 4279: 4276: 4274:unblockedThread 4273: 4270: 4267: 4264: 4261: 4258: 4255: 4252: 4250:blockingThreads 4249: 4246: 4244:unblockedThread 4243: 4240: 4237: 4234: 4231: 4228: 4225: 4223:blockingThreads 4222: 4219: 4216: 4213: 4210: 4207: 4204: 4201: 4198: 4195: 4192: 4189: 4186: 4183: 4180: 4177: 4174: 4171: 4168: 4165: 4162: 4159: 4156: 4153: 4150: 4147: 4144: 4141: 4138: 4135: 4132: 4129: 4126: 4123: 4120: 4117: 4114: 4111: 4108: 4105: 4102: 4099: 4096: 4093: 4090: 4087: 4084: 4081: 4078: 4076:blockingThreads 4075: 4072: 4069: 4066: 4063: 4060: 4057: 4054: 4051: 4048: 4045: 4042: 4039: 4036: 4033: 4031:blockingThreads 4030: 4027: 4024: 4021: 4018: 4015: 4012: 4009: 4006: 4003: 4000: 3997: 3994: 3991: 3988: 3985: 3982: 3979: 3976: 3973: 3971:blockingThreads 3970: 3967: 3964: 3961: 3958: 3955: 3952: 3949: 3946: 3943: 3940: 3937: 3934: 3931: 3928: 3925: 3922: 3919: 3916: 3913: 3910: 3907: 3904: 3901: 3898: 3895: 3893:blockingThreads 3892: 3889: 3886: 3883: 3880: 3877: 3874: 3871: 3868: 3865: 3862: 3859: 3856: 3853: 3850: 3847: 3844: 3841: 3838: 3835: 3832: 3829: 3826: 3823: 3820: 3817: 3814: 3811: 3808: 3805: 3802: 3799: 3796: 3793: 3790: 3787: 3784: 3781: 3778: 3775: 3772: 3769: 3766: 3763: 3760: 3757: 3754: 3751: 3748: 3745: 3742: 3739: 3736: 3733: 3730: 3727: 3724: 3721: 3718: 3715: 3712: 3709: 3706: 3703: 3700: 3697: 3694: 3691: 3688: 3685: 3682: 3679: 3676: 3673: 3670: 3667: 3664: 3661: 3658: 3655: 3652: 3649: 3646: 3643: 3640: 3637: 3634: 3631: 3628: 3625: 3622: 3619: 3616: 3613: 3610: 3607: 3604: 3601: 3598: 3595: 3592: 3589: 3586: 3583: 3580: 3577: 3574: 3571: 3568: 3565: 3562: 3559: 3556: 3553: 3550: 3547: 3544: 3541: 3538: 3535: 3532: 3529: 3526: 3523: 3520: 3517: 3514: 3511: 3508: 3505: 3502: 3499: 3496: 3493: 3490: 3487: 3484: 3481: 3478: 3475: 3472: 3469: 3466: 3463: 3460: 3457: 3454: 3451: 3448: 3445: 3442: 3439: 3436: 3433: 3430: 3427: 3424: 3421: 3418: 3415: 3412: 3409: 3406: 3403: 3400: 3397: 3394: 3391: 3388: 3385: 3382: 3379: 3376: 3373: 3370: 3367: 3364: 3361: 3358: 3355: 3352: 3349: 3346: 3343: 3340: 3337: 3334: 3331: 3328: 3325: 3322: 3319: 3316: 3313: 3310: 3307: 3304: 3301: 3298: 3295: 3292: 3289: 3286: 3283: 3280: 3277: 3274: 3271: 3268: 3265: 3262: 3259: 3256: 3253: 3250: 3247: 3244: 3241: 3238: 3235: 3232: 3229: 3226: 3223: 3220: 3217: 3214: 3211: 3208: 3205: 3202: 3199: 3196: 3193: 3190: 3187: 3184: 3181: 3179:getAllRegisters 3178: 3175: 3172: 3169: 3166: 3163: 3160: 3157: 3154: 3151: 3148: 3145: 3142: 3139: 3136: 3133: 3130: 3127: 3124: 3121: 3118: 3115: 3112: 3109: 3106: 3103: 3100: 3097: 3094: 3091: 3088: 3085: 3082: 3079: 3076: 3073: 3070: 3067: 3064: 3061: 3058: 3055: 3052: 3049: 3046: 3043: 3040: 3037: 3034: 3031: 3028: 3025: 3022: 3019: 3016: 3013: 3010: 3007: 3004: 3001: 2998: 2995: 2992: 2989: 2986: 2983: 2980: 2977: 2974: 2971: 2968: 2965: 2962: 2959: 2957:getAllRegisters 2956: 2953: 2950: 2947: 2944: 2941: 2938: 2935: 2932: 2929: 2926: 2923: 2920: 2917: 2914: 2911: 2908: 2905: 2902: 2899: 2896: 2893: 2890: 2887: 2884: 2881: 2878: 2875: 2872: 2869: 2866: 2863: 2860: 2857: 2854: 2851: 2848: 2845: 2842: 2839: 2836: 2833: 2830: 2827: 2824: 2821: 2818: 2815: 2812: 2809: 2806: 2803: 2800: 2797: 2794: 2791: 2784: 2773: 2767: 2764: 2756:help improve it 2753: 2744: 2740: 2733: 2702: 2697: 2696: 2693: 2690: 2687: 2684: 2681: 2678: 2675: 2672: 2669: 2666: 2663: 2660: 2657: 2654: 2651: 2648: 2645: 2642: 2639: 2636: 2633: 2630: 2627: 2624: 2621: 2618: 2615: 2612: 2609: 2606: 2603: 2600: 2597: 2594: 2591: 2588: 2585: 2582: 2579: 2576: 2573: 2570: 2567: 2564: 2561: 2558: 2555: 2552: 2549: 2546: 2543: 2540: 2537: 2534: 2531: 2528: 2525: 2522: 2519: 2516: 2513: 2510: 2507: 2504: 2501: 2498: 2495: 2492: 2489: 2486: 2483: 2480: 2477: 2474: 2471: 2468: 2465: 2462: 2459: 2456: 2453: 2450: 2447: 2444: 2441: 2438: 2435: 2432: 2429: 2426: 2423: 2420: 2417: 2414: 2411: 2408: 2405: 2402: 2399: 2396: 2393: 2390: 2387: 2384: 2381: 2378: 2375: 2372: 2369: 2366: 2363: 2360: 2357: 2354: 2351: 2348: 2345: 2342: 2339: 2336: 2333: 2330: 2327: 2324: 2321: 2318: 2315: 2312: 2309: 2306: 2303: 2300: 2297: 2294: 2291: 2288: 2285: 2282: 2279: 2276: 2273: 2238: 2237: 2234: 2231: 2228: 2225: 2222: 2219: 2216: 2213: 2210: 2207: 2204: 2201: 2198: 2195: 2192: 2189: 2186: 2183: 2180: 2177: 2174: 2171: 2168: 2165: 2162: 2159: 2156: 2153: 2150: 2147: 2144: 2141: 2138: 2135: 2132: 2129: 2126: 2123: 2120: 2117: 2114: 2111: 2108: 2105: 2102: 2099: 2096: 2093: 2090: 2087: 2084: 2081: 2078: 2075: 2072: 2069: 2066: 2063: 2060: 2057: 2054: 2051: 2048: 2045: 2042: 2039: 2036: 2033: 2030: 2027: 2024: 2021: 2018: 2015: 2012: 2009: 2006: 2003: 2000: 1997: 1994: 1991: 1988: 1985: 1982: 1979: 1976: 1973: 1970: 1967: 1964: 1961: 1958: 1955: 1952: 1949: 1946: 1943: 1940: 1937: 1934: 1931: 1928: 1925: 1922: 1919: 1916: 1913: 1910: 1907: 1904: 1901: 1898: 1895: 1892: 1889: 1886: 1883: 1880: 1877: 1874: 1871: 1868: 1865: 1862: 1859: 1856: 1853: 1850: 1847: 1844: 1841: 1838: 1835: 1832: 1829: 1826: 1823: 1820: 1817: 1814: 1811: 1808: 1797: 1786: 1780: 1777: 1769:help improve it 1766: 1757: 1753: 1746: 1741: 1740: 1737: 1734: 1731: 1728: 1725: 1722: 1719: 1716: 1713: 1710: 1707: 1704: 1701: 1698: 1695: 1692: 1689: 1686: 1683: 1680: 1677: 1674: 1671: 1668: 1665: 1662: 1659: 1656: 1653: 1650: 1647: 1644: 1641: 1638: 1635: 1632: 1629: 1626: 1623: 1620: 1617: 1614: 1611: 1608: 1605: 1602: 1599: 1596: 1593: 1590: 1587: 1584: 1581: 1578: 1575: 1572: 1569: 1566: 1563: 1560: 1557: 1554: 1551: 1548: 1545: 1542: 1539: 1536: 1533: 1530: 1527: 1524: 1521: 1518: 1515: 1512: 1509: 1506: 1503: 1500: 1497: 1494: 1491: 1488: 1485: 1482: 1479: 1476: 1473: 1470: 1467: 1464: 1461: 1458: 1455: 1452: 1449: 1446: 1443: 1440: 1437: 1434: 1431: 1428: 1425: 1422: 1419: 1416: 1413: 1407: 1406: 1403: 1400: 1397: 1394: 1391: 1388: 1385: 1382: 1379: 1376: 1373: 1370: 1367: 1364: 1361: 1358: 1355: 1352: 1349: 1346: 1343: 1340: 1337: 1334: 1331: 1328: 1325: 1322: 1319: 1316: 1313: 1310: 1304: 1261: 1257: 1255: 1252: 1251: 1245: 1219: 1215: 1213: 1210: 1209: 1203: 1197: 1194:described above 1189: 1185: 1153: 1146: 1138: 1132: 1128: 1125: 1121: 1114: 1107: 1097: 1091: 1085: 1079: 1064:program counter 1057: 1046: 1040: 1029: 1020: 1005: 1001: 993: 987: 980: 971: 967: 963: 960: 956: 949: 942: 922: 921: 918: 915: 912: 909: 906: 903: 900: 897: 894: 891: 888: 885: 882: 879: 876: 873: 870: 867: 864: 861: 858: 855: 852: 849: 846: 843: 840: 837: 834: 831: 828: 825: 822: 819: 816: 813: 810: 807: 804: 801: 798: 795: 792: 789: 786: 783: 780: 777: 774: 771: 768: 765: 762: 759: 756: 753: 750: 747: 744: 741: 738: 735: 732: 729: 726: 723: 720: 717: 714: 711: 708: 705: 702: 699: 696: 693: 690: 687: 684: 681: 678: 675: 672: 669: 666: 663: 660: 657: 654: 651: 648: 645: 642: 639: 636: 633: 630: 627: 624: 621: 618: 615: 612: 609: 606: 603: 600: 597: 594: 591: 588: 585: 582: 579: 576: 573: 570: 567: 564: 561: 551: 538:queue.isEmpty() 526: 525: 522: 519: 516: 513: 510: 507: 504: 501: 498: 495: 492: 489: 486: 483: 480: 477: 474: 471: 468: 465: 462: 459: 456: 453: 450: 447: 444: 441: 438: 435: 432: 429: 426: 423: 420: 417: 414: 411: 408: 405: 402: 399: 396: 393: 390: 387: 384: 381: 378: 375: 372: 369: 366: 363: 360: 357: 354: 351: 348: 345: 342: 339: 336: 333: 330: 327: 324: 321: 318: 315: 312: 302: 294:race conditions 252: 241: 237: 231: 223: 206: 201: 196: 172: 161:Brinch Hansen's 83: 77: 74: 51: 39: 35: 28: 23: 22: 15: 12: 11: 5: 6772: 6762: 6761: 6756: 6751: 6734: 6733: 6731: 6730: 6725: 6719: 6717: 6713: 6712: 6710: 6709: 6704: 6698: 6696: 6692: 6691: 6689: 6688: 6683: 6678: 6673: 6668: 6663: 6658: 6653: 6648: 6646:John Vlissides 6643: 6638: 6633: 6627: 6625: 6621: 6620: 6618: 6617: 6610: 6602: 6600: 6596: 6595: 6593: 6592: 6587: 6582: 6577: 6572: 6567: 6562: 6557: 6552: 6547: 6542: 6537: 6532: 6527: 6521: 6519: 6513: 6512: 6510: 6509: 6504: 6499: 6494: 6489: 6484: 6479: 6474: 6469: 6464: 6459: 6454: 6446: 6441: 6436: 6435: 6434: 6429: 6419: 6414: 6408: 6406: 6398: 6397: 6395: 6394: 6389: 6384: 6379: 6374: 6369: 6364: 6359: 6354: 6349: 6344: 6339: 6334: 6329: 6324: 6319: 6314: 6308: 6306: 6298: 6297: 6294: 6293: 6291: 6290: 6285: 6280: 6275: 6270: 6265: 6260: 6255: 6250: 6245: 6240: 6234: 6232: 6226: 6225: 6223: 6222: 6217: 6212: 6207: 6202: 6197: 6192: 6186: 6184: 6178: 6177: 6175: 6174: 6169: 6164: 6162:Factory method 6159: 6154: 6148: 6146: 6137: 6129: 6128: 6121: 6120: 6113: 6106: 6098: 6092: 6091: 6084: 6082:C. A. R. Hoare 6074: 6067: 6066:External links 6064: 6063: 6062: 6053: 6044: 6039:978-0134685991 6038: 6023: 6020: 6017: 6016: 5987: 5963: 5956: 5938: 5916: 5895:(7): 574–578. 5875: 5868: 5832: 5820: 5808: 5762: 5740: 5721:(2): 199–207. 5694: 5672:10.1.1.24.6394 5641: 5634: 5601: 5600: 5598: 5595: 5594: 5593: 5588: 5586:C. A. R. Hoare 5579: 5572: 5569: 5560: 5559: 5554: 5549: 5536: 5530: 5525: 5515: 5510: 5505: 5500: 5494: 5488: 5483: 5478: 5473: 5470:.NET Framework 5463: 5422: 5419: 5415: 5409: 5399: 5392: 5388: 5378: 5375: 5330: 5327: 5250: 5218: 5190: 5173: 5162: 5146: 5135: 5056: 4994: 4991: 4827: 4811: 4769: 4742: 4719: 4710: 4691: 4656: 4634: 4597: 4565: 4528: 4438: 4422: 4421: 4401: 4400: 4394: 4346:C. A. R. Hoare 4341: 4338: 4328:waitingThreads 3845:// Mesa style: 3788:waitingThreads 3761:waitingThreads 3665:// Mesa style: 3608:waitingThreads 3581:waitingThreads 3473:// Mesa style: 3422:waitingThreads 2790: 2786: 2785: 2747: 2745: 2738: 2732: 2729: 2701: 2698: 2272: 1807: 1799: 1798: 1760: 1758: 1751: 1745: 1742: 1540:// wait again. 1459:// first time. 1412: 1309: 1303: 1300: 1276: 1273: 1270: 1267: 1264: 1260: 1231: 1228: 1225: 1222: 1218: 1187: 1178: 1177: 1144: 1123: 1105: 1104: 1103: 1071: 1053: 1052: 1043: 1042: 1041: 1039: 1038: 1035: 1026: 1016: 1003: 969: 958: 941: 938: 560: 550: 547: 542:queue.isFull() 311: 301: 298: 251: 248: 239: 235: 221: 213: 207:holds true. A 204: 200: 197: 195: 192: 171: 168: 157:C. A. R. Hoare 85: 84: 42: 40: 33: 26: 9: 6: 4: 3: 2: 6771: 6760: 6757: 6755: 6752: 6750: 6747: 6746: 6744: 6729: 6726: 6724: 6721: 6720: 6718: 6714: 6708: 6705: 6703: 6700: 6699: 6697: 6693: 6687: 6684: 6682: 6679: 6677: 6674: 6672: 6671:Robert Martin 6669: 6667: 6666:Martin Fowler 6664: 6662: 6659: 6657: 6654: 6652: 6649: 6647: 6644: 6642: 6641:Ralph Johnson 6639: 6637: 6634: 6632: 6629: 6628: 6626: 6622: 6616: 6615: 6611: 6609: 6608: 6604: 6603: 6601: 6597: 6591: 6588: 6586: 6583: 6581: 6578: 6576: 6573: 6571: 6568: 6566: 6563: 6561: 6558: 6556: 6553: 6551: 6548: 6546: 6543: 6541: 6538: 6536: 6533: 6531: 6528: 6526: 6523: 6522: 6520: 6514: 6508: 6505: 6503: 6500: 6498: 6495: 6493: 6490: 6488: 6485: 6483: 6480: 6478: 6477:Active record 6475: 6473: 6470: 6468: 6467:Naked objects 6465: 6463: 6460: 6458: 6457:Specification 6455: 6453: 6451: 6447: 6445: 6442: 6440: 6437: 6433: 6430: 6428: 6425: 6424: 6423: 6420: 6418: 6415: 6413: 6410: 6409: 6407: 6405: 6402:Architectural 6399: 6393: 6390: 6388: 6385: 6383: 6380: 6378: 6375: 6373: 6370: 6368: 6365: 6363: 6360: 6358: 6355: 6353: 6350: 6348: 6345: 6343: 6340: 6338: 6335: 6333: 6330: 6328: 6325: 6323: 6320: 6318: 6315: 6313: 6312:Active object 6310: 6309: 6307: 6305: 6299: 6289: 6286: 6284: 6281: 6279: 6276: 6274: 6271: 6269: 6266: 6264: 6261: 6259: 6256: 6254: 6251: 6249: 6246: 6244: 6241: 6239: 6236: 6235: 6233: 6231: 6227: 6221: 6218: 6216: 6213: 6211: 6208: 6206: 6203: 6201: 6198: 6196: 6193: 6191: 6188: 6187: 6185: 6183: 6179: 6173: 6170: 6168: 6165: 6163: 6160: 6158: 6155: 6153: 6150: 6149: 6147: 6145: 6141: 6138: 6136: 6130: 6126: 6119: 6114: 6112: 6107: 6105: 6100: 6099: 6096: 6089: 6085: 6083: 6079: 6075: 6073: 6070: 6069: 6061: 6058: 6054: 6052: 6049: 6045: 6041: 6035: 6031: 6026: 6025: 6006:on 2021-10-01 6005: 6001: 5997: 5991: 5977: 5973: 5967: 5959: 5953: 5949: 5942: 5934: 5927: 5920: 5912: 5908: 5903: 5898: 5894: 5890: 5886: 5879: 5871: 5869:0-89791-570-4 5865: 5861: 5857: 5853: 5849: 5845: 5839: 5837: 5829: 5824: 5817: 5812: 5804: 5800: 5795: 5790: 5787:(1): 63–107. 5786: 5782: 5781: 5776: 5769: 5767: 5758: 5754: 5747: 5745: 5736: 5732: 5728: 5724: 5720: 5717: 5716: 5708: 5705:(June 1975). 5704: 5703:Hansen, P. B. 5698: 5690: 5686: 5682: 5678: 5673: 5668: 5664: 5660: 5659: 5654: 5648: 5646: 5637: 5631: 5626: 5625: 5616: 5609: 5607: 5602: 5592: 5589: 5587: 5583: 5580: 5578: 5575: 5574: 5568: 5566: 5558: 5557:Visual Prolog 5555: 5553: 5550: 5548: 5544: 5540: 5537: 5534: 5531: 5529: 5526: 5523: 5519: 5516: 5514: 5511: 5509: 5506: 5504: 5501: 5498: 5495: 5492: 5489: 5487: 5484: 5482: 5479: 5477: 5474: 5471: 5467: 5464: 5461: 5458: 5457: 5456: 5453: 5451: 5446: 5444: 5440: 5436: 5432: 5428: 5414: 5408: 5407:postcondition 5404: 5398: 5391: 5387: 5384: 5374: 5372: 5368: 5364: 5358: 5356: 5355: 5350: 5349: 5344: 5335: 5326: 5324: 5317: 5313: 5309: 5305: 5304:public method 5301: 5297: 5294: 5290: 5286: 5282: 5278: 5277:public method 5274: 5271: 5267: 5263: 5260: 5256: 5253: 5252:monitor class 5249: 5246: 5235: 5226: 5207: 5204: 5196: 5193: 5189: 5187: 5182: 5180: 5177:to simply be 5169: 5154: 5130: 5128: 5113: 5109: 5098: 5083: 5072: 5068: 5064: 5060: 5055: 5052: 5046: 5042: 5038: 5022: 5018: 5008: 5004: 5001:(also called 5000: 4990: 4988: 4980: 4976: 4972: 4969:0 <= size 4968: 4964: 4960: 4956: 4953: 4949: 4945: 4942: 4941:public method 4938: 4934: 4930: 4926: 4922: 4919:0 <= size 4918: 4914: 4911: 4907: 4903: 4899: 4898:public method 4896: 4894: 4891:0 <= size 4890: 4884: 4881: 4878: 4876: 4872: 4866: 4863: 4859: 4856:0 <= size 4855: 4851: 4848: 4844: 4841: 4837: 4836:private const 4833: 4830: 4829:monitor class 4826: 4824: 4821: 4816: 4806: 4804: 4795: 4794:postcondition 4791: 4784: 4776: 4766: 4758: 4754: 4748: 4739: 4738:postcondition 4735: 4729: 4722: 4718: 4715: 4697: 4688: 4684: 4678: 4672: 4671:postcondition 4668: 4662: 4653: 4646: 4640: 4631: 4630:postcondition 4627: 4621: 4614: 4608: 4601: 4600:postcondition 4596: 4594: 4586: 4579: 4572: 4557: 4554:schedule 4553: 4541: 4537: 4531: 4527: 4525: 4520: 4510: 4506: 4501: 4492: 4488: 4484: 4472: 4465: 4454: 4450: 4446: 4442: 4437: 4433: 4431: 4427: 4410: 4409: 4408: 4395: 4389: 4388: 4387: 4382: 4379:. After Buhr 4369: 4365: 4363: 4359: 4355: 4351: 4347: 4088:currentThread 4043:currentThread 4025:currentThread 3983:currentThread 3434:currentThread 3248:currentThread 3188:currentThread 3167:currentThread 3041:currentThread 3005:currentThread 2966:currentThread 2945:currentThread 2831:currentThread 2782: 2779: 2771: 2761: 2757: 2751: 2748:This section 2746: 2737: 2736: 2728: 2726: 2721: 2719: 2715: 2711: 2707: 2270: 2267: 2265: 2260: 2256: 2252: 2248: 2242: 1805: 1795: 1792: 1784: 1774: 1770: 1764: 1761:This section 1759: 1750: 1749: 1690:cvs_to_signal 1410: 1307: 1302:Monitor usage 1299: 1297: 1293: 1274: 1271: 1268: 1265: 1262: 1258: 1248: 1229: 1226: 1223: 1220: 1216: 1206: 1200: 1195: 1183: 1175: 1171: 1166: 1162: 1156: 1149: 1145: 1141: 1135: 1117: 1110: 1106: 1100: 1094: 1088: 1082: 1077: 1076:missed wakeup 1072: 1069: 1065: 1060: 1055: 1054: 1049: 1044: 1036: 1032: 1027: 1023: 1018: 1017: 1015: 1014: 1012: 1009: 1008: 999: 990: 983: 979: 978: 977: 974: 955: 947: 937: 935: 931: 926: 558: 556: 546: 543: 539: 535: 534:queue.dequeue 531: 530:queue.enqueue 309: 307: 297: 295: 291: 288:by arbitrary 287: 283: 282: 277: 273: 268: 265: 261: 257: 247: 245: 230: 227: 219: 216: 212: 210: 191: 187: 185: 181: 177: 167: 165: 162: 158: 154: 149: 147: 143: 139: 135: 131: 127: 123: 120: 116: 111: 109: 105: 101: 96: 92: 81: 71: 67: 63: 59: 55: 49: 48: 43:This article 41: 32: 31: 19: 6723:Anti-pattern 6686:Linda Rising 6612: 6605: 6550:Lazy loading 6482:Identity map 6449: 6351: 6133:Gang of Four 6029: 6008:. Retrieved 6004:the original 5999: 5990: 5979:. Retrieved 5975: 5966: 5947: 5941: 5932: 5919: 5892: 5888: 5878: 5847: 5823: 5811: 5784: 5778: 5756: 5718: 5713: 5697: 5662: 5656: 5623: 5561: 5454: 5447: 5424: 5412: 5406: 5402: 5397:precondition 5396: 5389: 5382: 5380: 5366: 5362: 5359: 5354:synchronized 5352: 5348:synchronized 5346: 5340: 5322: 5320: 5315: 5312:precondition 5311: 5307: 5303: 5299: 5295: 5292: 5288: 5285:precondition 5284: 5280: 5276: 5272: 5269: 5265: 5261: 5258: 5254: 5251: 5247: 5233: 5224: 5210: 5205: 5202: 5194: 5191: 5185: 5183: 5178: 5167: 5152: 5131: 5126: 5116: 5111: 5107: 5096: 5081: 5070: 5066: 5062: 5058: 5053: 5044: 5040: 5036: 5034: 5006: 5003:"Mesa style" 5002: 4998: 4996: 4986: 4983: 4978: 4974: 4970: 4966: 4962: 4961:0 < size 4958: 4954: 4951: 4947: 4943: 4940: 4936: 4932: 4928: 4927:0 < size 4924: 4920: 4916: 4912: 4909: 4905: 4901: 4897: 4892: 4888: 4886: 4882: 4879: 4874: 4873:0 < size 4870: 4868: 4864: 4861: 4857: 4853: 4849: 4846: 4842: 4839: 4835: 4831: 4828: 4817: 4807: 4802: 4800: 4793: 4789: 4782: 4774: 4764: 4756: 4753:precondition 4752: 4746: 4737: 4733: 4728:precondition 4727: 4720: 4716: 4702: 4695: 4687:precondition 4686: 4682: 4676: 4670: 4666: 4660: 4652:precondition 4651: 4644: 4638: 4629: 4625: 4620:precondition 4619: 4612: 4607:precondition 4606: 4599: 4577: 4570: 4560: 4555: 4551: 4539: 4535: 4529: 4523: 4521: 4508: 4504: 4502: 4495: 4490: 4486: 4482: 4470: 4463: 4452: 4448: 4444: 4440: 4434: 4423: 4402: 4385: 4380: 4361: 4360:monitors or 4357: 4353: 4343: 2774: 2768:January 2014 2765: 2749: 2725:test-and-set 2724: 2722: 2703: 2268: 2263: 2258: 2254: 2250: 2246: 2243: 2239: 2145:queueEmptyCV 2025:queueEmptyCV 1848:queueEmptyCV 1802: 1787: 1781:January 2014 1778: 1762: 1726:// sections. 1408: 1305: 1291: 1246: 1204: 1198: 1179: 1173: 1169: 1164: 1160: 1154: 1147: 1139: 1133: 1115: 1108: 1098: 1092: 1086: 1080: 1075: 1058: 1047: 1030: 1021: 998:mutex (lock) 988: 981: 975: 945: 943: 933: 929: 927: 923: 555:spin-waiting 554: 552: 549:Spin-waiting 541: 537: 533: 529: 527: 306:busy-waiting 305: 303: 289: 285: 279: 275: 269: 255: 253: 243: 242:is true (or 232: 228: 225: 217: 214: 209:busy waiting 202: 188: 183: 180:mutex (lock) 175: 173: 150: 118: 114: 112: 107: 103: 100:mutex (lock) 94: 88: 78:January 2014 75: 52:Please help 44: 6695:Communities 6676:Jim Coplien 6651:Grady Booch 6636:Erich Gamma 6580:Type tunnel 6565:Object pool 6560:Null object 6555:Mock object 6417:Interceptor 6387:Thread pool 6302:Concurrency 6248:Interpreter 5433:concept of 4832:SharedStack 4820:thread-safe 4805:for more.) 4358:Hoare-style 4325:ThreadQueue 4049:threadSleep 3890:ThreadQueue 3812:wokenThread 3776:wokenThread 3632:wokenThread 3596:wokenThread 3440:threadSleep 3275:otherThread 3254:otherThread 3227:otherThread 3146:threadSleep 3068:otherThread 3047:otherThread 3020:otherThread 2804:ThreadQueue 2190:queueFullCV 1980:queueFullCV 1866:queueFullCV 1182:one-to-many 1163:instead of 286:interleaved 264:ring buffer 119:thread-safe 62:Wikiversity 6743:Categories 6590:Delegation 6525:Blackboard 6230:Behavioral 6182:Structural 6144:Creational 6010:2021-06-17 5981:2021-06-17 5976:golang.org 5828:Bloch 2018 5816:Bloch 2018 5443:semaphores 5316:notify all 5234:notify all 5143:such that 5097:notify all 5045:notify all 4981:A } } 4979:and return 4937:and return 4683:and return 4536:and return 4364:monitors. 4262:readyQueue 4163:testAndSet 4013:readyQueue 3929:testAndSet 3800:readyQueue 3710:testAndSet 3620:readyQueue 3530:testAndSet 3350:testAndSet 3233:readyQueue 3026:readyQueue 2993:readyQueue 2897:testAndSet 2807:readyQueue 2280:RingBuffer 1815:RingBuffer 1068:subroutine 1011:Atomically 930:spin-locks 565:RingBuffer 316:RingBuffer 246:be true). 166:language. 70:Wikivoyage 6656:Kent Beck 6382:Semaphore 6372:Scheduler 6215:Flyweight 6205:Decorator 6200:Composite 6172:Singleton 6167:Prototype 6000:dtyler.io 5803:207193134 5667:CiteSeerX 5658:Comm. ACM 5535:Smalltalk 5435:Simula 67 5367:notifyAll 5279:withdraw( 5266:invariant 4950:size = 0 4854:invariant 4593:invariant 4585:contracts 4352:were for 3863:protected 3680:broadcast 3281:registers 3194:registers 3173:registers 3074:registers 2972:registers 2951:registers 2718:scheduled 2714:busy-wait 2664:queueLock 2643:broadcast 2598:queueLock 2553:queueLock 2499:queueLock 2478:broadcast 2433:queueLock 2388:queueLock 2298:queueLock 2264:broadcast 2251:broadcast 2205:queueLock 2139:queueLock 2094:queueLock 2040:queueLock 1974:queueLock 1929:queueLock 1833:queueLock 1174:broadcast 1161:broadcast 1155:notifyAll 1148:broadcast 954:assertion 934:queueLock 886:queueLock 847:queueLock 829:queueLock 790:queueLock 736:queueLock 697:queueLock 679:queueLock 640:queueLock 583:queueLock 66:Wikibooks 45:contains 6716:See also 6518:patterns 6404:patterns 6357:Proactor 6304:patterns 6278:Strategy 6268:Observer 6258:Mediator 6253:Iterator 6135:patterns 5911:14125530 5571:See also 5565:Pthreads 5513:Modula-3 5403:modifies 5306:deposit( 4790:modifies 4734:modifies 4667:modifies 4626:modifies 4498:schedule 4322:volatile 4082:contains 3977:contains 3887:volatile 3866:volatile 2849:volatile 2819:volatile 2801:volatile 2526:consumer 2346:producer 2277:volatile 2067:consumer 1887:producer 1812:volatile 986:, where 766:consumer 601:producer 436:consumer 337:producer 6570:Servant 6502:Model 2 6362:Reactor 6352:Monitor 6317:Balking 6288:Visitor 6263:Memento 6243:Command 6190:Adapter 6157:Builder 6059:, 1995 5735:2000388 5689:1005769 5543:Turing+ 5524:object) 5421:History 5341:In the 5270:private 5259:private 5255:Account 5051:queue. 5017:queue. 4880:private 4862:private 4847:private 4840:private 4777:(empty( 4487:else if 4268:enqueue 4256:dequeue 4229:isEmpty 4142:release 4037:enqueue 3908:acquire 3884:private 3806:enqueue 3794:dequeue 3767:isEmpty 3626:enqueue 3614:dequeue 3587:isEmpty 3485:acquire 3428:enqueue 3410:release 3239:dequeue 3032:dequeue 2999:enqueue 2754:Please 2679:doStuff 2670:release 2631:dequeue 2580:isEmpty 2559:acquire 2505:release 2460:enqueue 2394:acquire 2220:doStuff 2211:release 2172:dequeue 2121:isEmpty 2100:acquire 2046:release 2001:enqueue 1935:acquire 1767:Please 1729:release 1444:acquire 1392:release 1311:acquire 901:doStuff 892:release 877:dequeue 853:acquire 835:release 817:isEmpty 796:acquire 742:release 721:enqueue 703:acquire 685:release 646:acquire 505:doStuff 496:dequeue 472:isEmpty 406:enqueue 146:methods 115:monitor 95:monitor 6624:People 6507:Broker 6210:Facade 6195:Bridge 6036:  5954:  5909:  5866:  5801:  5733:  5687:  5669:  5632:  5545:, and 5539:Turing 5533:Squeak 5518:Python 5491:Delphi 5395:: 5383:signal 5363:notify 5300:assert 5257:{ 5225:notify 5211:where 5168:notify 5127:et al. 5082:notify 5067:return 5041:notify 5037:signal 4987:always 4975:signal 4967:assert 4959:assert 4939:} 4933:signal 4925:assert 4917:assert 4845:A 4834:{ 4803:et al. 4788:) 4759:empty( 4747:signal 4726:: 4685:: 4677:signal 4650:: 4645:signal 4618:: 4571:signal 4556:return 4538:: 4530:signal 4469:: 4464:signal 4449:return 4381:et al. 4313:struct 4238:Thread 4190:assert 4139:method 4136:public 4070:assert 4058:assert 4019:remove 3965:assert 3905:method 3902:public 3677:method 3674:public 3500:signal 3497:method 3494:public 3386:assert 3308:method 3305:public 3290:resume 3221:Thread 3206:resume 3143:method 3140:public 3083:resume 3014:Thread 2984:resume 2912:return 2879:method 2876:public 2852:global 2846:public 2825:Thread 2822:global 2816:public 2798:public 2706:atomic 2685:myTask 2619:myTask 2523:method 2520:public 2466:myTask 2415:isFull 2376:myTask 2343:method 2340:public 2307:global 2292:global 2274:global 2259:signal 2255:signal 2226:myTask 2184:signal 2160:myTask 2064:method 2061:public 2019:signal 2007:myTask 1956:isFull 1917:myTask 1884:method 1881:public 1860:global 1842:global 1827:global 1809:global 1699:signal 1374:signal 1170:signal 1165:signal 1116:notify 1109:signal 907:myTask 865:myTask 763:method 760:public 727:myTask 667:isFull 628:myTask 598:method 595:public 577:global 562:global 511:myTask 484:myTask 433:method 430:public 412:myTask 388:isFull 364:myTask 334:method 331:public 313:global 272:atomic 176:occupy 138:thread 130:module 126:object 60:it to 6599:Books 6516:Other 6452:-tier 6273:State 6220:Proxy 6080:" by 5929:(PDF) 5907:S2CID 5799:S2CID 5731:S2CID 5710:(PDF) 5685:S2CID 5618:(PDF) 5597:Notes 5520:(via 5431:class 5289:while 5192:while 4997:With 4900:push( 4823:stack 4289:false 4208:false 4157:while 4115:false 3923:while 3878:false 3857:Mutex 3854:class 3827:false 3746:while 3704:while 3647:false 3524:while 3455:false 3344:while 3317:Mutex 3191:-> 3170:-> 3101:false 2969:-> 2948:-> 2864:false 2625:queue 2574:queue 2568:while 2535:while 2454:queue 2409:queue 2403:while 2355:while 2283:queue 2166:queue 2115:queue 2109:while 2076:while 1995:queue 1950:queue 1944:while 1896:while 1818:queue 1471:while 1326:while 996:is a 871:queue 811:queue 805:while 775:while 715:queue 661:queue 655:while 610:while 568:queue 490:queue 466:queue 460:while 445:while 400:queue 382:queue 376:while 346:while 319:queue 260:queue 244:could 215:while 211:loop 134:mutex 128:, or 122:class 117:is a 106:. A 68:, or 6575:Twin 6432:MVVM 6347:Lock 6342:Join 6034:ISBN 5952:ISBN 5864:ISBN 5719:SE-1 5630:ISBN 5552:ÎĽC++ 5528:Ruby 5508:Mesa 5497:Java 5390:wait 5365:and 5343:Java 5323:know 5296:wait 5231:and 5206:wait 5186:wait 5179:true 5153:wait 5112:else 5071:wait 5063:else 5028:and 4955:wait 4952:then 4913:wait 4910:then 4721:wait 4707:and 4613:wait 4578:wait 4552:else 4496:The 4491:else 4453:wait 4445:else 4426:fair 4375:and 4348:and 4202:held 4193:held 4103:true 4097:held 4064:held 3995:held 3872:held 3869:bool 3395:held 3311:wait 2855:bool 2592:wait 2541:true 2427:wait 2382:...; 2373:task 2361:true 2295:Lock 2133:wait 2082:true 1968:wait 1923:...; 1914:task 1902:true 1830:Lock 1705:cv_x 1684:cv_x 1543:wait 1347:wait 984:c, m 982:wait 781:true 634:...; 625:task 616:true 580:Lock 540:and 532:and 451:true 370:...; 361:task 352:true 229:skip 155:and 93:, a 58:move 6444:ECS 6439:ADR 6427:MVP 6422:MVC 5897:doi 5856:doi 5852:ACM 5789:doi 5723:doi 5677:doi 5460:Ada 5413:and 5308:int 5281:int 5262:int 5195:not 4971:and 4963:and 4944:int 4929:and 4921:and 4902:int 4893:and 4887:/* 4875:and 4869:/* 4858:and 4850:int 4843:int 4783:and 4765:and 4757:not 4696:and 4661:and 4639:and 4562:If 4301:(); 4259:(); 4232:()) 4187:(); 4127:(); 4052:(); 3962:(); 3839:(); 3797:(); 3770:()) 3743:(); 3659:(); 3617:(); 3590:()) 3563:(); 3488:(); 3467:(); 3443:(); 3413:(); 3383:(); 3242:(); 3182:(); 3113:(); 3035:(); 2960:(); 2930:(); 2758:to 2710:ISA 2673:(); 2634:(); 2583:()) 2562:(); 2508:(); 2418:()) 2397:(); 2247:and 2214:(); 2175:(); 2124:()) 2103:(); 2049:(); 1959:()) 1938:(); 1771:to 1678:for 1483:()) 1380:cv2 1292:not 895:(); 880:(); 856:(); 838:(); 820:()) 799:(); 745:(); 706:(); 688:(); 670:()) 649:(); 499:(); 475:()) 391:()) 262:or 218:not 89:In 6745:: 5998:. 5974:. 5931:. 5905:. 5893:15 5891:. 5887:. 5862:. 5835:^ 5797:. 5785:27 5783:. 5777:. 5765:^ 5755:. 5743:^ 5729:. 5712:. 5683:. 5675:. 5663:17 5661:. 5644:^ 5620:. 5605:^ 5541:, 5503:Go 5466:C# 5452:. 5445:. 5373:. 5371:C# 5357:. 5293:do 5208:c 5203:do 5201:) 5197:( 5181:. 5108:if 5059:if 4948:if 4906:if 4825:. 4781:) 4775:or 4773:) 4763:) 4595:. 4540:if 4483:if 4471:if 4441:if 4432:. 4415:.q 4277:); 4214:if 4175:{} 4172:)) 4145:() 4091:); 4046:); 4028:); 3989:if 3986:); 3941:{} 3938:)) 3911:() 3815:); 3722:{} 3719:)) 3635:); 3566:if 3542:{} 3539:)) 3437:); 3362:{} 3359:)) 3284:); 3200:PC 3149:() 3077:); 3008:); 2978:PC 2906:)) 2891:if 2885:() 2688:); 2652:); 2607:); 2529:() 2487:); 2469:); 2442:); 2349:() 2310:CV 2229:); 2193:); 2148:); 2070:() 2028:); 2010:); 1983:); 1890:() 1863:CV 1845:CV 1738:); 1708:); 1687:in 1633:// 1627:// 1615:// 1597:// 1591:// 1558:); 1555:cv 1453:); 1401:); 1383:); 1362:); 1359:cv 1320:); 1013:: 910:); 769:() 730:); 604:() 514:); 478:{} 439:() 415:); 394:{} 340:() 296:. 226:do 224:) 220:( 124:, 64:, 6450:n 6117:e 6110:t 6103:v 6090:" 6086:" 6076:" 6042:. 6013:. 5984:. 5960:. 5935:. 5913:. 5899:: 5872:. 5858:: 5805:. 5791:: 5737:. 5725:: 5691:. 5679:: 5638:. 5486:D 5472:) 5416:I 5410:P 5400:I 5393:P 5242:P 5237:c 5228:c 5219:c 5217:P 5213:P 5199:P 5174:c 5172:P 5163:c 5161:P 5156:c 5147:c 5145:P 5141:c 5136:c 5134:P 5123:e 5119:w 5104:c 5100:c 5093:c 5089:c 5085:c 5078:c 5074:c 5049:e 5030:b 5026:a 5015:s 5011:e 4812:c 4810:P 4797:I 4786:I 4779:c 4770:c 4768:P 4761:c 4755:( 4750:c 4743:c 4741:P 4731:I 4724:c 4711:c 4709:P 4705:I 4699:I 4692:c 4690:P 4680:c 4674:I 4664:I 4657:c 4655:P 4648:c 4642:I 4635:c 4633:P 4623:I 4616:c 4610:I 4603:I 4589:I 4581:c 4574:c 4566:c 4564:P 4548:c 4544:c 4533:c 4517:e 4513:s 4479:c 4475:c 4467:c 4460:c 4456:c 4419:c 4413:c 4405:c 4397:s 4391:e 4377:b 4373:a 4334:} 4331:; 4319:{ 4310:} 4307:} 4292:; 4286:= 4280:} 4271:( 4265:. 4253:. 4247:= 4241:* 4235:{ 4226:. 4220:! 4217:( 4211:; 4205:= 4196:; 4166:( 4160:( 4148:{ 4133:} 4118:; 4112:= 4106:; 4100:= 4094:} 4085:( 4079:. 4073:! 4067:; 4061:! 4040:( 4034:. 4022:( 4016:. 4001:{ 3998:) 3992:( 3980:( 3974:. 3968:! 3932:( 3926:( 3914:{ 3896:; 3881:; 3875:= 3860:{ 3851:} 3830:; 3824:= 3818:} 3809:( 3803:. 3791:. 3785:. 3782:c 3779:= 3773:{ 3764:. 3758:. 3755:c 3752:! 3749:( 3713:( 3707:( 3695:{ 3692:) 3689:c 3683:( 3671:} 3650:; 3644:= 3638:} 3629:( 3623:. 3611:. 3605:. 3602:c 3599:= 3593:{ 3584:. 3578:. 3575:c 3572:! 3569:( 3533:( 3527:( 3515:{ 3512:) 3509:c 3503:( 3491:} 3482:. 3479:m 3458:; 3452:= 3431:( 3425:. 3419:. 3416:c 3407:. 3404:m 3398:; 3392:. 3389:m 3353:( 3347:( 3335:{ 3332:) 3329:c 3323:, 3320:m 3314:( 3302:} 3293:: 3278:. 3272:( 3257:; 3251:= 3236:. 3230:= 3224:* 3209:; 3203:= 3197:. 3176:= 3152:{ 3119:} 3104:; 3098:= 3086:: 3071:. 3065:( 3050:; 3044:= 3029:. 3023:= 3017:* 3002:( 2996:. 2987:; 2981:= 2975:. 2954:= 2921:} 2915:; 2909:{ 2900:( 2894:( 2888:{ 2867:; 2861:= 2834:; 2828:* 2810:; 2781:) 2775:( 2770:) 2766:( 2752:. 2694:} 2691:} 2682:( 2667:. 2646:( 2628:. 2622:= 2613:} 2601:, 2595:( 2586:{ 2577:. 2571:( 2556:. 2547:{ 2544:) 2538:( 2532:{ 2514:} 2511:} 2502:. 2481:( 2463:( 2457:. 2448:} 2436:, 2430:( 2421:{ 2412:. 2406:( 2391:. 2379:= 2367:{ 2364:) 2358:( 2352:{ 2316:; 2301:; 2286:; 2235:} 2232:} 2223:( 2208:. 2187:( 2169:. 2163:= 2154:} 2142:, 2136:( 2127:{ 2118:. 2112:( 2097:. 2088:{ 2085:) 2079:( 2073:{ 2055:} 2052:} 2043:. 2022:( 2004:( 1998:. 1989:} 1977:, 1971:( 1962:{ 1953:. 1947:( 1932:. 1920:= 1908:{ 1905:) 1899:( 1893:{ 1869:; 1851:; 1836:; 1821:; 1794:) 1788:( 1783:) 1779:( 1765:. 1735:m 1732:( 1714:} 1702:( 1696:{ 1693:) 1681:( 1645:} 1552:, 1549:m 1546:( 1525:{ 1480:p 1477:! 1474:( 1450:m 1447:( 1398:m 1395:( 1377:( 1368:} 1356:, 1353:m 1350:( 1341:{ 1338:) 1335:p 1332:! 1329:( 1317:m 1314:( 1275:y 1272:t 1269:p 1266:m 1263:e 1259:c 1247:m 1230:l 1227:l 1224:u 1221:f 1217:c 1205:m 1199:m 1188:c 1186:P 1176:. 1157:c 1150:c 1140:c 1134:m 1129:c 1124:c 1122:P 1118:c 1111:c 1099:c 1093:c 1087:c 1081:c 1059:c 1051:. 1048:m 1031:c 1025:, 1022:m 1004:c 1002:P 994:m 989:c 970:c 968:P 964:c 959:c 957:P 950:c 919:} 916:} 904:( 889:. 874:. 868:= 862:} 850:. 832:. 823:{ 814:. 808:( 793:. 787:{ 784:) 778:( 772:{ 754:} 751:} 739:. 724:( 718:. 712:} 700:. 682:. 673:{ 664:. 658:( 643:. 631:= 622:{ 619:) 613:( 607:{ 586:; 571:; 523:} 520:} 508:( 493:. 487:= 469:. 463:( 457:{ 454:) 448:( 442:{ 424:} 421:} 409:( 403:. 385:. 379:( 367:= 358:{ 355:) 349:( 343:{ 322:; 240:P 236:P 222:P 205:P 80:) 76:( 72:. 50:. 20:)

Index

Condition variable
instructions, advice, or how-to content
rewrite the content
move
Wikiversity
Wikibooks
Wikivoyage
concurrent programming
mutex (lock)
class
object
module
mutex
thread
mutual exclusion
methods
Per Brinch Hansen
C. A. R. Hoare
Brinch Hansen's
Concurrent Pascal
mutex (lock)
busy waiting
queue
ring buffer
atomic
critical section
race conditions
assertion
mutex (lock)
Atomically

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.

↑