SlideShare a Scribd company logo
1 of 23
1
COSC 3P92
Cosc 3P92
Week 9 Lecture slides
The human brain starts working the moment you are
born and never stops until you stand up to speak in
public.
George Jessel
2
COSC 3P92
• In a typical computer system, the storage system is organized according to
the following hierarchy:
Archival Storage (magnetic tape
or photographic)
Moving head disk (magnetic or optical)
High speed drum
Charge Coupled Device
Main memory
Cache
Internal
decreasing
cost/bit
decreasing
access time
fast access (1-20 ns.) and small capacity (1-4K byte)
slow access (1-5 s.) and large capacity (almost unlimited)
Memory Organization
3
COSC 3P92
Memory speed
• Access time (Ta)
– the average time taken to read a unit of information
e.g., 100 ns (100 x 10**-9 s)
• Access rate (Ra) = 1/Ta (bits/second)
e.g., 1/100ns = 10 Mb/s
• Cycle time (Tc)
– the average time lapse between two successive read
operations
e.g., 500 ns (500 x 10**-9 s)
• Bandwidth or transfer rate (Rc) = 1/Tc
(bits/second)
e.g., 1/500ns = 2 Mb/s
4
COSC 3P92
Classes of Memory
• RAM (“normal memory”)
• Direct-access storage: HD, CD ROM, DVD
• Sequential access storage tapes: DAT
• Associative (content-addressable) memory:
searches for data via bit patterns
– CAM (Content Addressable Memory)
» Includes comparison logic with each bit of storage.
» A data value is broadcast to all words of storage and
compared with the values there.
» Words which match are flagged.
» Subsequent operations can then work on flagged words.
» (computing-dictionary.thefreedictionary.com)
• ROM
5
COSC 3P92
Categories of RAM and ROM
Mask PROM EPROM,
ROM EAROM
RAM ROM
magnetic semiconductor
core
static dynamic
Bipolar MOS
Mask PROM
ROM
primary memory
6
COSC 3P92
Main Memory Design
1K x 4
RAM chip
10
4
A9-A0
WE
CS
D3-D0
CS WE MODE Status of the Power
Bi-directional
Datelines D3-D0
H X not selected High impedance Standby
L L Write Acts as input bus Active
L H Read Acts as output bus Active
7
COSC 3P92
Main Memory Design
Q. How do we build a 4K x 4 RAM using four 1K
x 4 RAM chips?
Chip A11 A10 A9 A8 A7 . . . A0 Range
0 0 0 x x x . . . x 0000 to 1023
1 0 1 x x x . . . x 1024 to 2047
2 1 0 x x x . . . x 2048 to 3071
3 1 1 x x x . . . x 3072 to 4096
8
COSC 3P92
Processor
log2 n 1-of-n
Decoder
Addr bus
Memory bank
Enable 1
Enable 2
Enable n
1 2
n
(On bus in parallel )
Main Memory Design
• Q. How do we build a 256KB RAM system
with an 16-bit address bus and four 64KB
RAM chips?
• Memory band-switching
9
COSC 3P92
Processor
Data bus
base
address
4-bit
Base
16-bit Address bus
Offset
20 bit
Physical
address
to memory
Main memory design
• Memory address extension
10
COSC 3P92
CPU
c
a
c
h
e
Main
memory
external
storage
C
a
c
h
e
Cache Memory
• Cache: fast-access memory buffer
• locality principle: programs usually use limited memory
areas, in contrast to totally random access
– spatial: location, address
– temporal: time accessed
– if commonly used memory can be buffered in high-speed cache, overall
performance enhanced
– cache takes form of small amount of store, with hardware support for
maintenance and lookup
– each cache cell saves a cache line - block of main memory (4-64 words)
• cache hit:
– requested memory resides in cache
11
COSC 3P92
• cache miss:
– requested memory not in cache, and must be fetched from main
memory and put into cache
• unified cache:
– instns, data share same cache
• split cache:
– separate instn, data caches
• parallel access:
– double the bandwidth
• level 2 cache:
– between instn/data cache and main memory
• Cache maintenance algorithms similar in spirit to
virtual memory ideas at operating system level; main
difference is that cache is hardware-supported,
whereas v.m. is software implemented
Cache
12
COSC 3P92
Measuring cache
performance
• c - cache access time
• m - main memory access time
• hr - hit ratio ( 0 <= hr <= 1) :
– # cache hits / total memory requests
• mr - miss ratio (1-hr)
• mean access time = c + (1-hr)m
– if hr --> 1 then m.a.t. = c
– if hr --> 0 then m.a.t. = c + m
13
COSC 3P92
Cache Example
• example:
let c = 160 ns
m = 960 ns
h = .90 (common)
mean = 160 + (1-.90)960
= 256 ns
efficiency = c / mean
= 160/256 = 62.5%
14
COSC 3P92
Direct mapping
0
1
i
M-1
0
N-1
Cache
Main memory
i mod N
15
COSC 3P92
Direct Mapped Cache
16
COSC 3P92
Direct mapping
• use a hash function to find cache location
• normally, modulo some bit field of address, then
just use low end field
• cache fields:
– valid bit
– tag - block # being held
– value - data block
• scheme:
• memory request:
– compute cache slot (low n bits)
– check block (tag) field
» hit: return value
» miss: fetch block from memory, give to CPU, and put into
that computed slot (replace existing item if there)
• can occasionally produce thrashing
– eg. addresses that are multiple of cache size (64K) will reside
at same entry
– split instn/data cache helps avoid thrashing
17
COSC 3P92
Set associative mapping
0
1
i
M-1
Set 0
Set 1
Set N/S - 1
Cache
Main memory
Set i mod (N/S)
S blocks per set
18
COSC 3P92
Set associative mapping
19
COSC 3P92
Set associative mapping
• [4.39]
• use same hash function as direct mapping, except
that each cache slot holds multiple data blocks
– usually max. 4 blocks (“4-way”)
• searching blocks in a slot done associatively:
simultaneous pattern matching
• more flexible than direct: multiple blocks in set
• use smaller tag than associative, therefore
cheaper to implement associative matching
• commonly used in larger systems (VAX 11-780)
• which line should be replaced when slot full?
– eg. LRU (least recently used)
20
COSC 3P92
Writing back to the memory
• only write to memory if cache data modified.
• write back (write-deferred):
– (i) use a modified bit. When swapping a cache slot or ending
job, write slot if its modified bit is set
• write through:
– (ii) whenever modifying data, always write it back to main
memory
– have to do this if memory being shared in a DMA or
multiprocessing system
21
COSC 3P92
Example: direct mapping
4 byte blocks
1 byte words
8 slots in cache
22
COSC 3P92
Example (cont)
23
COSC 3P92
The end

