The Linux kfifo, and the descriptor rings a network card shares with its driver, are two indices chasing each other around one fixed array: the producer moves the write index, the consumer moves the read index, and the gap between them is how much data is queued. Since each side only writes its own index and only moves it forward, a single producer and a single consumer need no lock. Empty and full both look like the indices touching, so implementations either leave one slot unused or let the indices run free and compare their difference.