CS代考 Final exam solutions

Final exam solutions
15-213 Fall 2010

1. client server

Copyright By PowCoder代写 加微信 powcoder

listen x 3
connect 2 x
accept x 4
socket 1 1

2-d 3-a 4-b 5-c 6-b 7-c 8-a 9-d 10-d
11-c 12-a 13-b 14-c 15-d 16-d 17-b 18-b 19-d

pos inf: 0 1111 000
nan: x 111 yyyy (where yyyy not 0000)

format A bin val format b val
largest normalized: 0 1110 111 240 0 1110 1111 248
smallest positive: 0 0000 001 1/512 0 0000 0001 1/1024
Negative one: 1 0111 000 -1 1 0111 0000 -1
2.625: 0 1000 010 2.5 0 1000 0101 2.625

1. continue
2. a[k] == k

Extra credit: Given an array consisting entirely of integers between 0
and n – 1 (inclusive), rofl returns an integer which occurs more than
once, if one exists, and -1 otherwise.

type1_t: any type t s.t. sizeof(t)==4 (e.g., int, unsigned int, etc)
type2_t: char

N, Gives offset of 28
N, Gives offset of 48
N, Gives offset of 32.

Stack at point A:
callee saved esi
callee saved ebx

Stack at point B:
callee saved esi
callee saved ebx
tree->left

A. 4 misses
B. 16 misses
C. 16×16 will have MORE misses than 17×17

Procs: cnt = 2
Threads: cnt = 4

1. 32 byte pages
2. 16 entries/page directory
3. 2-byte page directory entries
4. 128 entries/page table
5. 2-byte page table entries

**********
Problem 10
**********
snippet 1: Possible outcomes: nothing, “a”, “b”, “ab”, “ba”
snippet 2: Possible outcomes: “bac”, “bca”, “does not terminate”

**********
Problem 11
**********
prod_sem=10 /* 10 slots */
cons_sem=0 /* 0 items */

/* wait for two slots */
P(prod_sem)
P(prod_sem)
produce2()
/* signal two new items */
V(cons_sem)
V(cons_sem)

/* wait for three items */
P(cons_sem)
P(cons_sem)
P(cons_sem)
consume3()
/* signal three new slots */
V(prod_sem)
V(prod_sem)
V(prod_sem)

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com