What does Atomic Locks for Many Windows conclude, in numbers, about “Judging Orphan Locks: How Long a Silence Means Death”?

Answer: Chapter 5 treats the judgement of orphans: an hour of silence on a laptop says little about death, and once automatic stealing is allowed even release gives double claims, 12 of 80 schedules, a share of 0.150.

Scope of the numbers: Marked boxes separate published evidence, runnable Python calculations (19 programs), classical sources and the author's hypotheses.

中文版

Data table

The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 0.150, 12, 80

release by AB isschedulesdoubleshare
read, delete if minecleaner80120.150
read, delete if mineplain claimant1400.000
rename, check, restore cleaner106440.415
rename, check, restore plain claimant2400.000
Show the full program
# Chapter 5. p53: once a cleaner may steal, even releasing becomes a race.
# Window A owns the lock but has been silent; cleaner B deletes A's lock
# and claims; window C claims normally. A then wakes and releases.
# Release "read, then delete if mine" can delete B's fresh lock; the
# "rename to a private tombstone, check, put back" release looks more
# careful yet widens the race. Without a cleaner both are safe.
# Each schedule is counted once; double = B and C both end up holding.
from functools import lru_cache

A_READ = ("a_read", "a_del_if_mine")
A_TOMB = ("a_rename", "a_restore_if_not_mine")
B_CLEAN = ("b_delete", "b_create", "hold")
B_PLAIN = ("b_create", "hold")
C_PLAIN = ("c_create", "hold")


def step(op, lock, tomb, seen):
    """Return lock, tomb, seen, ok."""
    if op == "a_read":
        return lock, tomb, lock, True
    if op == "a_del_if_mine":
        return (None if seen == "A" else lock), tomb, seen, True
    if op == "a_rename":
        return None, lock, seen, True
    if op == "a_restore_if_not_mine":
        if tomb not in (None, "A") and lock is None:
            return tomb, None, seen, True
        return lock, None, seen, True
    if op == "b_delete":
        return None, tomb, seen, True
    if op in ("b_create", "c_create"):
        who = op[0].upper()
        if lock is None:
            return who, tomb, seen, True
        return lock, tomb, seen, False
    return lock, tomb, seen, True


def count(progs):
    @lru_cache(maxsize=None)
    def walk(lock, tomb, seen, pcs):
        live = [i for i in range(3)
                if pcs[i] is not None and pcs[i] < len(progs[i])]
        if not live:
            held = [i for i in (1, 2) if pcs[i] == len(progs[i])]
            return 1, (1 if len(held) == 2 else 0)
        tot = bad = 0
        for i in live:
            nl, nt, ns, ok = step(progs[i][pcs[i]], lock, tomb, seen)
            npcs = list(pcs)
            npcs[i] = pcs[i] + 1 if ok else None
            t, b = walk(nl, nt, ns, tuple(npcs))
            tot += t
            bad += b
        return tot, bad
    return walk("A", None, None, (0, 0, 0))


print("release by A          B is         schedules  double  share")
for an, a in (("read, delete if mine", A_READ),
              ("rename, check, restore", A_TOMB)):
    for bn, b in (("cleaner", B_CLEAN), ("plain claimant", B_PLAIN)):
        tot, bad = count((a, b, C_PLAIN))
        print("%-22s %-14s %7d %7d  %5.3f" % (an, bn, tot, bad,
                                              bad / tot))

Single source and citation

Fan, Y. (2026). Atomic File-Lock Protocols for Multiple Windows: Self-Recovering Orphan Locks after Power Loss and Cross-Window Hand-Over State Machines (Version 1.0.0), Chapter 5: Judging Orphan Locks: How Long a Silence Means Death. 5D Library. DOI pending

DOI pending · monograph page goes live after publication · 5DL-B-254 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026254,
  author    = {Fan, Yafu},
  title     = {Atomic File-Lock Protocols for Multiple Windows: Self-Recovering Orphan Locks after Power Loss and Cross-Window Hand-Over State Machines},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

Other chapter answers in this book