A lockless circular buffer Most, but not all, single-interrupt systems collect or emit data with a predefined rate You usually need a circular buffer for your data items The trivial implementation uses head+tail pointers or offsets But when head == tail, is the buffer full or empty? And how can you detect overflows and underflows? Usually, people uses a mutex primitive to access head and tail But we can do better. A lockless circular buffer is possible Please think about the problem and offer a solution