SlideShare a Scribd company logo
Virtual memory and page replacement algorithm
Presented to
Sir Tahir
Presented By
Ch Muhammad Awais
2695/FBAS/BSCS4/F13(A)
M Mansoor Ul Haq
2736/FBAS/BSCS4/F13(A)
Nouman Dilshad
2709/FBAS/BSCS4/F13(A)
Faheem Akhtar
2710/FBAS/BSCS4/F13(A)
Muddasir Shabbir
2739/FBAS/BSCS4/F13(A)
Virtual memory and page replacement algorithm
Now the Question is
What Is Virtual Memory ??
Virtual memory
“separation of user logical memory from physical memory.”
 Only part of the program needs to be in memory for execution
 Logical address space can therefore be much larger than physical address
space
 Allows address spaces to be shared by several processes
 Allows for more efficient process creation
Virtual Memory which is larger than Physical
Memory
Virtual Address Space
Advantages Of Virtual Memory:
Multitasking
Allocating Memory Is Easy and Cheap
More Efficient Swapping
Process may even be larger than all of the physical memory.
This concept is very helpful in implementing multiprogramming environment.
Disadvantage's Of Virtual Memory:
Longer Memory Access Time As HDD Is Slower.
Memory Requirement.
Applications run slower if the system is using virtual memory.
It takes more time to switch between applications.
Less hard drive space for your use.
Virtual memory and page replacement algorithm
 Prevent over-allocation of memory by modifying page-fault service routine to
include page replacement
 Use modify bit to reduce overhead of page transfers – only modified pages are
written to disk
 Page replacement completes separation between logical memory and physical
memory – large virtual memory can be provided on a smaller physical memory
Page Replacement
Need For Page Replacement
1. Find the location of the desired page on disk
2. Find a free frame:
- If there is a free frame, use it
- If there is no free frame, use a page replacement algorithm to select a victim frame
3. Bring the desired page into the (newly) free frame; update the page and frame tables
4. Restart the process
Basic Page Replacement
Page Replacement
Why and When We Use Page Replacement Algorithm ?
 Want lowest page-fault rate
Evaluate algorithm by running it on a particular string of memory
references (reference string) and computing the number of page faults
on that string
In all our examples, the reference string is
1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5
Virtual memory and page replacement algorithm
Treats page frames allocated to a process as a
circular buffer:
When the buffer is full, the oldest page is
replaced. Hence first-in, first-out:
A frequently used page is often the oldest, so it will be
repeatedly paged out by FIFO.
Simple to implement:
requires only a pointer that circles through the page
frames of the process.
Reference string: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5
 3 frames (3 pages can be in memory at a time per process)
 4 frames
First In First Out Algorithms
1
2
3
4
1
2
5
3
4
1
2
3
9 page faults
1
2
3
1
2
3
5
1
2
4
5 10 page faults
44 3
• Replace page that will not be used for longest period of time
• 4 frames example
1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5
 How do you know this?
 Used for measuring how well your algorithm performs
Optimal Algorithm
1
2
3
4
6 page faults
4 5
• Reference string: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5
• Counter implementation
• Every page entry has a counter; every time page is referenced through this entry, copy
the clock into the counter
• When a page needs to be changed, look at the counters to determine which are to
change
5
2
4
3
1
2
3
4
1
2
5
4
1
2
5
3
1
2
4
3
Least Recent Used (LRU) Algorithm
Use of a stack to Record The Most Recent Page Reference
LRU Approximation Algorithms
• Reference bit
o With each page associate a bit, initially = 0
o When page is referenced bit set to 1
o Replace the one which is 0 (if one exists)
• Second chance
o Need reference bit
o Clock replacement
o If page to be replaced (in clock order) has reference bit = 1 then:
 set reference bit 0
 leave page in memory
 replace next page (in clock order), subject to same rules
Advantages :-
 LRU policy is often used as a page replacement algorithm
 It is quite good algorithm.
 It is easy to choose that has already page faulted and not in use for
long period.
Disadvantages:-
 Problem is how to implement LRU replacement Require substantial
hardware assistance
 Problem is determine the frame order by the time of last use.
Counting Algorithms
Keep a counter of the number of references that have been made to each page
LFU Algorithm: replaces page with smallest count
MFU Algorithm: based on the argument that the page with the smallest count
was probably just brought in and has yet to be used
Thanks
Powered By: ProgCoders
Ad

More Related Content

What's hot (20)

Memory management
Memory managementMemory management
Memory management
CHANDERPRABHU JAIN COLLEGE OF HIGHER STUDIES & SCHOOL OF LAW
 
