SlideShare a Scribd company logo
1 of 15
Virtual
Memory
SHAYAN ALI CSC-21S-129
MUHAMMAD FURQAN CSC-21S-082
ARSAL AZHAR CSC-21S-019
What is Virtual Memory?
• Virtual memory is a computer memory management technique that allows an
operating system to use a combination of physical RAM (Random Access Memory) and
secondary storage, such as a hard disk drive, to effectively increase the amount of
usable memory available to programs.
What is the importance of Virtual Memory?
• Virtual memory expands the effective memory capacity of a computer system beyond
its physical limits.
• It facilitates memory sharing, swapping, and paging, optimizing memory usage and
improving overall system performance. It enables multitasking and efficient memory
allocation for running multiple programs simultaneously.
Why Do We Need Virtual Memory ?
• Increased Addressable Memory:
1. Virtual memory allows a computer system to access more memory than what is physically
available.
2. This allows programs to utilize more memory than the available physical RAM, enabling
them to run larger and more complex tasks.
• Memory Isolation and Protection:
1. Virtual memory facilitates memory isolation between different processes running on a
computer.
2. This isolation prevents one process from accessing or modifying another process's
memory, enhancing security and stability.
• Efficient Memory Management:
1. Virtual memory enables efficient memory management by utilizing techniques like
demand paging and page swapping.
2. Demand paging loads only the necessary portions of a program into physical memory,
allowing for efficient memory usage.
3. Page swapping moves infrequently used pages of memory between RAM and disk
storage, freeing up physical memory for other tasks.
• Simplified Program Development:
1. Virtual memory simplifies program development by providing a uniform and consistent
memory model for applications.
2. Programmers can develop applications using a flat, contiguous address space,
independent of physical memory limitations.
What is Demand Paging in
Virtual Memory ?
• Demand paging is a virtual memory management technique where pages are
loaded into memory only when they are explicitly requested by processes.
• Instead of loading the entire program into memory at once, only the required
pages are brought into memory as needed.
• When a process references a page that is not in physical memory, a page fault
occurs, and the operating system brings the required page from disk into
memory.
• Demand paging allows for efficient memory utilization by loading pages on-
demand, reducing the initial memory footprint of processes.
Benefits of demand Paging
in Virtual Memory
1. Reduced Memory Footprint:
Demand paging reduces the amount of physical memory required to
run processes by loading only necessary pages.
2. Faster Process Startup Time:
Since demand paging loads only essential pages initially, the
process startup time is reduced as it doesn't have to load the
entire program into memory.
3. Efficient Memory Sharing:
Multiple processes can share the same page in memory, which
reduces memory duplication and allows for better resource
utilization.
4. Improved Overall System Performance:
Demand paging helps to avoid unnecessary I/O operations by
loading pages only when they are needed.
Copy-on-Write in Virtual Memory
• Definition:
Copy-on-write (COW) is a memory management technique used in virtual
memory systems to optimize memory usage and improve efficiency. It is
particularly relevant in scenarios where multiple processes or threads share the
same memory resources.
How is Memory Shared with Copy-on-Write ?
When COW is implemented, the operating system initially maps the virtual pages of two or more
processes to the same physical memory page. In this scenario, the processes share the same
underlying memory content. However, if any process attempts to modify the shared memory page,
the operating system triggers a copy operation.
Benefits of Copy-on-Write
• Memory Efficiency:
COW reduces memory consumption by deferring the creation of separate copies until
necessary. This is especially advantageous when processes primarily read from shared
memory.
• Performance Improvement:
Copying memory can be a costly operation, particularly when dealing with large
memory pages. By postponing the copy until modifications occur, COW minimizes
the overhead associated with copying.
• Simplified Memory Sharing:
COW allows multiple processes to easily share memory without the need for explicit
coordination or synchronization mechanisms.
Usage in Operating Systems and Virtualization Tech.
• Copy-on-write is widely used in various operating systems and virtualization
technologies to optimize memory utilization and enhance system performance in
scenarios involving shared memory. It is a fundamental technique for managing
memory efficiently and improving overall system scalability.
Examples of Copy-on-Write Usage
• Copy-on-Write is widely used in operating systems, such as Unix/Linux, to optimize
process creation and memory management.
• Forking a process in Unix/Linux typically employs Copy-on-Write to save memory
and improve performance.
Page Replacement in Virtual Memory
Definition:
Page replacement is a crucial aspect of virtual memory management, where the operating system
dynamically moves pages between physical memory and secondary storage (such as a hard disk or
SSD) to efficiently utilize limited physical memory resources. When the physical memory becomes
full and a new page needs to be brought in, the operating system selects a victim page to be
replaced with the new page. This process is known as page replacement.
When a page fault occurs the operating system needs to select a page to replace from
physical memory to make room for the required page. This selection is done using a page
replacement algorithm.
There are Four Types of Algorithms using in Page Replacement.
1. FIFO (First-In-First-Out):
The page that has been in memory the longest is selected for
replacement.
2. LRU (Least Recently Used):
This algorithm replaces the page that has not been used for the
longest time.
3. LFU (Least Frequently Used):
This Algorithm replaces the page that has been accessed the fewest number
of times
4. Optimal:
It replaces the page that will not be used for the longest time in furture.
Page Replacement Algorithm
ALLOCATION
OF FRAMES
IN
VIRTUAL
MEMORY
Definition:
The allocation of frames in virtual memory refers to
the assignment of physical memory (RAM) frames
to the pages of a process's virtual address space.
The operating system manages this allocation to
enable efficient memory utilization and provide
each process with the necessary memory resources.
Memory Allocation Policies and Consideration.
• Memory Management Unit (MMU):
The MMU is responsible for translating virtual addresses to physical addresses using
the page table.
• Page Replacement Algorithms:
The choice of a page replacement algorithm affects frame allocation indirectly. The
algorithm determines which pages are evicted from memory when a new page needs
to be allocated. By selecting appropriate victim frames, the system can optimize memory
utilization and overall performance.
Page Table Entries and Frame Allocation
The mapping between virtual pages and physical frames is maintained in the process's page table. Each
entry in the page table represents a virtual page and stores the corresponding physical frame number.
The allocation can be done using following 3 strategies.
1. Contiguous Allocation:
2. Non-Contiguous Allocation
3. Segmentation

