The Gateway to Computer Science Excellence

0 votes

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__ __

- 6.36
- 7.92
- 9.62
- 9.35

0

The answer will be 9.35 when there will be 2000 references instead of 2000 instruction and 1.8 memory references per instruction.

otherwise answer will be 2.88.

otherwise answer will be 2.88.

+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

verify this bros...

0

there should 2000 MR not 2000 instructions.

it should be 2000 instructions only.

the answer is 9.36

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

tag me correctly otherwise i didn't get notification.

0 votes

**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

0 votes

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

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

0

Sir, what is the need of considering stall in case of $L_1$ hit?

I think the answer should be $5.202$.

I think the answer should be $5.202$.

0

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

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 😥

- All categories
- General Aptitude 1.9k
- Engineering Mathematics 7.6k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.4k
- Theory of Computation 6.2k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.2k
- Non GATE 1.4k
- Others 1.5k
- Admissions 595
- Exam Queries 573
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 18

50,834 questions

57,831 answers

199,497 comments

108,311 users