How pthread_mutex_lock is implemented
It is both complicated and differs from Unix to Unix variant. In Linux, for example, a system called Futex (Short for Fast Userspace Mutex) is used. In this system an atomic increment and test operation is performed on the mutex variable in user space. If the result of the operation indicates that there was no … Read more