Introduction - If you have any usage issues, please Google them yourself
By studying the Linux thread and semaphore mechanisms to achieve the producer consumer (Bounded Buffer) the issue of concurrency control. N the composition of a buffer zone through the buffer pool together, " production and consumption," the task, each buffer storing a product, producers will produce products Add empty buffer consumers out of the buffer zone from the full product. Once all the buffers are full, the producer must wait until buffer space consumers. In addition, producers and consumers of all threads, the buffer pool is a critical resource, that is, any thread of a buffer zone in the " deposit" and " check" operation to be mutually exclusive and the implementation of other threads.