[Haskell-cafe] Re: Re[2]: Parallel combinator, performance advice

Neil Mitchell ndmitchell at gmail.com
Tue Apr 7 11:47:17 EDT 2009

Hi Bulat,

> btw, if all that you need is to limit amount of simultaneous
> System.Cmd.system calls, you may go from opposite side: wrap this call
> into semaphore:
> sem = unsafePerformIO$ newQSem numCapabilities
> mysystem = bracket_ (waitQSem sem) (signalQSem sem) . system
> and implement para as simple thread population:
> para = mapM_ forkIO

My main motivation is to limit the number of system calls, but it's
also useful from a user point of view if the system is doing a handful
of things at a time - it makes it easier to track what's going on.

I might try that tomorrow and see if it makes a difference to the
performance. While the majority of computation is in system calls,
quite a few of the threads open files etc, and having them all run in
parallel would end up with way too many open handles etc.



More information about the Haskell-Cafe mailing list