A fixed-size FIFO laid out in a circle. The write position wraps around.
index = (index + 1) % capacity — wraps to 0Slots stay put; positions travel. Tail wraps past the end; oldest gets overwritten when full.
Both O(1). deque(maxlen) ≈10× faster (C vs a Python modulo per push).
dmesg kernel log, "last N events"deque(maxlen=N) — this is what it does underneathFixed array + two wrapping indices = an endless queue in O(capacity) memory. Worst-case O(1), no GC pauses. Next tier: hashing.