SlideShare a Scribd company logo
1 of 9
Memory Organization 1 Lecture 43
CSE 211, Computer Organization and Architecture Harjeet Kaur, CSE/IT
Overview
 Memory Hierarchy
 Main Memory
 Auxiliary Memory
 Associative Memory
 Cache Memory
 Virtual Memory
 Memory Mgt Hardware
Memory Organization 2 Lecture 43
CSE 211, Computer Organization and Architecture Harjeet Kaur, CSE/IT
Virtual Memory
Give the programmer the illusion that the system has a very large memory, even though the
computer actually has a relatively small main memory
Address Space(Logical) and Memory Space(Physical)
Address Mapping
Memory Mapping Table for Virtual Address -> Physical Address
virtual address
(logical address) physical address
address space memory space
address generated by programs actual main memory address
Mapping
Virtual address
Virtual
address
register
Memory
mapping
table
Memory table
buffer register
Main memory
address
register
Main
memory
Main memory
buffer register
Physical
Address
Memory Organization 3 Lecture 43
CSE 211, Computer Organization and Architecture Harjeet Kaur, CSE/IT
Address Mapping
Organization of memory Mapping Table in a paged system
Address Space and Memory Space are each divided into fixed size group of
words called blocks or pages
1K words group
Page 0
Page 1
Page 2
Page 3
Page 4
Page 5
Page 6
Page 7
Block 3
Block 2
Block 1
Block 0Address space
N = 8K = 213
Memory space
M = 4K = 212
0000
1001
1010
0011
0100
1101
1110
0111
1
Block 0
Block 1
Block 2
Block 3
MBR
0 1 0 1 0 1 0 1 0 0 1 1
1 0 1 0 1 0 1 0 1 0 0 1 1
Table
address
Presence
bit
Page no. Line number
Virtual address
Main memory
address register
Memory page table
Main memory
11
00
01
10
01
Memory Organization 4 Lecture 43
CSE 211, Computer Organization and Architecture Harjeet Kaur, CSE/IT
Associative Memory Page Table
Assume that
Number of Blocks in memory = m
Number of Pages in Virtual Address Space = n
Page Table
- Straight forward design -> n entry table in memory Inefficient storage space utilization
<- n-m entries of the table is empty
- More efficient method is m-entry Page Table
Page Table made of an Associative Memory
m words; (Page Number:Block Number)
1 0 1 Line number
Page no.
Argument register
1 0 1 0 0
0 0 1 1 1
0 1 0 0 0
1 0 1 0 1
1 1 0 1 0
Key register
Associative memory
Page no. Block no.
Virtual address
Page Fault
Page number cannot be found in the Page Table
Memory Organization 5 Lecture 43
CSE 211, Computer Organization and Architecture Harjeet Kaur, CSE/IT
Page Fault
Processor architecture should provide the ability
to restart any instruction after a page fault.
1. Trap to the OS
2. Save the user registers and program state
3. Determine that the interrupt was a page fault
4. Check that the page reference was legal and
determine the location of the page on the
backing store(disk)
5. Issue a read from the backing store to a free
frame
a. Wait in a queue for this device until serviced
b. Wait for the device seek and/or latency time
c. Begin the transfer of the page to a free frame
6. While waiting, the CPU may be allocated to
some other process
7. Interrupt from the backing store (I/O completed)
8. Save the registers and program state for the other user
9. Determine that the interrupt was from the backing store
10. Correct the page tables (the desired page is now in memory)
11. Wait for the CPU to be allocated to this process again
12. Restore the user registers, program state, and new page table, then
resume the interrupted instruction.
LOAD M
0
Reference1
OS
trap2
free frame
main memory
4
bring in
missing
page5
reset
page
table
6
restart
instruction
Memory Organization 6 Lecture 43
CSE 211, Computer Organization and Architecture Harjeet Kaur, CSE/IT
Page Replacement
Modified page fault service routine
Decision on which page to displace to make room for
an incoming page when no free frame is available
1. Find the location of the desired page on the backing store
2. Find a free frame
- If there is a free frame, use it
- Otherwise, use a page-replacement algorithm to select a victim frame
- Write the victim page to the backing store
3. Read the desired page into the (newly) free frame
4. Restart the user process
2
f 0 v i
f v
frame
valid/
invalid bit
page table
change to
invalid
4
reset page
table for
new page
victim
1
swap
out
victim
page
3
swap
desired
page in
backing store
physical memory
Memory Organization 7 Lecture 43
CSE 211, Computer Organization and Architecture Harjeet Kaur, CSE/IT
Page Replacement Algorithms
FIFO
0
7
1
7
2 0 3 0 4 2 3 0 3 2 1 2 0 1 77 0 1
0 0
7
1
2
0
1
2
3
1
2
3
0
4
3
0
4
2
0
4
2
3
0
2
3
0
1
3
0
1
2
7
1
2
7
0
2
7
0
1
Page frames
Reference string
-
FIFO algorithm selects the page that has been in memory the longest time
Using a queue - every time a page is loaded, its
identification is inserted in the queue
Easy to implement
May result in a frequent page fault
Optimal Replacement (OPT) - Lowest page fault rate of all algorithms
Replace that page which will not be used for the longest period of time
0
7
1
7
2 0 3 0 4 2 3 0 3 2 1 2 0 1 77 0 1
0 0
7
1
2
0
1
2
0
3
2
4
3
2
0
3
2
0
1
7
0
1
Page frames
Reference string
Memory Organization 8 Lecture 43
CSE 211, Computer Organization and Architecture Harjeet Kaur, CSE/IT
Page Replacement Algorithms
- OPT is difficult to implement since it requires future knowledge
- LRU uses the recent past as an approximation of near future.
Replace that page which has not been
used for the longest period of time
LRU
0
7
1
7
2 0 3 0 4 2 3 0 3 2 1 2 0 1 77 0 1
0 0
7
1
2
0
1
2
0
3
4
0
3
4
0
2
4
3
2
0
3
2
1
3
2
1
0
2
1
0
7
Page frames
Reference string
- LRU may require substantial hardware assistance
- The problem is to determine an order for the frames
defined by the time of last use
Memory Organization 9 Lecture 43
CSE 211, Computer Organization and Architecture Harjeet Kaur, CSE/IT
Page Replacement Algorithms
LRU Approximation
- Reference (or use) bit is used to approximate the LRU
- Turned on when the corresponding page is referenced after its initial loading
- Additional reference bits may be used
4 7 0 7 1 0 1 2 1 2 7 1 2
Reference string
2
1
0
7
4
7
2
1
0
4
LRU Implementation Methods
• Counters
- For each page table entry - time-of-use register
- Incremented for every memory reference
- Page with the smallest value in time-of-use register is replaced
• Stack
- Stack of page numbers
- Whenever a page is referenced its page number is removed from the stack and
pushed on top
- Least recently used page number is at the bottom

