0% found this document useful (0 votes)
8 views16 pages

04 OS - Virtual Memory

The document discusses virtual memory, which separates user logical memory from physical memory, allowing computers to address more memory than physically installed. It explains demand paging as a method of managing virtual memory, detailing its advantages, disadvantages, and how it operates, including page faults and replacement algorithms like FIFO and LRU. The document emphasizes the efficiency and complexity of demand paging in memory management.

Uploaded by

Angelo Vita
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views16 pages

04 OS - Virtual Memory

The document discusses virtual memory, which separates user logical memory from physical memory, allowing computers to address more memory than physically installed. It explains demand paging as a method of managing virtual memory, detailing its advantages, disadvantages, and how it operates, including page faults and replacement algorithms like FIFO and LRU. The document emphasizes the efficiency and complexity of demand paging in memory management.

Uploaded by

Angelo Vita
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Virtual Memory

Victoria Kirsten R. Sison


Daryl V. Buen
Andrea Nicole B. Querubin
Miriva India V. Alvair
Virtual Memory
• Separation of user logical memory from
physical memory.
• A computer can address more memory than
the amount physically installed on the system.
• This extra memory is actually called virtual
memory and it is a section of a hard disk
that's set up to emulate the computer's RAM
Virtual Memory
• Virtual memory can be implemented via:
⚬ Demand Paging
⚬ Demand Segmentation
Demand Paging
• is a process of swapping in the Virtual
Memory system.
• In this process, all data is not moved
from hard drive to main memory
because while using this demand
paging, when some programs are
getting demand then data will be
transferred.
Demand Paging
• allows pages that are referenced
actively to be loaded into memory
⚬ Remaining pages stay on disk
• Bring a page into memory only when it is
needed
⚬ Page is needed --> reference to it
■ invalid reference Þ abort
■ not-in-memory Þ bring to memory
Advantage of Demand Paging
• Large virtual memory.
• More efficient use of memory.
• There is no limit on degree of
multiprogramming..
Disadvantage of Demand Paging
• Number of tables and the amount of
processor overhead for handling page
interrupts are greater than in the case of
the simple paged management
techniques.
Demand Paging: how it works?
• The process address space (image) is
always in swap space (on disk).
• The page table entry now has three states:
⚬ Valid with the page physical address
⚬ Invalid with the address in the swap
space
■ Valid page, but not currently in
memory
⚬ Invalid (truly invalid page)
Demand Paging: how it works?
• When a memory access is attempted:
⚬ Valid page physical address, normal
access
⚬ Invalid with the address in the swap
space: page fault interrupt, which will
bring in the page.
⚬ Invalid, error
Page Fault
• an interrupt (or exception) to the
software raised by the hardware, when a
program accesses a page that is
mapped in address space, but not
loaded in physical memory
Page Replacement Algorithm
• Page replacement algorithms are the techniques
using which an Operating System decides which
memory pages to swap out, write to disk when a
page of memory needs to be allocated. Paging
happens whenever a page fault occurs and a
free page cannot be used for allocation purpose
accounting to reason that pages are not
available or the number of free pages is lower
than required pages.
Basic Pages 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
First in First Out (FIFO) Algorithm

• O
— ldest page in main memory is the one
which will be selected for replacement.

• E
—asy to implement, keep a list, replace pages
from the tail and add new pages at the head.
Least Recently Used (LRU)
Algorithm
• P
—age which has not been used for the
longest time in main memory is the one
which will be selected for replacement.

• E
—asy to implement, keep a list, replace pages
by looking back into time.
Least Recently Used (LRU)
Algorithm
• T
—he page with the smallest count is the one
which will be selected for replacement.

• —
Replaces the page that is used least often

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy