FIFO: rptr, wptr, empty, full if (write) { write it; wptr++: empty = 0; if (rptr == wptr) full = 1; } if (read) { read it; rptr++; full = 0; if (rptr == wptr) empty = 1; }