CS502 Practice Midterm Exam Solution

  1. The micro-kernel. A micro-kernel moves all non-essential OS functions to the user level. What's often left is a message passing structure that communicates info back and forth between user level processes. This message passing structure can be modified to work across a network, allowing traditional OS services to be distributed.

  2. Context switching is when the OS stops executing one process and starts executing another. The "context" of the first processes is switched to the "context" of the second. The process table contains all the information required to switch context from one processes to another. In addition, it can holds the state of the processes that need to be updated as contexts are changed for both the old and new processes.

  3. Multiple part question:

  4. An operating system runs the idle process or idle thread when it has nothing to do. This is often just a tight, infinite loop (see our simple OS). It stays there until it receives and interrupt.

  5. Here they are:

       n = 7
       n = 12 (7 done first)
    
       n = 5
       n = 12 (5 done first)
    
       n = 5
       n = 5 (clobber 7)
       
       n = 7
       n = 7 (clobber 5)
    
       n = 7
       n = 5 (switch before print)
    
       n = 5 
       n = 7 (switch before print)
    
       n = 7 (fork failed)
    

  6. Preemptive scheduling algorithms interrupt the current running process before it has finished it's CPU burst. This can be because of an interrupt unrelated to the running process or because of a timer interrupt in case the quanta has expired. Preemptive algorithms achieve better utilization of computer resources by allowing the CPU the parallelize more devices. In addition, preemptive scheduling algorithms favor interactive applications by giving them more chances to run since they tend to have shorter CPU burst times.

  7. (See Tannenbaum p. 30 or the class slides.)

  8. A busy waiting process is in running state or ready state. It wastes cpu cycles, but no context switch is required. The block operation places a process into a waiting queue associated with the semaphore, and the state of the process is switched to the waiting state. Then, control is transferred to the CPU scheduler, which selects another process to execute. The blocked process wastes almost no CPU cycles.

  9. No, the given solution does not work in at least two ways. Mutual exclusion can be violated if process 0 says its 1's turn. 1 says ok and starts to go in. Then process 0 comes back up and tries to enter the critical region. Progress may also be violated if 0 exits the critical region and comes back up and enters before 1 gets chance to test it and go in.

  10. Bits:

  11. Times are:

  12. The physical addresses are:

    1. 219 + 430 = 649
    2. 2300 + 10 = 2310
    3. illegal reference, trap to OS
    4. 1327 + 400 = 1727
    5. illegal reference, trap to OS

  13. (None available yet.)

  14. (None available yet.)

  15. (None available yet.)


Return to the CS502 Home Page