SlideShare a Scribd company logo
1 of 24
Download to read offline
MEMORY HIERARCHY
Gaurav Saxena
Memory
Main memory consists of a number of
storage locations, each of which is
identified by a unique address
The ability of the CPU to identify
each location is known as its
addressability
Each location stores a word i.e. the
number of bits that can be processed
by the CPU in a single operation.
Word length may be typically 16, 24,
32 or as many as 64 bits.
A large word length improves system
performance, though may be less
efficient on occasions when the full word
length is not used
Types of main memory
There are two types of main memory, Random Access Memory (RAM) and Read
Only Memory (ROM)
Random Access Memory (RAM)
✓holds its data as long as the computer is switched on
✓All data in RAM is lost when the computer is switched off
✓Described as being volatile
✓It is direct access as it can be both written to or read from in any order
Its purpose is to temporarily hold programs and data for processing. In
modern computers it also holds the operating system
Types of RAM
1. Dynamic Random Access Memory (DRAM)
• Contents are constantly refreshed 1000 times per second
• Access time 60 – 70 nanoseconds
Note: a nanosecond is one billionth of a second!
2. Synchronous Dynamic Random Access Memory (SDRAM)
• Quicker than DRAM
• Access time less than 60 nanoseconds
3. Direct Rambus Dynamic Random Access Memory (DRDRAM)
• New type of RAM architecture
• Access time 20 times faster than DRAM
• More expensive
4. Static Random Access Memory (SRAM)
• Doesn’t need refreshing
• Retains contents as long as power applied to the chip
• Access time around 10 nanoseconds
• Used for cache memory
• Also for date and time settings as powered by small battery
5. Cache memory
• Small amount of memory typically 256 or 512 kilobytes
• Temporary store for often used instructions
• Level 1 cache is built within the CPU (internal)
• Level 2 cache may be on chip or nearby (external)
• Faster for CPU to access than main memory
Types of RAM
Types of RAM
6. Video Random Access memory
• Holds data to be displayed on computer screen
• Has two data paths allowing READ and WRITE to occur at the same time
• A system’s amount of VRAM relates to the number of colours and resolution
• A graphics card may have its own VRAM chip on board
7. Virtual memory
• Uses backing storage e.g. hard disk as a temporary location for programs
and data where insufficient RAM available
• Swaps programs and data between the hard-disk and RAM as the CPU
requires them for processing
• A cheap method of running large or many programs on a computer system
• Cost is speed: the CPU can access RAM in nanoseconds but hard-disk in
milliseconds (Note: a millisecond is a thousandth of a second)
• Virtual memory is much slower than RAM
Read only memory (ROM)
✓ROM holds programs and data permanently even when computer is switched off
✓Data can be read by the CPU in any order so ROM is also direct access
✓The contents of ROM are fixed at the time of manufacture
✓Stores a program called the bootstrap loader that helps start up the computer
✓Access time of between 10 and 50 nanoseconds
Types of ROM
1. Programmable Read Only Memory (PROM)
• Empty of data when manufactured
• May be permanently programmed by the user
2. Erasable Programmable Read Only Memory (EPROM)
• Can be programmed, erased and reprogrammed
• The EPROM chip has a small window on top allowing it to be erased by
shining ultra-violet light on it
• After reprogramming the window is covered to prevent new contents being
erased
• Access time is around 45 – 90 nanoseconds
Types of ROM
3. Electrically Erasable Programmable Read Only Memory (EEPROM)
• Reprogrammed electrically without using ultraviolet light
• Must be removed from the computer and placed in a special machine to do this
• Access times between 45 and 200 nanoseconds
4. Flash ROM
• Similar to EEPROM
• However, can be reprogrammed while still in the computer
• Easier to upgrade programs stored in Flash ROM
• Used to store programs in devices e.g. modems
• Access time is around 45 – 90 nanoseconds
DYNAMIC RAM
 Bits stored as charge in capacitors
 Charges leak
 Need refreshing even when powered
 Simpler construction
 Smaller per bit
 Less expensive
 Need refresh circuits
 Slower
 Main memory
 Essentially analogue
 Level of charge determines value
STATIC RAM
 Bits stored as on/off switches
 No charges to leak
 No refreshing needed when powered
 More complex construction
 Larger per bit
 More expensive
 Does not need refresh circuits
 Faster
 Cache
 Digital
 Uses flip-flops
SRAM V DRAM
 Both volatile
 Power needed to preserve data
 Dynamic cell
 Simpler to build, smaller
 More dense
 Less expensive
 Needs refresh
 Larger memory units
 Static
 Faster
 Cache
