UNIT IV.ppt
UNIT IV.ppt
C
O
S
T
CAPACITY
MEMORY HIERARCHY
• The memory unit is an essential component in
any digital computer since it is needed for storing
programs and data.
• Computer memory should be fast , large and
inexpensive.
• The memory hierarchy system consists of all
storage devices employed in a computer system
from the slow by high-capacity auxiliary memory
to a relatively faster main memory, to an even
smaller and faster cache memory.
MAIN MEMORY
• The memory units that directly communicate
with CPU is called the main memory.
• The main memory occupies a central position
by being able to communicate directly with the
CPU.
• Main memory refers to physical memory that
is internal to the computer
STORAGE DEVICES
SECONDARY MEMORY
• Devices that provide backup storage are called
secondary memory.
• Secondary memory devices through an I/O
processor.
• Secondary memory access time is usually 1000
times that of main memory.
SECONDARY MEMORY DEVICES
CACHE MEMORY
• A special very-high-speed memory called
cache.
CACHE MEMORY
• It is used to increase the speed of processing
by making current programs and data available
to the CPU at a rapid rate.
• The cache is used for storing segments of
programs currently being executed in the
CPU and temporary data frequently needed in
the present calculations.
• The typical access time ratio between cache
and main memory is about 1 to 7ns
Cache location
Two Levels
• Memory hierarchy with two, three and four
levels
THREE LEVELS
MEMORY TECHNOLOGY
• There are four primary technologies used
today in memory hierarchies. Main memory is
implemented from
1. DRAM (dynamic random access memory)
2. SRAM (static random access memory).
3. Flash Memory
4. Disk Memory
• The fourth technology, used to implement the
largest and slowest level in the hierarchy in
servers, is magnetic disk
DRAM Technology: Dynamic
Random Access Memory
• Dynamic: must be refreshed periodically
• Volatile: loses data when power is removed
• DRAM is less costly per bit than SRAM,
although it is substantially slower.
• It provides higher density levels.
• More data can be stored using DRAM.
Internal organization of DRAM
MEMORY CHIP ORGANIZATION
RAM CHIP
CACHE MEMORY
CACHE MAPPING FUNCTIONS
• Mapping functions are used to
determine/specify where memory blocks are
placed in cache.
• Determine how memory blocks are mapped
into cache lines.
1) Direct mapping
2) Associative Mapping
3) Set Associative Mapping
How address is used to find respective
block in cache?
• Three portions of address
20 10 2
= 1 + (0.05 x 20)
= 2 Clock cycles or 2 ns
Measuring Cache Performance
• Calculating cache misses in all three mapping
technologies.
Problem
3 misses is the best we can do , because three unique block addresses are
accessed. For first time referring always report a miss.
Summary of different Mapping and
their relative performance
2 + 3.44 = 5.44
• Since there is no change in instruction count
or clock rate, the ratio of the CPU execution
times is
VIRTUAL MEMORY
VIRTUAL MEMORY
• Physical memory is not large enough to fit some
larger programs completely. When programs are
larger that physical memory.
• Virtual memory is a technique that allows execution
of a process that are not completely in MM.
• A part of the program is stored in secondary storage
devices like magnetic discs. The MM has only the
part of the program which is currently executing &
thus thy MM can act as a CACHE for secondary
storage.
• The OS moves the programs and data
between the MM and the Secondary storage.
They are brought into MM from SS when
needed.
Logical The address generated by CPU at
address compile time- Called Virtual address
Physical
An address in the MM. Actual MM
address address. Address loaded in PC during
load time.
Memory Management Unit (MMU)
• Converts logical Virtual address into actual Physical
address.
The Binary address that the processor issues for a data/instruction are called
virtual or logical address. These are translated into physical address.
• If a virtual address refers to the data that is
currently in the Physical memory, then it is
accessed immediately from the MM.
• On the other hand if the reference address is
not in the Main Memory, its contents must be
brought into a suitable location in Main
memory before they can be used.
Address Translation / Address
Mapping (VA to PA)
• The processor produces a virtual address, which is
translated by a combination of hardware and soft
ware to a physical address, which in turn can be used
to access main memory.
Address Translation
• The process by which VA is mapped to an address used to
access memory.
• Both VM and PM are broken into PAGES., so that a virtual
page is mapped to a physical page.
• No.of bits in page offset 🡪 Page Size
• No.Of bits in Page number 🡪 No.of pages
• Above diagram no.of offset bits 🡪12
– Page size = 212 = 4 KB
– No.of Physical pages = 218
– No.Of Virtual pages = 220
Page Table
• The table containing the virtual to physical
address translations in a virtual memory
system.
• The table, which is stored in memory, is
typically indexed by the virtual page number.
• Each entry in the table contains the physical
page number for that virtual page if the page
is currently in memory.
• Each program has its own page table, which maps
the virtual address space of that program to main
memory.
• Page table register : To indicate the location of the
page table in memory, the hardware includes a
register that points to the start of the page table.
0 , 6, 8 , 9, 0 , 6
, 6 , 7, 0, 9, 6
• Cache blocks 4
• Find no.of cache miss in each technique