Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Look Through vs Look aside

Suppose there are 2 caches L1 and L2

  • L1
    • Hit rate of L1=0.8
    • Access time of l1=2ns
    • and transfer time b/w L1 and CPU is 10ns
  • L2
    • Hit rate of L2=0.9
    • Access time of L2 =5ns
    • and transfer time b/w L2 and L1 is 100ns

What will be the effective access time in case of Look through and Look aside policies.

like image 969
Hemanshu Sethi Avatar asked Nov 30 '15 14:11

Hemanshu Sethi


People also ask

What is look through cache?

Look Through cache is located between processor and main memory. All requests and data is moving through cache before they access main memory. Advantages. Processor can access cache when another controller is working with main memory.

What are different caching strategies?

Two common approaches are cache-aside or lazy loading (a reactive approach) and write-through (a proactive approach). A cache-aside cache is updated after the data is requested. A write-through cache is updated immediately when the primary database is updated.

When should we implement a write through caching?

In write-through, data is simultaneously updated to cache and memory. This process is simpler and more reliable. This is used when there are no frequent writes to the cache(The number of write operations is less). It helps in data recovery (In case of a power outage or system failure).

What is writeback and write through cache?

Write-through: When data is updated, it is written to both the cache and the back-end storage. This mode is easy for operation but is slow in data writing because data has to be written to both the cache and the storage. Write-back: When data is updated, it is written only to the cache.


1 Answers

Look through and Look aside is the read policy of cache architecture.

First , We will see difference between them

(1) - LOOK THROUGH Policy = If processor wants to search content , it will first look into cache , if cache hits -- get content , if cache miss (here it will search into L2 and then go to main memory) it will go to main memory , read block from main memory and copy block into cache for further access...

Here , To calculate Access time

h = hit rate

c = cache access time

m = main memory access time

Access time = h * c + (1 - h ) * ( c + m )

for L1 = 2 + 10 = 12 ns

for (through L1) L2 = L1 time + 5 + 100 = 117 ns

for (through L1 + L2 ) memory = L1 + L2 + Mem = Mem ns

Access time = (0.8 * 12 ) + (0.18 * 117) + (0.02 * Mem ).

(2) LOOK ASIDE policy = Processor simultaneously look for content in both cache as well as in main memory....

Look aside requires more signal operation for every access(cache and main memory) and when content found in cache , it require to send a cancel signal to main memory..which is biggest disadvantage of look aside policy..

Here , To calculate Access time

you have to consider all signaling time for all operation ....

Note - Most of cache uses look through cache , because now a days , cache hit ratio is more than 95% ..so most of time content is available in cache....

like image 112
THINK-TANK Avatar answered Jan 01 '23 09:01

THINK-TANK