Pretty sure you cannot do this for two reasons: the runtime creates internal threads for IO and other purposes that you cannot control. Also the kernel IO / poll is non deterministic. 

You might have better luck with a custom tiny Go. 

On May 13, 2025, at 1:53 PM, Jason E. Aten <j.e.a...@gmail.com> wrote:

I'd like to run variations of my Raft test code on a fully 
deterministic runtime (meaning only one thread, all 
randomness from a pseudo RNG controlled with a repeatable seed). 
I was looking at the standard (big) Go runtime, and I don't
see where there are any options to control the random number
generator there used for choosing a select, for instance,
but maybe I've missed some already available option? 
Setting GOMAXPROC=1 apparently does not prevent other background threads
for GC, OS calls, etc... do I understand that right?

Trying to figure out if it would a smaller lift to hack some support into TinyGo,
whose typically microcontroller targets are single threaded, as
that would give me a big head start, or if the big Go runtime 
places that would need pseudo RNGs replaced
are isolated enough for it do be doable (in a hacked up, non-supported
version, of course)... big Go would have better compatibility with
production code of course, but TinyGo is already more conceptually
aligned, and might be easier to maintain if the experiment is successful...

Thoughts?

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/da4416ab-9710-4743-9dfd-67a89675af73n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/10B457E6-3B24-4C03-8259-C82C378C3B2A%40ix.netcom.com.

Reply via email to