Computer organisation cache memory


#1

The access times of the main memory and the Cache memory, in a computer system, are 500 n sec and 50 n sec,
respectively. It is estimated that 80% of the main memory request are for read the rest for write. The hit ratio for the read
access only is 0.9 and a write-through policy (where both main and cache memories are updated simultaneously) is used.
Determine the average time of the main memory.


#2

Average memory access time = Time spend for read + Time spend for write

= Read time when cache hit + Read time when cache miss
+Write time when cache hit + Write time when cache miss

= 0.8 ⨯ 0.9 ⨯ 50 + 0.8 ⨯ 0.1 ⨯ (500+50) (assuming hierarchical read from memory and cache as only simultaneous write is mentioned in question)

  • 0.2 ⨯ 0.9 ⨯ 500 + 0.2 ⨯ 0.1 ⨯ 500 (simultaneous write mentioned in question)

= 36 + 44 + 90 + 10 = 180 ns


#3

The system will look in cache 1. If it is not found in cache 1, then cache 2 and then further in main memory (if not in cache 2 also).
The average access time would take into consideration success in cache 1, failure in cache 1 but success in cache 2, failure in both the caches and success in main memory.

Average access time = [H1*T1]+[(1-H1)H2T2]+[(1-H1)(1-H2)HmTm]
where,
H1 = Hit rate of level 1 cache = 0.8
T1 = Access time for level 1 cache = 1 ns
H2 = Hit rate of level 2 cache = 0.9
T2 = Access time for level 2 cache = 10 ns
Hm = Hit rate of Main Memory = 1
Tm = Access time for Main Memory = 500 ns

So, Average Access Time = ( 0.8 * 1 ) + ( 0.2 * 0.9 * 10 ) + ( 0.2 * 0.1 * 1 * 500)
= 0.8 + 1.8 + 10
= 12.6 ns


#4

Average access time for memory read in the system is calculated using formula:

average_access_time_read = hit_ratio x cache_access_time + (1 - hit_ratio) x main_memory_access_time

so in this case:
average_access_time_read = 0.9 x 100ns + (1 - 0.9) x 1000ns = 90ns x 100ns = 190ns