A queue is a data structure of the First-In, First-Out (FIFO) type (the first input is the first to exit). A practical example is the queues to get a service, how to pay at the supermarket, or get your hair cut at the hairdresser. Ideally, you are served in the same order as you were presented to. This is exactly how a FIFO queue works.
Using a queue to exchange data
Getting ready
In this section, we show you how to use a queue for a producer-consumer problem, that is a classic example of process synchronization.
The producer-consumer problem describes two processes: one is the producer and the other is a consumer, sharing a common buffer of a fixed size.
The task of the producer is to generate data and...