Multiplexing I/O in Haskell

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiplexing I/O in Haskell

Sergey V. Mikhanov
   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)?

Thanks in advance,
Sergey
Reply | Threaded
Open this post in threaded view
|

Multiplexing I/O in Haskell

Magnus Therning
On Thu, Sep 3, 2009 at 2:41 PM, Sergey V. Mikhanov<[hidden email]> 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