More Related Content

What's hot

Basic Computer Architecture
Basic Computer ArchitectureBasic Computer Architecture
Basic Computer ArchitectureYong Heui Cho
 
Control Unit (CU) – Part 2
Control Unit (CU) – Part 2Control Unit (CU) – Part 2
Control Unit (CU) – Part 2Ajeng Savitri
 
Introduction to computer architecture and organization
Introduction to computer architecture and organizationIntroduction to computer architecture and organization
Introduction to computer architecture and organizationMuhammad Ishaq
 
Introduction to Computer Architecture and Organization
Introduction to Computer Architecture and OrganizationIntroduction to Computer Architecture and Organization
Introduction to Computer Architecture and OrganizationDr. Balaji Ganesh Rajagopal
 
0 introduction to computer architecture
0 introduction to computer architecture0 introduction to computer architecture
0 introduction to computer architectureaamc1100
 
Computer organiztion6
Computer organiztion6Computer organiztion6
Computer organiztion6Umang Gupta
 
Memory interleaving and superscalar processor
Memory interleaving and superscalar processorMemory interleaving and superscalar processor
Memory interleaving and superscalar processorsshwetasrivastava
 
Processor architecture
Processor architectureProcessor architecture
Processor architectureMuuluu
 
Lec9 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part 1
Lec9 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part 1Lec9 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part 1
Lec9 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part 1Hsien-Hsin Sean Lee, Ph.D.
 

What's hot (20)

01 Introduction
01 Introduction01 Introduction
01 Introduction
 
Lecture 27
Lecture 27Lecture 27
Lecture 27
 
Lecture 23
Lecture 23Lecture 23
Lecture 23
 
INSTRUCTION SET
INSTRUCTION SETINSTRUCTION SET
INSTRUCTION SET
 
Computer architecture
Computer architectureComputer architecture
Computer architecture
 
main memory
main memorymain memory
main memory
 
Basic Computer Architecture
Basic Computer ArchitectureBasic Computer Architecture
Basic Computer Architecture
 
Control Unit (CU) – Part 2
Control Unit (CU) – Part 2Control Unit (CU) – Part 2
Control Unit (CU) – Part 2
 
