On Thu, Nov 3, 2011 at 8:35 AM, Andreas Voellmy
<andreas.voel...@gmail.com>wrote:

> I just read Kazu Yamamoto's article on a high performance web server in
> the latest Monad.Reader, and I came across a statement that doesn't sound
> correct to me. He says:
>
> "When a user thread issues a system call, a context switch occurs. This
> means that all Haskell user threads stop, and instead the kernel is given
> the CPU time. "
>
> Is this right? I thought that when a system call is made by a Haskell
> thread being run by a particular worker thread on a CPU, other runnable
> Haskell threads in the run queues of the HECs for other CPUs can continue
> running concurrently (provided we've run our Haskell program with multiple
> CPUs using the -Nx RTS argument). That's what I understood from the
> discussion of foreign calls in "Runtime Support for Multicore Haskell".
>

That's correct. Blocking syscalls will not prevent other Haskell threads
from running. IIRC it will block the OS thread used to run the Haskell
thread making the blocking syscall, but the RTS always has one free OS
thread (i.e. it will allocated more if needed) that it can use to continue
running other Haskell threads with. Your best reference is probably
"Extending the Haskell Foreign Function Interface with Concurrency".

-- Johan
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to