More Related Content

Similar to 7_mem_cache.ppt

DLCA-UNIT-5-Memory Organization-Cache.pdf
DLCA-UNIT-5-Memory Organization-Cache.pdfDLCA-UNIT-5-Memory Organization-Cache.pdf
DLCA-UNIT-5-Memory Organization-Cache.pdfDrKRadhikaProfessorD
 
SOC-CH4.pptSOC Processors Used in SOCSOC Processors Used in SOC
SOC-CH4.pptSOC Processors Used in SOCSOC Processors Used in SOCSOC-CH4.pptSOC Processors Used in SOCSOC Processors Used in SOC
SOC-CH4.pptSOC Processors Used in SOCSOC Processors Used in SOCSnehaLatha68
 
Memory Organizationsssssssssssssssss.ppt
Memory Organizationsssssssssssssssss.pptMemory Organizationsssssssssssssssss.ppt
Memory Organizationsssssssssssssssss.pptk2w9psdb96
 
memeoryorganization PPT for organization of memories
memeoryorganization PPT for organization of memoriesmemeoryorganization PPT for organization of memories
memeoryorganization PPT for organization of memoriesGauravDaware2
 
Erasing Belady's Limitations: In Search of Flash Cache Offline Optimality
Erasing Belady's Limitations: In Search of Flash Cache Offline OptimalityErasing Belady's Limitations: In Search of Flash Cache Offline Optimality
Erasing Belady's Limitations: In Search of Flash Cache Offline OptimalityYue Cheng
 
Computer System Architecture Lecture Note 8.1 primary Memory
Computer System Architecture Lecture Note 8.1 primary MemoryComputer System Architecture Lecture Note 8.1 primary Memory
Computer System Architecture Lecture Note 8.1 primary MemoryBudditha Hettige
 
Taming Non-blocking Caches to Improve Isolation in Multicore Real-Time Systems
Taming Non-blocking Caches to Improve Isolation in Multicore Real-Time SystemsTaming Non-blocking Caches to Improve Isolation in Multicore Real-Time Systems
Taming Non-blocking Caches to Improve Isolation in Multicore Real-Time SystemsHeechul Yun
 
