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

2011-04-18 Thread Matthias Kilian
On Sun, Apr 17, 2011 at 01:44:50PM -0700, Don Stewart wrote: > `forkIO` is based on epoll. So threadWaitFD and friends are using epoll. Or (on non-Linux systems) on kqueue or poll, as i learned from grep(1) and the folowups here. (And sorry for the noise; I really didn't expect such a flamebait)

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

2011-04-18 Thread Ertugrul Soeylemez
Mike Meyer wrote: > [...] In case you don't have a subscription in haskell-cafe, I have replied there, because this discussion does not belong to the general Haskell list. Greets, Ertugrul -- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/

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

2011-04-18 Thread Colin Adams
On 18 April 2011 17:48, Mike Meyer wrote: > On Mon, 18 Apr 2011 17:07:53 +0100 > Colin Adams wrote: > > On 18 April 2011 16:54, Ertugrul Soeylemez wrote: > > > > > > > > > > > > > Well, *someone* has to worry about robustness and scalability. Users > > > > notice when their two minute system bu

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

2011-04-18 Thread Mike Meyer
On Mon, 18 Apr 2011 17:07:53 +0100 Colin Adams wrote: > On 18 April 2011 16:54, Ertugrul Soeylemez wrote: > > > > > > > > > Well, *someone* has to worry about robustness and scalability. Users > > > notice when their two minute system builds start taking four minutes > > > (and will be at my doo

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

2011-04-18 Thread Don Stewart
Redirecting to haskell-cafe@, where this kind of long discussion belongs. On Mon, Apr 18, 2011 at 9:07 AM, Colin Adams wrote: > > > On 18 April 2011 16:54, Ertugrul Soeylemez wrote: >> >> > >> > Well, *someone* has to worry about robustness and scalability. Users >> > notice when their two minut

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

2011-04-18 Thread Colin Adams
On 18 April 2011 16:54, Ertugrul Soeylemez wrote: > > > > > Well, *someone* has to worry about robustness and scalability. Users > > notice when their two minute system builds start taking four minutes > > (and will be at my door wanting me to fix it) because something didn't > > scale fast enoug

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

2011-04-18 Thread Ertugrul Soeylemez
Mike Meyer wrote: > > You also don't need Emacs/Vim, if all you want is to write a simple > > plain text file. There is nothing wrong with concurrency, because > > you are confusing the high level model with the low level > > implementation. Concurrency is nothing but a design pattern, and > >

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

2011-04-18 Thread Ertugrul Soeylemez
Mike Meyer wrote: > > To add a bit more. The most common use of select/epoll is to > > simulate the concurrency because the natural way of doing it > > fork/pthread_create etc are too expensive. I dont know of any other > > reason why select/epoll exits. > > You know, I've *never* written a s

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

2011-04-18 Thread Johan Tibell
Hi Mike, On Mon, Apr 18, 2011 at 12:00 PM, Mike Meyer wrote: > > It's useful to use non-determinism (i.e. concurrency) to model a server > > processing multiple requests. Since requests are independent and > shouldn't > > impact each other we'd like to model them as such. This implies some > lev

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

2011-04-18 Thread Johan Tibell
On Mon, Apr 18, 2011 at 2:25 PM, Mike Meyer wrote: > Only if you also made the TCP/IP connection overhead trivial so you > could stop with HTTP/1.0 and not deal with HTTP/1.1. Failing that, the > most natural way to do this is: > > forever do >accept the next connection > handle r

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

2011-04-18 Thread Mike Meyer
On Mon, 18 Apr 2011 17:05:12 +0530 Piyush P Kurur wrote: > On Mon, Apr 18, 2011 at 12:59:07PM +0200, Ertugrul Soeylemez wrote: > > Svein Ove Aas wrote: > To add a bit more. The most common use of select/epoll is to simulate > the concurrency because the natural way of doing it fork/pthread

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

2011-04-18 Thread Piyush P Kurur
On Mon, Apr 18, 2011 at 07:55:57AM -0400, Mike Meyer wrote: > On Mon, 18 Apr 2011 12:56:39 +0200 > Ertugrul Soeylemez wrote: > > > > You also don't need Emacs/Vim, if all you want is to write a simple > > plain text file. There is nothing wrong with concurrency, because you > > are confusing the

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

2011-04-18 Thread Simon Marlow
On 18/04/2011 12:55, Mike Meyer wrote: On Mon, 18 Apr 2011 12:56:39 +0200 Ertugrul Soeylemez wrote: Mike Meyer wrote: The unix process model works quite well. Compared to a threaded model, this is more robust (if a process breaks, you can kill and restart it without affecting other processes,

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

2011-04-18 Thread Jeremy Gibbons
Please can this discussion be moved to haskell-cafe? http://www.haskell.org/haskellwiki/Mailing_Lists Ta. Jeremy On 18 Apr 2011, at 12:55, Mike Meyer wrote: On Mon, 18 Apr 2011 12:56:39 +0200 Ertugrul Soeylemez wrote: Mike Meyer wrote: On Mon, 18 Apr 2011 11:07:58 +0200 Johan Tibell wr

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

2011-04-18 Thread Piyush P Kurur
On Mon, Apr 18, 2011 at 12:59:07PM +0200, Ertugrul Soeylemez wrote: > Svein Ove Aas wrote: > > > And I've often wanted a select-equivalent in Haskell. It'd be simple, > > it'd help, so why not? > > Because perhaps it's just an illusion that it would help. I don't see > any advantage in using ex

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

2011-04-18 Thread Mike Meyer
On Mon, 18 Apr 2011 12:56:39 +0200 Ertugrul Soeylemez wrote: > Mike Meyer wrote: > > On Mon, 18 Apr 2011 11:07:58 +0200 > > Johan Tibell wrote: > > > On Mon, Apr 18, 2011 at 9:13 AM, Mike Meyer wrote: > > > > I always looked at it the other way 'round: threading is a hack to > > > > deal with s

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

2011-04-18 Thread Piyush P Kurur
On Mon, Apr 18, 2011 at 12:59:07PM +0200, Ertugrul Soeylemez wrote: > Svein Ove Aas wrote: > > > And I've often wanted a select-equivalent in Haskell. It'd be simple, > > it'd help, so why not? > > Because perhaps it's just an illusion that it would help. I don't see > any advantage in using ex

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

2011-04-18 Thread Gregory Collins
On Mon, Apr 18, 2011 at 10:06 AM, Svein Ove Aas wrote: > And I've often wanted a select-equivalent in Haskell. It'd be simple, > it'd help, so why not? http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Concurrent.html#v:threadWaitRead Ta-da! It's select(), or something sm

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

2011-04-18 Thread Ertugrul Soeylemez
Svein Ove Aas wrote: > And I've often wanted a select-equivalent in Haskell. It'd be simple, > it'd help, so why not? Because perhaps it's just an illusion that it would help. I don't see any advantage in using explicit polling. Use concurrency. Greets, Ertugrul -- nightmare = unsafePerfo

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

2011-04-18 Thread Ertugrul Soeylemez
Mike Meyer wrote: > On Mon, 18 Apr 2011 11:07:58 +0200 > Johan Tibell wrote: > > On Mon, Apr 18, 2011 at 9:13 AM, Mike Meyer wrote: > > > 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 inabil

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

2011-04-18 Thread Mike Meyer
On Mon, 18 Apr 2011 11:07:58 +0200 Johan Tibell wrote: > On Mon, Apr 18, 2011 at 9:13 AM, Mike Meyer wrote: > > 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

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

2011-04-18 Thread Johan Tibell
On Mon, Apr 18, 2011 at 9:13 AM, Mike Meyer wrote: > 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 pro

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

2011-04-18 Thread Johan Tibell
On Mon, Apr 18, 2011 at 10:06 AM, Svein Ove Aas wrote: > 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 >

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

2011-04-18 Thread Svein Ove Aas
On Mon, Apr 18, 2011 at 8:13 AM, Mike Meyer wrote: > On Mon, 18 Apr 2011 11:31:08 +0530 > Piyush P Kurur wrote: >> >> 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

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

2011-04-18 Thread Mike Meyer
On Mon, 18 Apr 2011 11:31:08 +0530 Piyush P Kurur wrote: > > 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 ot

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

2011-04-17 Thread Piyush P Kurur
On Mon, Apr 18, 2011 at 12:47:33AM +0200, Johan Tibell wrote: > In other words, it's reasonable to fork of tens of thousands of threads and > expect good performance. Yes I think. Besides from the point of view of programming servers like for e.g. a web server, the forkIO based solution is

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

2011-04-17 Thread Johan Tibell
In other words, it's reasonable to fork of tens of thousands of threads and expect good performance. On Apr 17, 2011 10:46 PM, "Don Stewart" wrote: > `forkIO` is based on epoll. So threadWaitFD and friends are using epoll. > > On Sun, Apr 17, 2011 at 1:29 PM, Matthias Kilian wrote: >> Hi, >> >> i

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

2011-04-17 Thread Don Stewart
`forkIO` is based on epoll. So threadWaitFD and friends are using epoll. On Sun, Apr 17, 2011 at 1:29 PM, Matthias Kilian wrote: > Hi, > > is there something like select(2) or poll(2) available in the > standard (HP) libraries? I hoogled around a little bit but didn't > find anything. (Something

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

2011-04-17 Thread Matthias Kilian
Hi, is there something like select(2) or poll(2) available in the standard (HP) libraries? I hoogled around a little bit but didn't find anything. (Something like this will be crucial for networking stuff listening on v4 and v6 sockets at the same time) Ciao, Kili ___