5.2 Definitions
The following sections review basic definitions and concepts that are important to understanding the features of the Interthread Communication package.
5.2.1 Futures, IOUs, and Escrows
Future—A thread synchronization mechanism. A future can be thought of as placeholder or proxy for the eventual result produced by an asynchronous operation. A future is produced when an asynchronous operation is launched.
Once created, the future is immediately made available to any parties interested in the results of that operation. Any thread that attempts to evaluate or redeem the future before the associated operation has produced a result is delayed until a result is available. The result is returned immediately when the future is redeemed after a result has been produced.
IOU—In the Interthread Communication package, a future is called an IOU. An IOU consists of one or more IOU handles that reference another entity called an
escrow object.
Escrow object—Accepts the result of an operation and implements the synchronization policy that delays any threads attempting to redeem an IOU before a result is available.
5.2.2 Producers, Consumers, and Blocking
Producer-consumer synchronization—A common form of condition synchronization that mediates the transfer of information between threads.
Under this form of synchronization, a consumer thread attempts to get information from a producer thread or threads. If that information is not immediately available, it begins waiting for a producer thread to signal that information is available.
Similarly, a producer thread attempts to send information to a consumer thread or threads. If no consumer thread is waiting for the information or if the information cannot be buffered, then the producer thread begins waiting for a consumer thread to signal that it has received or is ready to receive information.
Blocking—A condition where a thread is unable to proceed because it lacks a necessary resource. A thread attempting to
read from an
empty buffer
blocks until an entry is available. A thread attempting to
write to a buffer that is
full blocks until an entry is removed or read by another thread