What does Drift Control for Multi-Window Writing conclude, in numbers, about “Concurrency Control: Exclusive-Create Locks, Leases, Version Numbers and Wave Scheduling”?

Answer: Testing and creating must be a single atomic action; otherwise, with four windows starting together, double ownership occurs in 0.8571 of all interleavings. Conflicts over chapters rise steeply with the number of windows: four windows picking among nine chapters already collide with probability 0.5391. Locks drive duplicate drafts to zero, the writer table makes responsibility traceable, and the two are used together. Leases reclaim the locks of silent holders, and their length is set by the heartbeat loss rate and the clock skew; reclamation may only rename and then create, and acquisition numbers stop late writes. Shared files compare version numbers and are sharded when retries pile up; locks everyone needs go through tickets; multiple locks follow one global order. Dependencies between chapters yield a wave zero, cutting the critical path from 22 to 17. Reviews sort by logical clocks and never assign blame by wall clocks. The next chapter turns to the term lock table these mechanisms protect.

Scope of the numbers: Every error rate without a source is an assumed parameter or a measurement on synthetic data; the book is not legal advice and recommends no writing tool or model. Marked boxes separate published evidence, runnable calculations, sources and the author's hypotheses, each stating what would refute it.

中文版

Data table

The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. printed values that match the answer: 17, 22

Kahn waves: 1 | 2,3,4,5,6,7 | 8 | 0
total work 50 ticks; critical path: chapters 22 ticks, with wave 0 17 ticks
none-waveviolationswaveslistwave0+list
2263333333
3194272727
4158262622
61210222220
Show the full program
# Chapter 2. p25: Wave scheduling for a nine-chapter book: one big wave, strict waves, a term-table wave 0.
# Durations are invented ticks for a fictitious book. Prerequisites: chapters 2-7 need chapter 1 (it fixes
# the locked terms), chapter 8 needs 1-7, the preface 0 needs 8. Policies on n windows:
#   one-wave  : start anything in chapter order, ignore prerequisites (count starts before a prereq ends)
#   waves     : Kahn levels; a wave starts only when the previous wave is complete
#   list      : prerequisite-respecting list scheduling, longest remaining path first
#   wave0+list: split a 1-tick term-lock table T out of chapter 1; chapters 1-7 then need only T
DUR = {"0": 3, "1": 6, "2": 6, "3": 5, "4": 6, "5": 7, "6": 5, "7": 6, "8": 6}
DEP = {"0": ["8"], "1": [], "8": [str(i) for i in range(1, 8)]}
DEP.update({str(i): ["1"] for i in range(2, 8)})


def levels(dep):
    lvl, left = {}, dict(dep)
    k = 0
    while left:
        ready = sorted(t for t, ds in left.items() if all(d in lvl for d in ds))
        for t in ready:
            lvl[t] = k
            del left[t]
        k += 1
    return lvl


def tail(dur, dep):
    succ = {t: [s for s, ds in dep.items() if t in ds] for t in dep}
    memo = {}

    def f(t):
        if t not in memo:
            memo[t] = dur[t] + max((f(s) for s in succ[t]), default=0)
        return memo[t]
    return {t: f(t) for t in dep}


def list_schedule(dur, dep, n, respect=True):
    prio = tail(dur, dep)
    order = sorted(dep, key=lambda t: (-prio[t], t)) if respect else sorted(dep, key=lambda t: t)
    free = [0] * n
    end, start = {}, {}
    for _ in range(len(dep)):
        cands = [t for t in order if t not in end
                 and (not respect or all(d in end for d in dep[t]))]
        w = min(range(n), key=lambda i: free[i])
        best = None
        for t in cands:
            ready = max([free[w]] + ([end[d] for d in dep[t]] if respect else []))
            if best is None or ready < best[0]:
                best = (ready, t)
        s, t = best
        start[t], end[t] = s, s + dur[t]
        free[w] = end[t]
    viol = sum(1 for t in dep for d in dep[t] if start[t] < end[d])
    return max(end.values()), viol


def waves(dur, dep, n):
    lvl = levels(dep)
    clock = 0
    for k in sorted(set(lvl.values())):
        sub = {t: [] for t in dep if lvl[t] == k}
        span, _ = list_schedule(dur, sub, n)
        clock += span
    return clock


if __name__ == "__main__":
    lvl = levels(DEP)
    print("Kahn waves:", " | ".join(",".join(sorted(t for t in lvl if lvl[t] == k))
                                    for k in sorted(set(lvl.values()))))
    dur2 = dict(DUR, T=1)
    dep2 = {t: list(ds) for t, ds in DEP.items()}
    dep2["T"] = []
    dep2["1"] = ["T"]
    for i in range(2, 8):
        dep2[str(i)] = ["T"]
    print("total work {} ticks; critical path: chapters {} ticks, with wave 0 {} ticks".format(
        sum(DUR.values()), max(tail(DUR, DEP).values()), max(tail(dur2, dep2).values())))
    print("  n  one-wave  violations  waves  list  wave0+list")
    for n in (2, 3, 4, 6):
        ow, v = list_schedule(DUR, DEP, n, respect=False)
        print("  {}  {:>8}  {:>10}  {:>5}  {:>4}  {:>10}".format(
            n, ow, v, waves(DUR, DEP, n), list_schedule(DUR, DEP, n)[0], list_schedule(dur2, dep2, n)[0]))

Single source and citation

Fan, Y. (2026). Drift Control for Parallel Multi-Window Book Writing, Cross-Volume Terminology Graph Audits and Zero-Hallucination Citation Verifiers (Version 0.1.0), Chapter 2: Concurrency Control: Exclusive-Create Locks, Leases, Version Numbers and Wave Scheduling. 5D Library. DOI pending

DOI pending · monograph page goes live after publication · 5DL-B-152 · v0.1.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026152,
  author    = {Fan, Yafu},
  title     = {Drift Control for Parallel Multi-Window Book Writing, Cross-Volume Terminology Graph Audits and Zero-Hallucination Citation Verifiers},
  year      = {2026},
  publisher = {5D Library},
  edition   = {0.1.0},
  note      = {DOI pending}
}

Other chapter answers in this book