Memory+management
Memory+managementMemory+management
Memory+management
 
cache
cachecache
cache
 
Chapter 8 - Main Memory
Chapter 8 - Main MemoryChapter 8 - Main Memory
Chapter 8 - Main Memory
 
Introduction to computer architecture and organization
Introduction to computer architecture and organizationIntroduction to computer architecture and organization
Introduction to computer architecture and organization
 
Introduction to Computer Architecture and Organization
Introduction to Computer Architecture and OrganizationIntroduction to Computer Architecture and Organization
Introduction to Computer Architecture and Organization
 
0 introduction to computer architecture
0 introduction to computer architecture0 introduction to computer architecture
0 introduction to computer architecture
 
Computer organiztion6
Computer organiztion6Computer organiztion6
Computer organiztion6
 
Memory interleaving and superscalar processor
Memory interleaving and superscalar processorMemory interleaving and superscalar processor
Memory interleaving and superscalar processor
 
Chapter 10
Chapter 10Chapter 10
Chapter 10
 
Ch 1 95
Ch 1 95Ch 1 95
Ch 1 95
 
Processor architecture
Processor architectureProcessor architecture
Processor architecture
 
Lec9 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part 1
Lec9 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part 1Lec9 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part 1
Lec9 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Memory part 1
 

Similar to Lecture 43

Unit 5Memory management.pptx
Unit 5Memory management.pptxUnit 5Memory management.pptx
Unit 5Memory management.pptxSourabhRaj29
 
Ch9 OS
Ch9 OSCh9 OS
Ch9 OSC.U
 
Mca ii os u-4 memory management
Mca  ii  os u-4 memory managementMca  ii  os u-4 memory management
Mca ii os u-4 memory managementRai University
 
OS virtual memory
OS virtual memoryOS virtual memory
OS virtual memoryanand hd
 
Chap8 Virtual Memory. 1997-2003.ppt
Chap8 Virtual Memory. 1997-2003.pptChap8 Virtual Memory. 1997-2003.ppt
Chap8 Virtual Memory. 1997-2003.pptMuteebulhassan
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memoryvampugani
 
Paging +Algorithem+Segmentation+memory management
Paging +Algorithem+Segmentation+memory managementPaging +Algorithem+Segmentation+memory management
Paging +Algorithem+Segmentation+memory managementkazim Hussain
 
STORAGE MANAGEMENT AND PAGING ALGORITHMS.pptx
STORAGE MANAGEMENT AND PAGING ALGORITHMS.pptxSTORAGE MANAGEMENT AND PAGING ALGORITHMS.pptx
STORAGE MANAGEMENT AND PAGING ALGORITHMS.pptxDivyaKS18
 
Memory management
Memory managementMemory management
Memory managementcpjcollege
 
Main memory os - prashant odhavani- 160920107003
Main memory   os - prashant odhavani- 160920107003Main memory   os - prashant odhavani- 160920107003
Main memory os - prashant odhavani- 160920107003Prashant odhavani
 
Lecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptxLecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptxAmanuelmergia
 
Chapter 04
Chapter 04Chapter 04
Chapter 04 Google
 

Similar to Lecture 43 (20)

Unit 5Memory management.pptx
Unit 5Memory management.pptxUnit 5Memory management.pptx
Unit 5Memory management.pptx
 
virtual memory
virtual memoryvirtual memory
virtual memory
 
CH09.pdf
CH09.pdfCH09.pdf
CH09.pdf
 
OSCh9
OSCh9OSCh9
OSCh9
 
Ch9 OS
Ch9 OSCh9 OS
Ch9 OS
 
OS_Ch9
OS_Ch9OS_Ch9
OS_Ch9
 
Mca ii os u-4 memory management
Mca  ii  os u-4 memory managementMca  ii  os u-4 memory management
Mca ii os u-4 memory management
 
Memory management
Memory managementMemory management
Memory management
 
OS virtual memory
OS virtual memoryOS virtual memory
OS virtual memory
 
Chap8 Virtual Memory. 1997-2003.ppt
Chap8 Virtual Memory. 1997-2003.pptChap8 Virtual Memory. 1997-2003.ppt
Chap8 Virtual Memory. 1997-2003.ppt
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 
Paging +Algorithem+Segmentation+memory management
Paging +Algorithem+Segmentation+memory managementPaging +Algorithem+Segmentation+memory management
Paging +Algorithem+Segmentation+memory management
 
