SlideShare a Scribd company logo
2
 Recall: memory allocation with variable partitions requires mapping logical
addresses to physical addresses
 Virtual memory achieves a complete separation of logical and physical address-
spaces
 Typically a virtual address is 32 bits, this allows a process to have 4GB of virtual
memory
 Physical memory is much smaller than this, and varies from machine to machine
 Virtual address spaces of different processes are distinct
 Structuring of virtual memory
 Paging: Divide the address space into fixed-size pages
 Segmentation: Divide the address space into variable-size segments
(corresponding to logical units)
Concept of Virtual Memory
Virtual Memory Organization
 Benefits of Virtual Memory ::
 Less I/O needed to load / swap a process.
 Degree of multiprogramming can be increased.
 A program’s logical address space can be larger than physical memory.
 How do we know if a page is in main memory or not?
 With each page table entry, a valid–invalid bit is associated
(1  legal/in-memory , 0  not-in-memory)
 During address translation, if valid–invalid bit in page table entry is 0  page fault trap
1
1
1
1
0
0
0

Frame # valid-invalid bit
page table
Dirty bit in Page table
 Hardware traps to kernel on page fault
 CPU registers of current process are saved
 OS determines which virtual page needed
 OS checks validity of address, protection status
 Check if there is a free frame, else invoke page replacement policy to
select a frame
 If selected frame is dirty, write it to disk
 When page frame is clean, schedule I/O to read in page
 Page table updated
 Process causing fault rescheduled
 Instruction causing fault reinstated
 Registers restored, and program continues execution
GMU – CS 571
Steps in Handling a Page Fault
GMU – CS 571
Impact of Page Faults
 Each page fault affects the system performance negatively
 The process experiencing the page fault will not be able to continue until
the missing page is brought to the main memory
 The process will be blocked (moved to the waiting state) so its data
(registers, etc.) must be saved.
 Dealing with the page fault involves disk I/O
 Increased demand to the disk drive
 Increased waiting time for process experiencing the page fault
Page-Fault Frequency Scheme
 Establish “acceptable” page-fault rate.
 If actual rate too low, process loses frame.
 If actual rate too high, process gains frame.
12
 To avoid thrashing (i.e. too many page faults), a process needs “enough” pages in
the memory
 Memory accesses by a program are not spread all over its virtual memory
randomly, but show a pattern
 E.g. while executing a procedure, a program is accessing the page that contains
the code of the procedure, the local variables, and global vars.
 This is called locality of reference.
 How to exploit locality?
 PrePaging : when a process is brought into memory by the swapper, a few
pages are loaded in a priory (note: demand paging means that a page is
brought in only when needed)
 Working set: Try to keep currently used pages in memory
13
 The phenomenon that programs actually use only a limited set of pages during any
particular time period of execution.
 This set of pages is called the locality of the program during that time.
 Ex. Program phase diagram
virtual
address --------------------------
5 | | x | x | |
--------------------------
4 | | x | x | |
--------------------------
segments 3 | x | x | x | x |
--------------------------
2 x | x | | x | x |
--------------------------
1 x | x | | | |
1 2 3 4 5 virtual
phases time
14
 Working set of a process at time t is the set of pages referenced over last k
accesses (here, k is a parameter)
 Goal of working set based algorithms: keep the working set in memory, and
replace pages not in the working set
 Maintaining the precise working set not feasible (since we don’t want to update
data structures upon every memory access)
 Compromise: Redefine working set to be the set of pages referenced over last m
clock cycles
 Recall: clock interrupt happens every 40 ms and OS can check if the page has
been referenced during the last cycle (R=1)
15
 The working set of a process is the set of all pages accessed by the process within some
fixed time window.
Locality of reference means that a process's working set is usually small compared to
the total number of pages it possesses.
 A program's working set at the k-th reference with window size h is defined to be
W(k,h) = { i  N | page i appears among rk-h+1 … rk }
 The working set at time t is
W(t,h) = W(k,h) where time(rk)  t < t(rk+1)
 Ex. h=4
 w = 1 2 3 4 1 2 5 1 2 5 3 2
| | | | | | | | | | | |
{1} | | | | | | | | | | |
{1,2}| {1,2,3,4} | {1,2,5} | |
{1,2,3} {1,2,4,5} {1,2,3,5}
  = working-set window = a fixed number of page references
Example: 10,000 instruction
 WSSi (working set of Process Pi) =
total number of pages referenced in the most recent  (varies in time)
 if  too small will not encompass entire locality.
 if  too large will encompass several localities.
 if  =   will encompass entire program.
 D =  WSSi  total demand frames
 if D > m  Thrashing
 Policy if D > m, then suspend one of the processes.
Working Sets and Page Fault Rates

More Related Content

What's hot

Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
sangrampatil81
 
Operating System-Memory Management
Operating System-Memory ManagementOperating System-Memory Management
Operating System-Memory Management
Akmal Cikmat
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
tamizh arthanari
 
Advanced computer architechture -Memory Hierarchies and its Properties and Type
Advanced computer architechture -Memory Hierarchies and its Properties and TypeAdvanced computer architechture -Memory Hierarchies and its Properties and Type
Advanced computer architechture -Memory Hierarchies and its Properties and Type
LalfakawmaKh
 
Memory hierarchy
Memory hierarchyMemory hierarchy
Memory hierarchy
Anurag Verma
 
Virtual Mapping in Virtual Memory
Virtual Mapping in Virtual MemoryVirtual Mapping in Virtual Memory
Virtual Mapping in Virtual Memory
Meghaj Mallick
 
Chapter 8 - Main Memory
Chapter 8 - Main MemoryChapter 8 - Main Memory
Chapter 8 - Main Memory
Wayne Jones Jnr
 
6.distributed shared memory
6.distributed shared memory6.distributed shared memory
6.distributed shared memory
Gd Goenka University
 
Virtual Memory ,Direct memory addressing and indirect memory addressing prese...
Virtual Memory ,Direct memory addressing and indirect memory addressing prese...Virtual Memory ,Direct memory addressing and indirect memory addressing prese...
Virtual Memory ,Direct memory addressing and indirect memory addressing prese...
ITM University
 
Bakery Algorithm
Bakery Algorithm Bakery Algorithm
Bakery Algorithm
thededar
 
4. Memory virtualization and management
4. Memory virtualization and management4. Memory virtualization and management
4. Memory virtualization and management
Hwanju Kim
 
Memory management
Memory managementMemory management
Memory management
Memory managementMemory management
Memory management
Mohamed Safraz
 
Virtual Memory and Paging
Virtual Memory and PagingVirtual Memory and Paging
Virtual Memory and Paging
Emery Berger
 
Paging and Segmentation in Operating System
Paging and Segmentation in Operating SystemPaging and Segmentation in Operating System
Paging and Segmentation in Operating System
Raj Mohan
 
Paging and Segmentation
Paging and SegmentationPaging and Segmentation
Paging and Segmentation
Madhur Gupta
 
Demand paging
Demand pagingDemand paging
Demand paging
Trinity Dwarka
 
Memory hierarchy unit 2 by ram k paliwal
Memory hierarchy  unit 2 by ram k paliwalMemory hierarchy  unit 2 by ram k paliwal
Memory hierarchy unit 2 by ram k paliwal
Ram Paliwal
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
vampugani
 

What's hot (20)

Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
 
Operating System-Memory Management
Operating System-Memory ManagementOperating System-Memory Management
Operating System-Memory Management
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Advanced computer architechture -Memory Hierarchies and its Properties and Type
Advanced computer architechture -Memory Hierarchies and its Properties and TypeAdvanced computer architechture -Memory Hierarchies and its Properties and Type
Advanced computer architechture -Memory Hierarchies and its Properties and Type
 
Memory hierarchy
Memory hierarchyMemory hierarchy
Memory hierarchy
 
Virtual Mapping in Virtual Memory
Virtual Mapping in Virtual MemoryVirtual Mapping in Virtual Memory
Virtual Mapping in Virtual Memory
 
Chapter 8 - Main Memory
Chapter 8 - Main MemoryChapter 8 - Main Memory
Chapter 8 - Main Memory
 
Memory virtualization
Memory virtualizationMemory virtualization
Memory virtualization
 
6.distributed shared memory
6.distributed shared memory6.distributed shared memory
6.distributed shared memory
 
