A Clock Made of Branches fzakaria.com · 13 points · 2 comments · HN thread TL;DR...
HN Best 200 @best
A Clock Made of Branches fzakaria.com · 13 points · 2 comments · HN thread
TL;DR Fabian Zakaria's post explains how Rewind, his deterministic VM, represents time for replay. The default exit-time clock advances only on guest exits (syscalls), so CPU-bound work looks instantaneous. He argues for a counter clock that advances one nanosecond per retired conditional branch, which he says is deterministic and closer to real-world timing.
- Wall-clock time on the host is unusable for replay because the same guest work takes different time depending on host load, frequency and caches.
- Exit time advances about 5µs per guest exit, so a program doing a second of math between syscalls sees almost no time pass, which can hide timeout bugs and skew races.
- Counter time advances 1ns per retired conditional branch, a proxy for the guest's instruction stream progress that is repeatable across runs.
- Using perf on a billion-iteration countdown loop, the conditional branch count was exactly 1,000,000,000 in both runs, while total instructions varied due to interrupts and page faults.
- On AMD Zen, the conditional branch counter overcounts slightly due to SpecLockMap; Rewind sets a PMU MSR bit to fix it.
- In a sample table, counter time gave 11.7 s inside the VM versus 14.2 s on the host, closer than exit time's 2.1 s versus 15.7 s.
Discussion The thread is small and light in tone. One commenter praised the title and riffed philosophically on what zero-exit time would feel like from inside the guest, comparing it to insomnia or a freeze and recalling a passage from Ender's series. Another joked that they expected a clock made of tree branches and shared an image search result. No technical debate about the approach took place.
- Enjoys the title and the imagery it evokes (some): Commenters found the title visual and playful, picturing a slippery branching contraption that matches the idea of time.
- Zero-exit time as a subjective experience (a few): One commenter likened a program running without exits to insomnia or a frozen, claustrophobic state, using the clock-skew idea as a metaphor for perceived time.
- Literal reading of the title (a few): One commenter expected an actual clock made of tree branches and shared an image search result for one.
Links from the comments