dscheck icon indicating copy to clipboard operation
dscheck copied to clipboard

Round robin scheduler

Open art-w opened this issue 1 year ago • 1 comments

(Builds on https://github.com/sadiqj/dscheck/pull/3 )

I'm not quite convince yet about this tiny change! The scheduler was exhausting the first thread before moving on, so I though it could be interesting to alternate between the threads in a round-robin-like fashion:

  • It enables testing spinlocks (otherwise the spinlocked thread could get us stuck)
  • On broken code, it terminates really really fast! I think it's because it's breaking nearly all the CAS operations from the start (rather than testing the happy path)
  • But on correct code, it tries a bunch more paths than before... I'm guessing that the backtracking logic could be improved to consider the involved values of the atomics ("does permuting this failing CAS at this point in the past yield a successful CAS?")

I'll try to improve on the last part when I get some time and push further analysis... In the mean time, I'm very open to suggestions or alternate explanations :)

art-w avatar Oct 03 '22 10:10 art-w