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 ________1________ share time appropriately with others. ________2________ scheduling runs each one until it must wait, while ________3________ scheduling shares time equally among competing ones. The ________4________ is the average number of these that are ready to run.
  2. The operating system communicates with processes via ________5________, while a process communicates with the operating system via 6________.
  3. Assignment 1 is based upon the trick that a call to nanosleep with zero arguments returns control to the process ________7________ the next time processes are checked for whether they are running.
  4. In an operating system, ________8________ 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 ________9________ the corresponding program is written in. Meanwhile, each process executes as if it is the ________10________ process running.
  5. A process contains four main memory "segments". The ________11________ segment contains a read-only version of your program that is ________12________ by all processes that run the program. The ________13________ segment contains variables created by subroutine invocation.
  6. The ________14________ system call creates an exact duplicate of a process, while the ________15________ system call loads a new program in place of the current process. The ________16________ system call reaps the child status code, which is set by calling the ________17________ system call.
  7. The declarations
    typedef int (*foo)(int,double); 
    foo bar; 
    mean that foo is a ________18________, bar is a ________19________ to function, and the return type of bar(1,2.0) is ________20________.
  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 ________21________ are used in implementing it.