CS 110 Homework Assignment 6
Due: Sunday April 29, 9PM

  1. t.7.2, pg 313.
    2 Points
    Write a UNIX pipeline that prints the eighth line of file Z on standard output.
  2. t.7.5, pg 313.
    2 Points
    When the UNIX shell starts up a process, it puts copies of its environment variables, such as HOME, on the process' stack, so the process can find out what its home directory is. If this process should later fork, will the child automatically get these variables too?
  3. t.7.7, pg 313.
    2 Points
    To what hardware concept is a signal closely related? Give two examples of how signals are used.
  4. t.7.13, pg 313.
    3 Points
    If a UNIX process runs for 1 sec without competition from other processes, how long does it take for its CPU usage counter to get back down to 0?
    "Once a second, all process priorities are recalculated. First, all the CPU usage counters are divided by 2, so that processes are not punished forever for past CPU use. Then each process' priority is calculated according to the formula:
    New priority = base + CPU usage
    The base is normally 0..."
  5. t.7.14, pg 314. 2 Points
    About how long does it take to fork off a child process under the following conditions: text size = 100K bytes, data size = 20K bytes, stack size = 10K bytes, process table size = 1K, user structure = 5K. The kernel trap and return takes 1 msec, and the machine can copy one 32-bit word every 500nsec. Text segments are shared.
  6. t.7.19, pg 314. 4 Points
    When the file /usr/ast/work/f is opened, several disk accesses are needed to read i-node and directory blocks. Calculate the number of disk accesses required under the assumption that the i-node for the root directory is always in memory, and all directories are one block long.
  7. s.21.6, pg 694 4 Points
    Does 4.2BSD UNIX give scheduling priority to I/O or CPU-bound processes? For what reason does it differentiate between these categories, and why is one given priority over the other? How does it know which of these categories fits a given process?
  8. s.10.4, pg 267 4 Points
  9. s.10.12, pg 267 4 Points

Last modified April 5, 1999 by mike@cs.hmc.edu