More Related Content

Similar to Virtual Memory: Understanding Key Concepts

Computer architecture virtual memory
Computer architecture virtual memoryComputer architecture virtual memory
Computer architecture virtual memoryMazin Alwaaly
 
Paging +Algorithem+Segmentation+memory management
Paging +Algorithem+Segmentation+memory managementPaging +Algorithem+Segmentation+memory management
Paging +Algorithem+Segmentation+memory managementkazim Hussain
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OSKumar Pritam
 
NOV11 virtual memory.ppt
NOV11 virtual memory.pptNOV11 virtual memory.ppt
NOV11 virtual memory.pptPratikBose10
 
Chapter 09 - Virtual Memory.ppt
Chapter 09 - Virtual Memory.pptChapter 09 - Virtual Memory.ppt
Chapter 09 - Virtual Memory.pptMonirJihad1
 
Virtual Memory Management Part - I.pdf
Virtual Memory Management Part - I.pdfVirtual Memory Management Part - I.pdf
Virtual Memory Management Part - I.pdfHarika Pudugosula
 
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
 
virtual memory.ppt
virtual memory.pptvirtual memory.ppt
virtual memory.pptsuryansh85
 
Virtual memory ppt
Virtual memory pptVirtual memory ppt
Virtual memory pptRITULDE
 
CSI-503 - 6. Memory Management
CSI-503 - 6. Memory Management CSI-503 - 6. Memory Management
CSI-503 - 6. Memory Management ghayour abbas
 
chapter 2 memory and process management
chapter 2 memory and process managementchapter 2 memory and process management
chapter 2 memory and process managementAisyah Rafiuddin
 

Similar to Virtual Memory: Understanding Key Concepts (20)

Os unit 3
Os unit 3Os unit 3
Os unit 3
 