Translation Look Aside buffer
Translation Look Aside buffer Translation Look Aside buffer
Translation Look Aside buffer
Zara Nawaz
 
Computer architecture virtual memory
Computer architecture virtual memoryComputer architecture virtual memory
Computer architecture virtual memory
Mazin Alwaaly
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
aaina_katyal
 
Virtual memory presentation
Virtual memory presentationVirtual memory presentation
Virtual memory presentation
Ranjeet Kumar
 
Page Replacement
Page ReplacementPage Replacement
Page Replacement
chandinisanz
 
Intermediate code generation in Compiler Design
Intermediate code generation in Compiler DesignIntermediate code generation in Compiler Design
Intermediate code generation in Compiler Design
Kuppusamy P
 
VIRTUAL MEMORY
VIRTUAL MEMORYVIRTUAL MEMORY
VIRTUAL MEMORY
Kamran Ashraf
 
Semaphore
SemaphoreSemaphore
Semaphore
Arafat Hossan
 
Virtual Memory in Operating System
Virtual Memory in Operating SystemVirtual Memory in Operating System
Virtual Memory in Operating System
Meghaj Mallick
 
Cache memory
Cache memoryCache memory
Cache memory
Anand Goyal
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
Kumar Pritam
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
Muhammad Farooq
 
Cs8493 unit 1
Cs8493 unit 1Cs8493 unit 1
Cs8493 unit 1
Kathirvel Ayyaswamy
 
Exception | How Exceptions are Handled in MIPS architecture
Exception | How Exceptions are Handled in MIPS architectureException | How Exceptions are Handled in MIPS architecture
Exception | How Exceptions are Handled in MIPS architecture
babuece
 
Linux Memory Management
Linux Memory ManagementLinux Memory Management
Linux Memory Management
Suvendu Kumar Dash
 
Cache memory
Cache memoryCache memory
Cache memory
Ansari Maviya
 
Free space managment46
Free space managment46Free space managment46
Free space managment46
myrajendra
 
Loop optimization
Loop optimizationLoop optimization
Loop optimization
Vivek Gandhi
 
Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory management
rprajat007
 

Viewers also liked (8)

141060753008 3715302
141060753008 3715302141060753008 3715302
141060753008 3715302
ITM Universe - Vadodara
 
Page Replacement Algorithms
Page Replacement AlgorithmsPage Replacement Algorithms
Page Replacement Algorithms
Kashif Dayo
 
Page replacement
Page replacementPage replacement
Page replacement
sashi799
 
Pagereplacement algorithm(computional concept)
Pagereplacement algorithm(computional concept)Pagereplacement algorithm(computional concept)
Pagereplacement algorithm(computional concept)
Siddhi Viradiya
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
Piyush Rochwani
 
Memory management
Memory managementMemory management
Memory management
Rajni Sirohi
 
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
 
Operating Systems and Memory Management
Operating Systems and Memory ManagementOperating Systems and Memory Management
Operating Systems and Memory Management
guest1415ae65
 
Page Replacement Algorithms
Page Replacement AlgorithmsPage Replacement Algorithms
Page Replacement Algorithms
Kashif Dayo
 
Page replacement
Page replacementPage replacement
Page replacement
sashi799
 
Pagereplacement algorithm(computional concept)
Pagereplacement algorithm(computional concept)Pagereplacement algorithm(computional concept)
Pagereplacement algorithm(computional concept)
Siddhi Viradiya
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
Piyush Rochwani
 
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
 
Operating Systems and Memory Management
Operating Systems and Memory ManagementOperating Systems and Memory Management
Operating Systems and Memory Management
guest1415ae65
 
Ad

Similar to Virtual memory and page replacement algorithm (20)

Demand paging
Demand pagingDemand paging
Demand paging
Trinity Dwarka
 
Virtual Memory sjkdhikejv vsdkjnksnv vkjhfvk
Virtual Memory sjkdhikejv vsdkjnksnv vkjhfvkVirtual Memory sjkdhikejv vsdkjnksnv vkjhfvk
Virtual Memory sjkdhikejv vsdkjnksnv vkjhfvk
HKShab
 
Lecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptxLecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptx
Amanuelmergia
 
Virtual Memory.pdf
Virtual Memory.pdfVirtual Memory.pdf
Virtual Memory.pdf
SujanTimalsina5
 
Comparision of page replacement algorithms.pptx
Comparision of page replacement algorithms.pptxComparision of page replacement algorithms.pptx
Comparision of page replacement algorithms.pptx
SureshD94
 
