CS502 Practice Mid-Term Exam

  1. Explain why a Micro-Kernel architecture is one of the easiest OS structures to extend to a distributed system.

  2. What are the various fields that need to be saved in a process control block (PCB)? Do we have to save the general purpose registers? Why or why not?

  3. In class, we noted that the Dispatcher() function does not return in the normal fashion. What did we mean by that?

  4. What are the possible outputs when the following code is compiled and run simultaneously in two separate processes on a Unix system?

        #include < stdio.h >
        #include "shm.h"		/* for our shared mem/sem primatives */
        int main(int argc, char *argv[]) {
          int *num;
          num = (int *) shmattach(502);
          if (num == NULL) {
    	num = (int *) shmcreate(502, sizeof(int));
    	*num = 0;
          *num = *num + 1;
          printf("%d\n", *num);

  5. Five processes are ready to run. Their CPU burst times are 5, 12, 1, 7 and 2. In what order are they run under a FCFS scheduling algorithm? What is the average waiting time? How close is this to the best average waiting time we could have had for these processes? What is the throughput?

  6. Modify Peterson's Solution as shown in class to properly synchronize 3 processes instead of only 2. You can add shared variables as needed.

  7. True or False:

    1. Conditional critical regions allow you to solve more synchronization problems than do semaphores.
    2. You will never get deadlock if you use semaphores.
    3. A process may still be starved in a correct critical region solution.
    4. Disabling interrupts, even by the operating system, is always a big no-no.
    5. Monitors are more commonly provided by today's operating systems than are semaphores.

  8. In the dining philosopher's solution shown in class, suppose philosopher 2 was absentminded and never let go of his left fork, even while thinking. If all the other philosophers behaved normally and kept thinking and eating, what would be the eventual outcome of the system?

  9. Modify the dining philosopher's solution shown in class to have the "odd" philosophers pick up their "left" forks first and the "even" philosophers pick up their "right" forks first. Does this solve the problem of potential deadlock?

  10. Threads are often called "lightweight" processes. Why? What is "light" about them?

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

    1. If a memory reference takes 175 nanoseconds, how long does a paged memory reference take?
    2. If we add associative registers, and we have a 95 percent hit-ratio what is the effective memory access time? Assume access to the associative registers takes 5 nanoseconds.

  12. Fragmentation:

    1. What kind of fragmentation do we have with paging? Given N processes in memory, how much fragmentation do we have?
    2. What kind of fragmentation do we have with fixed partitions? Given N processes each in size M memory partitions how much fragmentation do we have?

  13. Consider the StartUsingProcessTable() function for the Simple Operating System that we looked at in class. Is there busy waiting? If so, why is it ok here? If not, what kind of waiting is it?

Return to the CS502 Home Page