Principles of Wait-Free Queues

The wait-free queues are slightly unusual versions of ordinary producer/consumer queues.

One end of the queue acts like a typical message queue:

  • It is synchronized so multiple threads can safely use it.

  • If it is a blocking read, an empty queue will block a read until a write provides data for it to read.

  • If it is a blocking write, a full queue will block a write until a read leaves an empty queue entry for the write to use or until the write thread is interrupted.

The nonblocking end of the queue always returns immediately.

A wait-free write queue either enqueues its object and returns true or it finds a full queue and returns false. A wait-free read queue either returns the object from the head of the queue or it ...

Get Real-Time Java™ Platform Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.