Chapter 18. First-In-First-Out (FIFO) Queue


The First-In-First-Out (FIFO) queue is a data structure that has many applications in systems development. In this chapter, I'll show you a version of a FIFO queue that supports simultaneous access by multiple threads. In particular, I'll present two versions that are usable in the real world, as they are, and extendable:

  • ObjectFIFO, which holds references to objects

  • ByteFIFO, which holds byte values directly

How a FIFO Queue Works

As elements are added to a FIFO queue, they are stored in order. When elements ...

Get Java Thread Programming now with the O’Reilly learning platform.

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