CS3013 Practice Mid-Term Exam

  1. Explain why a Micro-Kernel architecture is, in theory, more robust than a Monolithic-Kernel architecture. Is Windows-NT a true Micro-Kernel? Explain why or why not.

  2. Select all relevant choices from the list below. The notion of "platform dependence" for various software packages comes from the fact that:

    1. Machine architectures differ from computer to computer
    2. Shells differ from OS to OS
    3. System calls differ from OS to OS
    4. Process scheduling algorithims differ from OS to OS

  3. Critical region access:

    1. What is "busy waiting"?
    2. What is "blocking"?
    3. Consider the multiprocess SOS solution we looked at (use-proc-table.c). Explain why "busy waiting" is acceptable in order to gain access to the process control block.

  4. Why is it (often) faster to context switch between threads than it is to context switch between processes? Be specific. (Hint: see system-thread.h).

  5. In class, we noted that sometimes the Dispatcher() function causes the OS to execute "while (1) { /* no op */ }". When and why does it do this?

  6. Consider compiling and running the following code on a Unix system:

        #include < stdio.h >
        int num;
        int main() {
          num = 1;
          num = num + 1;
          printf("%d\n", num);

    1. What are the possible outputs?
    2. What if the fork() call was changed to a system called, say spawn() that created a new thread instead of a new process. Now, what are the possible outputs?

  7. Four processes are ready to run. Their CPU burst times are 10, 2, 4 and 1. In what order are they run under a SJF 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?

  8. True or False:

    1. Monitors allow you to solve more types of synchronization problems than do semaphores.
    2. Test_and_Set() and semaphores are essentially the same.
    3. "Busy waiting", even by the operating system, is always a big no-no.
    4. Semaphores always let 1 and only 1 process a time past after a wait() call.

  9. 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?

  10. Suppose we tried to modify the Readers/Writers synchronization solution we saw in class to "favor" writers instead of readers:

      /* critical region */
      if (writecount) wait(wrt);
      if (readcount == 1) wait(wrt);
      /* critical region */
      if (readcount == 0) signal(wrt);
    Does this work? Why or why not?

  11. Consider your Project 1. Which of the following fields in the Linux struct task_struct (greatly condensed, here) could be used to solve the problem:

    struct task_struct {
            volatile long state;    /* -1 unrunnable, 0 runnable, >0 stopped */
            long counter;
            long priority;
            int pid;
    Briefly explain how they could be used.

Return to the CS3013 Home Page