Virtual Memory ,Direct memory addressing and indirect memory addressing prese...
Virtual Memory ,Direct memory addressing and indirect memory addressing prese...Virtual Memory ,Direct memory addressing and indirect memory addressing prese...
Virtual Memory ,Direct memory addressing and indirect memory addressing prese...
 
Bakery Algorithm
Bakery Algorithm Bakery Algorithm
Bakery Algorithm
 
4. Memory virtualization and management
4. Memory virtualization and management4. Memory virtualization and management
4. Memory virtualization and management
 
Memory management
Memory managementMemory management
Memory management
 
Memory management
Memory managementMemory management
Memory management
 
Virtual Memory and Paging
Virtual Memory and PagingVirtual Memory and Paging
Virtual Memory and Paging
 
Paging and Segmentation in Operating System
Paging and Segmentation in Operating SystemPaging and Segmentation in Operating System
Paging and Segmentation in Operating System
 
Paging and Segmentation
Paging and SegmentationPaging and Segmentation
Paging and Segmentation
 
Demand paging
Demand pagingDemand paging
Demand paging
 
Memory hierarchy unit 2 by ram k paliwal
Memory hierarchy  unit 2 by ram k paliwalMemory hierarchy  unit 2 by ram k paliwal
Memory hierarchy unit 2 by ram k paliwal
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 

Viewers also liked

Vm
VmVm
Operating Systems - Virtual Memory
Operating Systems - Virtual MemoryOperating Systems - Virtual Memory
Operating Systems - Virtual Memory
Emery Berger
 
Virtual memory 20070222-en
Virtual memory 20070222-enVirtual memory 20070222-en
Virtual memory 20070222-en
Tetsuyuki Kobayashi
 
Ch10: Virtual Memory
Ch10: Virtual MemoryCh10: Virtual Memory
Ch10: Virtual Memory
Ahmar Hashmi
 
virtual memory
virtual memoryvirtual memory
virtual memory
Abeer Naskar
 
Virtual Memory (Making a Process)
Virtual Memory (Making a Process)Virtual Memory (Making a Process)
Virtual Memory (Making a Process)
David Evans
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
Farzan Dehbashi
 
15. Computer Systems Basic Software 1
15. Computer Systems   Basic Software 115. Computer Systems   Basic Software 1
15. Computer Systems Basic Software 1New Era University
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
Asif Iqbal
 
Device Management
Device ManagementDevice Management
Device Management
Kabarak University
 
Virtual memory
Virtual memoryVirtual memory
Virtual memoryMohd Arif
 
Operating system introduction to operating system
Operating system   introduction to operating systemOperating system   introduction to operating system
Operating system introduction to operating systemjaydeesa17
 
39 virtual memory
39 virtual memory39 virtual memory
39 virtual memorymyrajendra
 
Virtual memory
Virtual memoryVirtual memory
Virtual memoryvatsaanadi
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
rapunzel08
 

Viewers also liked (20)

Vm
VmVm
Vm
 
Operating Systems - Virtual Memory
Operating Systems - Virtual MemoryOperating Systems - Virtual Memory
Operating Systems - Virtual Memory
 
VIRTUAL MEMORY
VIRTUAL MEMORYVIRTUAL MEMORY
VIRTUAL MEMORY
 
Virtual memory ppt
Virtual memory pptVirtual memory ppt
Virtual memory ppt
 
Virtual memory 20070222-en
Virtual memory 20070222-enVirtual memory 20070222-en
Virtual memory 20070222-en
 
Ch10: Virtual Memory
Ch10: Virtual MemoryCh10: Virtual Memory
Ch10: Virtual Memory
 
Ch09
Ch09Ch09
Ch09
 
virtual memory
virtual memoryvirtual memory
virtual memory
 
Os8
Os8Os8
Os8
 
Virtual Memory (Making a Process)
Virtual Memory (Making a Process)Virtual Memory (Making a Process)
Virtual Memory (Making a Process)
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 
15. Computer Systems Basic Software 1
15. Computer Systems   Basic Software 115. Computer Systems   Basic Software 1
15. Computer Systems Basic Software 1
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Device Management
Device ManagementDevice Management
Device Management
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Operating system introduction to operating system
Operating system   introduction to operating systemOperating system   introduction to operating system
Operating system introduction to operating system
 
