Queues

A queue is a dynamic data structure (and an abstract data type) that allows a new data item to be added to the rear (enqueue) and an existing element to be removed from the front (dequeue). A queue is a First In First Out structure (FIFO).

There are two types of queue. The linear queue and the circular queue.

Uses of queues

  • Used by the operating system scheduler to hold jobs waiting to be run
  • Used as buffers (E.G. to store keystrokes from the keyboard)
  • Used to spool printed output (E.G. a print queue)