Queue
What a queue is
Describe a queue and give real-life and computer uses.
A queue is an ordered linear list of elements that has different ends for adding and removing them. Elements join at one end, the REAR (or tail), and leave from the other, the FRONT (or head).
So the element that has been in the queue longest leaves first: First-In-First-Out (FIFO), also called First Come First Served. It is just like a line of people.
Real-life queues:
- people at a bank counter, a fuel pump or a toll booth;
- waiting-list train tickets: if one confirmed ticket is cancelled, W/L1, at the front, is confirmed first;
- callers to a customer-care number (IVRS), answered in the order they called.
Queues in computers:
- A web server handles requests from many users in the order they arrive.
- Jobs waiting for the processor are kept in a queue.
- Print jobs sent to a shared printer wait in a queue and are printed one by one, in order.
First come, first served.
Practise this lesson
Questions that get harder as you improve, a Tutor that helps without giving the answer away, and progress you can see. Free for every learner.
No account, no email address. Opens the real product.