The total number of B's and C's which have been output at any given point in the output string cannot exceed the number of A's which have been output up to that point. Semaphores Synchronize Processes. This is an SR program simulating the bounded buffer producer and consumer classical OS problem. There is one producer and one consumer process that share a buffer of some finite number of slots. Bounded Buffer Producer and Consumer.
Bounded buffers are useful for many things.
For example, if you have a bunch of computations that can each be broken into several parts, each part taking about the same amount of time, then the series of computations can be performed in an assembly line, conveyor belt, or pipeline fashion. Each part will be handled by its own process. If a CPU can be dedicated to each process, then the series of computations can be performed faster. The same basic idea is used in the vector or pipeline units in the Cray architecture. Each part can be done to the pairs of vector components in an assembly line fashion as the pairs stream into the vector unit.