COSC 4330 FIRST MIDTERM March 1, 2000 This exam is closed book. You can have one sheet of notes. 1. Answer in one sentence to each of the following questions: (5x5 points) (a) What is the major disadvantage of datagrams over virtual circuits? (b) Why is memory protection always implemented in hardware? (c) What is the major advantage of monolithic kernels over microkernels? (d) What is the major disadvantage of non-preemptive scheduling policies? (e) Why is the fork() system call so expensive? 2. What is the major disadvantage of the master-slave approach in operating systems for multiprocessor architectures? (5 points) What is its only advantage? (5 points) 3. How many lines of output will the following program print out? (5 points)? main(){ fork(); printf("Hi!\n"); fork(); } The program will print ____________ lines. 4. Contrast the respective advantages and disadvantages of user- level and kernel-level threads. (20 points) 5. How can you simulate blocking sends using only non-blocking sends and non-blocking receives? (10 points) 6. List the two state transitions leaving the waiting state and indicate what events can cause them (2×5 points) 7. Consider the following system V scheduler, which contains two errors: (4x5 points) #ts_quantum ts_tqexp ts_slpret ts_maxwait ts_lwait LEVEL 800 0 1 4000 0 # 0 400 0 2 2000 2 # 1 200 1 3 1000 3 # 2 100 3 3 500 3 # 3 On level ___ parameter ______________ should be set to _____ On level ___ parameter ______________ should be set to _____