[Haskell-cafe] Killer pickler combinators (was Time leak)

Donald Bruce Stewart dons at cse.unsw.edu.au
Tue Dec 20 22:35:07 EST 2005

> About the only universal solution seems to pace the threads by  
> passing trace to read. Even then I got 1 alert. Now, can someone  
> explain why the lock eliminates the time leak?

It looks like with the 1000s of threads that get run, the problem is
just getting enough cpu time for each thread. All the solutions that
appear to work involve some kind of blocking (on Handles, MVars, ffi
calls), allowing the scheduler to switch.

So why don't we just increase the scheduler switch rate ourselves?

Using +RTS -C -RTS we can convince the rts to switch on every alloc, and
with 4000 threads running this seems to remove the timeout alerts, and
give all threads enough time to get things done.

This can be baked into the using an rts hook, a small C file containing
a C string that is added to the cmd line:

    char *ghc_rts_opts = "-C0";


More information about the Haskell-Cafe mailing list