Course on Operating Systems - Project of Fall 2006

Starting on November, 29th, 2006

Ludovic Apvrille


Information on the project

If you have problems to make this project, you may come to my office to get help and advices. Also, do not start working on your project the 30th of January ;-) You should have completed a subsequent part of the project before the end-of-year's vacations.

Information about the computer system

The project should be realized using a "vmwared" Linux. The starting vmware machine is the one provided in /home/Admin_Data/Tp_Apvrille/TP_Kernel.tar. Information on the use of this machine is provided in lab session on Linux kernel. This lab session also contains information on the system (edition, compilation, and various functions that may be useful).

We provide a backuped disk space for your project. Thus, the first time you use your machine, do:

Copy the virtual machines information into a work directory:
$ cd /home/Local_Data
$ cp /home/Admin_Data/Tp_Apvrille/TP_Kernel.tar .

Extract all data necessary to start your linux running inside the virtual machine
$ tar -xof TP_Kernel.tar

Then, you may start the virtual machine. When you have finished working on it, do as follows:

Stop the system, in the virutal machine


Wait for the Linux to be halted, and then, close vmware. Comme back to the main Linux, and do:

$ cd /home/Local_Data
$ tar -cvf <mylogin_vm>.tar TP_Kernel/

And save it in you project directory:
$cp <mylogin_vm>.tar /archives/kernel_project/<mylogin>/

Next time you want to access it, do:
$ cd /home/Local_Data
$cp /archives/kernel_project/<mylogin>/<mylogin_vm>.tar .

Work to do

Basically, your work is to program a system call that is a bit more complex than the one made during the lab session. 

At first, you have to finish the lab session on kernel programming i.e. your final virtual machine should contain the implementation of exercises 1 to 3. You don't have to provide information on theses system calls in your report.

Then,  you have to do the following exercise named: maintaining global information within the kernel

In this project, the objective is to design a system call that returns the number of times it has been called since system’s startup. The idea is to initialize an integer variable at system’s bootup; and then to increment this variable each time this system call is called.

1) Add this new system call (name it global and use init function capabilities, see annex A, “Linux system calls: some useful functions). Recompile the kernel and test it.

2) Modify this system call as follows. This system call should also return the number of seconds and microseconds elapsed since the last time it was called.

For example, the system call global could take as input two pointers to two long integers representing the number of seconds and microseconds elapsed since last call.

Example of your test program using this system call:

  long sec, usec;
  int x;

  x = global(&sec, &usec);
  printf("global #%d sec=%ld, usec=%ld\n", x, sec, usec);
  x = global(&sec, &usec);
  printf("global #%d sec=%ld, usec=%ld\n", x, sec, usec);
  x = global(&sec, &usec);
  printf("global #%d sec=%ld, usec=%ld\n", x, sec, usec);


For time-stamping, you may use the C function gettimeofday() (see manual pages). Program, recompile and test.

3) Calculate the minimum number of microseconds between two calls to your system call global. Is this result operating system dependent? Machine dependent? Dependent of the load of the computer during test?

4) In this third version of your system call, assume that you must keep track of all calls to global i.e. at what time each call has been made. Therefore, you need to use dynamic allocations for storing timing information. Also, there should now be two modes in your system call. The interface of your function should look like this:

int global(int mode, long *sec, long *used, void* list).

When a call is made with mode = 0, then, the system call works as in previous question.
If a call is made with mode = 1, then, list should contain, after the call, all information on calls.

Propose a dynamic data structure for storing information in the kernel, and program it relying on the kmalloc() function. Program, recompile and test.

What are the strength and limitations of your approach?