MEMORY HIERARCHY
Memory technology Typical access time $ per GB in 2004
SRAM 0.5–5 ns $4000–$10,000
DRAM 50–70 ns $100–$200
Magnetic disk 5,000,000–20,000,000 ns $0.50–$2
CPU
Level n
Level 2
Level 1
Levels in the
memory hierarchy
Increasing distance
from the CPU in
access time
Size of the memory at each level
Processor
Data are transferred
14
“MEMORY HIERARCHY
PYRAMID”
$0.137/MB
$1.10/GB
Pages
Blocks
Lines
Words
CPU Registers
3-10 acc/cycl
32-64 words
On-Chip Cache
1-2 access/cycle
5-10 ns 1KB - 2MB
Off-Chip Cache (SRAM)
5-20 cycles/access
10-40 ns 1MB – 16MB
Main Memory (DRAM)
20-200 cycles/access
60-120ns
64MB -many GB
Disk or Network
1M-2M cycles/access
4GB – many TB
MEMORY HIERARCHY - DIAGRAM
MEMORY HIERARCHY: HOW DOES IT WORK?
 Temporal Locality (Locality in Time):
=> Keep most recently accessed data items closer to the
processor
 Spatial Locality (Locality in Space):
=> Move blocks consists of contiguous words to the upper
levels
Lower Level
Memory
Upper Level
Memory
To Processor
From Processor
Blk X
Blk Y
MEMORY HIERARCHY: TERMINOLOGY
 Hit: data appears in some block in the upper level (example: Block
X)
 Hit Rate: the fraction of memory access found in the upper
level
 Hit Time: Time to access the upper level which consists of
RAM access time + Time to determine hit/miss
 Miss: data needs to be retrieve from a block in the lower level
(Block Y)
 Miss Rate = 1 - (Hit Rate)
 Miss Penalty: Time to replace a block in the upper level +
Time to deliver the block the processor
 Hit Time << Miss Penalty
Lower Level
Memory
Upper Level
Memory
To Processor
From Processor
Blk X
Blk Y
CONT..
 How does the memory hierarchy work? Well it is rather
simple, at least in principle.
 In order to take advantage of the temporal locality, that is
the locality in time, the memory hierarchy will keep those
more recently accessed data items closer to the processor
because chances are (points to the principle), the processor
will access them again soon.
 In order to take advantage of the spatial locality, not ONLY
do we move the item that has just been accessed to the
upper level, but we ALSO move the data items that are
adjacent to it.
MEMORY HIERARCHY OF A MODERN COMPUTER SYSTEM
 By taking advantage of the principle of locality:
 Present the user with as much memory as is available in the cheapest
technology.
 Provide access at the speed offered by the fastest technology.
Control
Datapath
Secondary
Storage
(Disk)
Processor
Registers
Main
Memory
(DRAM)
Second
Level
Cache
(SRAM)
On-Chip
Cache
Tertiary
Storage
(Tape)
Ts
THE OPERATION OF CACHE MEMORY
1. Cache fetches data
from next to current
addresses in main
memory
2. CPU checks to see
whether the next
instruction it requires is in
cache
3. If it is, then the
instruction is fetched from
the cache – a very fast
position
4. If not, the CPU has to
fetch next instruction
from main memory - a
much slower process
Main
Memory
(DRAM)
CPU
Cache
Memory
(SRAM)
= Bus connections
21
Problem: Main Memory is slow compared to CPU.
Solution: Store the most commonly used data in a smaller,
faster memory. Good trade off between $$ and performance.
CACHE AND MAIN MEMORY
CACHE OPERATION - OVERVIEW
 CPU requests contents of memory location
 Check cache for this data
 If present, get from cache (fast)
 If not present, read required block from main
memory to cache
 Then deliver from cache to CPU
CACHE READ OPERATIONS
QUESTIONS
 What is the difference between DRAM and SRAM in terms
of applications?
 What is the difference between DRAM and SRAM in terms
of characteristics such as speed, size and cost?
 What is the distinction between spatial and temporal
locality?
 What are the strategies for exploring spatial and temporal
locality?

More Related Content

Similar to Memory hierarchy.pdf

Similar to Memory hierarchy.pdf (20)

3 computer memory
3   computer memory3   computer memory
3 computer memory
 
logical memory-organisation
logical memory-organisationlogical memory-organisation
logical memory-organisation
 
memory hierarchy
memory hierarchymemory hierarchy
memory hierarchy
 
lecture_5_computer_memory.pptx
lecture_5_computer_memory.pptxlecture_5_computer_memory.pptx
lecture_5_computer_memory.pptx
 
Memory organization
Memory organizationMemory organization
Memory organization
 
Coa presentation3
Coa presentation3Coa presentation3
Coa presentation3
 
Memory management
Memory managementMemory management
Memory management
 
TYPES OF COMPUTER MEMORIES
TYPES OF COMPUTER MEMORIESTYPES OF COMPUTER MEMORIES
TYPES OF COMPUTER MEMORIES
 
