CS502 Practice Midterm Exam

  1. We discussed four ways in which operating systems are structured. Which of these structures is easiest to extend to a distributed system? Briefly explain why.

  2. What is context switching? How is the process table used in context switching?

  3. Consider the following processes, given their burst times and arrival times:

        Process      Arrival Time   Burst Time
        -------      ------------   ----------
        A            0              8
        B            1              4
        C            2              9
        D            3              5
    

  4. What does the operating system do at process scheduling time when no processes are ready to run?

  5. What are all the possible outputs when the following code is run on a Unix system?

    int n;  /* shared variable */
    
    main(int argc, char **argv)
    {
        n = 0;
    
        if (fork() == 0)
            n = n + 5;
        else
            n = n + 7;
        printf("n = %d\n", n);
    }
    

  6. Explain the difference between a preemptive and a non-preemptive process scheduling policy. Why do all interactive systems use premptive polcies even though these policies have a higher overhead?

  7. Processes can be in one of three states: running, ready and blocked. Show the possible transitions between these states and the reason for each transition.

  8. Explain the difference between busy waiting and blocking.

  9. Consider the code below as a variation of the critical region solution we saw in class:

      shared int turn;          /* set to i or j */
      shared boolean flag[2];   /* set to T or F */
    
      while(1) {
        ...
        flag[i] = true;
        turn = i;  /* traditionally set to j */
        while (turn==j && flag[j]==true) { /* no-op */ }
        ...
        /* critical region */
        ...
        flag[i] = false;
        turn = j;  /* not usually done */
        ...
        /* remainder region */
        ...
      }
    

    Does the above solution satisfy the 3 required critical region conditions? If not, which property or properties is violated?

  10. Consider a logical address space of eight pages of 1024 words each, mapped onto a physical memory of 32 frames.

  11. Consider a paging system with the page table stored in memory.

  12. Consider the following segment table:

        Segment      Base     Length
        _______      ____     ______
           0          219        600
           1         2300         14
           2           90        100
           3         1327        580
           4         1952         96
    
    What are the physical addresses for the following logical addresses?
    1. 0,430
    2. 1,10
    3. 2,500
    4. 3,400
    5. 4,112
  13. Consider the paper "Removing Priority Inversion from an Operating System". What are the disadvantages of simply raising the priority of servicing threads?

  14. Consider the papers on "Inside the Windows NT Scheduler". When does the NT Scheduler put a Thread on the front of it's priority queue rather than the end?

  15. Consider the paper "The Chorus Microkernel". Name two advantages to using a microkernel archetecture?


Return to the CS502 Home Page