Chapter 8 - Virtual memory - William stallings.ppt
Chapter 8  - Virtual memory - William stallings.pptChapter 8  - Virtual memory - William stallings.ppt
Chapter 8 - Virtual memory - William stallings.ppt
GMRavinduDulshan
 
Chapter 9 - Virtual Memory
Chapter 9 - Virtual MemoryChapter 9 - Virtual Memory
Chapter 9 - Virtual Memory
Wayne Jones Jnr
 
Virtual Memory Management Part - II.pdf
Virtual Memory Management Part - II.pdfVirtual Memory Management Part - II.pdf
Virtual Memory Management Part - II.pdf
Harika Pudugosula
 
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
 
OS Presentation 2023.pptx
OS Presentation 2023.pptxOS Presentation 2023.pptx
OS Presentation 2023.pptx
ShayanAli68
 
Page replacement_Architecture ppt (213015018+213015017).pptx
Page replacement_Architecture ppt (213015018+213015017).pptxPage replacement_Architecture ppt (213015018+213015017).pptx
Page replacement_Architecture ppt (213015018+213015017).pptx
MD SAZID ZAMIL
 
Ch09
Ch09Ch09
Ch09
guest64730d
 
O ssvv82014
O ssvv82014O ssvv82014
O ssvv82014
Shivashekharayya Viraktamath
 
Mem mgt
Mem mgtMem mgt
Mem mgt
Dr. Jasmine Beulah Gnanadurai
 
final_unit_6_spos_notes_2023/24 pattern.pdf
final_unit_6_spos_notes_2023/24 pattern.pdffinal_unit_6_spos_notes_2023/24 pattern.pdf
final_unit_6_spos_notes_2023/24 pattern.pdf
silentkillerin2023
 
Ch10 OS
Ch10 OSCh10 OS
Ch10 OS
C.U
 
OS_Ch10
OS_Ch10OS_Ch10
OS_Ch10
Supriya Shrivastava
 
OSCh10
OSCh10OSCh10
OSCh10
Joe Christensen
 
Operating system 38 page replacement
Operating system 38 page replacementOperating system 38 page replacement
Operating system 38 page replacement
Vaibhav Khanna
 
Memory management
Memory managementMemory management
Memory management
Rasi123
 
Virtual Memory sjkdhikejv vsdkjnksnv vkjhfvk
Virtual Memory sjkdhikejv vsdkjnksnv vkjhfvkVirtual Memory sjkdhikejv vsdkjnksnv vkjhfvk
Virtual Memory sjkdhikejv vsdkjnksnv vkjhfvk
HKShab
 
Lecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptxLecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptx
Amanuelmergia
 
Comparision of page replacement algorithms.pptx
Comparision of page replacement algorithms.pptxComparision of page replacement algorithms.pptx
Comparision of page replacement algorithms.pptx
SureshD94
 
Chapter 8 - Virtual memory - William stallings.ppt
Chapter 8  - Virtual memory - William stallings.pptChapter 8  - Virtual memory - William stallings.ppt
Chapter 8 - Virtual memory - William stallings.ppt
GMRavinduDulshan
 
Chapter 9 - Virtual Memory
Chapter 9 - Virtual MemoryChapter 9 - Virtual Memory
Chapter 9 - Virtual Memory
Wayne Jones Jnr
 
Virtual Memory Management Part - II.pdf
Virtual Memory Management Part - II.pdfVirtual Memory Management Part - II.pdf
Virtual Memory Management Part - II.pdf
Harika Pudugosula
 
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
 
OS Presentation 2023.pptx
OS Presentation 2023.pptxOS Presentation 2023.pptx
OS Presentation 2023.pptx
ShayanAli68
 
Page replacement_Architecture ppt (213015018+213015017).pptx
Page replacement_Architecture ppt (213015018+213015017).pptxPage replacement_Architecture ppt (213015018+213015017).pptx
Page replacement_Architecture ppt (213015018+213015017).pptx
MD SAZID ZAMIL
 
final_unit_6_spos_notes_2023/24 pattern.pdf
final_unit_6_spos_notes_2023/24 pattern.pdffinal_unit_6_spos_notes_2023/24 pattern.pdf
final_unit_6_spos_notes_2023/24 pattern.pdf
silentkillerin2023
 
Ch10 OS
Ch10 OSCh10 OS
Ch10 OS
C.U
 
Operating system 38 page replacement
Operating system 38 page replacementOperating system 38 page replacement
Operating system 38 page replacement
Vaibhav Khanna
 
Memory management
Memory managementMemory management
Memory management
Rasi123
 
