[Haskell-cafe] Re[4]: Parallel combinator, performance advice
Bulat Ziganshin
bulat.ziganshin at gmail.com
Tue Apr 7 11:58:24 EDT 2009
Hello Neil,
Tuesday, April 7, 2009, 7:47:17 PM, you wrote:
>> para = mapM_ forkIO
> 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.
if you have too much threads, you may replace forkIO with one more
QSem-enabled call:
semIO = unsafePerformIO$ newQSem 100
myForkIO = bracket_ (waitQSem semIO) (signalQSem semIO) . forkIO
this limit may be much higher than for System.Cmd.system
or you may go further and replace it with thread pool approach. the
main problem behind is raw calls to forkIO since these increases
amount of threads capable to call System.Cmd.system without any
control from us
--
Best regards,
Bulat mailto:Bulat.Ziganshin at gmail.com
More information about the Haskell-Cafe
mailing list