Virtual Memory in Windows
Operating System
Contents
• Virtual Memory
• Basic concepts
• Page Table
• Page replacement algorithms
• Advantages
• Disadvantages
Virtual Memory
• A technique using main memory as a “cache”
for secondary storage (disk).
• He virtual memory technique allows users to
use more memory for a program than the real
memory of a computer.
Virtual Memoryvirtualpages
physicalpages
Basic Concepts
• Address space(Logical & Physical)
• Pages
• Frames
• Mapping
Pages
• Continuous range of addresses
• Logical concept
• Equal size
• Present in any order
Frames
• Counterpart of pages
• Physical concept
• Reality
• Equal size
Mapping
• Mapping between pages and frames(CPU
generates page addresses and page addresses
are converted in frame addresses called
mapping.)
• Heart of Virtual Memory
• MMU performs mapping
Mapping
Example
• Lets suppose
• A program having 8 statements
• Processor divides them in to 8 pages
• 1 statement per page
• These pages can be present any where
• Not necessary in sequence
Example
Address Generation
• After dividing the program into pages
• Processor generates logical address
• Logical address is received by MMU
• Conversion is done to physical address
• Incase if page is not present in the memory
• Page fault occur
Address Generation
Page Table
• The operating system (OS) maps the virtual to any
physical page (associative placement of pages).
• A page table stored in memory, indexed by the
virtual page number, contains the virtual to physical
address translations.
• An entry contains the physical page number for that
virtual page if the page is currently in memory.
Page Table(cont…)
Each process
has such
register.
OS algorithm
determines the
physical page
number.
Page Replacement Algorithms
1) FIFO (first in first out)
2) LRU (Least Recently used)
3) OPT (Optimal)
1) FIFO:-
• The FIFO algorithm select the page for
replacement that has been in memory the
longest time
•
2) LRU:-
• The least recently used page replacement algorithm keeps
track page uses over a short period of time.
• The LRU algorithm can be implemented by associating a
counter with every page that is n main memory.
3) OPT:-
• The optimal policy selects that page for replacement for
which the time to the next reference is longest.
• This algorithm result is fewest number of page faults.
Advantage :-
• Allows processes whose aggregate memory
requirement is greater than the amount of
physical memory, as infrequently used pages
can reside on the disk.
• Virtual memory allows speed gain when only
a particular segment of the program is
required for the execution of the program.
• This concept is very helpful in implementing
multiprogramming environment.
Disadvantage:-
• 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.
• It reduces system stability.
Virtual Memory in Windows

Virtual Memory in Windows

  • 1.
    Virtual Memory inWindows Operating System
  • 2.
    Contents • Virtual Memory •Basic concepts • Page Table • Page replacement algorithms • Advantages • Disadvantages
  • 3.
    Virtual Memory • Atechnique using main memory as a “cache” for secondary storage (disk). • He virtual memory technique allows users to use more memory for a program than the real memory of a computer.
  • 4.
  • 5.
    Basic Concepts • Addressspace(Logical & Physical) • Pages • Frames • Mapping
  • 6.
    Pages • Continuous rangeof addresses • Logical concept • Equal size • Present in any order
  • 7.
    Frames • Counterpart ofpages • Physical concept • Reality • Equal size
  • 8.
    Mapping • Mapping betweenpages and frames(CPU generates page addresses and page addresses are converted in frame addresses called mapping.) • Heart of Virtual Memory • MMU performs mapping
  • 9.
  • 10.
    Example • Lets suppose •A program having 8 statements • Processor divides them in to 8 pages • 1 statement per page • These pages can be present any where • Not necessary in sequence
  • 11.
  • 12.
    Address Generation • Afterdividing the program into pages • Processor generates logical address • Logical address is received by MMU • Conversion is done to physical address • Incase if page is not present in the memory • Page fault occur
  • 13.
  • 14.
    Page Table • Theoperating system (OS) maps the virtual to any physical page (associative placement of pages). • A page table stored in memory, indexed by the virtual page number, contains the virtual to physical address translations. • An entry contains the physical page number for that virtual page if the page is currently in memory.
  • 15.
    Page Table(cont…) Each process hassuch register. OS algorithm determines the physical page number.
  • 16.
    Page Replacement Algorithms 1)FIFO (first in first out) 2) LRU (Least Recently used) 3) OPT (Optimal)
  • 17.
    1) FIFO:- • TheFIFO algorithm select the page for replacement that has been in memory the longest time •
  • 18.
    2) LRU:- • Theleast recently used page replacement algorithm keeps track page uses over a short period of time. • The LRU algorithm can be implemented by associating a counter with every page that is n main memory.
  • 19.
    3) OPT:- • Theoptimal policy selects that page for replacement for which the time to the next reference is longest. • This algorithm result is fewest number of page faults.
  • 20.
    Advantage :- • Allowsprocesses whose aggregate memory requirement is greater than the amount of physical memory, as infrequently used pages can reside on the disk. • Virtual memory allows speed gain when only a particular segment of the program is required for the execution of the program. • This concept is very helpful in implementing multiprogramming environment.
  • 21.
    Disadvantage:- • Applications runslower if the system is using virtual memory. • It Takes more time to switch between applications. • Less hard drive space for your use. • It reduces system stability.