3. 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.
8. 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
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
12. 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
14. 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.
17. 1) FIFO:-
• The FIFO algorithm select the page for
replacement that has been in memory the
longest time
•
18. 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.
19. 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.
20. 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.
21. 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.