Comp111 - Quiz 1 Answers

Oct 7, 2015 - closed book



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

  1. In ____round-robin____ scheduling, the goal is to allot equal amounts of time to all runnable processes, while in ____batch____ scheduling, the goal is to accomplish as much computation as possible. In ____real-time____ scheduling, the goal is to respond to external events as quickly as possible.
  2. The ____fork_______ system call creates an exact copy of a process, that differs only in the ____return value_______ of ____fork____. The execl system call runs a new process; it erases current ____memory____ but preserves ____environment variables____ and open ____files____. After a child process ends, the parent can call ____wait____ to reap the exit code from the process. This can be done in response to the signal ____SIGCHLD____.
  3. More generally, a process communicates with the operating system via system calls, that in turn communicate with device ____drivers____ when necessary. These, in turn, manage device ____state____. When a device needs attention from a process, it sends a ____signal____ to the process.
  4. Processes can communicate via ____pipes____ that are essentially first-in, first-out character queues. These are ____preserved____ when a process duplicates itself, and one can use the ____dup____ system call to remap the standard input and output for the process. To do formatted I/O, one can use ____fdopen____ to obtain a file pointer from each file descriptor. A common danger in using file pointers is to forget to ____flush____ a file pointer, leading to output never being sent. This is not a problem for file descriptors, because writes to them are not ____buffered____.
  5. The state code ____D____ in status corresponds to "uninterruptable" wait, which is different than sleeping only because the scheduler is not permitted to stop it.
  6. (Extra Credit) When the operating system doesn't want to know about a type for any reason, it declares variables of that type as ____void *____ in system calls.