Producer-Consumer System/Goal
Jump to navigation
Jump to search
A buffer holds the data created by producing threads until they are retrieved by consuming threads. More importantly, the buffer acts as a synchronizer, blocking and suspending threads when there is nothing for them to do. When the buffer is empty, any consuming thread needs to be blocked until there is data in the buffer. Conversely, if the buffer has finite capacity, producing threads must be suspended when the buffer is full.