SlideShare a Scribd company logo
9
Virtual Memory
Prepared By: Ghayour Abbas
Virtual Memory is a storage mechanism which offers user an illusion of having a
very big main memory. It is done by treating a part of secondary memory as the
main memory. In Virtual memory, the user can store processes with a bigger size
than the available main memory.
Therefore, instead of loading one long process in the main memory, the OS
loads the various parts of more than one process in the main memory. Virtual
memory is mostly implemented with demand paging and demand segmentation.
Why Need Virtual Memory?
Here, are reasons for using virtual memory:
Whenever your computer doesn’t have space in the physical memory it
writes what it needs to remember to the hard disk in a swap file as virtual memory.
If a computer running Windows needs more memory/RAM, then installed in the
system, it uses a small portion of the hard drive for this purpose.
How Virtual Memory Works?
When an application (including the operating system) is running, it stores the
location of program threads and other data at a virtual address, while the data is
actually stored at a physical address in RAM. If later that RAM space is needed
more urgently by another process, then the data may be swapped out of RAM and
into virtual memory.
The responsibility for keeping track of all this data as it is swapped between
physical and virtual memory falls to the computer’s memory manager. The
memory manager maintains a table which maps virtual addresses used by the
operating system and applications to the physical addresses that data is actually
stored in. When data is swapped between RAM and virtual memory, the table is
updated so that a given virtual address always points to the correct physical
location.
A computer can only run threads and manipulate data that is stored in RAM rather
than virtual memory. And it takes a non-negligible amount of time to swap data
that is needed into RAM. Consequently, it follows that using virtual memory
involves a performance hit.
For example:
Let’s assume that an OS requires 300 MB of memory to store all the running
programs. However, there’s currently only 50 MB of available physical memory
stored on the RAM.
The OS will then set up 250 MB of virtual memory and use a program called the
Virtual Memory Manager(VMM) to manage that 250 MB.
So, in this case, the VMM will create a file on the hard disk that is 250 MB in size to
store extra memory that is required.
The OS will now proceed to address memory as it considers 300 MB of real memory
stored in the RAM, even if only 50 MB space is available.
It is the job of the VMM to manage 300 MB memory even if just 50 MB of real
memory space is available.
What is Demand Paging?
A demand paging mechanism is very much similar to a paging system with
swapping where processes stored in the secondary memory and pages are
loaded only on demand, not in advance.
So, when a context switch occurs, the OS never copy any of the old
program’s pages from the disk or any of the new program’s pages into the main
memory. Instead, it will start executing the new program after loading the first
page and fetches the program’s pages, which are referenced.
During the program execution, if the program references a page that may not be
available in the main memory because it was swapped, then the processor
considers it as an invalid memory reference. That’s because of the page fault
and transfers send control back from the program to the OS, which demands to
store page back into the memory.
Types of Page Replacement Methods
Here, are some important Page replacement methods
• FIFO
• Optimal Algorithm
• LRU Page Replacement
FIFO Page Replacement
FIFO (First-in-first-out) is a simple implementation method. In this method,
memory selects the page for a replacement that has been in the virtual address
of the memory for the longest time.
Features:
• Whenever a new page loaded, the page recently comes in the memory is
removed. So, it is easy to decide which page requires to be removed as its
identification number is always at the FIFO stack.
• The oldest page in the main memory is one that should be selected for
replacement first.
Optimal Algorithm
The optimal page replacement method selects that page for a replacement for
which the time to the next reference is the longest.
Features:
• Optimal algorithm results in the fewest number of page faults. This
algorithm is difficult to implement.
LRU Page Replacement
The full form of LRU is the Least Recently Used page. This method helps OS to
find page usage over a short period of time. This algorithm should be
implemented by associating a counter with an even- page.
How does it work?
• Page, which has not been used for the longest time in the main memory, is
the one that will be selected for replacement.
• Easy to implement, keep a list, replace pages by looking back into time.
Features:
• The LRU replacement method has the highest count. This counter is also
called aging registers, which specify their age and how much their
associated pages should also be referenced.
• The page which hasn’t been used for the longest time in the main memory
is the one that should be selected for replacement.
• It also keeps a list and replaces pages by looking back into time.
Advantages of Virtual Memory
Here, are pros/benefits of using Virtual Memory:
• Virtual memory helps to gain speed when only a particular segment of the
program is required for the execution of the program.
• It is very helpful in implementing a multiprogramming environment.
• It allows you to run more applications at once.
• It helps you to fit many large programs into smaller programs.
• Common data or code may be shared between memory.
• Process may become even larger than all of the physical memory.
• Data / code should be read from disk whenever required.
• The code can be placed anywhere in physical memory without requiring
relocation.
• More processes should be maintained in the main memory, which increases the
effective use of CPU.
• Each page is stored on a disk until it is required after that, it will be removed.
• It allows more applications to be run at the same time.
• There is no specific limit on the degree of multiprogramming.
• Large programs should be written, as virtual address space available is more
compared to physical memory.
Disadvantages of Virtual Memory
Here, are drawbacks/cons of using virtual memory:
• Applications may run slower if the system is using virtual memory.
• Likely takes more time to switch between applications.
• Offers lesser hard drive space for your use.
• It reduces system stability.
• It allows larger applications to run in systems that don’t offer enough physical
RAM alone to run them.
• It doesn’t offer the same performance as RAM.
• It negatively affects the overall performance of a system.
• Occupy the storage space, which may be used otherwise for long term data
storage.

