CMSC 412 Midterm #1 (Spring 2003)

1.)                 (20 points) Define and explain the following terms:

a)                   Critical Section

b)                   Safe Sequence

c)                   Deadlock

d)                   Dispatcher

2.)                 (25 points) Synchronization: You need to synchronize the process of getting and making coffee in the CS department lounge.  In the department, there are two types of coffee urns (regular and decaf) and one coffee maker.  If someone goes to get a cup of coffee of one type, and that pot is empty they make a new pot of that type of coffee. Provide a solution using semaphores (include variable declarations and initial semaphore values) to the coffee problem that ensures:

·         Only one person at a time is taking coffee out of the decaf urn

·         Only one person at a time is taking coffee out of the regular urn

·         Only one urn is on the coffee maker at a time

·         If one type of urn is being made and the other has coffee, people can get the type of coffee that is available.

Declarations:

Coffee Drinker(Boolean usesDecaf):

3.)                 (20 Points) Sally Smart decides to test project #1 in the following way: she implements the loading of the user program from the elf file, but does not implement the user segments and instead plans to test running a user program within the kernel segment.  Her argument is that since she is testing, it doesn’t matter that memory security is not provided for the user process. Assuming she is correct about the memory security issue, would her solution work?  Explain your answer.

4.)                  (15 points) In an OS kernel, give two reasons why are system calls done indirectly via a system call number and trap rather than simply calling a subroutine in the kernel?

5.)                  (20 points) OS Structure

a)                   (10 points) Give an example of a mechanism and an example of a policy in an OS

b)                   (10 points) Why did your kernel need to check both the base and extent of the string passed to the printString system call even if your version of libuser.c already checked the pointer?

Web Accessibility