2007年11月21日 星期三

Linux Kernel Project 1

Project 1

The purpose of project 1 is to let you understand the distribution of dynamic memeory allocated by the Kernel for process descriptor memory and the relationships between processes.

* Part 1 (25%):
o In this project you need to list the virtual address and physical address of the process descriptor of every process that is running at the time right after you execute a user program 20 times in the background. This user program is written by you and do nothing but a while loop. e.g.
#include "stdio.h"
main()
{
while(1)
;
}
o Assume the name of this user program is called orchid.c and its corresponding executable is called orchid.
o Hint:
+ For each execution of orchid, the Kernel creates a new process to execute the program.
+ You can solve the above problem by traveling the Process List starting from Process 1's process descriptor.
+ You can use the following command ``orchid &'' to have orchid executed in the background.
* Part 2 (25%):
o After the above experiment, terminate the execution of the above 20 processes, and then execute orchid again. However, this time you execute orchid in the background twice and execute orchid in the foreground once. After the above setup, then from the point of view of the foreground process, list the PIDs and the process descriptor addresses of All its ancestor processes. Besides, also list the PIDs and the process descriptor addresses of all its sibling processes.
o Hint:
+ In this part, you only need to list the virtual addresses.
+ You can use command ``kill -9 PID'' to terminate a process.
* Part 3 (35%):
o After the experiments in part 1 and part 2, terminate all processes that execute orchid.
o Execute orchid in the background. ( Assume Process X executes it.)
o Execute orchid in the foreground again. ( Assume Process Y executes it.)
o For Process X
+ List the PGID, PID, process descriptor address of it.
+ List the PID and process descriptor address of the login session leader of it.
+ List the PID and process descriptor address of each other process that belongs to the same Process Group as Process X's.
o For Process Y
+ List the PGID, PID, process descriptor address of it.
+ List the PID and process descriptor address of the login session leader of it.
+ List the PID and process descriptor address of each other process that belongs to the same Process Group as Process Y's.
o Hint:
+ You can use command ``ps'' to get the PIDs of Process X and Process Y.
* Part 4 (35%):
o After experiment in part 3, without killing Process X, execute command ``exit'' to logout.
P.S.
+ You may need to press ``Ctl-X'' to terminate the execution of Process Y before you can execute command ``exit''.
+ After the logout Process X is supposed to be continuously alive.
o After the above logout, then login again using the same terminal.
o After the login, execute orchid in the background. ( Assume Process Z executes it.)
o For Process X
+ List the PGID, PID, process descriptor address of it.
+ List the PID and process descriptor address of the login session leader of it.
+ List the PID and process descriptor address of each other process that belongs to the same Process Group as Process X's.
o For Process Z
+ List the PGID, PID, process descriptor address of it.
+ List the PID and process descriptor address of the login session leader of it.
+ List the PID and process descriptor address of each other process that belongs to the same Process Group as Process Z's.
* Project Submission:
o The due day is 4th Dec. 2007.
o On site demo for this project is NOT required.
o Your must sumbit your project report in paper form, not in e-mail form, to the TA.
o Late sumbission is NOT accepted.
* Tips
o You can add a new system call to perform the printing out job.
o Check the "Referenced Material" part of the Course web site to see how to add a new system call in Linux.

沒有留言: