Homework10-sol - Homework #10 (Solution) 4/11/2003 8:54 AM...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
ECSE-2660 Computer Architecture, Networks, & Operating Systems, Spring 2001 Page 1 of 6 Homework #10 (Solution) 4/11/2003 8:54 AM This homework requires use of a UNIX computer. If you haven’t used one of these before, stoop by the VCC help desk, and pickup some of the handouts on UNIX basics. There is also information available online. Finally, the consultants can help as well. UNIX Processes 1. (20 points) Login to a (preferably, sun) UNIX machine on RCS, and use the man command to look up the manual pages for the following UNIX system calls: fork() getpid() getppid() execve() exit() Note: The UNIX man pages are organized by section, so some functions, such as exit(), may be described under more than one section. For instance, exit is a shell command, as well as a system call. On SunOS, the shell command is exit(1), whereas the system call is exit(3C). Usually, it is best to do "man man" to quickly read the manual page about the man command itself. Often, "man -a <name>" would bring up all manual entries. Answer the following questions. a. (3 points) What type of operating system did you log on to? This information is usually printed at login time on your screen. Sun OS 5.6 (your answer may be different) Grading: 3pts for correct, 0pts otherwise. b. (3 points) How many arguments does the function fork() have, and what do they represent? No arguments for fork() Grading: 3pts for correct, 0pts otherwise. c. (4 points) What does the fork() system call return? Describe the return values for each possible case that you can think of, for instance, if the call is successful or otherwise, and if the process of interest is the child or parent, etc. Returns a process ID ordinarily. If there is an error, it returns -1. If there is no error, after a fork is executed, we could end up with either 0 or 1 depending upon whether the executing process is the child process or the parent process. Grading: 1pt for trying, +3pts for correct. d. (4 points) Under what conditions would fork() fail? Too many processes on the system Not enough resources for the new process, especially virtual memory swap space. Grading: 1pt for trying, +3pts for correct. e. (6 points) What attributes does a child process inherit from its parent? The child process inherits the following attributes from the parent process (from the manual page): real user ID, real group ID, effective user ID, effective group ID environment
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
ECSE-2660 Computer Architecture, Networks, & Operating Systems, Spring 2001 Page 2 of 6 open file descriptors close-on-exec flags (see exec(2)) signal handling settings (that is, SIG_DFL, SIG_IGN, SIG_HOLD, function address) supplementary group IDs set-user-ID mode bit set-group-ID mode bit profiling on/off status nice value (see nice(2))
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/25/2010 for the course ECSE ecse-2340 taught by Professor Wozny during the Spring '09 term at Rensselaer Polytechnic Institute.

Page1 / 6

Homework10-sol - Homework #10 (Solution) 4/11/2003 8:54 AM...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online