为什么自旋锁在中断处理程序使用 [英] Why spinlocks are used in interrupt handlers

查看:342
本文介绍了为什么自旋锁在中断处理程序使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道为什么自旋锁来代替信号灯中断处理程序中。

I would like to know why spin locks are used instead of semaphores inside an interrupt handler.

推荐答案

信号灯导致任务上争,这是中断处理程序不能接受的睡眠。基本上,对于这样一个短期和快速任务(中断处理)的信号所进行的工作是矫枉过正。此外,自旋锁不能由一个以上的任务保持

Semaphores cause tasks to sleep on contention, which is unacceptable for interrupt handlers. Basically, for such a short and fast task (interrupt handling) the work carried out by the semaphore is overkill. Also, spinlocks can't be held by more than one task.

这篇关于为什么自旋锁在中断处理程序使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