UNIVERSITY OF HOUSTON Department of Computer Science COSC 4330—Fundamentals of Operating Systems MIDTERM EXAMINATION March 4, 1996 This exam is 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) Memory protection prevents user processes from directly accessing the file system. b) Most scheduling policies decrease the priority of processes that have exhausted their slice of CPU time. c) Most servers process all incoming requests in a purely sequential fashion. d) Streams are a special kind of virtual circuits. 2. Which system calls should you use to write: a) one program executing as two processes? (5 points) b) two programs executing as a single process? (5 points) 3. What are the major advantage (5 points) and the major disadvantage (5 points) of kernel-supported threads? 4. What is the main difference between the at most once and the all or nothing semantics in remote procedure calls? (5 points) Which one is the easiest to implement and why? (5 points) 5. What are the major disadvantages of: a) non-preemptive scheduling policies? (5 points) b) the round-robin policy? (5 points) 6. Consider the following main program fragment: int alpha; alpha = 1; modify(&alpha,&alpha); printf("result = %d", alpha); and the following procedure: modify(int *pone, *ptwo) { (*pone) = (*pone)*3; (*ptwo) = (*ptwo)*2; } // modify What would the program print out: a) if modify was called through a regular procedure call? (5 points) b) if modify was called through a remote procedure call? (5 points) 7. What are the major differences between blocking and non-blocking send primitives? (10 points) 8. When is it a good idea to disable interrupts to ensure mutual exclusion? (2×5 points) 9. Fill the missing parts of this solution to the mutual exclusion problem: (10 points) #define FALSE 0 #define TRUE 1 int can_go; // process that can go int beg[2]; beg[0] = beg[1] = _____________; enter_region(int me) { int other; // pid of other process other = 1 - me; // 0 if 1 and 1 if 0 beg[me] = TRUE; can_go = other; while (beg[other]&&________________________________); } // enter_region leave_region(int me) { ____________________________________________________; } // leave_region ____________________________________________________; } // leave_region --IMPORTANT----IMPORTANT----IMPORTANT----IMPORTANT----IMPORTANT-- Please do not try to answer these questions by yourself BEFORE having a clear idea of what's on the test for which you are studying. Materials covered in each test DO VARY from semester to semester because the pace of the course can change, some materials are be added and other deleted almost every semester. ----------------------------------------------------------------