Chapter 8. Queues

A queue is another fundamental data structure; it is heavily used in many contexts. Queuing up tasks is a very common requirement. For example, if we look at the producer/consumer pattern, we see that both the producers and consumers communicate using a queue.

You will find many examples of queues being used in practice. Here's one of them: In an actor framework, an actor sends a message to another actor. These messages are enqueued in the recipient actor's mailbox, which is a queue.

Message brokers use queues to order and distribute messages to consumers. Priority queues are used by operating system schedulers so high priority tasks are handled before tasks that are low on priority.

In this chapter:

  • We will look at functional, persistent ...

Get Learning Functional Data Structures and Algorithms now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.