60

linux内核级同步机制--futex-Java架构笔记

 5 years ago
source link: https://blog.51cto.com/14440216/2424640
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
在面试中关于多线程同步,你必须要思考的问题 一文中,我们知道glibc的pthread_cond_timedwait底层是用linux futex机制实现的。理想的同步机制应该是没有锁冲突时在用户态利用原子指令就解决问题,而需要挂起等待时再使用内核提供的系统调用进行睡眠与唤醒。换句话说,在用户态的自旋失败时,能不能让进程挂起,由持有锁的线程释放锁时将其唤醒?如果你没有较深入地考虑过这个问题,很可能

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK