Comp111 - Quiz 1 Answers

Oct 2, 2012 - closed book



Please fill in the blanks. Each blank is worth 5 points. Blanks with the same number have the same answer.

  1. An operating system "mediates" between the ___ (physical) hardware____ and user programs. Parts of this mediation include device ____drivers____ that describe how to control external devices, as well as mechanism for ____sharing____ resources such as memory, devices, and computing cycles among several processes.
  2. The difference between a program and a process is that a program lives on disk and describes what to do, while a process lives in ____memory____ and actually does it. A process has -- in addition to a program -- a ____memory map____ that gives it the illusion that it is executing in isolation from other processes.
  3. One difference between interrupts and signals is that interrupts are delivered and processed ____immediately____, while signals are processed when the target process is ____scheduled____.
  4. In a typical linux system, system activity is checked every ____1/100____ of a second, and the running processes are charged with using that amount of time. The extent to which a system is busy is measured via the ____load____ average, which is the average number of processes that are ____ready____ to run.
  5. In a process memory map, the text segment contains a ____read-only____ version of your program, which is ____shared____ by all processes that run the program.
  6. The program
    if (____!fork()____) { exit(0); } 
    creates an unlimited number of zombie processes, because the parent doesn't ____14____ any of their exit codes.
  7. The C library avoids system calls when possible, because each call requires expensive ____context switches____ into ____kernel/system____ mode and back.
  8. When a process asks malloc for a few bytes of memory, the operating system actually allocates the process a ____page____ of memory in response. This remains allocated until the process ____exits/terminates____.
  9. In the five-state model of process execution, a process cannot go directly from "blocked" to "running" because the process must first be placed into the ____ready (to run)____ state.
  10. The ____exec(l)____ system call replaces one process with another.
  11. (Extra credit) The reason that the fork call is not outrageously expensive in time is that all pages -- including writeable ones -- are shared between the two copies of a process until one process ____writes to them____.