COSC 4330 MIDTERM 10/14/1999 Closed Book. You can have one sheet of notes. 1. For each of the statements below, indicate in one sentence whether the statement is true or false (2 points), and why (3 points). (a) Disk drive access times have been doubling every year for the last two or three years. FALSE, they have actually decreased (b) To reduce I/O costs, we should try read or write as many useful data as possible during each disk access TRUE, we will need less disk accesses to get the same amount of data (c) A system without privileged instructions cannot be made safe. TRUE, user programs can directly access disk drives (d) In a master/slave multiprocessor organization, there can be several copies of the kernel running at the same time. FALSE, the master processor is the only one on which the kernel can run. (e) Most scheduling policies decrease the priority of processes that have exhausted their slice of CPU time. TRUE, other processes are favored. (f) In BSD UNIX, the priority of a process is function of its past CPU usage. TRUE. 2. Answer in one sentence to each of the following questions: (4*5 points) (a) What is the major disadvantage of microkernels? Each system call involving a user-level server will require four context switches instead of two. (b) How does the System V.4 scheduler prevent process starvation? It changes the priority of processes that waited more than the maximum waiting time for their priority level. (c) What is the major advantage of kernel-supported threads? They do not block the whole task when a thread is doing a blocking system call. (d) When should we worry about the ordering of bytes inside words? In remote procedure calls between to different machines. 3. A good scheduling policy should (a) be fair, (b) minimize response time for interactive users, and (c) maximize system throughput. How does the round robin policy fare with respect to these three criteria (3x5 points)? (a) round robin is fair as it does not favor any type of processes (b) round robin can provide a low response time for interactive users by using a small time slice (c) round robin cannot provide at the same time a small response time for interactive users and a good system throughput as a small time slice involves too many context switches. 4. What would be the major disadvantage of using non-blocking receives to build a server? (5 points) The server would have to do busy waits. 5. How many processes will the following program fork? (5 points)? main(){ fork(); fork(); fork(); } The program will fork _____7______ processes. (not counting the original process) 6. List the three state transitions bringing a process into the ready state and indicate what events can cause them (3x5 points) -- returning from the RUNNING state after a timer interrupt or the arrival of a higher priority process -- leaving the WAITING state once a system request has been completed -- returning from the READY-SUSPENDED state 7. What would be the effect of executing the following program fragment? (10 points) int pda[2]; int pdb[2]; pipe(pda); pipe(pdb); close(2); dup(pdb[1]); close(0); dup(pda[0]); The program will read its standard input from pda[0] and redirect its standard error to pdb[1].