This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: University of California, Berkeley College of Engineering Computer Science Division EECS Spring 2000 Prof. Michael J. Franklin Midterm Exam #1 SOLUTIONS February 28, 2000 CS 162 Operating Systems Your Name: Anne Cerky SID and 162 Login: 123456789 cs162zz TA Name: E Djikstra Discussion Section: Section 13 - Sunday 7:30 am General Information: This is a closed book examination. You have 1 hour and 20 minutes to answer as many questions as possible. Partial credit will be given. There are 100 points in all. You should read all of the questions before starting the exam, as some of the questions are substantially more time-consuming than others. Write all of your answers directly on this paper. Be sure to clearly indicate your final answer for each question. Also, be sure to state any assumptions that you are making in your answers. Please try to be as concise as possible . GOOD LUCK!!! Problem Possible Score 1. Thread Basics (3 parts) 20 20 2. Synchronization (5 parts) 35 35 3. Using Semaphores (3 parts) 15 15 4. Deadlock (3 parts) 15 15 5. Atomicity (2 parts) 15 15 TOTAL 100 100! CS 162 Spring 2000, Midterm Exam #1 February 28, 2000 Page 2 of 2 Question 1 [ 3 parts, 20 points total]: Thread Basics (Assume Mesa-style monitors throughout unless explicitly stated otherwise) a) (4 points) Because personal computers were intended to be used by a single person at a time, early PC operating systems such as MSDOS provided only a single thread of control and a single address space. Even assuming only one person uses the computer at a time, briefly state a problem or limitation resulting from this approach. The two most popular correct answers were: 1. Cant do more than one task at a time which means either users have to wait for one task to finish before working on another (e.g., cant read email while printing) or resources would be used inefficiently (cant overlap I/O and CPU). 2. Single address space leads to protection problems --- user program can overwrite parts of the operating system. Partial credit was given if no implication was stated. b) (10 points) Given the three thread states: running, runnable (i.e., ready), and waiting , state which of the six possible thread transitions are allowed and give an example of why a thread would follow such a transition. Runnable (Ready) & Running; //Chosen to run by OS Scheduler Running & Runnable (Ready); //Time-sliced out or called Yield() Running & Waiting; // Requests I/O, lock, or wait on another thread Waiting & Runnable (Ready) //Event completion 1 point for each correct transition plus 1 point for each correct example. 1 Point each for not listing the two illegal transitions. c) (6 points) What state information do you need to save/restore about threads when performing a context switch?...
View Full Document
This homework help was uploaded on 01/30/2008 for the course CS 162 taught by Professor Kubiatowicz during the Spring '02 term at University of California, Berkeley.
- Spring '02
- Operating Systems