Fa05 midterm - Page 1/20 University of California Berkeley College of Engineering Computer Science Division ⎯ EECS Fall 2005 John Kubiatowicz

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Page 1/20 University of California, Berkeley College of Engineering Computer Science Division ⎯ EECS Fall 2005 John Kubiatowicz Midterm I SOLUTIONS October 12 th , 2005 CS162: Operating Systems and Systems Programming Your Name: SID Number: Discussion Section: General Information: This is a closed book exam. You are allowed 1 page of hand-written notes (both sides). You have 3 hours to complete as much of the exam as possible. Make sure to read all of the questions first, as some of the questions are substantially more time consuming. Write all of your answers directly on this paper. Make your answers as concise as possible. On programming questions, we will be looking for performance as well as correctness, so think through your answers carefully. If there is something about the questions that you believe is open to interpretation, please ask us about it! Problem Possible Score 1 25 2 17 3 20 4 18 5 20 Total CS 162 Fall 2005 Midterm Exam I October 12, 2005 Page 2/20 [ This page left for π ] 3.141592653589793238462643383279502884197169399375105820974944 CS 162 Fall 2005 Midterm Exam I October 12, 2005 Page 3/20 Problem 1: Short Answer Problem 1a[2pts]: Suppose a thread is running in a critical section of code, meaning that it has acquired all the locks through proper arbitration. Can it get context switched? Why or why not? Yes it can get context switched. Locks (especially user-level locks) are independent of the scheduler. ( Note that threads running in the kernel with interrupts disabled would not get context-switched. ) Grading Scheme: One point for the correct answer and one point for the explanation Problem 1b[3pts]: What are some of the hardware differences between kernel mode and user mode? Name at least three. There are many differences. They all involve protection. Here are a few possible answers: 1) There is a bit in a control register that is different (say 0=kernel, 1=user). 2) Hardware access to devices is usually unavailable in user mode. 3) Some instructions are available only in kernel mode. 4) Modifications to the page tables are only possible in kernel mode. 5) The interrupt controller can only be modified in kernel mode. 6) Other hardware control registers (such as system time, timer control, etc) are available only in kernel mode. 7) Kernel memory is not available to users in user mode. Grading Scheme: One point for each of the three differences Problem 1c[3pts]: Name three ways in which the processor can transition from user mode to kernel mode. Can the user execute arbitrary code after transitioning? 1) The user program can execute a trap instruction (for a system call) 2) The user program can perform a synchronous exception (bad address, bad instruction, etc) 3) The processor transitions into kernel mode when responding to an interrupt....
View Full Document

This homework help was uploaded on 01/30/2008 for the course CS 162 taught by Professor Kubiatowicz during the Fall '02 term at University of California, Berkeley.

Page1 / 20

Fa05 midterm - Page 1/20 University of California Berkeley College of Engineering Computer Science Division ⎯ EECS Fall 2005 John Kubiatowicz

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online