# Linux Kernel Module Cheat

#### 17.9.3. Workqueues

A more convenient front-end for kthread:

    insmod workqueue_cheat.ko

Outcome: count from `0` to `9` infinitely many times

Stop counting:

    rmmod workqueue_cheat

Source: kernel_modules/workqueue_cheat.c

The workqueue thread is killed after the worker function returns.

We can’t call the module just `workqueue.c` because there is already a built-in with that name: https://unix.stackexchange.com/questions/364956/how-can-insmod-fail-with-kernel-module-is-already-loaded-even-is-lsmod-does-not

Bibliography: https://github.com/torvalds/linux/blob/v4.17/Documentation/core-api/workqueue.rst

- Workqueue from workqueue