hw3 - CSE 422S (Fall 2009) Operating Systems Organization...

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

View Full Document Right Arrow Icon
CSE 422S (Fall 2009) Operating Systems Organization Homework 3 Reading: See Problem 1 Due: Mon, Sep. 28, 2009 Preview: Problem 6 asks you to read an article on system calls. This reading should help you better understand how system calls are implemented for one architecture, the IA32 (Intel). In Problem 8, you are given the source code to part of a test harness for xsshA and are asked to complete the source code so that it can handle a small number of xsshA commands. A real shell interpreter accepts commands from stdin. But the test harness initializes an array with a Fxed command sequence. Having a Fxed set of commands for interpretation will allow you to focus on implementing some core shell interpreter functions. Some students do not complete this problem, but the important part is the e±ort that you put into this problem. The coding required may be more intense than you have experienced in the past (about 100 lines of code), but the journey will prepare you for Project A. Try to look under the hood by inserting debug output that veriFes your understanding of the behavior of the code. Problem 7 will introduce you to a few simple xsshA commands by asking you to write shell scripts using these commands. But since the commands are also found in the bash shell, you should be able to test the same scripts by creating shell scripts and running them in any Unix system. Note that the shell scripts each consist of no more than three or four commands (excluding comments and blank lines). So, there is more thinking involved than writing. Problem 1 (0 Points) [ Gnu C Library ] The Process item in the course Syllabus contains a link to the section of The Gnu C Library Reference Manual which discusses Processes . Read this section. ²ollow the Top link to the Main Menu and familiarize yourself with what is documented in the other sections. Problem 2 (0 Points) [ fork ] Consider the following code fragment: printf("mypid = %d\n", getpid()); for (int i=0; i<2; i++) { pid_t p = Fork(); // never returns an error printf("i = %d (pid = %d), fork returned = %d\n", i, getpid(), p); ... code goes here . .. } a) Complete the code fragment so that it will produce a chain of three (3) processes where the original process is the parent of a child which is the parent of the another child. b) If we assume that process IDs start at 1000 and assigned consecutively for each new
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 11/13/2009.

Page1 / 4

hw3 - CSE 422S (Fall 2009) Operating Systems Organization...

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

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