Ad

Recently uploaded (20)

Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Leonel Morgado
 
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon DolabaniHistory Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
fruinkamel7m
 
How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18
Celine George
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
Nguyen Thanh Tu Collection
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-14-2025 .pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-14-2025  .pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-14-2025  .pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-14-2025 .pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
The role of wall art in interior designing
The role of wall art in interior designingThe role of wall art in interior designing
The role of wall art in interior designing
meghaark2110
 
Pope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptxPope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptx
Martin M Flynn
 
Myopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduateMyopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduate
Mohamed Rizk Khodair
 
How to Create Kanban View in Odoo 18 - Odoo Slides
How to Create Kanban View in Odoo 18 - Odoo SlidesHow to Create Kanban View in Odoo 18 - Odoo Slides
How to Create Kanban View in Odoo 18 - Odoo Slides
Celine George
 
How to Manage Manual Reordering Rule in Odoo 18 Inventory
How to Manage Manual Reordering Rule in Odoo 18 InventoryHow to Manage Manual Reordering Rule in Odoo 18 Inventory
How to Manage Manual Reordering Rule in Odoo 18 Inventory
Celine George
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
COPA Apprentice exam Questions and answers PDF
COPA Apprentice exam Questions and answers PDFCOPA Apprentice exam Questions and answers PDF
COPA Apprentice exam Questions and answers PDF
SONU HEETSON
 
Final Evaluation.docx...........................
Final Evaluation.docx...........................Final Evaluation.docx...........................
Final Evaluation.docx...........................
l1bbyburrell
 
How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18
Celine George
 
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales moduleHow To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
Celine George
 
Cyber security COPA ITI MCQ Top Questions
Cyber security COPA ITI MCQ Top QuestionsCyber security COPA ITI MCQ Top Questions
Cyber security COPA ITI MCQ Top Questions
SONU HEETSON
 
How to Add Button in Chatter in Odoo 18 - Odoo Slides
How to Add Button in Chatter in Odoo 18 - Odoo SlidesHow to Add Button in Chatter in Odoo 18 - Odoo Slides
How to Add Button in Chatter in Odoo 18 - Odoo Slides
Celine George
 
MCQS (EMERGENCY NURSING) DR. NASIR MUSTAFA
MCQS (EMERGENCY NURSING) DR. NASIR MUSTAFAMCQS (EMERGENCY NURSING) DR. NASIR MUSTAFA
MCQS (EMERGENCY NURSING) DR. NASIR MUSTAFA
Dr. Nasir Mustafa
 
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Leonel Morgado
 
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon DolabaniHistory Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
fruinkamel7m
 
How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18
Celine George
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
Nguyen Thanh Tu Collection
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
The role of wall art in interior designing
The role of wall art in interior designingThe role of wall art in interior designing
The role of wall art in interior designing
meghaark2110
 
Pope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptxPope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptx
Martin M Flynn
 
Myopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduateMyopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduate
Mohamed Rizk Khodair
 
How to Create Kanban View in Odoo 18 - Odoo Slides
How to Create Kanban View in Odoo 18 - Odoo SlidesHow to Create Kanban View in Odoo 18 - Odoo Slides
How to Create Kanban View in Odoo 18 - Odoo Slides
Celine George
 
How to Manage Manual Reordering Rule in Odoo 18 Inventory
How to Manage Manual Reordering Rule in Odoo 18 InventoryHow to Manage Manual Reordering Rule in Odoo 18 Inventory
How to Manage Manual Reordering Rule in Odoo 18 Inventory
Celine George
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
COPA Apprentice exam Questions and answers PDF
COPA Apprentice exam Questions and answers PDFCOPA Apprentice exam Questions and answers PDF
COPA Apprentice exam Questions and answers PDF
SONU HEETSON
 
Final Evaluation.docx...........................
Final Evaluation.docx...........................Final Evaluation.docx...........................
Final Evaluation.docx...........................
l1bbyburrell
 
How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18
Celine George
 
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales moduleHow To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
Celine George
 
Cyber security COPA ITI MCQ Top Questions
Cyber security COPA ITI MCQ Top QuestionsCyber security COPA ITI MCQ Top Questions
Cyber security COPA ITI MCQ Top Questions
SONU HEETSON
 
How to Add Button in Chatter in Odoo 18 - Odoo Slides
How to Add Button in Chatter in Odoo 18 - Odoo SlidesHow to Add Button in Chatter in Odoo 18 - Odoo Slides
How to Add Button in Chatter in Odoo 18 - Odoo Slides
Celine George
 
