RE: [Haskell-cafe] Project postmortem

On 02 December 2005 12:25, Joel Reymont wrote:
I thought that if -threaded is not used then all the blocking IO is assigned a separate OS thread.
No - the runtime is completely single-threaded without -threaded. Blocking I/O is managed by the runtime. With -threaded, blocking I/O is managed by a Haskell thread. The programmer shouldn't see any difference in the behaviour of I/O. Is the documentation for -threaded lacking? I realise it's a bit terse, but do you have any concrete suggestions for improving it? Cheers, Simon

Simon, On Dec 2, 2005, at 1:16 PM, Simon Marlow wrote:
No - the runtime is completely single-threaded without -threaded. Blocking I/O is managed by the runtime. With -threaded, blocking I/ O is managed by a Haskell thread. The programmer shouldn't see any difference in the behaviour of I/O.
I was going on this quote by Simon PJ: -- It should be find to have lots of threads, esp if most of them are asleep. The only thing to watch out for is that GHC's runtime system will consume one *OS* thread for each *blocked* foreign call. So if you have 10k threads each making a separate call to the OS to read from 10k sockets, and they all block, you'll use 10k OS threads, and that will probably fail. -- Is this correct and if so how does it mesh with what you said above?
Is the documentation for -threaded lacking? I realise it's a bit terse, but do you have any concrete suggestions for improving it?
Not at the moment but I'll think about it once I understand everything. It could be worth summarizing every clarification in this thread. Thanks, Joel -- http://wagerlabs.com/

Simon, You told me a bit about how to examine the Haskell stack by looking at R22 on the PowerPC and $ebx on Intel architectures. I looked at your .gdbinit but could not figure out which macros are to be used. The example below is a bit contrived in that I'm freeing the SSL context twice, on purpose. I tried getting a disassembler dump using the contents of R22 without luck: (gdb) info registers r22 r22 0x137a3cc 20423628 (gdb) disas 0x137a3cc No function contains specified address. This is my stack trace: Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x00000019 0x00568fe0 in sk_pop_free () (gdb) where #0 0x00568fe0 in sk_pop_free () #1 0x0059f128 in X509_VERIFY_PARAM_free () #2 0x003c4d5c in SSL_free () #3 0x000c3254 in r7cH_info () #4 0x000ccd04 in schedule (mainThread=0x13f3f18, initialCapability=0x578df0) at Schedule.c:932 #5 0x000cdcac in waitThread_ (m=0x1100360, initialCapability=0x0) at Schedule.c:2156 #6 0x000cdb90 in scheduleWaitThread (tso=0x13c0000, ret=0x0, initialCapability=0x0) at Schedule.c:2050 #7 0x0001ff0c in rts_evalLazyIO (p=0x1ce0c8, ret=0x0) at RtsAPI.c:459 #8 0x0000495c in main (argc=25, argv=0x578df0) at Main.c:104 (gdb) info registers r22 r22 0x137a3cc 20423628 (gdb) disas 0x137a3cc No function contains specified address. -- http://wagerlabs.com/
participants (2)
-
Joel Reymont
-
Simon Marlow