QUEUE Program 1

QUEUE

A queue maintains a first in/first out (FIFO) order of data items. For instance, the customers waiting in line at a fast food restaurant are in a queue. The first customer to arrive is going to be the first one served.

A queue is useful in producer/consumer situations, where one portion of code is creating data to be used by another portion. These can e.g. be two loops running in parallel. The advantage of using a queue is that the producer and consumer rates do not have to be identical. If consumption is slower than production, the queue will eventually become full and the producer code will be forced to wait until the consumer has dequeued an element before a new element can be queued up.




Published By:- Abhay Pratap
8178894736



0 Comments