[Haskell-cafe] concurrency vs. I/O in GHC

John Lato jwlato at gmail.com
Mon Oct 18 12:15:42 EDT 2010

> From: Donn Cave <donn at avvanta.com>
> [I wrote initially, ...]
> > As I have migrated more of my application into Haskell, I find that
> > I/O in one thread effectively blocks other threads.
> Resolved - the SSL_read external I/O function needs to be "safe".

If anyone is listening, I would very much like for there to be a mechanism
by which external functions can be called "unsafe"-ly, but without blocking
all other Haskell threads.  I have code that does this:

calcUpdate a b c = do
  expensiveComputation a b
  expensiveComputation a c

"expensiveComputation" mutates the second argument (b or c here), but does
not call back into Haskell or update "a" and I would very much like to run
these two in parallel, however it's not possible if "expensiveComputation"
is unsafe.

If I make "expensiveComputation" safe, the extra time necessary for
safe-ness outweighs the gains from parallelization for even reasonably-sized
inputs (the expensiveComputation is called 100k's of times or more). My
current plan is to handle the parallelization in C, but I'd prefer to do it
in Haskell if possible.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20101018/6e20b243/attachment.html

More information about the Haskell-Cafe mailing list