Final Exam Solutions
CS 213 Fall 2006
Value FP bits Rounded val Comment
Copyright By PowCoder代写 加微信 powcoder
1/32 000 00 0 denorm, round down to zero
1/16 000 01 1/16 smallest positive denorm, exact
3/32 000 10 1/8 denorm, round up
1 011 00 1 normalized, exact
11 110 10 12 normalized, round up
12 110 10 12 normalized, no rounding
Example solutions:
type_t: long, N=4
type_t: int[2], N=5
type_t: long double, N=3
int looped (int a[], int n) {
int x = 0;
for(i = 0; x < n; i++) { if (x < a[i]) A. &buf = 0x55683a68 B. %ebp = 0x55683a78 C. ret addr = 0x08048bf9 D. %esp = 0x55683a58 E. 00 00 00 00 00 00 00 00 00 00 00 00 20 8b 04 08 1. CPE = 15/3 2. CPE = 10/3 3. CPE = 7/3 4. CPE = 7/3 5. CPE = 10/3 -1 if you forgot to divide by three. (a) | 10 CT | 1 CI | 3 CO | (b) CI = 0x1, CO = 0x4 (a) (i) 7 misses, (ii) 13 misses (b) (i) 2 misses, (ii) 8 misses A. abc, bac Problem 10 Problem 11 B. The deadlock occurs because mutex4 and mutex2 are allocated in different orders. Here is one example: t1p4 -> t2p1 -> t2p2 -> t2p4 -> t1p2
At this point, thread 1 is blocked forever on mutex2 and thread 2 is
blocked forever on mutex 4.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com