Presentation on Queues

Download Report

Transcript Presentation on Queues

5. Abstract Data
Structures & Algorithms
5.1 Data Structure Fundamentals
1
5.1.3 Queues:
Definition
Definitions
• Data are inserted at one end and retrieved
from the other.
• Think of a queue of humans – people arrive at
the back and have to work their way to the
front.
3
Definitions
• FIFO structure (First In First Out).
• Items are dealt with in the order they arrive.
• This presentation is a queue of slides.
4
Uses
• Maintaining a list of data to be transferred
between the processor and printer (a print
queue or print buffer) or other peripheral
device.
• A keyboard queue is similar (characters are
buffered in a small amount of memory and
then sent to the processor in the order that
their keys were pressed).
5
More on printer queues
• Printers on a LAN buffer jobs in a queue and
deal with them in order.
• This is more obvious with a slower printer or if
you watch the print queue on a print server.
• The print server will also hold a print queue.
6
Uses
• Queues are more common in real life, so
queue simulations are more common than
stacks:
‣
‣
‣
supermarket checkouts
traffic lights
air traffic control
7