$linuxjunkies
>

workqueue

also: work queue, workqueue handler, queued work

A kernel mechanism for deferring work to be executed asynchronously by background kernel threads, allowing interrupt handlers and other kernel code to return quickly without blocking.

A workqueue is a kernel subsystem that manages the execution of work functions (callbacks) in process context rather than interrupt context. When kernel code needs to perform potentially blocking or time-consuming operations, it can queue the work to a workqueue instead of executing it immediately, allowing the caller to return quickly.

Linux provides both general-purpose workqueues (like the default system workqueue) and custom workqueues that applications can create for specific purposes. Each workqueue is serviced by one or more dedicated kernel worker threads, which execute the queued work items sequentially or in parallel depending on configuration.

A common example is a device driver's interrupt handler receiving data: rather than process it immediately in interrupt context (which is restrictive), the handler queues work to a workqueue, and a kernel thread processes it later in the safer process context where sleeping and locking are permitted.

Related terms