三种 bottom half的实现方式 softirqs, tasklets, work queue 及之间的比较

本文介绍了Linux内核中用于延后工作的三种主要机制:软中断(softirqs)、任务集(tasklets)和工作队列(workqueues)。软中断作为底层机制主要用于网络、SCSI及定时器等性能敏感子系统;任务集则更易于使用,适用于大多数场景除非对扩展性和速度有特别需求;工作队列允许睡眠并可调用阻塞函数如互斥锁。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

The following mechanisms are available in the kernel to defer work to a bottom half: softirqs, tasklets, and work queues .

 

 

Softirqs are the basic bottom half mechanism and have strong locking requirements. They are used only by a
few performance-sensitive subsystems such as the networking layer, SCSI layer, and kernel timers.

 

Tasklets are built on top of softirqs and are easier to use. It's recommended to use tasklets unless you have crucial
scalability or speed requirements.

 

A primary difference between a softirq and a tasklet is that the former is reentrant whereas the latter isn't. Different instances of a softirq can run simultaneously on different processors, but that is not the case with tasklets.

 

Work queues are a third way to defer work from interrupt handlers. They execute in process context and are
allowed to sleep , so they can use drowsy functions such as mutexes.

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值