Homework 5
Homework 5
PID:
Name:
1. Assume that you have a computer with 4KB pages and a 4-entry full-associative
TLB that uses LRU replacement policy. If page must be brought into main
memory, increment the largest page number. If the current TLB content is
Valid tag Physical page number
0 1 0xB 12
1 1 0x7 4
2 1 0x3 6
3 0 0x4 9
and the current page table is
Valid Physical page or in disk
0 1 0x5
1 0 Disk
2 0 Disk
3 1 0x6
4 1 0x9
5 1 0xB
6 0 Disk
7 1 0x4
8 0 Disk
9 0 Disk
10 1 0x3
11 1 0xC
Please identify how many TLB misses and page faults in the following address stream:
0x123D, 0x8B3, 0x365C, 0x871B, 0xBEE6, 0x3140, 0xC049
Answer:
Assume index 0 is the most recent used entry.
TLB {TAG [PPN]} | PT update
0x123D PF 1[D], B[C], 7[4], 3[6]
0x08B3 M 0[5], 1[D], B[C], 7[4]
0x365C M 3[6], 0[5], 1[D], B[C]
0x871B PF 8[E], 3[6], 0[5], 1[D]
0xBEE6 M B[C], 8[E], 3[6], 0[5] |1[D]
0x3140 H 3[6], B[C], 8[E], 0[5]
0xC049 PF C[F], 3[6], B[C], 8[E]
3 Page faults and 3(6) TLB Miss // Page faults happens after TLB misses
2. Assume the virtual address space of the computer is 64 bits, each page is 8KB in
size, each page table entry occupies 8 bytes memory and the system is running 6
processes concurrently.
(1) If the computer uses conventional page table, what’s the total size of page
tables in the system?
VA space: 264
Page size: 213
Page table entries (per process): 264 / 213 = 251
Total Page Tables size = #process * Page table entries * entry size
= 6 * 251 * 8
= 3 * 255 bytes (96PB)
(2) Please identify the false dependencies (WAW and WAR) in the given code
(3) The processor that you’re given is a 2-issue out-of-order processor with
unlimited physical registers and it takes 3 cycles to finish a load/store, 1
cycle to finish other instructions and with a perfect branch predictor.
Assume all instructions are now already in the instruction window. How
many cycles it takes to issue (moving out from schedule to execution) all
the dynamic instructions?
Assume we have two threads A and B to run on these CPUs that include the
following operations (You may assume these processors have full capability of
eliminating false dependencies and all the instructions are already in instruction
queues. If not specified, the instruction will take one cycle to execute):
Thread A Thread B
A1: takes 2 cycles to execute B1: no dependencies
A2: depends on the result of A1 B2: conflicts for a functional unit with
A3: conflicts for a functional unit with B1 (They must use the same one)
A2 (They must use the same one) B3: no dependencies
A4: depends on the result of A2 B4: depends on the result of B2
(1) How many cycles will it take to issue these two threads on each processor?
CPU CMP CPU SMT
Core #1 Core #2
A1 A3
A1 A3 B1 B3
B1 B3
B2
B2 A2
A2 B4
B4 A4
A4
4 cycles for thread A
4 cycles for thread A
4cycles for thread B
3 cycles for thread B