Computer architecture for HNDIT
Computer architecture for HNDITComputer architecture for HNDIT
Computer architecture for HNDITtjunicornfx
 
Kiến trúc máy tính - COE 301 - Memory.ppt
Kiến trúc máy tính - COE 301 - Memory.pptKiến trúc máy tính - COE 301 - Memory.ppt
Kiến trúc máy tính - COE 301 - Memory.pptTriTrang4
 
Ct213 memory subsystem
Ct213 memory subsystemCt213 memory subsystem
Ct213 memory subsystemSandeep Kamath
 
cache memory introduction, level, function
cache memory introduction, level, functioncache memory introduction, level, function
cache memory introduction, level, functionTeddyIswahyudi1
 

Similar to 7_mem_cache.ppt (20)

DLCA-UNIT-5-Memory Organization-Cache.pdf
DLCA-UNIT-5-Memory Organization-Cache.pdfDLCA-UNIT-5-Memory Organization-Cache.pdf
DLCA-UNIT-5-Memory Organization-Cache.pdf
 
Memory (Computer Organization)
Memory (Computer Organization)Memory (Computer Organization)
Memory (Computer Organization)
 
SOC-CH4.pptSOC Processors Used in SOCSOC Processors Used in SOC
SOC-CH4.pptSOC Processors Used in SOCSOC Processors Used in SOCSOC-CH4.pptSOC Processors Used in SOCSOC Processors Used in SOC
SOC-CH4.pptSOC Processors Used in SOCSOC Processors Used in SOC
 
Lecture 25
Lecture 25Lecture 25
Lecture 25
 
Memory Organizationsssssssssssssssss.ppt
Memory Organizationsssssssssssssssss.pptMemory Organizationsssssssssssssssss.ppt
Memory Organizationsssssssssssssssss.ppt
 
memeoryorganization PPT for organization of memories
memeoryorganization PPT for organization of memoriesmemeoryorganization PPT for organization of memories
memeoryorganization PPT for organization of memories
 
Erasing Belady's Limitations: In Search of Flash Cache Offline Optimality
Erasing Belady's Limitations: In Search of Flash Cache Offline OptimalityErasing Belady's Limitations: In Search of Flash Cache Offline Optimality
Erasing Belady's Limitations: In Search of Flash Cache Offline Optimality
 
Computer System Architecture Lecture Note 8.1 primary Memory
Computer System Architecture Lecture Note 8.1 primary MemoryComputer System Architecture Lecture Note 8.1 primary Memory
Computer System Architecture Lecture Note 8.1 primary Memory
 
computer-memory
computer-memorycomputer-memory
computer-memory
 
Taming Non-blocking Caches to Improve Isolation in Multicore Real-Time Systems
Taming Non-blocking Caches to Improve Isolation in Multicore Real-Time SystemsTaming Non-blocking Caches to Improve Isolation in Multicore Real-Time Systems
Taming Non-blocking Caches to Improve Isolation in Multicore Real-Time Systems
 
cache memory management
cache memory managementcache memory management
cache memory management
 
Computer architecture for HNDIT
Computer architecture for HNDITComputer architecture for HNDIT
Computer architecture for HNDIT
 
Memory organisation
Memory organisationMemory organisation
Memory organisation
 
Kiến trúc máy tính - COE 301 - Memory.ppt
Kiến trúc máy tính - COE 301 - Memory.pptKiến trúc máy tính - COE 301 - Memory.ppt
Kiến trúc máy tính - COE 301 - Memory.ppt
 
Ct213 memory subsystem
Ct213 memory subsystemCt213 memory subsystem
Ct213 memory subsystem
 
Coa presentation3
Coa presentation3Coa presentation3
Coa presentation3
 
Lecture2
Lecture2Lecture2
Lecture2
 
memory.ppt
memory.pptmemory.ppt
memory.ppt
 
memory.ppt
memory.pptmemory.ppt
memory.ppt
 
cache memory introduction, level, function
cache memory introduction, level, functioncache memory introduction, level, function
cache memory introduction, level, function
 

More from RohitPaul71

Class & Objects in JAVA.ppt
Class & Objects in JAVA.pptClass & Objects in JAVA.ppt
Class & Objects in JAVA.pptRohitPaul71
 
FiniteAutomata.ppt
FiniteAutomata.pptFiniteAutomata.ppt
FiniteAutomata.pptRohitPaul71
 
