Skip to main content

Practice · 1 of 2

Write like the OS is watching

CHALLENGE
Difficulty: advanced+25 XP

Implement AtomicStore — a file store whose write(path, data) follows the real atomic-replace pattern, recorded in log: - append ('write', path + '.tmp'), then ('flush', path + '.tmp'), then ('replace', path + '.tmp', path) - after the log entries, the data is readable at path, and no .tmp file remains - read(path) raises FileNotFoundError for unknown paths - expose log as a property The log IS the test: a torn write is impossible when the sequence is write-tmp, flush, replace.

Back to lesson: Practice: Systems Drills