自旋锁和信号灯之间的区别 [英] Differences between a spinlock and a semaphore
本文介绍了自旋锁和信号灯之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
自旋锁和信号量有什么区别?
What are the differences between a spinlock and a semaphore?
推荐答案
自旋锁使过程不断循环直到自旋锁被释放,而信号量则导致自旋锁进入睡眠直到释放的过程.
如果您要等待更长的时间才能满足条件,通常最好使用信号灯.
A spinlock causes the process to continuously loop until the spinlock is released, while a semaphore causes the process to sleep until it''s released.
A semaphore is usually better if you''re going to be waiting a longer time for the criteria to be met.
请购买一本书,而不是在此处发布所有家庭作业问题
Please buy a book instead of posting all of your homework questions here
这篇关于自旋锁和信号灯之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文