Aguilera, Gafni and Lamport introduced and solved the mailbox problem in , which can be used to speed-up interactions between a processor and a device. They provide a mailbox algorithm with “flag registers” of size 14 and space complexity Θ(nlogn), and they conjecture that a solution with logarithmic space complexity exists. We prove this conjecture by presenting such a mailbox algorithm. We prove that the space complexity of our mailbox algorithm is optimal. The size of its flag registers is reduced to 4, which matches a lower bound established by Aguilera et al. In the same paper, Aguilera et al. also pointed out that the mailbox problem can be solved by means of a more general problem: the signaling problem. They presented a non-blocking solution to the signaling problem, and asked whether a wait-free solution exists. We solve this question with a bounded wait-free signaling algorithm, and we prove its correctness. A related problem is the N-buffer problem introduced by Lamport. Aguilera et al. employ their mailbox algorithm and provide a first solution to the N-buffer problem with flag registers of constant size. The drawback of their solution is its space complexity which is unbounded. We show how our signaling algorithm can be used to solve the N-buffer problem with constant-size flags and optimal space complexity.
- Distributed algorithms
- Shared memory