39 virtual memory
39 virtual memory39 virtual memory
39 virtual memory
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
virtual memory
virtual memoryvirtual memory
virtual memory
 

Similar to basics of virtual memory

Unit 5Memory management.pptx
Unit 5Memory management.pptxUnit 5Memory management.pptx
Unit 5Memory management.pptx
SourabhRaj29
 
Chapter 9 - Virtual Memory
Chapter 9 - Virtual MemoryChapter 9 - Virtual Memory
Chapter 9 - Virtual Memory
Wayne Jones Jnr
 
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
Rai University
 
Unit 2chapter 2 memory mgmt complete
Unit 2chapter 2  memory mgmt completeUnit 2chapter 2  memory mgmt complete
Unit 2chapter 2 memory mgmt complete
Kalai Selvi
 
Ch10 OS
Ch10 OSCh10 OS
Ch10 OSC.U
 
Ch9 OS
Ch9 OSCh9 OS
Ch9 OSC.U
 
CH09.pdf
CH09.pdfCH09.pdf
CH09.pdf
ImranKhan880955
 
Mem mgt
Mem mgtMem mgt
Virtual memory - Demand Paging
Virtual memory - Demand PagingVirtual memory - Demand Paging
Virtual memory - Demand Paging
jeyaperumal
 
Memory management
Memory managementMemory management
Memory management
cpjcollege
 
Virtual memory This is the operating system ppt.ppt
Virtual memory This is the operating system ppt.pptVirtual memory This is the operating system ppt.ppt
Virtual memory This is the operating system ppt.ppt
ry54321288
 
Virtual memory pre-final-formatting
Virtual memory pre-final-formattingVirtual memory pre-final-formatting
Virtual memory pre-final-formatting
marangburu42
 
Virtualmemoryfinal 161019175858
Virtualmemoryfinal 161019175858Virtualmemoryfinal 161019175858
Virtualmemoryfinal 161019175858
marangburu42
 

Similar to basics of virtual memory (20)

Unit 5Memory management.pptx
Unit 5Memory management.pptxUnit 5Memory management.pptx
Unit 5Memory management.pptx
 
Chapter 9 - Virtual Memory
Chapter 9 - Virtual MemoryChapter 9 - Virtual Memory
Chapter 9 - Virtual Memory
 
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
 
Unit 2chapter 2 memory mgmt complete
Unit 2chapter 2  memory mgmt completeUnit 2chapter 2  memory mgmt complete
Unit 2chapter 2 memory mgmt complete
 
OS_Ch10
OS_Ch10OS_Ch10
OS_Ch10
 
Ch10 OS
Ch10 OSCh10 OS
Ch10 OS
 
OSCh10
OSCh10OSCh10
OSCh10
 
Ch9 OS
Ch9 OSCh9 OS
Ch9 OS
 
OS_Ch9
OS_Ch9OS_Ch9
OS_Ch9
 
OSCh9
OSCh9OSCh9
OSCh9
 
CH09.pdf
CH09.pdfCH09.pdf
CH09.pdf
 
Mem mgt
Mem mgtMem mgt
Mem mgt
 
Memory management
Memory managementMemory management
Memory management
 
Virtual memory - Demand Paging
Virtual memory - Demand PagingVirtual memory - Demand Paging
Virtual memory - Demand Paging
 
Memory management
Memory managementMemory management
Memory management
 
Virtual memory This is the operating system ppt.ppt
Virtual memory This is the operating system ppt.pptVirtual memory This is the operating system ppt.ppt
Virtual memory This is the operating system ppt.ppt
 
Memory+management
Memory+managementMemory+management
Memory+management
 
Ch8
Ch8Ch8
Ch8
 
Virtual memory pre-final-formatting
Virtual memory pre-final-formattingVirtual memory pre-final-formatting
Virtual memory pre-final-formatting
 
Virtualmemoryfinal 161019175858
Virtualmemoryfinal 161019175858Virtualmemoryfinal 161019175858
Virtualmemoryfinal 161019175858
 

More from Adarsh Patel

CMACs and MACS based on block ciphers, Digital signature
CMACs and MACS based on block ciphers, Digital signatureCMACs and MACS based on block ciphers, Digital signature
CMACs and MACS based on block ciphers, Digital signature
Adarsh Patel
 
