# Linux Kernel Module Cheat

#### 17.9.4. schedule

Let’s block the entire kernel! Yay:

    ./run --eval-after 'dmesg -n 1;insmod schedule.ko schedule=0'

Outcome: the system hangs, the only way out is to kill the VM.

Source: kernel_modules/schedule.c

kthreads only allow interrupting if you call `schedule()`, and the `schedule=0` kernel module parameter turns it off.

Sleep functions like `usleep_range` also end up calling schedule.

If we allow `schedule()` to be called, then the system becomes responsive:

    ./run --eval-after 'dmesg -n 1;insmod schedule.ko schedule=1'

and we can observe the counting with:

    dmesg -w

The system also responds if we add another core:

    ./run --cpus 2 --eval-after 'dmesg -n 1;insmod schedule.ko schedule=0'