More Related Content

What's hot

Chapter 2 (Part 2)
Chapter 2 (Part 2) Chapter 2 (Part 2)
Chapter 2 (Part 2)
rohassanie
 
Operating system introducton and tyes
Operating system introducton and tyesOperating system introducton and tyes
Operating system introducton and tyes
Nancy Verma
 
Chapter 2 part 1
Chapter 2 part 1Chapter 2 part 1
Chapter 2 part 1
rohassanie
 
introduction To Operating System
introduction To Operating Systemintroduction To Operating System
introduction To Operating System
Luka M G
 

What's hot (20)

Understanding memory management
Understanding memory managementUnderstanding memory management
Understanding memory management
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
Operating system || Chapter 3: Process
Operating system || Chapter 3: ProcessOperating system || Chapter 3: Process
Operating system || Chapter 3: Process
 
Operating System (Scheduling, Input and Output Management, Memory Management,...
Operating System (Scheduling, Input and Output Management, Memory Management,...Operating System (Scheduling, Input and Output Management, Memory Management,...
Operating System (Scheduling, Input and Output Management, Memory Management,...
 
Os unit 3 , process management
Os unit 3 , process managementOs unit 3 , process management
Os unit 3 , process management
 
Chapter 2 (Part 2)
Chapter 2 (Part 2) Chapter 2 (Part 2)
Chapter 2 (Part 2)
 
Operating system introducton and tyes
Operating system introducton and tyesOperating system introducton and tyes
Operating system introducton and tyes
 
Operating system concepts
Operating system conceptsOperating system concepts
Operating system concepts
 
Operating systems types, spooling and buffering
Operating systems types, spooling and bufferingOperating systems types, spooling and buffering
Operating systems types, spooling and buffering
 
Real time operating system
Real time operating systemReal time operating system
Real time operating system
 
Storage management
Storage managementStorage management
Storage management
 
Chapter 2 part 1
Chapter 2 part 1Chapter 2 part 1
Chapter 2 part 1
 
Register
RegisterRegister
Register
 
Unit v: Device Management
Unit v: Device ManagementUnit v: Device Management
Unit v: Device Management
 
introduction To Operating System
introduction To Operating Systemintroduction To Operating System
introduction To Operating System
 
Introduction to Operating Systems
Introduction to Operating SystemsIntroduction to Operating Systems
Introduction to Operating Systems
 
Operating Systems 1 (9/12) - Memory Management Concepts
Operating Systems 1 (9/12) - Memory Management ConceptsOperating Systems 1 (9/12) - Memory Management Concepts
Operating Systems 1 (9/12) - Memory Management Concepts
 
Operating System
Operating SystemOperating System
Operating System
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Basics of Operating System
Basics of Operating SystemBasics of Operating System
Basics of Operating System
 

Similar to CSI-503 - 9. Virtual Memory

Adobe Scan 06-Jan-2023.pdf demand paging document
Adobe Scan 06-Jan-2023.pdf demand paging documentAdobe Scan 06-Jan-2023.pdf demand paging document
Adobe Scan 06-Jan-2023.pdf demand paging document
AllyKhan2
 
Chapter 09 - Virtual Memory.ppt
Chapter 09 - Virtual Memory.pptChapter 09 - Virtual Memory.ppt
Chapter 09 - Virtual Memory.ppt
MonirJihad1
 
Lecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptxLecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptx
Amanuelmergia
 

Similar to CSI-503 - 9. Virtual Memory (20)

Adobe Scan 06-Jan-2023.pdf demand paging document
Adobe Scan 06-Jan-2023.pdf demand paging documentAdobe Scan 06-Jan-2023.pdf demand paging document
Adobe Scan 06-Jan-2023.pdf demand paging document
 
OS Presentation 2023.pptx
OS Presentation 2023.pptxOS Presentation 2023.pptx
OS Presentation 2023.pptx
 
Computer architecture virtual memory
Computer architecture virtual memoryComputer architecture virtual memory
Computer architecture virtual memory
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 
Abhaycavirtual memory and the pagehit.pptx
Abhaycavirtual memory and the pagehit.pptxAbhaycavirtual memory and the pagehit.pptx
Abhaycavirtual memory and the pagehit.pptx
 
Virtual memory managment
Virtual memory managmentVirtual memory managment
Virtual memory managment
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
virtual memory
virtual memoryvirtual memory
virtual memory
 
Virtual Memory in Operating System
Virtual Memory in Operating SystemVirtual Memory in Operating System
Virtual Memory in Operating System
 
VirutualMemory.docx
VirutualMemory.docxVirutualMemory.docx
VirutualMemory.docx
 
Chapter 09 - Virtual Memory.ppt
Chapter 09 - Virtual Memory.pptChapter 09 - Virtual Memory.ppt
Chapter 09 - Virtual Memory.ppt
 
Power Point Presentation on Virtual Memory.ppt
Power Point Presentation on Virtual Memory.pptPower Point Presentation on Virtual Memory.ppt
Power Point Presentation on Virtual Memory.ppt
 
Lecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptxLecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptx
 
virtual memory
virtual memoryvirtual memory
virtual memory
 
Paging +Algorithem+Segmentation+memory management
Paging +Algorithem+Segmentation+memory managementPaging +Algorithem+Segmentation+memory management
Paging +Algorithem+Segmentation+memory management
 
NOV11 virtual memory.ppt
NOV11 virtual memory.pptNOV11 virtual memory.ppt
NOV11 virtual memory.ppt
 
NOV11 virtual memory.ppt
NOV11 virtual memory.pptNOV11 virtual memory.ppt
NOV11 virtual memory.ppt
 
Virtual Memory
Virtual MemoryVirtual Memory
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
 
STORAGE MANAGEMENT AND PAGING ALGORITHMS.pptx
STORAGE MANAGEMENT AND PAGING ALGORITHMS.pptxSTORAGE MANAGEMENT AND PAGING ALGORITHMS.pptx
STORAGE MANAGEMENT AND PAGING ALGORITHMS.pptx
 

More from ghayour abbas

More from ghayour abbas (20)

TCP/IP & UDP
TCP/IP & UDPTCP/IP & UDP
TCP/IP & UDP
 
Web Development 5
Web Development 5 Web Development 5
Web Development 5
 
Web Development 4
Web Development 4Web Development 4
Web Development 4
 
Web Development 4 (HTML & CSS)
Web Development 4 (HTML & CSS)Web Development 4 (HTML & CSS)
Web Development 4 (HTML & CSS)
 
Web Development 3 (HTML & CSS)
Web Development 3  (HTML & CSS)Web Development 3  (HTML & CSS)
Web Development 3 (HTML & CSS)
 
Lab Manual CSI-321
Lab Manual CSI-321Lab Manual CSI-321
Lab Manual CSI-321
 
Web Development 2 (HTML & CSS)
Web Development 2 (HTML & CSS)Web Development 2 (HTML & CSS)
Web Development 2 (HTML & CSS)
 
Web Development 1 (HTML & CSS)
Web Development 1 (HTML & CSS)Web Development 1 (HTML & CSS)
Web Development 1 (HTML & CSS)
 
CSI-503 - 11.Distributed Operating System
CSI-503 - 11.Distributed Operating SystemCSI-503 - 11.Distributed Operating System
CSI-503 - 11.Distributed Operating System
 
SWE-401 - 10. Software Testing Overview
SWE-401 - 10. Software Testing OverviewSWE-401 - 10. Software Testing Overview
SWE-401 - 10. Software Testing Overview
 
SWE-401 - 9. Software Implementation
SWE-401 - 9. Software ImplementationSWE-401 - 9. Software Implementation
SWE-401 - 9. Software Implementation
 
SWE-401 - 8. Software User Interface Design
SWE-401 - 8. Software User Interface DesignSWE-401 - 8. Software User Interface Design
SWE-401 - 8. Software User Interface Design
 
SWE-401 - 7. Software Design Strategies
SWE-401 - 7. Software Design StrategiesSWE-401 - 7. Software Design Strategies
SWE-401 - 7. Software Design Strategies
 
SWE-401 - 5. Software Design Basics
SWE-401 - 5. Software Design BasicsSWE-401 - 5. Software Design Basics
SWE-401 - 5. Software Design Basics
 
SWE-401 - 6. Software Analysis and Design Tools
SWE-401 - 6. Software Analysis and Design ToolsSWE-401 - 6. Software Analysis and Design Tools
SWE-401 - 6. Software Analysis and Design Tools
 
SWE-401 - 4. Software Requirement Specifications
SWE-401 - 4. Software Requirement Specifications SWE-401 - 4. Software Requirement Specifications
SWE-401 - 4. Software Requirement Specifications
 
SWE-401 - 3. Software Project Management
SWE-401 - 3. Software Project ManagementSWE-401 - 3. Software Project Management
SWE-401 - 3. Software Project Management
 
CSI-503 - 6. Memory Management
CSI-503 - 6. Memory Management CSI-503 - 6. Memory Management
CSI-503 - 6. Memory Management
 
CSI-503 - 4. Process synchronization
CSI-503 - 4. Process synchronizationCSI-503 - 4. Process synchronization
CSI-503 - 4. Process synchronization
 
CSI-503 - 3. Process Scheduling
CSI-503 - 3. Process SchedulingCSI-503 - 3. Process Scheduling
CSI-503 - 3. Process Scheduling
 

Recently uploaded

Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
Avinash Rai
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 

Recently uploaded (20)

Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
NLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptxNLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptx
 
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxSolid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resources
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
NCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdfNCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdf
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 

CSI-503 - 9. Virtual Memory

  • 1. 9 Virtual Memory Prepared By: Ghayour Abbas Virtual Memory is a storage mechanism which offers user an illusion of having a very big main memory. It is done by treating a part of secondary memory as the main memory. In Virtual memory, the user can store processes with a bigger size than the available main memory. Therefore, instead of loading one long process in the main memory, the OS loads the various parts of more than one process in the main memory. Virtual memory is mostly implemented with demand paging and demand segmentation. Why Need Virtual Memory? Here, are reasons for using virtual memory: Whenever your computer doesn’t have space in the physical memory it writes what it needs to remember to the hard disk in a swap file as virtual memory. If a computer running Windows needs more memory/RAM, then installed in the system, it uses a small portion of the hard drive for this purpose. How Virtual Memory Works? When an application (including the operating system) is running, it stores the location of program threads and other data at a virtual address, while the data is actually stored at a physical address in RAM. If later that RAM space is needed more urgently by another process, then the data may be swapped out of RAM and into virtual memory. The responsibility for keeping track of all this data as it is swapped between physical and virtual memory falls to the computer’s memory manager. The memory manager maintains a table which maps virtual addresses used by the operating system and applications to the physical addresses that data is actually stored in. When data is swapped between RAM and virtual memory, the table is updated so that a given virtual address always points to the correct physical location.
  • 2. A computer can only run threads and manipulate data that is stored in RAM rather than virtual memory. And it takes a non-negligible amount of time to swap data that is needed into RAM. Consequently, it follows that using virtual memory involves a performance hit. For example: Let’s assume that an OS requires 300 MB of memory to store all the running programs. However, there’s currently only 50 MB of available physical memory stored on the RAM. The OS will then set up 250 MB of virtual memory and use a program called the Virtual Memory Manager(VMM) to manage that 250 MB. So, in this case, the VMM will create a file on the hard disk that is 250 MB in size to store extra memory that is required. The OS will now proceed to address memory as it considers 300 MB of real memory stored in the RAM, even if only 50 MB space is available. It is the job of the VMM to manage 300 MB memory even if just 50 MB of real memory space is available. What is Demand Paging? A demand paging mechanism is very much similar to a paging system with swapping where processes stored in the secondary memory and pages are loaded only on demand, not in advance. So, when a context switch occurs, the OS never copy any of the old program’s pages from the disk or any of the new program’s pages into the main memory. Instead, it will start executing the new program after loading the first page and fetches the program’s pages, which are referenced. During the program execution, if the program references a page that may not be available in the main memory because it was swapped, then the processor considers it as an invalid memory reference. That’s because of the page fault and transfers send control back from the program to the OS, which demands to store page back into the memory.
  • 3. Types of Page Replacement Methods Here, are some important Page replacement methods • FIFO • Optimal Algorithm • LRU Page Replacement FIFO Page Replacement FIFO (First-in-first-out) is a simple implementation method. In this method, memory selects the page for a replacement that has been in the virtual address of the memory for the longest time. Features: • Whenever a new page loaded, the page recently comes in the memory is removed. So, it is easy to decide which page requires to be removed as its identification number is always at the FIFO stack. • The oldest page in the main memory is one that should be selected for replacement first. Optimal Algorithm The optimal page replacement method selects that page for a replacement for which the time to the next reference is the longest. Features: • Optimal algorithm results in the fewest number of page faults. This algorithm is difficult to implement. LRU Page Replacement The full form of LRU is the Least Recently Used page. This method helps OS to find page usage over a short period of time. This algorithm should be implemented by associating a counter with an even- page.
  • 4. How does it work? • Page, which has not been used for the longest time in the main memory, is the one that will be selected for replacement. • Easy to implement, keep a list, replace pages by looking back into time. Features: • The LRU replacement method has the highest count. This counter is also called aging registers, which specify their age and how much their associated pages should also be referenced. • The page which hasn’t been used for the longest time in the main memory is the one that should be selected for replacement. • It also keeps a list and replaces pages by looking back into time. Advantages of Virtual Memory Here, are pros/benefits of using Virtual Memory: • Virtual memory helps to gain speed when only a particular segment of the program is required for the execution of the program. • It is very helpful in implementing a multiprogramming environment. • It allows you to run more applications at once. • It helps you to fit many large programs into smaller programs. • Common data or code may be shared between memory. • Process may become even larger than all of the physical memory. • Data / code should be read from disk whenever required. • The code can be placed anywhere in physical memory without requiring relocation. • More processes should be maintained in the main memory, which increases the effective use of CPU. • Each page is stored on a disk until it is required after that, it will be removed. • It allows more applications to be run at the same time. • There is no specific limit on the degree of multiprogramming. • Large programs should be written, as virtual address space available is more compared to physical memory.
  • 5. Disadvantages of Virtual Memory Here, are drawbacks/cons of using virtual memory: • Applications may run slower if the system is using virtual memory. • Likely takes more time to switch between applications. • Offers lesser hard drive space for your use. • It reduces system stability. • It allows larger applications to run in systems that don’t offer enough physical RAM alone to run them. • It doesn’t offer the same performance as RAM. • It negatively affects the overall performance of a system. • Occupy the storage space, which may be used otherwise for long term data storage.