Sample Midterm Exam Questions
Sample Midterm Exam Questions
Sample Midterm Exam Questions
Stewart Weiss
Sample Midterm Exam Questions
2. A machine has a base CPI of 2 clock cycles. Measurements obtained show that the instruction miss
rate is 12% and the data miss rate is 6%, and that on average, 30% of all instructions contain one data
reference. The miss penalty for the cache is 10 cycles. What is the total CPI?
Effective CPI = 2.0 + instruction miss cycles + data miss cycles
= 2.0 + 0.12*10 + 0.30*0.06*10 = 2.0 + 1.2 + 0.18
= 3.38
3. A machine has a 500MHz system clock. Memory takes 30 ns to access a word. How many clock cycles
is this?
Clock cycles to access a word
= 30 ns/(1 clock cycle) * ( 500 * 10^6 clock cycles/sec) * ( 1 sec/10^9 ns)
= 30 * 500 * 10^6 * 10^-9
= 15000 * 10^-3 = 15 clock cycles
4. A machine has a 32-bit virtual address space and a 16KB page size. It has 1GB of physical memory.
How many pages does a process have? How many bytes are needed for a page table, assuming 4 control
bits and that disk addresses are stored elsewhere?
Pages per process = 2^32 bytes * (1 page / 16*2^10 bytes) = 2^32 / 2^14
= 2^18 = 256K pages
5. A machine with a two level cache has a base CPI of 1.5 when all references hit the primary cache.
Given the following characteristics:
• a clock rate of 250MHz
• memory access time of 100ns
1
CSci 360 Computer Architecture 3 Prof. Stewart Weiss
Sample Midterm Exam Questions
6. Draw a picture showing the organization of a direct-mapped cache with 16 words per block, with
a capacity of 128KB. Show any multiplexors, gates, needed. Show how a 32-bit physical address is
mapped to a cache block.
Cache capacity is 128KB. Each block has 16*4 = 64 bytes. There are 128K/64 = 2K = 2048 blocks.
The bytes oset is 2 bits, the word oset is 4 bits (16 = 2^4) and the index is 11 bits since 2K = 2^11.
That leaves 15 bits for the tag.