[Haskell-beginners] Multiplexing I/O in Haskell

Magnus Therning magnus at therning.org
Thu Sep 3 09:52:15 EDT 2009


On Thu, Sep 3, 2009 at 2:41 PM, Sergey V. Mikhanov<sergey at mikhanov.com> wrote:
>   Hello community,
>
> Is there a good/proper way to do multiplexing I/O in Haskell, similar
> to what we are getting by using select()/poll() in Unix kernel? It
> does not seem impossible to implement this on top of existing IO
> library (though I haven't tried this actually, so I may be wrong).
> What interest me most here is whether we could use Haskell's implicit
> multithreading here (select()/poll() combination is all about
> multithreading)?

There used to be a select()-like call available in a Posix-related
module in older versions of GHC.  It seems to have disappeared a while
ago though.  The current "best-practice" seems to be using forkIO
"threads".  The old-ish paper on the haskell web server[1] contains
some numbers that suggest this is indeed a fairly high-performing
solution.

/M

[1]: http://www.haskell.org/haskellwiki/Haskell_Web_Server

-- 
Magnus Therning                        (OpenPGP: 0xAB4DFBA4)
magnus@therning.org          Jabber: magnus@therning.org
http://therning.org/magnus         identi.ca|twitter: magthe


More information about the Beginners mailing list