Comp111 - Quiz 1 Review 2 Answers

Oct 6, 2009 - closed book

Name:___________Answers_____________

Login:____couch_____

Please fill in the blanks. Each blank is worth 5 points.

  1. The difference between signal(2) and sigaction(2) is that signal only allows one to set the ________handler________ for a specific signal, while sigaction allows one to additionally specify the ________signal mask during handling________ and various other options. While signal is deprecated, sigaction is part of the POSIX standard. This means that code that utilizes sigaction is more likely to be ________portable________ among several operating systems.
  2. The signal SIGINT corresponds to typing ________control-C________ on a keyboard. Signal SIGKILL tells a process to die ________immediately/quickly/without cleanup________. In the C call kill(547,SIGKILL); 547 is a ________process identifier________ while the type of the value SIGKILL is ________integer________.
  3. A signal handler must have the declaration
     
    void handler(________int________); 
    
    In passing that handler as a function argument, one declares the signal function as
     
    sighandler_t signal(int signum, sighandler_t handler);
    
    In this, sighandler_t is a ________typedef________ that represents "pointer to ________function________."
  4. In an operating system, the ________kernel/signal stack________ handles nested or concurrent signals while the ________user stack________ handles subroutine calls.
  5. To read the contents of a directory in unix (e.g., /proc), one uses the ________opendir________ and ________readdir________ system calls.
  6. The context of a process contains value for the program counters and other ________registers________ as well as a ________map________ of memory used by the program.
  7. The difference between a file descriptor and a file pointer is that a file pointer contains a ________buffer________ that stores information already read from the device but not yet consumed by the process.
  8. In /proc, the ________utime________ parameter depicts time spent computing in the user's program, while the ________stime________ parameter depicts time spent in system calls. The ________"resident set size"/resident/rss________ parameter depicts the amount of physical memory in use by a process, not including virtual memory.