Explain how a ring buffer wraps and how to avoid overwriting unread data.