I am working on verifying Go applications and wondering if you are aware of any way to manipulate the scheduler? I only found runtime.Gosched() that preempt the thread (M) from the current goroutine and give back the control to the scheduler to execute a runnable goroutine from the queue. But for the sake of systematic search-space reduction for dynamic verification, I need a way to dictate interleavings of goroutines (e.g., what goroutine to execute after a context switch).
I would appreciate any input on this topic.
I think that is all you will get unless you play with unsafe or hack on the Go source. There are deliberately few tuning parameters in the runtime to give the Go team the freedom to change how it works.
True.
Dmitry Vyukov (and others) designed wrote the amazing scheduler (and the whole runtime) with a lot of creativity to make it efficient and safe. I am reading the source to find code regions that are responsible for picking a G from the available (aka “runnable”) G queue. Then I can change the scheduler algorithm and pick random goroutines to execute.