-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Round robin scheduler #4
base: main
Are you sure you want to change the base?
Conversation
So the naïve round-robin was clearly not good enough... I've been playing with By using a trie, Printing the full trie with graphviz isn't reasonnable nor useful, so it attempts to compact the useful information surrounding the found error traces:
This shows the first 5 error traces to produce a FIFO ordering bug in the MPMC queue, with 1 consummer + 3 producers threads that attempts to push more than the max capacity of the queue: It still requires deep knowledge of the exact test and algorithm to read the graph, but seeing the different branches helps a bit to figure out which instruction starts the bug chain. Here we can see at the top Another example with short code: module Atomic = Dscheck.TracedAtomic
let rec add t i =
if i > 0 then begin
let v = Atomic.get t in
Atomic.set t (v + 1) ;
let i = if Atomic.get t > v then i - 1 else i in
add t i
end
let test () =
let counter = Atomic.make 0 in
Atomic.spawn (fun () -> add counter 4) ;
Atomic.spawn (fun () -> add counter 4) ;
Atomic.final (fun () -> Atomic.check (fun () -> Atomic.get counter >= 3))
let () = Atomic.trace test The two threads attempt to increment the The search space is much smaller, so no branches have been left unexplored! I've also changed a tiny bit the terminal output while debugging the scheduler:
|
(Builds on #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:
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 :)