CPU & RAM
CPU & RAMCPU & RAM
CPU & RAM
 
Introduction to Types of Memory Chips
Introduction to Types of Memory ChipsIntroduction to Types of Memory Chips
Introduction to Types of Memory Chips
 
2. the memory systems (module2)
2. the memory systems (module2)2. the memory systems (module2)
2. the memory systems (module2)
 
primary memory
primary memoryprimary memory
primary memory
 
Basics Of Semiconductor Memories
Basics Of Semiconductor MemoriesBasics Of Semiconductor Memories
Basics Of Semiconductor Memories
 
Internal memory
Internal memoryInternal memory
Internal memory
 
Memory Hierarchy PPT of Computer Organization
Memory Hierarchy PPT of Computer OrganizationMemory Hierarchy PPT of Computer Organization
Memory Hierarchy PPT of Computer Organization
 
project on memories .pptx
project on memories .pptxproject on memories .pptx
project on memories .pptx
 
2 memory-and-io-devices
2 memory-and-io-devices2 memory-and-io-devices
2 memory-and-io-devices
 
Memory
MemoryMemory
Memory
 
COMPUTER MEMORY
COMPUTER MEMORYCOMPUTER MEMORY
COMPUTER MEMORY
 
Esd mod 3
Esd mod 3Esd mod 3
Esd mod 3
 

Recently uploaded

VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacingjaychoudhary37
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 

Recently uploaded (20)

VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacing
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 

