CS 110 Homework Assignment 1
Due: 27 January, 9PM

The material for the questions below can be found in any operating system text.
Remember, no hand written material. Use a text processor - you might try troff or latex/xfig.
Also remember to date and time stamp your homework.

  1. Points 3:
    S.1.7, pg. 21, Define the essential properties of the following types of operating systems: Batch, Interactive, Time Sharing, Real Time, and Distributed.
  2. Points 2:
    s.2.2,
    How does the distinction between monitor mode and user mode function as a rudimentary form of protection (security) system?
  3. Points 2:
    s.2.3, What are the differences between a trap and an interrupt? What is the use of each function?
  4. Points 2:
    Tanenbaum #1.6, pg 26,
    Which of the following instructions should be allowed only in kernel mode?
    1. Disable all interrupts
    2. Read the time-of-day clock
    3. Set the time-of-day clock
    4. Change the memory map
  5. Points 2:
    Tanenbaum #1.12, pg 26,
    Why is the process table needed in a timesharing system? Is it also needed in personal computer systems in which only one process exists, that process taking over the entire machine until it is finished?
  6. Points 2:
    Tanenbaum #2.3, pg 71,
    Explain the difference between busy waiting and blocking.
  7. Points 5:
    Using the figure handed out in class, write a small program (C++) that has a parent and child process. The parent process forks the child, then calls a function which prints out the parent and child process id (with a tag indicating which pid is which). The parent then waits for the child to complete.

    Once forked, the child calls a function which sleeps for a period of seconds where the sleep time in seconds is (command line) input as a startup parameter to the program (data sharing between parent and child). Once the child wakes up, it prints out the date (do not use system to do the date, but find the underlying OS system call) and terminates.

    The printout should delineate between parent and child. Turn in a copy of your program and a script file of its execution (do a man script if you do not know what a script file is). On the script file, differentiate between parent and child output.
    If you have problems with I/O, then make sure to flush the buffers.

  8. Points 5:
    Write a small program (C++) that takes input from the user via the command line and checks that input for validity, and prints out the date as mm/dd/yy . The 1st parameter is a character string of 3 characters that is the abbreviation of the month. The 2nd parameter is an integer that is the day of the month. The 3rd parameter is an integer specifying the year. You do NOT have to worry about the user putting a character in place of an integer, but you do need to worry about the range of integers, e.g., negative where you really want positive. Turn in a copy of your program and a script file of its execution, make sure to show handling of lousy input. Do NOT worry about leap years. Do worry about different days in each month, and the case of the input.
  9. Points 3:
    Determine an alias to get ps to print out all the processes assigned to a user. What do time and C tell you about each job. Also, add this alias to your shell startup script.
  10. Points 3:
    On turing which manual section holds the descriptions of the system calls.

Last modified Jan 25, 01 by mike@cs.hmc.edu