Course on Operating Systems - Project of Fall 2008

Starting on November, 27th, 2008

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 19th of January ;-) You should have completed a subsequent part - if not all parts - 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 and extract the virtual machines information into a work directory:
$ cd /home/Local_Data
$ tar xvf /packages/administration/TP_Kernel.apvrille.tar

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

$ cd TP_Kernel
$ vmplayer TP_Kernel.vmx

Stop the system, in the virtual machine:

$halt

Wait for the Linux to be halted, and then, close vmware. Come 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 .

You may need to use Linux manual pages, section 9 (kernel). I recommend using:

Work to do

Basically, your work is to implement a new function offered by Linux to user applications.

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.

In this project, the objective is to design a system call that can handle a delayed signals between processes. Indeed, usually, when a process sends a signal to another process - using the kill() system call - , that signal is delivered immediatly by the operating system to the destination process. On the contrary, with your new system call - called mykill() - the signal shall be delivered to the destination process only after a given duration provided as argument to the system call.

1) At first, understand how the usual kill() system call works

To do so, you may use the lecture notes on "thread", and use related manual pages i.e. :

$ man -s2 signal

$ man -s2 kill

Then, do two different programs, and test them under linux

2) We now wish to add a delay parameter to signals

int mykill(pid_t pid, int sig, int delay);

The delay shall be given in milliseconds. A test program should look like this (with pid being the process id of P1):

  int pid;
 
  if (mykill(pid, SIGUSR1, 10000) <0) {exit(-1);}
  if (mykill(pid, SIGUSR1, 1000) <0) {exit(-1);}
  if (mykill(pid, SIGUSR1, 5000) <0) {exit(-1);}

 ...
 

In that test program, we specify to the operating system that we wish three SIGUSR1 to be delivered to P1: one after 1 second, one after 5 seconds, at the last one after 10 seconds.

3) Is your system call re-entrant i.e. can it be called at the same time by several user processes? If no, what shall be done for making it re-entrant? Do justify your answer in the report [Here, I do not ask you to program a re-entrant system call if the one you have programmed is not].

4) Now, we wish to implement another system call that allows the cancellation of a signal

int mycancelkill(pid_t pid, int sig);

This calls means that all signals -of number sig - that have not yet been sent to process pid shall be cancelled.

Propose an implementation for that second system call, and provide a test program.