STORAGE MANAGEMENT AND PAGING ALGORITHMS.pptx
STORAGE MANAGEMENT AND PAGING ALGORITHMS.pptxSTORAGE MANAGEMENT AND PAGING ALGORITHMS.pptx
STORAGE MANAGEMENT AND PAGING ALGORITHMS.pptx
 
Ch8
Ch8Ch8
Ch8
 
Memory management
Memory managementMemory management
Memory management
 
Memory management
Memory managementMemory management
Memory management
 
Main memory os - prashant odhavani- 160920107003
Main memory   os - prashant odhavani- 160920107003Main memory   os - prashant odhavani- 160920107003
Main memory os - prashant odhavani- 160920107003
 
Lecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptxLecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptx
 
Chapter 04
Chapter 04Chapter 04
Chapter 04
 
Memory Management
Memory ManagementMemory Management
Memory Management
 

More from RahulRathi94 (20)

Lecture 40
Lecture 40Lecture 40
Lecture 40
 
Lecture 39
Lecture 39Lecture 39
Lecture 39
 
Lecture 38
Lecture 38Lecture 38
Lecture 38
 
Lecture 37
Lecture 37Lecture 37
Lecture 37
 
Lecture 36
Lecture 36Lecture 36
Lecture 36
 
Lecture 35
Lecture 35Lecture 35
Lecture 35
 
Lecture 34
Lecture 34Lecture 34
Lecture 34
 
Lecture 26
Lecture 26Lecture 26
Lecture 26
 
Lecture 24
Lecture 24Lecture 24
Lecture 24
 
Lecture 22
Lecture 22Lecture 22
Lecture 22
 
Lecture 21
Lecture 21Lecture 21
Lecture 21
 
Lecture 20
Lecture 20Lecture 20
Lecture 20
 
Lecture 19
Lecture 19Lecture 19
Lecture 19
 
Lecture 18
Lecture 18Lecture 18
Lecture 18
 
Lecture 17
Lecture 17Lecture 17
Lecture 17
 
Lecture 16
Lecture 16Lecture 16
Lecture 16
 
Lecture 15
Lecture 15Lecture 15
Lecture 15
 
Lecture 14
Lecture 14Lecture 14
Lecture 14
 
Lecture 13
Lecture 13Lecture 13
Lecture 13
 
Lecture 12
Lecture 12Lecture 12
Lecture 12
 

Recently uploaded

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 

Recently uploaded (20)

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 

