Powered By Blogger

Friday, October 6, 2017

Workqueue's in Linux

In order to ease the asynchronous execution of functions a new abstraction, the work item , is introduced. A work item is a simple struct that holds a pointer to the function that is to be executed asynchronously. Whenever a driver or subsystem wants a function to be executed asynchronously it has to set up a work item pointing to that function and queue that work item on a workqueue.Special purpose threads, called worker threads, execute the functions off of the queue, one after the other. If no work is queued, the worker threads become idle. hese worker threads are managed in so called worker-pools. On the workqueue several concepts are work-related data structure: 1) work: work. 2) workqueue: a collection of work. workqueue and work are one-to-many relationships. 3) worker:. In the code worker corresponds to a work_thread() kernel thread. 4) worker_pool: the collection of workers. worker_pool and worker are one-to-many relationships. 5) (pool_workqueue): middleman responsible for establishing the relationship between workqueue and worker_pool..
Workqueue Topology
Normal Worker_pool


Normal Worker Pool Topology
Unbound Worker Pool

Unbound Worker pool Topology