Benjamin Franksen <[EMAIL PROTECTED]> writes:

>> Producer/consumer ping-pong is 15 times slower between threads
>> running on different OS threads than on two unbound threads.
>
> Which OS?

Linux/NPTL.

A context switch which changes OS threads involves:
   setitimer
   pthread_sigmask
   pthread_mutex_lock
   pthread_cond_signal
   pthread_cond_wait (starting)
and in the other thread:
   pthread_cond_wait (returning)
   pthread_mutex_unlock
   pthread_sigmask
   setitimer

setitimer is necessary because I tested that it is installed per
thread rather than per process, even though SUSv3 says it should be
per process.

pthread_sigmask makes the thread holding the capability handle signals.
I've heard that the interaction of signals and threads is broken in
pre-NPTL Linux threads, I will have to check how it behaves and what
should be used in this case (perhaps having signals unblocked in all
threads).

-- 
   __("<         Marcin Kowalczyk
   \__/       [EMAIL PROTECTED]
    ^^     http://qrnik.knm.org.pl/~qrczak/
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to