Memory Managment(OS).pptx
Memory Managment(OS).pptxMemory Managment(OS).pptx
Memory Managment(OS).pptxRohitPaul71
 
376951072-3-Greedy-Method-new-ppt.ppt
376951072-3-Greedy-Method-new-ppt.ppt376951072-3-Greedy-Method-new-ppt.ppt
376951072-3-Greedy-Method-new-ppt.pptRohitPaul71
 
amer-memory1.ppt
amer-memory1.pptamer-memory1.ppt
amer-memory1.pptRohitPaul71
 
Binary Adder Design(COA).ppt
Binary Adder Design(COA).pptBinary Adder Design(COA).ppt
Binary Adder Design(COA).pptRohitPaul71
 
Air Pollution (1).ppt
Air Pollution (1).pptAir Pollution (1).ppt
Air Pollution (1).pptRohitPaul71
 

More from RohitPaul71 (12)

Class & Objects in JAVA.ppt
Class & Objects in JAVA.pptClass & Objects in JAVA.ppt
Class & Objects in JAVA.ppt
 
FiniteAutomata.ppt
FiniteAutomata.pptFiniteAutomata.ppt
FiniteAutomata.ppt
 
lecture4.pptx
lecture4.pptxlecture4.pptx
lecture4.pptx
 
Memory Managment(OS).pptx
Memory Managment(OS).pptxMemory Managment(OS).pptx
Memory Managment(OS).pptx
 
376951072-3-Greedy-Method-new-ppt.ppt
376951072-3-Greedy-Method-new-ppt.ppt376951072-3-Greedy-Method-new-ppt.ppt
376951072-3-Greedy-Method-new-ppt.ppt
 
amer-memory1.ppt
amer-memory1.pptamer-memory1.ppt
amer-memory1.ppt
 
ch05.ppt
ch05.pptch05.ppt
ch05.ppt
 
Binary Adder Design(COA).ppt
Binary Adder Design(COA).pptBinary Adder Design(COA).ppt
Binary Adder Design(COA).ppt
 
ch8.ppt
ch8.pptch8.ppt
ch8.ppt
 
4876238.ppt
4876238.ppt4876238.ppt
4876238.ppt
 
ALUdesign.ppt
ALUdesign.pptALUdesign.ppt
ALUdesign.ppt
 
Air Pollution (1).ppt
Air Pollution (1).pptAir Pollution (1).ppt
Air Pollution (1).ppt
 

Recently uploaded

History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 

Recently uploaded (20)

History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 