Memory hierarchy.pdf

  • 2. Memory Main memory consists of a number of storage locations, each of which is identified by a unique address The ability of the CPU to identify each location is known as its addressability Each location stores a word i.e. the number of bits that can be processed by the CPU in a single operation. Word length may be typically 16, 24, 32 or as many as 64 bits. A large word length improves system performance, though may be less efficient on occasions when the full word length is not used
  • 3. Types of main memory There are two types of main memory, Random Access Memory (RAM) and Read Only Memory (ROM) Random Access Memory (RAM) ✓holds its data as long as the computer is switched on ✓All data in RAM is lost when the computer is switched off ✓Described as being volatile ✓It is direct access as it can be both written to or read from in any order Its purpose is to temporarily hold programs and data for processing. In modern computers it also holds the operating system
  • 4. Types of RAM 1. Dynamic Random Access Memory (DRAM) • Contents are constantly refreshed 1000 times per second • Access time 60 – 70 nanoseconds Note: a nanosecond is one billionth of a second! 2. Synchronous Dynamic Random Access Memory (SDRAM) • Quicker than DRAM • Access time less than 60 nanoseconds 3. Direct Rambus Dynamic Random Access Memory (DRDRAM) • New type of RAM architecture • Access time 20 times faster than DRAM • More expensive
  • 5. 4. Static Random Access Memory (SRAM) • Doesn’t need refreshing • Retains contents as long as power applied to the chip • Access time around 10 nanoseconds • Used for cache memory • Also for date and time settings as powered by small battery 5. Cache memory • Small amount of memory typically 256 or 512 kilobytes • Temporary store for often used instructions • Level 1 cache is built within the CPU (internal) • Level 2 cache may be on chip or nearby (external) • Faster for CPU to access than main memory Types of RAM
  • 6. Types of RAM 6. Video Random Access memory • Holds data to be displayed on computer screen • Has two data paths allowing READ and WRITE to occur at the same time • A system’s amount of VRAM relates to the number of colours and resolution • A graphics card may have its own VRAM chip on board 7. Virtual memory • Uses backing storage e.g. hard disk as a temporary location for programs and data where insufficient RAM available • Swaps programs and data between the hard-disk and RAM as the CPU requires them for processing • A cheap method of running large or many programs on a computer system • Cost is speed: the CPU can access RAM in nanoseconds but hard-disk in milliseconds (Note: a millisecond is a thousandth of a second) • Virtual memory is much slower than RAM
  • 7. Read only memory (ROM) ✓ROM holds programs and data permanently even when computer is switched off ✓Data can be read by the CPU in any order so ROM is also direct access ✓The contents of ROM are fixed at the time of manufacture ✓Stores a program called the bootstrap loader that helps start up the computer ✓Access time of between 10 and 50 nanoseconds
  • 8. Types of ROM 1. Programmable Read Only Memory (PROM) • Empty of data when manufactured • May be permanently programmed by the user 2. Erasable Programmable Read Only Memory (EPROM) • Can be programmed, erased and reprogrammed • The EPROM chip has a small window on top allowing it to be erased by shining ultra-violet light on it • After reprogramming the window is covered to prevent new contents being erased • Access time is around 45 – 90 nanoseconds
  • 9. Types of ROM 3. Electrically Erasable Programmable Read Only Memory (EEPROM) • Reprogrammed electrically without using ultraviolet light • Must be removed from the computer and placed in a special machine to do this • Access times between 45 and 200 nanoseconds 4. Flash ROM • Similar to EEPROM • However, can be reprogrammed while still in the computer • Easier to upgrade programs stored in Flash ROM • Used to store programs in devices e.g. modems • Access time is around 45 – 90 nanoseconds
  • 10. DYNAMIC RAM  Bits stored as charge in capacitors  Charges leak  Need refreshing even when powered  Simpler construction  Smaller per bit  Less expensive  Need refresh circuits  Slower  Main memory  Essentially analogue  Level of charge determines value
  • 11. STATIC RAM  Bits stored as on/off switches  No charges to leak  No refreshing needed when powered  More complex construction  Larger per bit  More expensive  Does not need refresh circuits  Faster  Cache  Digital  Uses flip-flops
  • 12. SRAM V DRAM  Both volatile  Power needed to preserve data  Dynamic cell  Simpler to build, smaller  More dense  Less expensive  Needs refresh  Larger memory units  Static  Faster  Cache
  • 13. MEMORY HIERARCHY Memory technology Typical access time $ per GB in 2004 SRAM 0.5–5 ns $4000–$10,000 DRAM 50–70 ns $100–$200 Magnetic disk 5,000,000–20,000,000 ns $0.50–$2 CPU Level n Level 2 Level 1 Levels in the memory hierarchy Increasing distance from the CPU in access time Size of the memory at each level Processor Data are transferred
  • 14. 14 “MEMORY HIERARCHY PYRAMID” $0.137/MB $1.10/GB Pages Blocks Lines Words CPU Registers 3-10 acc/cycl 32-64 words On-Chip Cache 1-2 access/cycle 5-10 ns 1KB - 2MB Off-Chip Cache (SRAM) 5-20 cycles/access 10-40 ns 1MB – 16MB Main Memory (DRAM) 20-200 cycles/access 60-120ns 64MB -many GB Disk or Network 1M-2M cycles/access 4GB – many TB
  • 16. MEMORY HIERARCHY: HOW DOES IT WORK?  Temporal Locality (Locality in Time): => Keep most recently accessed data items closer to the processor  Spatial Locality (Locality in Space): => Move blocks consists of contiguous words to the upper levels Lower Level Memory Upper Level Memory To Processor From Processor Blk X Blk Y
  • 17. MEMORY HIERARCHY: TERMINOLOGY  Hit: data appears in some block in the upper level (example: Block X)  Hit Rate: the fraction of memory access found in the upper level  Hit Time: Time to access the upper level which consists of RAM access time + Time to determine hit/miss  Miss: data needs to be retrieve from a block in the lower level (Block Y)  Miss Rate = 1 - (Hit Rate)  Miss Penalty: Time to replace a block in the upper level + Time to deliver the block the processor  Hit Time << Miss Penalty Lower Level Memory Upper Level Memory To Processor From Processor Blk X Blk Y
  • 18. CONT..  How does the memory hierarchy work? Well it is rather simple, at least in principle.  In order to take advantage of the temporal locality, that is the locality in time, the memory hierarchy will keep those more recently accessed data items closer to the processor because chances are (points to the principle), the processor will access them again soon.  In order to take advantage of the spatial locality, not ONLY do we move the item that has just been accessed to the upper level, but we ALSO move the data items that are adjacent to it.
  • 19. MEMORY HIERARCHY OF A MODERN COMPUTER SYSTEM  By taking advantage of the principle of locality:  Present the user with as much memory as is available in the cheapest technology.  Provide access at the speed offered by the fastest technology. Control Datapath Secondary Storage (Disk) Processor Registers Main Memory (DRAM) Second Level Cache (SRAM) On-Chip Cache Tertiary Storage (Tape) Ts
  • 20. THE OPERATION OF CACHE MEMORY 1. Cache fetches data from next to current addresses in main memory 2. CPU checks to see whether the next instruction it requires is in cache 3. If it is, then the instruction is fetched from the cache – a very fast position 4. If not, the CPU has to fetch next instruction from main memory - a much slower process Main Memory (DRAM) CPU Cache Memory (SRAM) = Bus connections
  • 21. 21 Problem: Main Memory is slow compared to CPU. Solution: Store the most commonly used data in a smaller, faster memory. Good trade off between $$ and performance. CACHE AND MAIN MEMORY
  • 22. CACHE OPERATION - OVERVIEW  CPU requests contents of memory location  Check cache for this data  If present, get from cache (fast)  If not present, read required block from main memory to cache  Then deliver from cache to CPU
  • 24. QUESTIONS  What is the difference between DRAM and SRAM in terms of applications?  What is the difference between DRAM and SRAM in terms of characteristics such as speed, size and cost?  What is the distinction between spatial and temporal locality?  What are the strategies for exploring spatial and temporal locality?