Part 4 of 5 · 2 min read
Exercises
Easy
Easy 1: Run it (30 minutes)
Run pytest -q and python run_all.py in code/mini-durable.
Done when: you report bytes and replayed events for the three stores at 200 steps.
Easy 2: Derive the snapshot cost (30 minutes)
Show that total snapshot bytes are about 300 times n(n+1)/2.
Done when: your formula is within 5 percent of the table for n = 50, 200 and 800.
Hint
the snapshot at step i has about 300 times i bytes.
Easy 3: Pick an interval (30 minutes)
Replay costs 40 ms per event and you can tolerate 400 ms on resume.
Done when: you choose k and check the replayed-events figure with storage_cost.
Hint
expected replay is about k/2 events after a crash.
Medium
Medium 1: Fork (2 hours)
Add fork(log, at) returning a new log branch.
Done when: a test shows the original is unchanged and the branch continues independently.
Hint
copy the list; do not share it.
Medium 2: A second migration (2 hours)
Add a v4 that changes budget to a dict with currency.
Done when: v1, v2 and v3 states all load, and the tests cover each path.
Hint
each migration handles one version step.
Medium 3: Expiry (3 hours)
Add a time limit to the stale-resume model and a cancel rule.
Done when: you plot false-premise acts against the limit and say which limit you'd choose.
Hint
compare the hazard with the cost of an expired run.
Hard
Hard 1: Real checkpointer (6 hours)
Run the experiment in section 7 with a real checkpointer. (I did not run this, so your numbers are the ground truth.)
Done when: you report file size, resume time and the library version, and compare them with the simulation.
Hint
kill with a signal, not a clean exit.
Hard 2: Crash between effect and checkpoint (5 hours)
Combine this with module 6: crash at every point of a five-step run and check that no effect is repeated or lost. (I did not run this.)
Done when: a table lists each crash point and the outcome.
Hint
crash before the effect, after it, and after the checkpoint.
Hard 3: Concurrent resume (6 hours)
Two workers resume the same run. (I did not run this.)
Done when: you show how a lock or version check prevents double execution, and what it costs.
Hint
a compare-and-set on a version number (module 3).