Ludovic Apvrille
Information on the project
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_Kernel.apvrille.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 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/
You may need to use Linux manual pages, section 9 (kernel). I recommend using:
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.
In this project, the objective is to design a system call that can handle a specific message queue (To simplify the work, only one message queue is handled). This message queue has two specific parameters: a delay, and a loss rate. This delay represents the duration between the time at which a message is written and the time at which it could be read by another process, or the same. The loss rate is given as a percentage of lost messages. Each time a message is written, it has loss rate % of being immediately deleted i.e. it will never be read.
This kind of message queue is particularly useful for simulating communication networks.
1) At first, implement a basic message queue called mmq (for my message queue), i.e. at first, your message queue does not handle any delay nor loss rate.
The interface of the mmq is as follows:
int mmq(int config, int*data)
This system call is assumed to be never blocking i.e. if a read operation is performed and if the queue contains no data, 0 is returned and the data at specified address is not set.
Program this system call, recompile the kernel and test it.
A test program should look like this:…
int x;2) We now wish to add delay and loss rate information. Modify mmq as follows:
For example, the following test program configures the message queue:
…
int x;3) Is your system call re-entrant i.e. can it be executed at the same time by several processes? Do justify your answer.
4) Now assume that the message queue contains strings and not int values. What does it change to your program? I do not ask you to modify your code, but rather to explain me what would be the major and minor modifications to be lead on your code.
5) At last, we wish to develop a blocking version of your system call, that is, we have a new config mode in (config = 2 for example) which represents a blocking read. That is now, when the system call is performed with a "2" mode, the system call returns only when a data has been read. What would you have to change to your implementation? Once again, I do not ask you to modify your code, but rather to explain me what would be the major and minor modifications to be lead on your code.