MCQS (EMERGENCY NURSING) DR. NASIR MUSTAFA
MCQS (EMERGENCY NURSING) DR. NASIR MUSTAFAMCQS (EMERGENCY NURSING) DR. NASIR MUSTAFA
MCQS (EMERGENCY NURSING) DR. NASIR MUSTAFA
Dr. Nasir Mustafa
 

Virtual memory and page replacement algorithm

  • 2. Presented to Sir Tahir Presented By Ch Muhammad Awais 2695/FBAS/BSCS4/F13(A) M Mansoor Ul Haq 2736/FBAS/BSCS4/F13(A) Nouman Dilshad 2709/FBAS/BSCS4/F13(A) Faheem Akhtar 2710/FBAS/BSCS4/F13(A) Muddasir Shabbir 2739/FBAS/BSCS4/F13(A)
  • 4. Now the Question is What Is Virtual Memory ??
  • 5. Virtual memory “separation of user logical memory from physical memory.”  Only part of the program needs to be in memory for execution  Logical address space can therefore be much larger than physical address space  Allows address spaces to be shared by several processes  Allows for more efficient process creation
  • 6. Virtual Memory which is larger than Physical Memory
  • 8. Advantages Of Virtual Memory: Multitasking Allocating Memory Is Easy and Cheap More Efficient Swapping Process may even be larger than all of the physical memory. This concept is very helpful in implementing multiprogramming environment.
  • 9. Disadvantage's Of Virtual Memory: Longer Memory Access Time As HDD Is Slower. Memory Requirement. Applications run slower if the system is using virtual memory. It takes more time to switch between applications. Less hard drive space for your use.
  • 11.  Prevent over-allocation of memory by modifying page-fault service routine to include page replacement  Use modify bit to reduce overhead of page transfers – only modified pages are written to disk  Page replacement completes separation between logical memory and physical memory – large virtual memory can be provided on a smaller physical memory Page Replacement
  • 12. Need For Page Replacement
  • 13. 1. Find the location of the desired page on disk 2. Find a free frame: - If there is a free frame, use it - If there is no free frame, use a page replacement algorithm to select a victim frame 3. Bring the desired page into the (newly) free frame; update the page and frame tables 4. Restart the process Basic Page Replacement
  • 15. Why and When We Use Page Replacement Algorithm ?  Want lowest page-fault rate Evaluate algorithm by running it on a particular string of memory references (reference string) and computing the number of page faults on that string In all our examples, the reference string is 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5
  • 17. Treats page frames allocated to a process as a circular buffer: When the buffer is full, the oldest page is replaced. Hence first-in, first-out: A frequently used page is often the oldest, so it will be repeatedly paged out by FIFO. Simple to implement: requires only a pointer that circles through the page frames of the process.
  • 18. Reference string: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5  3 frames (3 pages can be in memory at a time per process)  4 frames First In First Out Algorithms 1 2 3 4 1 2 5 3 4 1 2 3 9 page faults 1 2 3 1 2 3 5 1 2 4 5 10 page faults 44 3
  • 19. • Replace page that will not be used for longest period of time • 4 frames example 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5  How do you know this?  Used for measuring how well your algorithm performs Optimal Algorithm 1 2 3 4 6 page faults 4 5
  • 20. • Reference string: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5 • Counter implementation • Every page entry has a counter; every time page is referenced through this entry, copy the clock into the counter • When a page needs to be changed, look at the counters to determine which are to change 5 2 4 3 1 2 3 4 1 2 5 4 1 2 5 3 1 2 4 3 Least Recent Used (LRU) Algorithm
  • 21. Use of a stack to Record The Most Recent Page Reference
  • 22. LRU Approximation Algorithms • Reference bit o With each page associate a bit, initially = 0 o When page is referenced bit set to 1 o Replace the one which is 0 (if one exists) • Second chance o Need reference bit o Clock replacement o If page to be replaced (in clock order) has reference bit = 1 then:  set reference bit 0  leave page in memory  replace next page (in clock order), subject to same rules
  • 23. Advantages :-  LRU policy is often used as a page replacement algorithm  It is quite good algorithm.  It is easy to choose that has already page faulted and not in use for long period. Disadvantages:-  Problem is how to implement LRU replacement Require substantial hardware assistance  Problem is determine the frame order by the time of last use.
  • 24. Counting Algorithms Keep a counter of the number of references that have been made to each page LFU Algorithm: replaces page with smallest count MFU Algorithm: based on the argument that the page with the smallest count was probably just brought in and has yet to be used
  翻译: