
On 03 January 2006 15:13, Joel Reymont wrote:
On Jan 3, 2006, at 2:30 PM, Simon Marlow wrote:
The default context switch interval in GHC is 0.02 seconds, measured in CPU time by default. GHC's scheduler is stricly round- robin, so therefore with 100 threads in the system it can be 2 seconds between a thread being descheduled and scheduled again.
I measured the time taken to unpickle those large 50k packets as 0.3 seconds on my amd64 box (program compiled *without* optimisation), so the thread can get descheduled twice during while unpickling a large packet, giving a >4s delay with 100 threads running.
Is it impractical then to implement this type of app in Haskell? Based on the nature of Haskell scheduling I would be inclined to say yes.
Absolutely not! Apart from the problem you have with a space leak caused by the input buffer of the logging thread overflowing, which is easily fixed by using a bounded channel, I don't know why you want priorities. Is there something else? We could easily add Erlang-style priorities (though without the overhead of counting function calls, I'd do it by counting allocations), but I'd rather not if we can avoid it. Cheers, Simon