UNIT-2 OS.pptx
UNIT-2 OS.pptxUNIT-2 OS.pptx
UNIT-2 OS.pptx
 
Os unit 2
Os unit 2Os unit 2
Os unit 2
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
Computer architecture virtual memory
Computer architecture virtual memoryComputer architecture virtual memory
Computer architecture virtual memory
 
Paging +Algorithem+Segmentation+memory management
Paging +Algorithem+Segmentation+memory managementPaging +Algorithem+Segmentation+memory management
Paging +Algorithem+Segmentation+memory management
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 
NOV11 virtual memory.ppt
NOV11 virtual memory.pptNOV11 virtual memory.ppt
NOV11 virtual memory.ppt
 
Chapter 09 - Virtual Memory.ppt
Chapter 09 - Virtual Memory.pptChapter 09 - Virtual Memory.ppt
Chapter 09 - Virtual Memory.ppt
 
Virtual Memory Management Part - I.pdf
Virtual Memory Management Part - I.pdfVirtual Memory Management Part - I.pdf
Virtual Memory Management Part - I.pdf
 
NOV11 virtual memory.ppt
NOV11 virtual memory.pptNOV11 virtual memory.ppt
NOV11 virtual memory.ppt
 
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
 
virtual memory.ppt
virtual memory.pptvirtual memory.ppt
virtual memory.ppt
 
Virtual memory ppt
Virtual memory pptVirtual memory ppt
Virtual memory ppt
 
CSI-503 - 6. Memory Management
CSI-503 - 6. Memory Management CSI-503 - 6. Memory Management
CSI-503 - 6. Memory Management
 
CH09.pdf
CH09.pdfCH09.pdf
CH09.pdf
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
chapter 2 memory and process management
chapter 2 memory and process managementchapter 2 memory and process management
chapter 2 memory and process management
 
Demand paging
Demand pagingDemand paging
Demand paging
 

Recently uploaded

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
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
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
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
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 

Recently uploaded (20)

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
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
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 

