CS 350 MIDTERM :: SPRING 2012
Date: Monday, June 25, 2012
Time: 7:00 – 8:50 pm
Instructor: Dave Tompkins
Exam Type: Closed book
Additional Materials Allowed: none
Last Name: SOLUTION
First Name: ____________________________
Student #:
__ __ __ __ __ __ __ __
UW Login: __ __ __ __ __ __ __ __
Signature:
____________________________
Question Out Of
INSTRUCTIONS
1. Before you begin, make certain that you have one exam booklet with 8 pages (double sided)
2. All solutions must be placed in this booklet.
3. If you need to make an assumption to answer a question, state your assumption clearly.
4. When writing code, you should use C or C-like pseudocode. You do not have to worry about
#include statements or semi-colons.
5. If you need more space, use the last page, and indicate that you have done so in the original question.
6. A big gap after a question does not necessarily mean that a long answer is expected.
7. Did you see in the marking guide there's a bonus question? woo-hoo! Make sure you answer it at the end.
8. Relax! Read this instruction as often as needed.
CS350 Midterm
Spring 2012
AVG
1
10
6.2
2
15
9.5
3
5
4.1
4
16
9.0
5
12
10.6
6
4
2.4
7
18
5.8
8
20
11.6
0.9
Bonus
Total
100
60.0
Page 1
Question 1 [10 Marks] (a) [3 Marks] In OS/161 there is a struct thread to represent a thread context and a struct trapframe to represent a trap frame. Describe something that is contained in both structures, and then for each of the structures describe something that it contains that the other does not. Briefly explain why each of the 3 things you describe appears where it does.
Almost ALL registers are stored in a trap frame when a trap occurs (interrupt/syscall/exception), but only a subset are backed up when a thread context switch occurs. So (for example) s1 would be in both, but temp register t0 would only be in the trapframe. The thread context also has threadspecific information, such as