We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
二者区别在于在争夺锁的过程,没获得锁的那一方的行为,互斥锁会阻塞线程睡眠等待,而自旋锁会不断尝试,直到获得锁为止。自旋锁在未获得锁的情况下会占用着CPU一直运行,在长时间未能获得锁的情况会降低CPU的效率,并且自旋锁有优先级反转的问题存在,所以自旋锁适用于内核可抢占式的系统,对于单CPU且不可抢占式的内核下仅适合于锁使用者保持锁时间比较短的情况。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
二者区别在于在争夺锁的过程,没获得锁的那一方的行为,互斥锁会阻塞线程睡眠等待,而自旋锁会不断尝试,直到获得锁为止。自旋锁在未获得锁的情况下会占用着CPU一直运行,在长时间未能获得锁的情况会降低CPU的效率,并且自旋锁有优先级反转的问题存在,所以自旋锁适用于内核可抢占式的系统,对于单CPU且不可抢占式的内核下仅适合于锁使用者保持锁时间比较短的情况。
The text was updated successfully, but these errors were encountered: