Creating a dedicated workqueue

In the previous articles, we created work and we scheduled the work using default worker threads. If a dedicated workqueue is desired specifically to handle specific work for the kernel module that you are developing, a workqueue can be created using “create_workqueue” API.

The code block creates a work queue, assigns initialized work and later queues that work to the workqueue created. The code is shown below

Since we have created a workqueue ourselves and queue the kernel module work to that particular workqueue, it is also seen in the list of workqueues currently operational in the “ps -e” output.

The dedicated workqueue output is shown in the “dmesg” output below:

Kernel Threads

Comments

  1. Pingback: Workqueue code example using INIT_WORK Macro | Hitch Hiker's Guide to Learning

Leave a Reply

Your email address will not be published. Required fields are marked *