[Haskell] select(2) or poll(2)-like function?

Svein Ove Aas svein.ove at aas.no
Mon Apr 18 10:06:10 CEST 2011


On Mon, Apr 18, 2011 at 8:13 AM, Mike Meyer <mwm at mired.org> wrote:
> On Mon, 18 Apr 2011 11:31:08 +0530
> Piyush P Kurur <ppk at cse.iitk.ac.in> wrote:
>> <begin rant>
>> It is unfortunate that the usual fork and even pthread_create is not light
>> weight enough for programming such high performance servers. The select
>> based programming is more a hack than anything IMNSHO.
>
> I always looked at it the other way 'round: threading is a hack to
> deal with system inadequacies like poor shared memory performance or
> an inability to get events from critical file types.
>
> Real processes and event-driven programming provide a more robust,
> understandable and scalable solutions.
> <end rant>
>
And I've often wanted a select-equivalent in Haskell. It'd be simple,
it'd help, so why not?

But good luck using multiple cores like that. The one paradigm that
makes no sense in Haskell is worker threads (since the RTS does that
for us); instead of fetching a worker, just forkIO instead.

Unless you're trying for LIFO or similar for overload handling, in
which case.. umh. Right. Can we have select, please?

..I'm sure I started this off trying to explain why you don't need it.


-- 
Svein Ove Aas



More information about the Haskell mailing list