CS3 Operating Systems 2013-14, Practical Exercise. PHASE 3 ------- The assessed submission for this practical comprises three installments. Part 1 ------ In the directory /group/teaching/cs3/os/Modules which you should already have copied into your shared directory, you will find a module worker.c . This module starts a new kernel thread (i.e. a thread running in kernel space), which just prints a message every ten seconds. When it is rmmod'ed, it asks the kernel thread to terminate. You should note the use of a wait queue (basically a semaphore) to achieve synchronization between rmmod and the kernel thread. Since the kernel thread is running code from the module, the thread should terminate before the module is unloaded! Hence the cleanup_module() routine (which is called before the module is unloaded) sets a shared flag to ask the kernel thread to terminate, and then waits until the thread signals to the wait queue (semaphore) that it has finished. Thus the expected behaviour is: insmod worker.ko and then get a greeting, followed by a message every ten seconds. When you do rmmod worker there will be a delay of up to ten seconds before the thread terminates and the module is removed. The first part of the assessment simply asks you to verify this. First, verify that you can compile and run the module, with the behaviour described above. Now copy worker.c to worker1.c, and adjust the Makefile accordingly. Edit the messages in worker1.c to something different, preferably including something unique and witty (but not your name, please). Compile the module, and then insmod worker1.ko wait for 30 seconds or so, and rmmod worker1 Then capture the output of the dmesg command into a file in your shared directory, e.g. by dmesg >/mnt/shared/part1-output . (For safety, unmount or shut down the VM before assuming that any files written to your home directory are actually there!) You should now submit this file using the command submit os 1 part1-output (You may re-submit at any time up to the practical deadline.) That is the end of part 1; it is trivial, but it assures you that you have successfully understood how to use UML and modules. Successful completion of this part instantly gets you 30% of the practical marks!