CS3013 Practice Mid-Term Exam

  1. Briefly describe why a virtual machine operating system structure is a good environment for developing new operating systems.

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

  3. Modify the SOS Dispatcher to support a class of SCHED_IDLE processes that get selected to run only when they are no normal processes to run. Show any needed changes to the struct ProcessDescriptor data structure.

  4. Consider the following incomplete solution for a basic Unix shell:

          while (1) {
    [1]     _A____
            if (id>0) {
    [2]       _______     
    [3]       _______     
            } else {
    [4]       _______ 
    [5]       _______
    [6]       _______

    Indicate where each of the following pseudo-system calls should go in the above code. The first one has been done for you:

      A. id = fork()
      B. call execvp(cmd, args)
      C. wait()
      D. print out "this is the child process"
      E. print out "this is the parent process"
      F. exit()

  5. Consider the following mutual solution to a critical-section problem:

      #define TRUE 1
      #define FALSE 0
      int lock;         /* shared between two processes */
      while (1)      {
        while (lock)  /* Loop until safe to enter */
            ; /* do nothing until FALSE */
        lock = TRUE;
        /* do critical region stuff */
        lock = FALSE;

    Does it work? Explain why or why not.

  6. 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.

  7. True or False:

    1. You cannot get deadlock with semaphores.
    2. The operating system can disable interrupts to protect a critical region.
    3. A process may still be blocked indefinitely in a correct critical region solution.
    4. Semaphores are more commonly provided by operating systems than are monitors.

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

  9. Four processes are ready to run. Their CPU burst times are 5, 12, 1 and 7. 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?

Return to the CS3013 Home Page