Hacker News Viewer

Async Python Is Secretly Deterministic

by KraftyOne on 4/3/2026, 6:55:12 PM

https://www.dbos.dev/blog/async-python-is-secretly-deterministic

Comments

by: 12_throw_away

No, determinstic scheduling is not a property of async python.<p>Yes, the stdlib asyncio event loop does have deterministic scheduling, but that&#x27;s an implementation detail and I would not rely on it for anything critical. Other event loops - for instance trio [1] - explicitly randomize startup order so that you won&#x27;t accidentally write code that relies on it.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;python-trio&#x2F;trio&#x2F;issues&#x2F;32" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;python-trio&#x2F;trio&#x2F;issues&#x2F;32</a>

4/3/2026, 7:31:13 PM


by: jpollock

That&#x27;s deterministic dispatch, as soon as it forks or communicates, it is non deterministic again?<p>Don&#x27;t you need something like a network clock to get deterministic replay?<p>It can&#x27;t use immediate return on replay, or else the order will change.<p>This makes me twitchy. The dependencies should be better modelled, and idempotency used instead of logging and caching.

4/3/2026, 8:11:07 PM


by: whinvik

Is this guaranteed by the async specification? Or is this just current behavior which could be changed in a future update. Feels like a brittle dependency if its not part of the spec.

4/3/2026, 7:31:29 PM


by: arn3n

While not production ready, I’ve been happily surprised at this functionality when building with it. I love my interpreters to be deterministic, or when random to be explicitly seeded. It makes debugging much easier when I can rerun the same program multiple times and expect identical results.

4/3/2026, 7:13:21 PM


by: lexicality

&gt; This makes it possible to write simple code that’s both concurrent and safe.<p>Yeah, great, my hello world program is deterministic.<p>What happens when you introduce I&#x2F;O? Is every network call deterministic? Can you depend on reading a file taking the same amount of time and being woken up by the scheduler in the same order every time?

4/3/2026, 7:12:14 PM