CS433 Linux Kernel Programming

Homework 6 on Creating and Destroying Kernel Threads

See the sample output below that shows the process list and the boot time messages.

Example: process list ("$ps -ef")
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 09:36 ?        00:00:00 /sbin/init
root         2     0  0 09:36 ?        00:00:00 [kthreadd]
root         3     2  0 09:36 ?        00:00:00 [ksoftirqd/0]
root         4     2  0 09:36 ?        00:00:00 [kworker/0]
root         5     2  0 09:36 ?        00:00:00 [migration/0]
...

root         10     2  0 09:36 ?        00:00:00 [my_hotplugd/0]
root         12     2  0 09:36 ?        00:00:00 [my_hotplugd/1]

...
root       579     2  0 09:36 ?        00:00:00 [hid_compat]

root       613     1  0 09:36 ?        00:00:00 [My_name: my_ker_thd_1]
root       614     2  0 09:36 ?        00:00:00 [My_name: my_ker_thd_2]

...
  

For creating the first 2 threads try the following procedure:

For creating the second type of threads, follow the procedure for creating ksoftirqd and kworker discussed in class:

For printing some info on processes, try the following:

...
struct task_struct *tmp_tsk;
...
tmp_tsk = current;
for_each_process(tmp_tsk)        {
    ...
    print some info on all the processes on runqueue;
    ...
}

Now, remove all the threads you created and print all the processes, something similiar to "ps -ef".

Submit a patch file, only the portion of the code you actually modified, not all the files. Include screen shots/dmesg that show that it worked.