0% found this document useful (0 votes)
40 views14 pages

MODULE 4 Memory System

The document discusses cache memories and how they improve processor performance. Cache memories store frequently accessed instructions and data from main memory in a faster cache in order to reduce processor wait times. This is possible due to the principle of locality of reference, where programs tend to access data and instructions near ones recently accessed. On a cache hit, the processor can access the needed data from the fast cache. On a miss, the block containing the requested data is copied from main memory to cache.

Uploaded by

Madhura N K
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views14 pages

MODULE 4 Memory System

The document discusses cache memories and how they improve processor performance. Cache memories store frequently accessed instructions and data from main memory in a faster cache in order to reduce processor wait times. This is possible due to the principle of locality of reference, where programs tend to access data and instructions near ones recently accessed. On a cache hit, the processor can access the needed data from the fast cache. On a miss, the block containing the requested data is copied from main memory to cache.

Uploaded by

Madhura N K
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

MEMORY SYSTEM

Module 4
Speed, size and cost of memory system
Memory Hierarchy
Cache Memories
Cache Memories
 Processor is much faster than the main memory.
 As a result, the processor has to spend much of its time
waiting while instructions and data are being fetched
from the main memory.
 Major obstacle towards achieving good performance.
 Speed of the main memory cannot be increased
beyond a certain point.
 Cache memory is an architectural arrangement which
makes the main memory appear faster to the processor
than it really is.
 Cache memory is based on the property of computer
programs known as “locality of reference”.
Locality of Reference
 Analysis of programs shows that most of their
execution time is spent on routines in which
many instructions are executed repeatedly.
 These instructions may constitute a simple loop,
nested loops, or a few procedures that repeatedly
call each other.
 Many instructions in localized areas of the program
are executed repeatedly during some time period,
and the remainder of the program is accessed
relatively infrequently.
 This is called “locality of reference”.
Locality of Reference..
 Temporal locality of reference
 Recently executed instruction is likely to be
executed again very soon.
 Spatial locality of reference
 Instructions with addresses close to a recently
executed instruction are likely to be executed
soon.
Operation of Cache Memories
 If the active segments of a program can be placed in a fast
cache memory, then the total execution time can be reduced
significantly.
 The memory control circuitry is designed to take
advantage of the property of locality of reference.
 The temporal aspect of the locality of reference suggests that whenever an
information item (instruction or data) is first needed, this item should be
brought into the cache where it will hopefully remain until it is needed again.
 The spatial aspect suggests that instead of fetching just one item from the
main memory to the cache, it is useful to fetch several items that reside at
adjacent addresses as well.
 The term block refers to a set of contiguous address
locations of some size.
 The term Cache line refers to a cache block.
Operation of Cache Memories..
Operation of Cache Memories..
 Processor issues a Read request, a block of words is
transferred from the main memory to the cache, one word
at a time.
 Subsequent references to the data in this block of words are
found in the cache.
 At any given time, only some blocks in the main memory are
held in the cache.
 Which blocks in the main memory are in the cache is determined
by a “mapping function”.
 When the cache is full, and a block of words needs to be
transferred from the main memory, some block of words in
the cache must be replaced.
 This is determined by a “replacement algorithm”.
Cache Hit
 Processor simply issues Read and Write requests
using addresses that refer to locations in the
memory.
 The cache control circuitry determines whether the
requested word currently exists in the cache.
 If it does, the Read or Write operation is performed on the
appropriate cache location.
 In this case, a read hit or write hit is said to have occurred.
 In a Read operation, the main memory is not involved.
 Data is obtained from the cache.
Read Operation with Cache: ‘Hits’
and ‘Misses’
Data found in cache = ‘Hit’
Cache
Read
Request

No data found = ‘Miss’


Cache
Read
Request
Cache Hit..
 For a Write operation, the system can proceed in two
ways.
 Write-through protocol
 The cache location and the main memory location are
updated simultaneously.
 Write-back or copy-back protocol
 Only the cache location is updated and it is marked as
updated with an associated flag bit, often called the dirty
or modified bit.
 The main memory location of the word is updated later,
when the block containing this marked word is to be
removed from the cache to make room for a new block.
Cache Miss
 When the addressed word in a Read operation is not
in the cache, a read miss occurs.
 The block of words that contains the requested word is
copied from the main memory into the cache.
 After the entire block is loaded into the cache, the
particular word requested is forwarded to the
processor.
 Alternatively, this word may be sent to the processor as
soon as it is read from the main memory.
 This approach is called load-through, or early restart,
 Reduces the processor's waiting period, but at the expense
of more complex circuitry.
Cache Miss..
 During a Write operation, if the addressed word is not
in the cache, a write miss occurs.

You might also like