Mutexes

When we insert the mutex.ko module, the output should be something like the following:

# insmod mutex.ko 
mutex:mut_init: delay is set to 1000ms (250 jiffies)
mutex:mut_init: mutex module loaded

In step 1, we execute the module init() function where we increase minfo.data within a mutex protected area.

mutex:ktimer_handler: kernel timer expired at 4294997916 (data=1)
mutex:ktimer_handler: kernel timer expired at 4294998168 (data=2)
mutex:ktimer_handler: kernel timer expired at 4294998424 (data=3)
...

When we execute the handler, we can be sure that it cannot increase minfo.data if the module init() function is currently holding the mutex.