UNIVERSITY OF HOUSTON Department of Computer Science COSC 4330: Fundamentals of Operating Systems MIDTERM EXAMINATION October 7, 1993 CLOSED BOOK: You are allowed one 8.5 by 11" sheet of notes. 1. Given the declaration char text[80][24]; how do you pass the array textby reference to a procedure called firstnum()? (5 points) 2. What is the difference between a uniprogramming and a mul- tiprogramming system? (10 points) 3. How are system calls implemented on most machines having a user mode and a supervisor mode? (10 points) 4. You are hired as consultant by the ACME Computer Company. They have just discovered that timer interrupts do not work on their new microprocessor chip. They ask you whether they will be ever able to build a decent timesharing system using their new chip? Justify your answer. (20 points) 5. Show how an instruction such as RSW r1,r2 which swaps the values of the two registers r1 and r2 can be used to solve the mutual exclusion problem. (20 points) 6. What are the two possible correct values for a mutual exclu- sion semaphore? (5 points) 7. What are the possible outcomes of a DOWN operation executed through a semop() system call? In which states will the pro- cess be left? (10 points) 8. Explain why the following solution to the mutual exclusion problem does NOT work. (20 points) int lock one, lock two; ... process one { process two{ for (;;) { for (;;) { lock one = 1; lock two = 1; while (lock two); while (lock one); crit sect crit sect lock one = 0; lock two = 0; other stuff other stuff } } }/* one*/ } /*two*/ --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. ----------------------------------------------------------------