Comp111 - Quiz 1 Review 1

Oct 6, 2009 - closed book



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

  1. The condition in which two processes are waiting for each other is called ________1________.
  2. In a virtual memory hierarchy, disk is used because it is ________2________ and ________3________ and ________4________ than cache.
  3. In the code:
    if ((pid1=fork())) { 
        FILE *write = fdopen(fd[1],"w"); close(fd[0]); 
        fprintf(write, "hi there!\n"); 
        fflush(write); fclose(write); 
        pid2=wait3(&status, 0, &usage); 
        printf("exit code for %d is %d\n", pid2, status); 
    } else { 
        FILE *read = fdopen(fd[0],"r"); close(fd[1]); 
        fgets(buf,1024,read); fclose(read); 
        printf("child %d got: '%s'\n", getpid(),buf); 
    The top clause is executed by the ________5________ while the bottom clause is executed by the ________6________ process. fd[0] is called a ________7________ while read is called a ________8________ If the fflush and fclose(write) calls are omitted from the top clause, the program will ________9________. At the end of both clauses, pid1 and pid2 will be ________10________.
  4. Consider the code:
    void (*oldhandler)(int); 
    ________11________ nu,old; 
    nu.mask=0; // don't block any
    nu.flags=0; // nothing special
    sigaction(SIGINT, &nu, &old); 
    registers a signal handler that says to call ________12________ when the user types the character ________13________. In the code, &old has the type ________14________.
  5. Operating systems would not be so interesting a subject if ________15________ and ________16________ took no time at all. The fact that these take time means that there is no ________17________ solution to balancing performance metrics such as ________18________ and ________19________.
  6. A thread is also called a ________20________ process.