4G 5G technology
4G 5G technology 4G 5G technology
4G 5G technology
Adarsh Patel
 
jstl ( jsp standard tag library )
jstl ( jsp standard tag library )jstl ( jsp standard tag library )
jstl ( jsp standard tag library )
Adarsh Patel
 
Loaders ( system programming )
Loaders ( system programming ) Loaders ( system programming )
Loaders ( system programming )
Adarsh Patel
 
Non Linear Data Structures
Non Linear Data StructuresNon Linear Data Structures
Non Linear Data Structures
Adarsh Patel
 
8255:ppi & 8259:pic
8255:ppi & 8259:pic 8255:ppi & 8259:pic
8255:ppi & 8259:pic
Adarsh Patel
 
case study of curve fitting
case study of curve fittingcase study of curve fitting
case study of curve fitting
Adarsh Patel
 
synchronous state machine design
synchronous state machine designsynchronous state machine design
synchronous state machine design
Adarsh Patel
 
projection of solid
projection of solidprojection of solid
projection of solidAdarsh Patel
 
basic electronics, Transmission lines, wave guides And Antenna fundamental
basic electronics, Transmission lines, wave guides And Antenna fundamentalbasic electronics, Transmission lines, wave guides And Antenna fundamental
basic electronics, Transmission lines, wave guides And Antenna fundamentalAdarsh Patel
 
Radioactive pollution
Radioactive pollutionRadioactive pollution
Radioactive pollution
Adarsh Patel
 
Perfect Bookreview - you can win
Perfect Bookreview - you can winPerfect Bookreview - you can win
Perfect Bookreview - you can win
Adarsh Patel
 
mechanical engineering transmission of motion and power
 mechanical engineering transmission of motion and power mechanical engineering transmission of motion and power
mechanical engineering transmission of motion and power
Adarsh Patel
 

More from Adarsh Patel (14)

CMACs and MACS based on block ciphers, Digital signature
CMACs and MACS based on block ciphers, Digital signatureCMACs and MACS based on block ciphers, Digital signature
CMACs and MACS based on block ciphers, Digital signature
 
4G 5G technology
4G 5G technology 4G 5G technology
4G 5G technology
 
jstl ( jsp standard tag library )
jstl ( jsp standard tag library )jstl ( jsp standard tag library )
jstl ( jsp standard tag library )
 
Loaders ( system programming )
Loaders ( system programming ) Loaders ( system programming )
Loaders ( system programming )
 
Non Linear Data Structures
Non Linear Data StructuresNon Linear Data Structures
Non Linear Data Structures
 
8255:ppi & 8259:pic
8255:ppi & 8259:pic 8255:ppi & 8259:pic
8255:ppi & 8259:pic
 
case study of curve fitting
case study of curve fittingcase study of curve fitting
case study of curve fitting
 
synchronous state machine design
synchronous state machine designsynchronous state machine design
synchronous state machine design
 
projection of solid
projection of solidprojection of solid
projection of solid
 
basic electronics, Transmission lines, wave guides And Antenna fundamental
basic electronics, Transmission lines, wave guides And Antenna fundamentalbasic electronics, Transmission lines, wave guides And Antenna fundamental
basic electronics, Transmission lines, wave guides And Antenna fundamental
 
linear equations
linear equationslinear equations
linear equations
 
Radioactive pollution
Radioactive pollutionRadioactive pollution
Radioactive pollution
 
Perfect Bookreview - you can win
Perfect Bookreview - you can winPerfect Bookreview - you can win
Perfect Bookreview - you can win
 
mechanical engineering transmission of motion and power
 mechanical engineering transmission of motion and power mechanical engineering transmission of motion and power
mechanical engineering transmission of motion and power
 

Recently uploaded

Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 

Recently uploaded (20)

Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 

