pipes-concurrent - forkIO

38 views
Skip to first unread message

GS

unread,
Dec 8, 2014, 1:49:55 PM12/8/14
to haskel...@googlegroups.com
Hello,

I'm just skimming through some of the pipes libraries, and in particular
the one which I assume I'll be definitively needing, namely
pipes-concurrent.

Did I see this correctly, that pipes-concurrent is using forkIO under
the hood? I had hoped to be able to avoid threads / forks altogether but
I may just have misunderstood Simon Marlow and his "there is no fork" work.

GS

William Casarin

unread,
Dec 8, 2014, 1:54:41 PM12/8/14
to haskel...@googlegroups.com
forkIO doesn't spawn OS threads, they spawn lightweight green threads that are managed by GHCs IO manager. You can spawn millions of threads without much issue.

Cheers,
Bill

--
You received this message because you are subscribed to the Google Groups "Haskell Pipes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haskell-pipes+unsubscribe@googlegroups.com.
To post to this group, send email to haskel...@googlegroups.com.

Gabriel Gonzalez

unread,
Dec 8, 2014, 2:15:11 PM12/8/14
to haskel...@googlegroups.com, g...@kmmd.de
`pipes-concurrency` does not spawn any threads. It's completely up to
the user to spawn any threads they need. You can verify this yourself
by studying the source code for `pipes-concurrency`, which is very short:

http://hackage.haskell.org/package/pipes-concurrency-2.0.2/docs/src/Pipes-Concurrent.html

However, your question seems a little unusual: you say that you think
you need `pipes-concurrency`, but that you don't want to use
fork/threads. What are you using `pipes-concurrency` for if you're not
using it for concurrency?

GS

unread,
Dec 8, 2014, 3:16:53 PM12/8/14
to haskel...@googlegroups.com
Hi Gabriel,

a lot of my questions will be naive, simply because there's a lot of
misunderstanding from my side and I'm asking questions way too early,
better brace yourself. ;)

As I said I was only skimming the library, but I'm making progress on
another "pipes" front and I'm feeling encouraged by that.

Wow, I'm so glad I finally get to code in a language that I actually
like, after years of commercial Java.

GS

Gabriel Gonzalez

unread,
Dec 8, 2014, 3:40:59 PM12/8/14
to haskel...@googlegroups.com, g...@kmmd.de
That's fine! I ask a lot of strange questions, too! It's the best way
to learn. :)
Reply all
Reply to author
Forward
0 new messages