Comp111 - Quiz 1

Sept 29, 2011 - closed book



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

  1. The scheduling problem is to insure that ____processes____ share time appropriately with others. ____Batch____ scheduling runs each one until it must wait, while ____round-robin____ scheduling shares time equally among competing ones. The ____load average____ is the average number of these that are ready to run.
  2. The operating system communicates with processes via ____signals____, while a process communicates with the operating system via system calls____.
  3. Assignment 1 is based upon the trick that a call to nanosleep with zero arguments returns control to the process ____(immediately) after____ the next time processes are checked for whether they are running.
  4. In an operating system, ____knowledge/information____ boundaries determine what information one part of the operating system has about other parts. In particular, the Operating system does not know, for a process, what ____language____ the corresponding program is written in. Meanwhile, each process executes as if it is the ____only____ process running.
  5. A process contains four main memory "segments". The ____text____ segment contains a read-only version of your program that is ____shared____ by all processes that run the program. The ____stack____ segment contains variables created by subroutine invocation.
  6. The ____fork____ system call creates an exact duplicate of a process, while the ____exec/execl/execve/...____ system call loads a new program in place of the current process. The ____wait/wait3/...____ system call reaps the child status code, which is set by calling the ____exit____ system call.
  7. The declarations
    typedef int (*foo)(int,double); 
    foo bar; 
    mean that foo is a ____type/typedef____, bar is a ____pointer____ to function, and the return type of bar(1,2.0) is ____int____.
  8. Extra credit. The reason that I usually write
    if ((pid=fork())) { 
    rather than
    pid = fork(); 
    if (pid!=0) { 
    is that the former is a bit faster, because less ____assembly language instructions/steps____ are used in implementing it.