Virtual Memory: Understanding Key Concepts

  • 1. Virtual Memory SHAYAN ALI CSC-21S-129 MUHAMMAD FURQAN CSC-21S-082 ARSAL AZHAR CSC-21S-019
  • 2. What is Virtual Memory? • Virtual memory is a computer memory management technique that allows an operating system to use a combination of physical RAM (Random Access Memory) and secondary storage, such as a hard disk drive, to effectively increase the amount of usable memory available to programs. What is the importance of Virtual Memory? • Virtual memory expands the effective memory capacity of a computer system beyond its physical limits. • It facilitates memory sharing, swapping, and paging, optimizing memory usage and improving overall system performance. It enables multitasking and efficient memory allocation for running multiple programs simultaneously.
  • 3. Why Do We Need Virtual Memory ? • Increased Addressable Memory: 1. Virtual memory allows a computer system to access more memory than what is physically available. 2. This allows programs to utilize more memory than the available physical RAM, enabling them to run larger and more complex tasks. • Memory Isolation and Protection: 1. Virtual memory facilitates memory isolation between different processes running on a computer. 2. This isolation prevents one process from accessing or modifying another process's memory, enhancing security and stability.
  • 4. • Efficient Memory Management: 1. Virtual memory enables efficient memory management by utilizing techniques like demand paging and page swapping. 2. Demand paging loads only the necessary portions of a program into physical memory, allowing for efficient memory usage. 3. Page swapping moves infrequently used pages of memory between RAM and disk storage, freeing up physical memory for other tasks. • Simplified Program Development: 1. Virtual memory simplifies program development by providing a uniform and consistent memory model for applications. 2. Programmers can develop applications using a flat, contiguous address space, independent of physical memory limitations.
  • 5. What is Demand Paging in Virtual Memory ? • Demand paging is a virtual memory management technique where pages are loaded into memory only when they are explicitly requested by processes. • Instead of loading the entire program into memory at once, only the required pages are brought into memory as needed. • When a process references a page that is not in physical memory, a page fault occurs, and the operating system brings the required page from disk into memory. • Demand paging allows for efficient memory utilization by loading pages on- demand, reducing the initial memory footprint of processes.
  • 6. Benefits of demand Paging in Virtual Memory 1. Reduced Memory Footprint: Demand paging reduces the amount of physical memory required to run processes by loading only necessary pages. 2. Faster Process Startup Time: Since demand paging loads only essential pages initially, the process startup time is reduced as it doesn't have to load the entire program into memory. 3. Efficient Memory Sharing: Multiple processes can share the same page in memory, which reduces memory duplication and allows for better resource utilization. 4. Improved Overall System Performance: Demand paging helps to avoid unnecessary I/O operations by loading pages only when they are needed.
  • 7. Copy-on-Write in Virtual Memory • Definition: Copy-on-write (COW) is a memory management technique used in virtual memory systems to optimize memory usage and improve efficiency. It is particularly relevant in scenarios where multiple processes or threads share the same memory resources. How is Memory Shared with Copy-on-Write ? When COW is implemented, the operating system initially maps the virtual pages of two or more processes to the same physical memory page. In this scenario, the processes share the same underlying memory content. However, if any process attempts to modify the shared memory page, the operating system triggers a copy operation.
  • 8. Benefits of Copy-on-Write • Memory Efficiency: COW reduces memory consumption by deferring the creation of separate copies until necessary. This is especially advantageous when processes primarily read from shared memory. • Performance Improvement: Copying memory can be a costly operation, particularly when dealing with large memory pages. By postponing the copy until modifications occur, COW minimizes the overhead associated with copying. • Simplified Memory Sharing: COW allows multiple processes to easily share memory without the need for explicit coordination or synchronization mechanisms.
  • 9. Usage in Operating Systems and Virtualization Tech. • Copy-on-write is widely used in various operating systems and virtualization technologies to optimize memory utilization and enhance system performance in scenarios involving shared memory. It is a fundamental technique for managing memory efficiently and improving overall system scalability.
  • 10. Examples of Copy-on-Write Usage • Copy-on-Write is widely used in operating systems, such as Unix/Linux, to optimize process creation and memory management. • Forking a process in Unix/Linux typically employs Copy-on-Write to save memory and improve performance.
  • 11. Page Replacement in Virtual Memory Definition: Page replacement is a crucial aspect of virtual memory management, where the operating system dynamically moves pages between physical memory and secondary storage (such as a hard disk or SSD) to efficiently utilize limited physical memory resources. When the physical memory becomes full and a new page needs to be brought in, the operating system selects a victim page to be replaced with the new page. This process is known as page replacement.
  • 12. When a page fault occurs the operating system needs to select a page to replace from physical memory to make room for the required page. This selection is done using a page replacement algorithm. There are Four Types of Algorithms using in Page Replacement. 1. FIFO (First-In-First-Out): The page that has been in memory the longest is selected for replacement. 2. LRU (Least Recently Used): This algorithm replaces the page that has not been used for the longest time. 3. LFU (Least Frequently Used): This Algorithm replaces the page that has been accessed the fewest number of times 4. Optimal: It replaces the page that will not be used for the longest time in furture. Page Replacement Algorithm
  • 13. ALLOCATION OF FRAMES IN VIRTUAL MEMORY Definition: The allocation of frames in virtual memory refers to the assignment of physical memory (RAM) frames to the pages of a process's virtual address space. The operating system manages this allocation to enable efficient memory utilization and provide each process with the necessary memory resources.
  • 14. Memory Allocation Policies and Consideration. • Memory Management Unit (MMU): The MMU is responsible for translating virtual addresses to physical addresses using the page table. • Page Replacement Algorithms: The choice of a page replacement algorithm affects frame allocation indirectly. The algorithm determines which pages are evicted from memory when a new page needs to be allocated. By selecting appropriate victim frames, the system can optimize memory utilization and overall performance.
  • 15. Page Table Entries and Frame Allocation The mapping between virtual pages and physical frames is maintained in the process's page table. Each entry in the page table represents a virtual page and stores the corresponding physical frame number. The allocation can be done using following 3 strategies. 1. Contiguous Allocation: 2. Non-Contiguous Allocation 3. Segmentation