CACHE MEMORY
CACHE MEMORY
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 a new block enters the cache, the 7-bit cache block field
determines the cache position in which this block must be stored.
The high-order 5 bits of the memory address of the block are stored in 5
tag bits associated with its location in the cache..
The tag bits identify which of the 32 main memory blocks mapped into this
cache position is currently resident in the cache.
DIRECT MAPPING
The blocks of the cache are grouped into sets, and the
mapping allows a block of the main memory to reside in any
block of a specific set.
The extreme condition of 128 blocks per set requires no set bits
and corresponds to the fully-associative technique, with 12 tag
bits.
tag
Remaining 8-bits set word
specify the tag
8 4 7
REPLACEMENT ALGORITHMS
When a new block is to be brought into the cache and all the
positions that it may occupy are full, the cache controller must decide
which of the old blocks to overwrite.
The preferred approach is to keep blocks in the cache that are likely
to be referenced in the near future
REPLACEMENT ALGORITHMS
As these parts are needed for execution, they must first be brought
into the main memory, possibly replacing other parts that are
already in the memory.
If the data are not in the main memory, the MMU causes the
operating system to transfer the data from the disk to the
memory.
PAGING
A data structure called page map table is used to keep track of the
relation between a page of a process to a frame in physical memory.
By adding the virtual page number to the contents of this register, the
address of the corresponding entry in the page table is obtained.
The contents of this location give the starting address of the frame if it
currently resides in the main memory
Adding the offset to the frame will give the address of the specific word
in the memory.
ADDRESS TRANSLATION-TLB
The page table information is used by the MMU for every read and write
access.
But due to its size page table cannot be included in MMU.
The complete table is kept in the main memory.
But a copy of only a small portion of the table corresponding to the most
recently accessed pages is accommodated within the MMU.
They are stored in a small table, usually called the Translation Lookaside
Buffer (TLB) which acts as a cache for page table.
Given a virtual address, the MMU looks in the TLB for the referenced page. If
the page table entry for this page is found in the TLB, the physical address
is obtained immediately.
If there is a miss in the TLB, then the required entry is obtained from the
page table in the main memory and the TLB is updated
SEGMENTATION