@@ -23,14 +23,14 @@ domain ids on which the fibers run:
2323 open Picos_std_structured
2424 module Mpscq = Picos_aux_mpscq
2525
26- let main () =
26+ let main ~work () =
2727 let dids = Mpscq.create () in
2828
2929 Flock.join_after begin fun () ->
3030 for _ = 1 to 4 do
3131 Flock.fork @@ fun () ->
3232 let did = (Domain.self () :> int) in
33- Unix.sleepf 0.1 ; (* <- simulate work *)
33+ Unix.sleepf work ; (* <- simulate work *)
3434 Mpscq.push dids did
3535 done
3636 end;
@@ -43,17 +43,17 @@ domain ids on which the fibers run:
4343We can now try running the program with the sample schedulers:
4444
4545{[
46- # Picos_mux_fifo.run main
46+ # Picos_mux_fifo.run ( main ~work:0.0)
4747 - : int list = [0; 0; 0; 0]
48- # Picos_mux_multififo.run_on ~n_domains:4 main
48+ # Picos_mux_multififo.run_on ~n_domains:4 ( main ~work:0.2)
4949 - : int list = [0; 1; 2; 3]
50- # Picos_mux_random.run_on ~n_domains:4 main
50+ # Picos_mux_random.run_on ~n_domains:4 ( main ~work:0.2)
5151 - : int list = [0; 4; 5; 6]
52- # Picos_mux_thread.run main
52+ # Picos_mux_thread.run ( main ~work:0.0)
5353 - : int list = [0; 0; 0; 0]
5454]}
5555
56- A subtle detail above is that the [Unix.sleepf 0.1 ] call blocks the underlying
56+ A subtle detail above is that the [Unix.sleepf] call blocks the underlying
5757thread for a moment, which makes it likely that multiple domains will be used by
5858the multi-threaded schedulers. The results with the multi-threaded schedulers
5959are still strictly speaking non-deterministic.
0 commit comments