Skip to content

Commit

Permalink
Aside: notes on playing with "erl +T {n}" values to adjust the Erlang…
Browse files Browse the repository at this point in the history
… scheduler

Experimentation using:

    eqc:quickcheck(eqc:numtests(200, slf_msgsim_qc:prop_mc_simulate(distrib_counter_bad1_sim, []))).

Using `erl +T 0`, the output of the per-client-process counters usually looks
something like a zig-zag, starting with the 1st client process first line.
And it's like this very consistently.  For example:

    [[{counter,0},{counter,2}],
     [{counter,1},{counter,4},{counter,6}],
     [{counter,3},{counter,5}],
     [],
     [{counter,7},{counter,8},{counter,9}]]

Using `erl +T 5`, the same zig-zag pattern usually appears, but occasionally
something different happens, like this almost-top-to-bottom-left-to-right
pattern:

    [[{counter,0}],
     [{counter,1},{counter,4},{counter,7}],
     [],
     [{counter,2},{counter,6},{counter,8}],
     [{counter,3},{counter,5},{counter,9}]]

Using `erl +T 6`, things appear to get *much* slower.  (The "man" page
wasn't lying when it said that higher `+T` values can hurt performance.)
Now, we almost always see each process being as greedy as possible,
running seemingly to completion before allowing another client to run,
for example:

    [[{counter,0},{counter,1}],
     [{counter,2},{counter,3},{counter,4}],
     [{counter,5}],
     [{counter,6},{counter,7},{counter,8},{counter,9}]]

At `+T 8` and `+T 9`, things are noticibly slower than the slow `+T 6` or
`+T 7`.  But the same greedy-like client behavior as described above for
`+T 6` is the same.
  • Loading branch information
slfritchie committed May 28, 2011
1 parent 19ce3fc commit bc27ce5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/distrib_counter_bad1_sim.erl
Expand Up @@ -118,11 +118,11 @@ verify_mc_property(_NumClients, _NumServers, _ModProps, _F1, _F2,
Ops, ClientResults) ->
AllEmitted = lists:flatten(ClientResults),
EmittedByEach = [Val || {counter, Val} <- ClientResults],
%% if length(Ops) == 10, length(ClientResults) > 3 ->
%% io:format("\n~p\n", [ClientResults]);
%% true ->
%% ok
%% end,
if length(Ops) == 10, length(ClientResults) > 3 ->
io:format("\n~p\n", [ClientResults]);
true ->
ok
end,
length(Ops) == length(AllEmitted) andalso
[] == [x || EmitList <- EmittedByEach,
EmitList == lists:sort(EmitList),
Expand Down

0 comments on commit bc27ce5

Please sign in to comment.