Operating Systems: Lab 1 Preparation Report
Total Page:16
File Type:pdf, Size:1020Kb
Operating Systems: Lab 1 preparation report January 18, 2008 Please answer the following questions in a .txt file, Question 3 and submit the file to the fire system. Describe the output of the following command and the scenarios for which the output in not empty. Preparing the working space Perform the following command % ( ps aux | grep defunct ) Please dedicate a directory for this assignment Write a command that kills a defunct or zombie pro- and download all the source program files (see cess. When should we use such a command? Please ex- http://www.cse.chalmers.se/EDU/OS/lab/). plain what the following command does. % ps aux | grep -v "ˆroot" | wc -l Question 1 Read the page help ulimit, and explain its func- tion. Please design a technique that restricts processes What does the flags -Wall -g means for gcc? from executing programs that proliferate zombie. Can you extend that technique to other resources? The man pages Exploring the existing shell program Please study the manual pages of the following system calls: fork, clone, create, open, close, The strace commands trace system calls and signals in wait, stat, signal, pipe, dup, exit, Linux. Please read the man pages of one of this command execvp, chdir. and study the tracesyscalls script file. Question 2 Question 4 For each of the system calls above briefly describe its Please list the system calls in use in the following com- function, its arguments, the required include files, and all mands using tracesyscalls. (Don’t forget to chmod possible return values. Please look at the following code. the file tracesyscalls.) pid t pid; % date if ( (pid = fork()) == -1) % ls /* react to the reported error */ % ls *.c (Assuming there are c files in the directory.) else if (pid == 0) You may find it useful to activate an interactive mode. /* ... */ % tracesyscalls bash (Use Ctrl-D to exit.) Assuming bash is the shell program. Remember to check the system calls’ return code! Question 5 Resource hygiene Please explain the output of of the following command. % echo $0 On Unix computer operating systems, a zombie process or defunct process is a process that has completed execution but still has an entry in the process table, this entry being still needed to allow the process that started the zombie process to read its exit status. 1.