Memory
● A essential component of the computer system
● Stores binary instructions and datum for the microcomputer
● The place where the computer holds current programs and data that are in
use
Cache Memory
● A essential component of the computer system
● Stores binary instructions and datum for the microcomputer
● The place where the computer holds current programs and data that are in
use
Memory Mapping
● A mechanism that maps a portion of a file, or an entire file, on disk to a range
of addresses within an application’s address space
● The translation between the logical address space and physical memory
Objects:
○ To translate physical address from logical address
○ To aid in memory protection
○ To enable better memory management
● Mapping is important to computer performance both
○ Locally( how long it takes to execute an instruction) and
○ Globally( how long it takes to run a set of program)
Types:
○ Direct mapping
○ Associated Mapping
○ Set Associated Mapping
Direct Mapping
● The procedure used to assign each memory block in the main memory to a
particular line in the cache (if a line is already filled with a memory block and a
new block needs to be loaded, then the old block is discarded from the cache)
● the simplex technique, maps each block of main memory into only one
possible cache line
i = j modulo m
Where I = cache line number; j = main memory block number; m = number of
lines in the cache
Direct Mapping (contd..)
Direct Mapping (contd..)
Direct Mapping (contd..)
● Direct mapping divides an address into three parts: t tag bits, l line bits, and
w word bits.
○ The w(word) bits are the least significant bits that identify the specific
word within a block of memory.
○ The l(line) bits are the next least significant bits that identify the line of
the cache in which the block is stored.
○ The remaining bits are stored along with the block as the tag which
locates the block’s position in the main memory.
Direct Mapping (contd..)
● Prons:
○ Simple
○ Inexpensive
○ Fixed location for given block
But, If a program accesses 2 blocks that map to the same line repeatedly, cache
misses are very high
Associated Mapping
● Overcomes the disadvantage of direct mapping by permitting each main
memory block to be loaded into any line of cache.
● Cache control logic interprets a memory address simply as a tag and a word
field
● Tag uniquely identifies block of memory
● Cache control logic must simultaneously examine every line’s tag for a match
which requires fully associative memory
● very complex circuitry, complexity increases exponentially with size
● Cache searching gets expensive (slow)
Associated Mapping (contd..)
Set Associated Mapping
Set Associated Mapping (contd..)
● It is a compromise between direct and associative mappings that exhibits the
strength and reduces the disadvantages
● Cache is divided into v sets, each of which has k lines;
● number of cache lines M = v X k
● I = j modulo v
● Where, i = cache set number; j = main memory block number; m = number of
lines in the cache
Set Associated Mapping (contd..)
● The most common set associative mapping is 2 lines per set, and is called two-
way set associative. It significantly improves hit ratio over direct mapping, and
the associative hardware is not too expensive

Memory Management.pptx

  • 1.
    Memory ● A essentialcomponent of the computer system ● Stores binary instructions and datum for the microcomputer ● The place where the computer holds current programs and data that are in use
  • 2.
    Cache Memory ● Aessential component of the computer system ● Stores binary instructions and datum for the microcomputer ● The place where the computer holds current programs and data that are in use
  • 3.
    Memory Mapping ● Amechanism that maps a portion of a file, or an entire file, on disk to a range of addresses within an application’s address space ● The translation between the logical address space and physical memory Objects: ○ To translate physical address from logical address ○ To aid in memory protection ○ To enable better memory management ● Mapping is important to computer performance both ○ Locally( how long it takes to execute an instruction) and ○ Globally( how long it takes to run a set of program) Types: ○ Direct mapping ○ Associated Mapping ○ Set Associated Mapping
  • 4.
    Direct Mapping ● Theprocedure used to assign each memory block in the main memory to a particular line in the cache (if a line is already filled with a memory block and a new block needs to be loaded, then the old block is discarded from the cache) ● the simplex technique, maps each block of main memory into only one possible cache line i = j modulo m Where I = cache line number; j = main memory block number; m = number of lines in the cache
  • 5.
  • 6.
  • 7.
    Direct Mapping (contd..) ●Direct mapping divides an address into three parts: t tag bits, l line bits, and w word bits. ○ The w(word) bits are the least significant bits that identify the specific word within a block of memory. ○ The l(line) bits are the next least significant bits that identify the line of the cache in which the block is stored. ○ The remaining bits are stored along with the block as the tag which locates the block’s position in the main memory.
  • 8.
    Direct Mapping (contd..) ●Prons: ○ Simple ○ Inexpensive ○ Fixed location for given block But, If a program accesses 2 blocks that map to the same line repeatedly, cache misses are very high
  • 9.
    Associated Mapping ● Overcomesthe disadvantage of direct mapping by permitting each main memory block to be loaded into any line of cache. ● Cache control logic interprets a memory address simply as a tag and a word field ● Tag uniquely identifies block of memory ● Cache control logic must simultaneously examine every line’s tag for a match which requires fully associative memory ● very complex circuitry, complexity increases exponentially with size ● Cache searching gets expensive (slow)
  • 10.
  • 11.
  • 12.
    Set Associated Mapping(contd..) ● It is a compromise between direct and associative mappings that exhibits the strength and reduces the disadvantages ● Cache is divided into v sets, each of which has k lines; ● number of cache lines M = v X k ● I = j modulo v ● Where, i = cache set number; j = main memory block number; m = number of lines in the cache
  • 13.
    Set Associated Mapping(contd..) ● The most common set associative mapping is 2 lines per set, and is called two- way set associative. It significantly improves hit ratio over direct mapping, and the associative hardware is not too expensive