# Linux Kernel Module Cheat

#### 17.9.2. sleep

Count to dmesg every one second from `0` up to `n - 1`:

    insmod sleep.ko n=5

Source: kernel_modules/sleep.c

The sleep is done with a call to `usleep_range` directly inside `module_init` for simplicity.

Bibliography:

- https://stackoverflow.com/questions/15994603/how-to-sleep-in-the-linux-kernel/44153288#44153288

- https://github.com/torvalds/linux/blob/v4.17/Documentation/timers/timers-howto.txt