|
From: Tom H. <to...@co...> - 2012-02-15 08:28:44
|
On 15/02/12 07:22, Bart Van Assche wrote: > Note: glibc mutexes do a little more than invoking the futex syscalls > directly - if I remember correctly the pthread_mutex_lock() > implementation first spins for a short time in order to minimize the > number of system calls invoked. That's the whole point of the futex - you only have to make a system call and enter the kernel when the lock is contended. I don't think it actually spins in userspace, it's just that it is able to check (and if available take) the lock from userspace and only enter the kernel if it needs to block. Wikipedia has a summary and links to various papers: http://en.wikipedia.org/wiki/Futex Tom -- Tom Hughes (to...@co...) http://compton.nu/ |