Types of Queues

Learn about the different types of queues and their practical applications.

We'll cover the following

Overview

Let’s have a look at an application of the list structure to create a queue. A queue is a special kind of buffer, summarized as First In First Out (FIFO). The idea is to act as a temporary stash so one part of an application can write to the queue while another part consumes items from the queue.

A database might have a queue of data to be written to disk. When our application performs an update, the local cache version of the data is updated so all other applications can see the change. However, the write to the disk may be placed in a queue for a writer to deal with a few milliseconds later.

When we’re looking at files and directories, a queue can be a handy place to stash details of the directories so they can be processed later. We’ll often represent a directory as the path from the root of the filesystem to the file of interest. The algorithm works like this:

Get hands-on with 1200+ tech skills courses.