CS 307 assignments, spring 2002

Things to hand in

  1. Assigned Monday 4/1/02, due Friday 4/5/02. Please submit your source code via HSP.

    Write a Linux program that creates a child process, after which the following steps take place indefinitely.

    1. the parent asks the user to type a string
    2. the parent stores the string in memory shared with the child
    3. the parent sends a signal to the child
    4. the child prints a message making clear that it received the signal and the user's string
    5. the child sends a signal to the parent
    6. the parent prints a message making clear that it received the signal from the child
    7. go to step 1

    On Wednesday, I'll talk in class about shared memory. You can get started before then by leaving out step 2 and the "user's string" part of step 4.

    You'll need to use several system calls, including (but not necessarily limited to) fork, signal, kill, and shmget.

  2. Assigned 4/3/02, due Friday 4/12/02, on paper. Problems 7, 16, 21, 22, 28, 32, 38, 40, 43, and 45 from chapter 2.

  3. Assigned 4/3/02. For each of three major topics (processes, memory management, and files systems), I am going to ask groups of students to investigate how some important operating systems solve certain problems. Since short presentations work best if there are no more than two presenters, and we have 32 people in the class, you will work in pairs, and each pair will do only one presentation. We will line up the first round of presenters in class on 4/3.

    On Wednesday 4/10/02, the chosen pairs will give 10-minute presentations on the following questions.

  4. Assigned 4/12/02, due 8:30 AM Friday, 4/19/02. Write a command shell that supports >, <, |, and &. Include a readme.txt that specifies the limitations, if any, of your shell (for example, if you require the full path of the command to be typed, or if you have not implemented <). You may work in pairs for this assignment.

  5. Assigned 4/19/02, due Friday 4/26/02. The memory groups will give a 10-minute summary of your operating system's memory management system. Some questions you might want to address include:

  6. Assigned 4/22/02, due class time Friday, 4/26/02. Do problems 2, 9, 12, 13, 19 from chapter 3, and 1, 8, 11, 12, 13, 16, 21, 23, 29 from chapter 4.

  7. Assigned 5/12/02, due 8:30AM Monday, 5/20/02. First, go through the hello world syscall exercise. Don't hand anything in for that. Once you are confident that you can add a system call, add the following to the kernel:

    Test the new system call by collecting enough data to determine the average quantum length over a period of ten seconds. Try this under varying conditions (e.g. minimal load, with even X-windows shut off, or heavy load, with some long CPU-intensive program running).

    Hand in hard copies of all the code you add to the kernel, along with the program you write to test your new system call. Also, hand in a summary and brief (one or two paragraphs) discussion of your quantum length observations.

  8. Assigned Monday 5/20/02, due 8:30AM Monday, 5/27/02. Write a program that will generate a report about the program's own virtual memory use. In particular, you should give your program the power to count the page faults it generates, and to report the list of (virtual page #, physical page #) pairs that it uses.

    Hand in hard copies of whatever code you write, including system calls and kernel modifications, if any. Also hand in a report on the memory behavior of your program, and a discussion of your observations.

    When discussing the list of page numbers, make sure to identify the purposes of the virtual pages that got loaded (this page is the system stack, this is the text of the main program, etc.) A handy way to help yourself with this task is to print out pointers to various objects. For example,

    printf( "0x%lx\n", (long)main );

    will print out in hexadecimal the virtual address of the first instruction in main(), while

    char *p = "howdy";
    printf( "0x%lx\n", (long)p );

    will show you where literal strings are stored.

Reading

  1. 4/1/02. Look at the Unix manual pages for the system calls read(), write(), fork(), exec(), signal(), getpid(), getppid(), wait(), and kill(). For system calls like kill() for which there is also a Unix command with the same name, you'll need to specify the manual section number to get the documentation you need. For example, to get the manual page for kill(), you type "man 2 kill".

    Read chapter 1 of Tanenbaum.

  2. 4/5/02. Read chapter 2 of Tanenbaum.

  3. Read sections 3.1-7.

  4. Read sections 4.1-4, 4.6-8.

  5. Read sections 6.1-3.

  6. Read up through the Processes section of The Linux Kernel, by David Rusling.

  7. Read How System Calls Work on Linux/i86 from the Linux Kernel Hacker's Guide.





Jeff Ondich, Department of Mathematics and Computer Science, Carleton College, Northfield, MN 55057, (507) 646-4364, jondich@carleton.edu