7_mem_cache.ppt

  • 1. 1 COSC 3P92 Cosc 3P92 Week 9 Lecture slides The human brain starts working the moment you are born and never stops until you stand up to speak in public. George Jessel
  • 2. 2 COSC 3P92 • In a typical computer system, the storage system is organized according to the following hierarchy: Archival Storage (magnetic tape or photographic) Moving head disk (magnetic or optical) High speed drum Charge Coupled Device Main memory Cache Internal decreasing cost/bit decreasing access time fast access (1-20 ns.) and small capacity (1-4K byte) slow access (1-5 s.) and large capacity (almost unlimited) Memory Organization
  • 3. 3 COSC 3P92 Memory speed • Access time (Ta) – the average time taken to read a unit of information e.g., 100 ns (100 x 10**-9 s) • Access rate (Ra) = 1/Ta (bits/second) e.g., 1/100ns = 10 Mb/s • Cycle time (Tc) – the average time lapse between two successive read operations e.g., 500 ns (500 x 10**-9 s) • Bandwidth or transfer rate (Rc) = 1/Tc (bits/second) e.g., 1/500ns = 2 Mb/s
  • 4. 4 COSC 3P92 Classes of Memory • RAM (“normal memory”) • Direct-access storage: HD, CD ROM, DVD • Sequential access storage tapes: DAT • Associative (content-addressable) memory: searches for data via bit patterns – CAM (Content Addressable Memory) » Includes comparison logic with each bit of storage. » A data value is broadcast to all words of storage and compared with the values there. » Words which match are flagged. » Subsequent operations can then work on flagged words. » (computing-dictionary.thefreedictionary.com) • ROM
  • 5. 5 COSC 3P92 Categories of RAM and ROM Mask PROM EPROM, ROM EAROM RAM ROM magnetic semiconductor core static dynamic Bipolar MOS Mask PROM ROM primary memory
  • 6. 6 COSC 3P92 Main Memory Design 1K x 4 RAM chip 10 4 A9-A0 WE CS D3-D0 CS WE MODE Status of the Power Bi-directional Datelines D3-D0 H X not selected High impedance Standby L L Write Acts as input bus Active L H Read Acts as output bus Active
  • 7. 7 COSC 3P92 Main Memory Design Q. How do we build a 4K x 4 RAM using four 1K x 4 RAM chips? Chip A11 A10 A9 A8 A7 . . . A0 Range 0 0 0 x x x . . . x 0000 to 1023 1 0 1 x x x . . . x 1024 to 2047 2 1 0 x x x . . . x 2048 to 3071 3 1 1 x x x . . . x 3072 to 4096
  • 8. 8 COSC 3P92 Processor log2 n 1-of-n Decoder Addr bus Memory bank Enable 1 Enable 2 Enable n 1 2 n (On bus in parallel ) Main Memory Design • Q. How do we build a 256KB RAM system with an 16-bit address bus and four 64KB RAM chips? • Memory band-switching
  • 9. 9 COSC 3P92 Processor Data bus base address 4-bit Base 16-bit Address bus Offset 20 bit Physical address to memory Main memory design • Memory address extension
  • 10. 10 COSC 3P92 CPU c a c h e Main memory external storage C a c h e Cache Memory • Cache: fast-access memory buffer • locality principle: programs usually use limited memory areas, in contrast to totally random access – spatial: location, address – temporal: time accessed – if commonly used memory can be buffered in high-speed cache, overall performance enhanced – cache takes form of small amount of store, with hardware support for maintenance and lookup – each cache cell saves a cache line - block of main memory (4-64 words) • cache hit: – requested memory resides in cache
  • 11. 11 COSC 3P92 • cache miss: – requested memory not in cache, and must be fetched from main memory and put into cache • unified cache: – instns, data share same cache • split cache: – separate instn, data caches • parallel access: – double the bandwidth • level 2 cache: – between instn/data cache and main memory • Cache maintenance algorithms similar in spirit to virtual memory ideas at operating system level; main difference is that cache is hardware-supported, whereas v.m. is software implemented Cache
  • 12. 12 COSC 3P92 Measuring cache performance • c - cache access time • m - main memory access time • hr - hit ratio ( 0 <= hr <= 1) : – # cache hits / total memory requests • mr - miss ratio (1-hr) • mean access time = c + (1-hr)m – if hr --> 1 then m.a.t. = c – if hr --> 0 then m.a.t. = c + m
  • 13. 13 COSC 3P92 Cache Example • example: let c = 160 ns m = 960 ns h = .90 (common) mean = 160 + (1-.90)960 = 256 ns efficiency = c / mean = 160/256 = 62.5%
  • 16. 16 COSC 3P92 Direct mapping • use a hash function to find cache location • normally, modulo some bit field of address, then just use low end field • cache fields: – valid bit – tag - block # being held – value - data block • scheme: • memory request: – compute cache slot (low n bits) – check block (tag) field » hit: return value » miss: fetch block from memory, give to CPU, and put into that computed slot (replace existing item if there) • can occasionally produce thrashing – eg. addresses that are multiple of cache size (64K) will reside at same entry – split instn/data cache helps avoid thrashing
  • 17. 17 COSC 3P92 Set associative mapping 0 1 i M-1 Set 0 Set 1 Set N/S - 1 Cache Main memory Set i mod (N/S) S blocks per set
  • 19. 19 COSC 3P92 Set associative mapping • [4.39] • use same hash function as direct mapping, except that each cache slot holds multiple data blocks – usually max. 4 blocks (“4-way”) • searching blocks in a slot done associatively: simultaneous pattern matching • more flexible than direct: multiple blocks in set • use smaller tag than associative, therefore cheaper to implement associative matching • commonly used in larger systems (VAX 11-780) • which line should be replaced when slot full? – eg. LRU (least recently used)
  • 20. 20 COSC 3P92 Writing back to the memory • only write to memory if cache data modified. • write back (write-deferred): – (i) use a modified bit. When swapping a cache slot or ending job, write slot if its modified bit is set • write through: – (ii) whenever modifying data, always write it back to main memory – have to do this if memory being shared in a DMA or multiprocessing system
  • 21. 21 COSC 3P92 Example: direct mapping 4 byte blocks 1 byte words 8 slots in cache