basics of virtual memory

  • 1.
  • 2. 2  Recall: memory allocation with variable partitions requires mapping logical addresses to physical addresses  Virtual memory achieves a complete separation of logical and physical address- spaces  Typically a virtual address is 32 bits, this allows a process to have 4GB of virtual memory  Physical memory is much smaller than this, and varies from machine to machine  Virtual address spaces of different processes are distinct  Structuring of virtual memory  Paging: Divide the address space into fixed-size pages  Segmentation: Divide the address space into variable-size segments (corresponding to logical units)
  • 5.  Benefits of Virtual Memory ::  Less I/O needed to load / swap a process.  Degree of multiprogramming can be increased.  A program’s logical address space can be larger than physical memory.
  • 6.  How do we know if a page is in main memory or not?  With each page table entry, a valid–invalid bit is associated (1  legal/in-memory , 0  not-in-memory)  During address translation, if valid–invalid bit in page table entry is 0  page fault trap 1 1 1 1 0 0 0  Frame # valid-invalid bit page table
  • 7. Dirty bit in Page table
  • 8.  Hardware traps to kernel on page fault  CPU registers of current process are saved  OS determines which virtual page needed  OS checks validity of address, protection status  Check if there is a free frame, else invoke page replacement policy to select a frame  If selected frame is dirty, write it to disk  When page frame is clean, schedule I/O to read in page  Page table updated  Process causing fault rescheduled  Instruction causing fault reinstated  Registers restored, and program continues execution
  • 9. GMU – CS 571 Steps in Handling a Page Fault
  • 10. GMU – CS 571 Impact of Page Faults  Each page fault affects the system performance negatively  The process experiencing the page fault will not be able to continue until the missing page is brought to the main memory  The process will be blocked (moved to the waiting state) so its data (registers, etc.) must be saved.  Dealing with the page fault involves disk I/O  Increased demand to the disk drive  Increased waiting time for process experiencing the page fault
  • 11. Page-Fault Frequency Scheme  Establish “acceptable” page-fault rate.  If actual rate too low, process loses frame.  If actual rate too high, process gains frame.
  • 12. 12  To avoid thrashing (i.e. too many page faults), a process needs “enough” pages in the memory  Memory accesses by a program are not spread all over its virtual memory randomly, but show a pattern  E.g. while executing a procedure, a program is accessing the page that contains the code of the procedure, the local variables, and global vars.  This is called locality of reference.  How to exploit locality?  PrePaging : when a process is brought into memory by the swapper, a few pages are loaded in a priory (note: demand paging means that a page is brought in only when needed)  Working set: Try to keep currently used pages in memory
  • 13. 13  The phenomenon that programs actually use only a limited set of pages during any particular time period of execution.  This set of pages is called the locality of the program during that time.  Ex. Program phase diagram virtual address -------------------------- 5 | | x | x | | -------------------------- 4 | | x | x | | -------------------------- segments 3 | x | x | x | x | -------------------------- 2 x | x | | x | x | -------------------------- 1 x | x | | | | 1 2 3 4 5 virtual phases time
  • 14. 14  Working set of a process at time t is the set of pages referenced over last k accesses (here, k is a parameter)  Goal of working set based algorithms: keep the working set in memory, and replace pages not in the working set  Maintaining the precise working set not feasible (since we don’t want to update data structures upon every memory access)  Compromise: Redefine working set to be the set of pages referenced over last m clock cycles  Recall: clock interrupt happens every 40 ms and OS can check if the page has been referenced during the last cycle (R=1)
  • 15. 15  The working set of a process is the set of all pages accessed by the process within some fixed time window. Locality of reference means that a process's working set is usually small compared to the total number of pages it possesses.  A program's working set at the k-th reference with window size h is defined to be W(k,h) = { i  N | page i appears among rk-h+1 … rk }  The working set at time t is W(t,h) = W(k,h) where time(rk)  t < t(rk+1)  Ex. h=4  w = 1 2 3 4 1 2 5 1 2 5 3 2 | | | | | | | | | | | | {1} | | | | | | | | | | | {1,2}| {1,2,3,4} | {1,2,5} | | {1,2,3} {1,2,4,5} {1,2,3,5}
  • 16.   = working-set window = a fixed number of page references Example: 10,000 instruction  WSSi (working set of Process Pi) = total number of pages referenced in the most recent  (varies in time)  if  too small will not encompass entire locality.  if  too large will encompass several localities.  if  =   will encompass entire program.  D =  WSSi  total demand frames  if D > m  Thrashing  Policy if D > m, then suspend one of the processes.
  • 17. Working Sets and Page Fault Rates