CMSC 421, Spring 2006, Sample Study Problem Set for Midterm 1
Prof. Krishna Sivalingam



  1. What is the purpose of system calls? Explain how the operating system handles a system call.
  2. Compare the layered and the micro-kernel approaches to system design - describe the relative advantages and disadvantages of each scheme.
  3. What are the benefits and the determents of each of the following? Consider both the systems and programmers' perspectives.
    1. Direct and Indirect Communication
    2. Symmetric and asymmetric communication
    3. Fixed-size and variable-sized messages.

  4. What are the differences between user-level threads and kernel-level threads? Under what circumstances is one type better than the other?
  5. Of the different user to kernel thread mapping models, which would be most fair in terms of allocating equal amount of CPU time per process (that consists of multiple threads)? Explain why.
  6. The first known correct software solution to critical section problem for two process was developed by Dekker. The two processes, P0 and P1, share the following variables:
                  Boolean flag [2];   /* initially False */
                 Int turn;
    

    The structure of process Pi (i = =0 or 1), with Pj (j= =0 or 1) being the other process, is
                             Do
         				{
    
    				   	Flag[i] = true;
    					
    					While (flag [j])
    					{
    					   if (turn = = j)
    					   {
    						flag [i] = false;
    						while ( turn = = j) {};
    						flag [i] = true;
    					    }
    					}
    
    
    					Critical Section
    
           
    					Turn = j;
    
    					Flag [i] = false;
    
    
    
    					Remainder section
    
    				}  While (TRUE)
    
    
    

    Prove that the algorithm satisfies all the three requirements for the critical section problem.
  7. Write the solution to the sleeping barber problem, described in the list of problems at the end of Chapter 6. List the synchronization variables and the logic to be used.