What’s different between deferrable functions and work queues

Tasklets and work queues implement deferrable functionality and replace the older bottom-half mechanism for drivers.

The BH interface is ancient, and it showed. Each BH must be statically defined, and
there are a maximum of 32. Because the handlers must all be defined at compile-time,
modules could not directly use the BH interface.They could piggyback off an existing
BH, however. Over time, this static requirement and the maximum of 32 bottom halves
became a major hindrance to their use.
All BH handlers are strictly serialized—no two BH handlers, even of different types,
can run concurrently.This made synchronization easy, but it wasn’t beneficial to multi-
processor scalability. Performance on large SMP machines was sub par.A driver using the
BH interface did not scale well to multiple processors.The networking layer, in particular,
suffered.

Work queues are a different form of deferring work from what we have looked at so far.
Work queues defer work into a kernel thread—this bottom half always runs in process
context.Thus, code deferred to a work queue has all the usual benefits of process context.
Most important, work queues are schedulable and can therefore sleep.


你可能感兴趣的:(编程,linux,unix)