Lecture 43

  • 1. Memory Organization 1 Lecture 43 CSE 211, Computer Organization and Architecture Harjeet Kaur, CSE/IT Overview  Memory Hierarchy  Main Memory  Auxiliary Memory  Associative Memory  Cache Memory  Virtual Memory  Memory Mgt Hardware
  • 2. Memory Organization 2 Lecture 43 CSE 211, Computer Organization and Architecture Harjeet Kaur, CSE/IT Virtual Memory Give the programmer the illusion that the system has a very large memory, even though the computer actually has a relatively small main memory Address Space(Logical) and Memory Space(Physical) Address Mapping Memory Mapping Table for Virtual Address -> Physical Address virtual address (logical address) physical address address space memory space address generated by programs actual main memory address Mapping Virtual address Virtual address register Memory mapping table Memory table buffer register Main memory address register Main memory Main memory buffer register Physical Address
  • 3. Memory Organization 3 Lecture 43 CSE 211, Computer Organization and Architecture Harjeet Kaur, CSE/IT Address Mapping Organization of memory Mapping Table in a paged system Address Space and Memory Space are each divided into fixed size group of words called blocks or pages 1K words group Page 0 Page 1 Page 2 Page 3 Page 4 Page 5 Page 6 Page 7 Block 3 Block 2 Block 1 Block 0Address space N = 8K = 213 Memory space M = 4K = 212 0000 1001 1010 0011 0100 1101 1110 0111 1 Block 0 Block 1 Block 2 Block 3 MBR 0 1 0 1 0 1 0 1 0 0 1 1 1 0 1 0 1 0 1 0 1 0 0 1 1 Table address Presence bit Page no. Line number Virtual address Main memory address register Memory page table Main memory 11 00 01 10 01
  • 4. Memory Organization 4 Lecture 43 CSE 211, Computer Organization and Architecture Harjeet Kaur, CSE/IT Associative Memory Page Table Assume that Number of Blocks in memory = m Number of Pages in Virtual Address Space = n Page Table - Straight forward design -> n entry table in memory Inefficient storage space utilization <- n-m entries of the table is empty - More efficient method is m-entry Page Table Page Table made of an Associative Memory m words; (Page Number:Block Number) 1 0 1 Line number Page no. Argument register 1 0 1 0 0 0 0 1 1 1 0 1 0 0 0 1 0 1 0 1 1 1 0 1 0 Key register Associative memory Page no. Block no. Virtual address Page Fault Page number cannot be found in the Page Table
  • 5. Memory Organization 5 Lecture 43 CSE 211, Computer Organization and Architecture Harjeet Kaur, CSE/IT Page Fault Processor architecture should provide the ability to restart any instruction after a page fault. 1. Trap to the OS 2. Save the user registers and program state 3. Determine that the interrupt was a page fault 4. Check that the page reference was legal and determine the location of the page on the backing store(disk) 5. Issue a read from the backing store to a free frame a. Wait in a queue for this device until serviced b. Wait for the device seek and/or latency time c. Begin the transfer of the page to a free frame 6. While waiting, the CPU may be allocated to some other process 7. Interrupt from the backing store (I/O completed) 8. Save the registers and program state for the other user 9. Determine that the interrupt was from the backing store 10. Correct the page tables (the desired page is now in memory) 11. Wait for the CPU to be allocated to this process again 12. Restore the user registers, program state, and new page table, then resume the interrupted instruction. LOAD M 0 Reference1 OS trap2 free frame main memory 4 bring in missing page5 reset page table 6 restart instruction
  • 6. Memory Organization 6 Lecture 43 CSE 211, Computer Organization and Architecture Harjeet Kaur, CSE/IT Page Replacement Modified page fault service routine Decision on which page to displace to make room for an incoming page when no free frame is available 1. Find the location of the desired page on the backing store 2. Find a free frame - If there is a free frame, use it - Otherwise, use a page-replacement algorithm to select a victim frame - Write the victim page to the backing store 3. Read the desired page into the (newly) free frame 4. Restart the user process 2 f 0 v i f v frame valid/ invalid bit page table change to invalid 4 reset page table for new page victim 1 swap out victim page 3 swap desired page in backing store physical memory
  • 7. Memory Organization 7 Lecture 43 CSE 211, Computer Organization and Architecture Harjeet Kaur, CSE/IT Page Replacement Algorithms FIFO 0 7 1 7 2 0 3 0 4 2 3 0 3 2 1 2 0 1 77 0 1 0 0 7 1 2 0 1 2 3 1 2 3 0 4 3 0 4 2 0 4 2 3 0 2 3 0 1 3 0 1 2 7 1 2 7 0 2 7 0 1 Page frames Reference string - FIFO algorithm selects the page that has been in memory the longest time Using a queue - every time a page is loaded, its identification is inserted in the queue Easy to implement May result in a frequent page fault Optimal Replacement (OPT) - Lowest page fault rate of all algorithms Replace that page which will not be used for the longest period of time 0 7 1 7 2 0 3 0 4 2 3 0 3 2 1 2 0 1 77 0 1 0 0 7 1 2 0 1 2 0 3 2 4 3 2 0 3 2 0 1 7 0 1 Page frames Reference string
  • 8. Memory Organization 8 Lecture 43 CSE 211, Computer Organization and Architecture Harjeet Kaur, CSE/IT Page Replacement Algorithms - OPT is difficult to implement since it requires future knowledge - LRU uses the recent past as an approximation of near future. Replace that page which has not been used for the longest period of time LRU 0 7 1 7 2 0 3 0 4 2 3 0 3 2 1 2 0 1 77 0 1 0 0 7 1 2 0 1 2 0 3 4 0 3 4 0 2 4 3 2 0 3 2 1 3 2 1 0 2 1 0 7 Page frames Reference string - LRU may require substantial hardware assistance - The problem is to determine an order for the frames defined by the time of last use
  • 9. Memory Organization 9 Lecture 43 CSE 211, Computer Organization and Architecture Harjeet Kaur, CSE/IT Page Replacement Algorithms LRU Approximation - Reference (or use) bit is used to approximate the LRU - Turned on when the corresponding page is referenced after its initial loading - Additional reference bits may be used 4 7 0 7 1 0 1 2 1 2 7 1 2 Reference string 2 1 0 7 4 7 2 1 0 4 LRU Implementation Methods • Counters - For each page table entry - time-of-use register - Incremented for every memory reference - Page with the smallest value in time-of-use register is replaced • Stack - Stack of page numbers - Whenever a page is referenced its page number is removed from the stack and pushed on top - Least recently used page number is at the bottom