[parisc-linux] ldcw in __pthread_acquire
LaMont Jones
lamont@hp.com
Sun, 17 Dec 2000 21:43:59 -0700
> x86 is about 50 clocks to do a syscall so the maths is strongly in favour
> of user mode spins.
It really comes down to what is the cost to get into kernel mode, as
compared to the cost of dealing with the atomicity problems that come
in when you try to implement locking completely in user space.
In the ideal world, I think that what we want is a libc entry point that
we can use for semaphoring (msem_lock comes to mind...), which the lib
(in arch specific code) either implements in a mixture of user/kernel
space, or (if you can get to kernel mode cheaply), does it in kernel mode
via a lightweight system call.
Note also that spinning in a ldcw is very painful for the bus, and
switching to a ldw-loop followed by ldcw results in starvation in a
greater-than-2-way MP system.
lamont