175 views

consider a CPU contains 2000 instructions, there are 80 misses in L1 cache and 40 misses in the L2 cache. Assume miss penalty from the L2 cache to memory is 200 clock cycles, the hit time of L2 cache is 30 clock cycles, the hit time of L1 cache is 5 clock cycles and there are 1.8 memory references per instruction, then average stall per instruction is

1. 6.36
2. 7.92
3. 9.62
4. 9.35

edited | 175 views
+1
I am getting $5.202$.
0
2.88 ???
0
test series answer is option 4. 9.35.......but i'm getting 7.88
0
What explanation did they provide?
0
The answer will be 9.35 when there will be 2000 references instead of 2000 instruction and 1.8 memory references per instruction.

+1

1 Instr  ----- 1.8 memory ref (mr)

2000 inst ---- 2000 * 1.8 mr = 3600 mr.

$\text{Avg stalls/memory reference = miss ratio of$L_1$* miss penalty in$L_1$} \\ \text{miss penalty of$L_1$= hit in$L_2$+ miss ratio in$L_2$* miss penalty of$L_2$} \\ \text{Avag stall/memory refernce} = \frac{80}{3600} *(30 + \frac{40}{80}*(200))= 2.89 \\ \text{1 mr ---- 2.89 stall cycle }\\ \text{1inst --- 1.8 mr}\\\text{1inst ---- 1.8*2.89 = 5.202 stalls}\\ \text{1 instr ---- 5.202 stalls}\\ \text{Avg stalls/inst = 5.202}$

@Shaik Masthan

@Mk Utkarsh

verify this bros...

0

0
this is the things, I told in an earlier comment.there should 2000 MR not 2000 instructions.
0
in the case of 2000 instructions that is 3600 references answer will be 5.2
0

there should 2000 MR not 2000 instructions.

it should be 2000 instructions only.

you may check it on https://gateoverflow.in/281228/doubt-previous-year

@Shubhanshu

tag me correctly otherwise i didn't get notification.

Easiest solution would be:

calculate the total no of clocks without any miss = [ 2000(5) ]*1.8 = 18000

calculate the same with misses as given in the question = [ 2000(5)  + 80(30) + 40(200) ]*1.8 = 36720

stall cycle per instruction would be 36720 - 18000 / 2000 = 9.36

by Active (3.3k points)
0
the answer will be 9.36 when 2000 references given but here references are 3600, so the answer is 5.2.
Average memory stall time per instruction  =  Average number of memory accesses per instruction * Average memory access time.

Assuming no memory stalls for $L_1$ hit

$L_1$ miss rate $=\frac{80}{2000 \times 1.8} = \frac{1}{45}$

$L_2$ miss rate $= \frac{40}{80} = 0.5$

Therefore, Average memory stalls time per instruction

$\qquad =1.8 \times (\frac{1}{45} \times (30 + 0.5 \times 200)$

$\qquad = 1.8 \times \left( \frac{130}{45}\right) = 5.2$ cycles
by Veteran (434k points)
edited by
0
Sir, what is the need of considering stall in case of $L_1$ hit?

I think the answer should be $5.202$.
0

@Arjun

Sir, here is a similar problem that is given in the book Computer Architecture- A Quantitative Approach 4th Edition, Hennessy Patterson

So according to the below problem, they haven't added the CPU Stalls on L1 hit. Isn't it?

0

@Arjun

Sir, here is another text in the same book describing what exactly is memory stalls. Kindly go through and let me know whether to add the L1 part.

0

@Fyse One small thing there is the $L_1$ hit time - given as 1 cycle. So it is safe to assume it is not causing a stall. But 5 cycles? Anyway it depends on how it is used/defined in the given question and should be clear in GATE. When such questions are given in Patterson not sure why people are posting ME ones here 😥