0% found this document useful (0 votes)
2 views12 pages

CH10 - Virtual Memory

Chapter 10 discusses virtual memory, a technique that enables the execution of processes not fully in memory, allowing for larger programs than physical memory. It explains demand paging, where pages are loaded only when needed, and outlines the valid-invalid bit scheme used to manage memory access. The chapter also covers page replacement algorithms, including FIFO, and the occurrence of page faults when accessing pages not currently in memory.
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)
2 views12 pages

CH10 - Virtual Memory

Chapter 10 discusses virtual memory, a technique that enables the execution of processes not fully in memory, allowing for larger programs than physical memory. It explains demand paging, where pages are loaded only when needed, and outlines the valid-invalid bit scheme used to manage memory access. The chapter also covers page replacement algorithms, including FIFO, and the occurrence of page faults when accessing pages not currently in memory.
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/ 12

CHAPTER 10 : VIRTUAL MEMORY

VIRTUAL MEMORY

All these strategies have the same goal : to keep many processes in
memory simultaneously to allow multiprogramming.

Virtual memory is technique that allows the execution of processes that


not completely in memory.

One major advantage of this scheme is that programs can be larger than
physical memory
DEMAND PAGING

Used in virtual memory systems, Pages are loaded only when they are
demanded during program execution. Pages that are never accessed
are thus never loaded into physical memory

A demand-paging system is similar to a paging system with swapping


where processes reside in secondary memory (usually an HDD or NVM
device) – by loading only the portions of programs that are needed,
memory is used more efficiently.
BASIC CONCEPTS
➢ The valid – invalid bit scheme
The valid bit : the associated page is both legal and in
memory

The invalid bit : The page either is not valid (that is, not
in the logical address space of the process ) or is valid
but is currently in secondary storage.

The page-table entry for a page that is not currently in


memory is simply marked invalid

What happens if the process tries to access a page that


was not brought into memory ? Access to a page marked
invalid causes a page fault.
The paging hardware, in
translating the address
through the page table,
will notice the invalid bit
is set, causing a trap to
the operating system.
FREE-FRAME LIST
When a page fault occurs, the operating system must bring the desired page from
secondary storage into main memory.
To resolve page faults, most OSs maintain a free-frame list, a pool of free frames for
satisfying such requests
Free-frames must also be allocated when the stack or heap segments from a process
expand
OSs allocate free frames using a technique known as zero-fill-on-demand
PERFORMANCE OF DEMAND PAGING

The effective access time for a demand-paged memory.

Assume the memory-access time, denoted ma, is 10 nanosecond

The effective access time is directly proportional to the page-fault rate.


PAGE REPLACEMENT
There are many different page-replacement
algorithms. Every OS probably has its own
replacement sheme. How do we select a particular
replacement algorithm ? In general, we want the
one with the lowest page-fault rate.
- Page Replacement Algorithms :
▪ FIFO Page Replacement
▪ Optimal Page Replacement
▪ LRU Page Replacement
▪ LRU-Approximation Page Replacement
▪ Counting-Based Page Replacement (LFU – Least
Frequently Used, MFU – Most Frequently Used)
REFERENCE STRING
The string of memory references is called a reference string. We can
generate reference string (by using a random-numbers generator, for
example)
WHEN DOES PAGE FAULT
OCCUR

A page fault occurs when a program


running on the CPU tries to access a
page that is in the address space of
that program, but the requested
page is currently not loaded into
the main physical memory, the
RAM of the system
Page fault – in simple terms, if an
incoming stream item (page) is not
available in any of the frames. The
page fault occurs.
FIFO PAGE REPLACEMENT (FIRST IN – FIRST
OUT)
A FIFO replacement algorithm associates with
0
each page the time when that page was brought
into memory
How FIFO Works –
▪ If an incoming page is not available in any of
frames. Replacement shall be done
Hit
▪ Page replaced is according to FIFO (First In First
Out)
▪ The page that entered first must be swapped
out first
▪ In other words, the oldest frame must be
swapped out

You might also like