Definition
A checkpoint is a saved record of the state of a long-running task at a chosen point, complete enough that the task can resume from that point instead of from the beginning. For a running program, the state is the program’s data. For a research or engineering task, it is what is finished, the evidence for each finished item, what is still open and what comes next. Each piece of evidence is either copied into the checkpoint or referred to by an identifier that names exactly one version of it.
The idea
A measurement campaign that takes two weeks is handed from one engineer to another halfway through, or its computer restarts. Without a checkpoint, the successor either repeats everything, which wastes a week, or continues on guesses, for example that the last run was reviewed when it was not. A note saying “2 of 4 steps done” is true but does not help: it does not say which steps, on what evidence, or whether that evidence is still where the note says it is.
A hospital shift handover is a fair picture. The outgoing nurse hands over a written summary of each patient, a copy that travels with the handover, and points to laboratory results kept in the laboratory’s system under a sample number, a reference. The incoming nurse acts on the summary and looks up any result by its number. The picture stops being accurate in one respect. A sample number keeps naming the same sample, but a file path, the most common reference in computing, names a location: the file there can be replaced, and the path then names the new file without warning.
How it works
Taking a checkpoint has five steps.
Choose a consistent point. Take the checkpoint where every item is in a known state: finished and recorded, not started, or in progress and declared as such. A program’s checkpoint is taken where no update is half applied.
Record the status of every item. Give each item one status: accepted, with the exact scope of the acceptance, such as “reviewed for correctness, not yet run on hardware”; done but not reviewed; in progress; or not started. Record the owner of each open item, the conditions still open, and the next dependency, meaning what must happen before the next step can start. Keep plans apart from completed actions.
Copy or reference each piece of evidence. Copy evidence that is small, that the next decision depends on, or that is not reliably kept anywhere else: decisions and their reasons, short result tables, the exact commands used. Reference evidence that is large and already kept in a store that retains versions: raw data §13.16, logs, build outputs, the version of the source code.
Pin every reference to one version. A reference records three things. First, an identifier that names exactly one content: a cryptographic digest of the bytes, which is a short fixed-length value computed from the content by a cryptographic hash function §5.1 such as SHA-256 §5.2 (Secure Hash Algorithm with a 256-bit output); or a Git commit §13.19 identifier, which is itself a digest computed over the committed files, the identifier of the previous commit, and the commit’s author, time and message. Second, where the object is kept and for how long. Third, its role: which claim it is evidence for.
Save the checkpoint atomically and give it an identifier. Write it to a new file, make sure the file’s contents have reached the storage device, then rename the file over the old name, so that a crash leaves either the old checkpoint or the new one, never a mixture. Record the checkpoint’s own digest.
To resume, fetch each referenced object that the next action needs, recompute its digest and compare it with the recorded one. A match shows that the object is the one the checkpoint named. Accepted items whose evidence still matches are kept, not redone.
Worked example
A task has four items: source review, implementation, a run on the target hardware, and a final review. The first two are accepted; the last two have not started. “2 of 4 items complete” is correct, since , but a successor cannot act on it. A usable checkpoint also says: implementation accepted for correctness in review record R-12, not yet run on hardware; next dependency, the hardware run, which needs the test device; open condition, the final review needs the log of the hardware run.
Its evidence splits into copies and references.
Copied: the 300-byte decision record of review R-12, and the one-line command that built the implementation.
Referenced: the 1 GiB archive of build outputs and test logs, by its SHA-256 digest, a value of 32 bytes written as 64 hexadecimal characters, together with the archive’s storage location and its retention period of 5 years.
Since 1 GiB is bytes and the digest is bytes, the digest is times smaller than the archive it names.
Had the checkpoint recorded only the path results/latest.tar, a later run could write a new archive to that path. The path would still work, but it would lead to different bytes, and the checkpoint would silently describe the wrong evidence. With the digest recorded, the successor recomputes the digest of the file at that path, finds that it differs, and knows that the reference no longer leads to the original archive.
Stated precisely
A checkpoint is adequate for resuming a task when four conditions hold.
Every item of the task has exactly one recorded status, and every claim that an item is finished names its evidence and the scope of its acceptance.
Every piece of evidence is either copied into the checkpoint or referenced, and the checkpoint says which.
Every reference is pinned. For a digest, the reference records , where is the intended content and is a cryptographic hash function; the successor accepts a fetched object only if .
Every referenced object is retained, unchanged and reachable, for as long as the checkpoint will be used.
Condition 3 rests on collision resistance §5.5: the assumption that no one can find two different contents with the same digest. Condition 4 is an assumption about storage, not about the checkpoint; the checkpoint can only state it and name who keeps each object. If the checkpoint itself crosses a trust boundary §1.3, a point where data passes from a less trusted party to a more trusted one, the checkpoint needs protection too, for example its digest recorded where the sender cannot change it, or a digital signature §5.14.
Limits and common mistakes
A path is a location, not an identity. A path names whatever is stored there now. Only a content digest or a version identifier that can never be reassigned names one exact content.
A digest shows sameness, not correctness. A matching digest proves that the object is the one the checkpoint named. It says nothing about whether that object is right, or where it came from.
A checkpoint is not a new validation. It summarizes evidence and reviews that already exist. Reading it re-checks nothing, and it is only as good as the evidence and reviews it cites.
Copying more is not summarizing better. A checkpoint that copies every file but does not state each item’s status and scope is still ambiguous.
A checkpoint describes the state at its own point. If the source code, the device or the environment has changed since then, the successor must check the items that the next action depends on. It need not redo accepted items whose evidence still matches.
For a program, saving memory does not save the outside world. Open network connections, the state of an attached device and messages in flight are not in the saved data, and resuming must restore or re-establish them.
Questions answered
Which evidence is copied and which is only referenced by identity?
A checkpoint copies the evidence that is small, that the next decision depends on, or that is not reliably kept anywhere else, and it references by identity the evidence that is large and already kept in a store that retains versions. A checkpoint is a saved record of a task’s state from which the task can resume. Typically copied: the status of each item, decisions and their reasons, the exact scope of each acceptance, open conditions and the exact commands used. Typically referenced: raw data, logs, build outputs and the version of the source code.
A reference by identity uses an identifier that names exactly one content, such as a SHA-256 (Secure Hash Algorithm with a 256-bit output) digest of the bytes or a Git commit identifier, never a bare file path, which can later lead to a different file. For each reference, the checkpoint also states where the object is kept, how long it will be kept and which claim it supports. The checkpoint must say, for every piece of evidence, which of the two treatments it received. A successor verifies each reference it needs by recomputing the digest of the fetched object and comparing it with the recorded one.
Related entries: Artifact provenance (§13.1), Immutable evidence (§13.12), Incremental validation (§10.42), Independent review (§10.44), Content-addressed identity (§13.2), Cryptographic digest versus path identity (§13.3).