Preparing your design workspace

Loading the problem and your saved attempt…

Design a Bounded Flash Logging Buffer

Collect concurrent module logs, batch them into a fixed flash partition, recover after interruption, and expose deterministic overwrite behavior.

Design an in-process logging buffer for an embedded device. Multiple software modules submit timestamped log records that must be flushed to a dedicated 96 KiB flash partition.

For this exercise, assume records have a module, severity, monotonic sequence, timestamp, and UTF-8 payload; one writer component serializes appends to flash. The partition is a circular sequence of independently checksummed segments.

A complete segment becomes readable only after a commit marker, an interrupted write is ignored during recovery, and new committed segments overwrite the oldest committed segments when capacity is exhausted. Producers use a bounded memory queue with an explicit drop-newest or block policy selected at construction.

Support append, flush, snapshot read, and restart recovery. Remote aggregation, log search, compression, encryption, flash wear-leveling firmware, and dynamic partition resizing are outside scope.