Operating Systems

2008 Fall, Project One

Process Creation Statistics

Due Time:

    Oct. 23rd 00:00


Demo Time:

    Oct. 28th and Oct. 29th 13:30 - 15:00



   System call is an interface between users and the kernel. Through system call, user processes can access peripherals or run privileged operations. Learning how to design a system call can help us understand how the user processes communicate with kernel. "fork()" is a system call in Linux to create new processes. We would like to know how many processes have been forked since system boots from a user program. However, since information in the kernel cannot be read directly from user processes. We need to design a new system call to return how many times the "fork()" have been invoked.



    You are to design a new system call that can return current value of a system information counter. You can modify the kernel source codes or make a kernel module for this system call. Instrument the kernel to keep track of the number of times the fork() system call has been invoked and write a user-level C program that print the number of times it has been invoked (by any process in the system). Your output should be exactly the same as the following to print information regarding the system call.  Note that, you should create a new file named myservice.cto store your system call and your system call might have some arguments. The name of your user program should betest.c”.


Output :

fork() is invoked # times.
    Process Creation Rate = Percentage  times/s after system boots
Sample Output :

fork() is invoked 123 times.
    Process Creation Rate = 20.31  times/s after system boots



Linux, kernel version: 2.6.x

    Programming Language:



try to find one by yourself



    Kernel modification:


    System call design:


    Program result:




    Coding style:




Late penalty is 10% per day. E.g. if 2 days late and with grade 90, the final grade will be 90 * 90% * 90% = 72.9



     You may need to modify <directory to Linux source>/arch/<platform>/kernel/fork.c to get the counter information. “extern” the counter variables might reduce the effort to recompile kernel.


Handing in:

Turn in one-page report in class showing how you did it and how good it is. Make your source codes self-documented.

Upload your source codes and executable file, including Makefile, *.c, *.h, to FTP server

Host:, Port:53, User: OS2008 Password: project1

You should create your own directory named by your student ID number for your files. Note that the initial should be capital.




http://rswiki.csie.org/phpbb/viewforum.php?f=12   (the OS forum)


Understand the Linux Kernel 3rd Edition  

            Daniel P. Bovet & Macro Cesati, O'REILLY


Linux Device Driver 3rd Edition  

            Jonathan Corbet, Alessandro, Rubini & Greg Kroah-Hartman, O'REILLY


The other references will be announced later in the OS forum.