In addition to the memory used for storing data elements, a concurrent implementation of a dynamic data structure exhibits a metadata overhead related to resolving synchronization issues caused by concurrent data accesses. An implementation can be more or less memory-friendly, depending on how much memory it requires for the metadata. A memory-optimal implementation enjoys the minimal possible memory overhead, which, in practice, reduces cache misses and unnecessary memory reclamation. In this paper, we discuss the memory-optimality question in the context of non-blocking bounded queues. We observe first that, in special cases when the ABA problem is precluded, e.g., by assuming that the hardware supports LL/SC instructions or that the queue is only used for storing distinct elements, there exist lock-free queues with constant memory overhead (in the number of concurrent processes ). For the general and more realistic case, we present a CAS-based lock-free bounded queue implementation with memory overhead. We show that this overhead is asymptotically optimal: it is impossible to construct a non-blocking concurrent bounded queue with the constant memory overhead, e.g., a bounded queue that maintains a fixed-size array for the data and uses counters for enqueue/dequeue operations. This work opens a new research avenue devoted to the memory-optimality phenomenon in concurrent data structures.
View on arXiv