for this exam, summer 2020 semester students should ignore question 8c

Problem 1

a b c b c a b b a c

(05)

Problem 2

3 exponent, 2 fraction

[-(2^(3-1)-2), 2^(3-1)-1] [-2, 3]

2 = 10.000 = 1.00 * 2^-1 = 010 00 13 = 1101.000 = 1.101 * 2^3 = 110 101 = 110 10 1/8 = 0.001 = 1.000 * 2^-3 = 0.100 * 2^-2 = 000 10 15/4 = 1111.00 * 2^-2 = 1.111 * 2^1 = 100 111 = 16/4 = 4 = 101 00 = 100.000 = 1.000 * 2^2

010 00 -> 2 110 10 -> 12 000 10 -> 1/8 101 00 -> 4

16 8 4 2 1

(15)

2 = 10.000 = 1.00 * 2^1 = 100 00

Problem 3

rdx = ((y << 4) - y + x)4 + array2 ^ | rax = (8x - x + y)*4 + array1

rdx = (15y + x)4 + array2 ^ | rax = (7x + y)4 + array1

J = 7 H = 15

(22)

Problem 4

sizeof(node) = sizeof(data) + 8 = 32 sizeof(data) = 8 + 16 = 24

  1. gamma
  2. delta
  3. beta
  4. alpha
  5. epsilon

(29)

delta alpha flipped

Problem 5

int loopy(int a[], int n) { int i%edx; int x%ecx = 0; for (i = 0; n%esi > x; i++) { if (a[i] < x) x = a[x]; } return x; }

cmovl means compare less than

(39)

Problem 6

0xffffd834 0x0804839c

24 = 0x?? ?? ?? ?? 20 = 0x?? ?? ?? ?? 1c = 0xffffd838 18 = 0x?? ?? ?? ?? 14 = 10 = uu 0c =

ebp = ...18 edx = (...24) eax = 1 if (edx == 0) leave eax = edx - 1

(NOPE)

0xffffd838

(58)


rip != rsp
be careful: push is move first

esp = 0xrrrrd818, 0xrrrrd810
ebp = 0xrrrrd818
edx = (0xrrrrd824)=arg1=2
eax = 1, 1
81c:
818: 0xffffd838
814: 1
810: 4
80c:

Problem 7

16 way, block 32 byte 1/32 + 1 = 1/2 1/16

(1:02)

single access will at most generate 1 miss
please divide by 2 if there are two access, we count by chance, not occurance

Problem 8

+10+20 child = 30 -5+20 parent = 15

Parent: sum=15 Child: sum=30

Child: sum=30 Parent: sum=15

95030 59030 93050 93500

(1:09)

expect fork() fail
wait only wait for dirrect child

Problem 9

1KB = 1024 byte = 2^10 256KB = 2^18 1MB = 2^20

a. 20 b. 18 c. 12

(6bit)(2bit) 0x(0001) (1111) (0010) (0001) (0011)

VPO=0x213 VPN=0x1F Index = 11 = 3 Tag= 0000 0111 = 0x0E wrong, 7

0x1F, N 0x3, Y 0x0E, -

0x(0001)(0100)213 Tag = 0000 0101 = 0x05

0x14, Y 0x00, N 0x05, 0x13213

(1:26)

Problem 10

foobar foofoo

(1:28)

Problem 11

1 0 10

P(mutex) P(slots)

V(item) V(mutex)


P(mutex) P(item)

V(slots) V(mutex)

(1:32)

Table of Content