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