0% found this document useful (0 votes)
25 views7 pages

p6 Virtual Memory

Virtual memory is a technique that allows processes to execute without being fully loaded into physical memory, enabling larger programs and improved CPU utilization. Demand paging loads pages into memory only when needed, reducing swap time and memory usage, while various page replacement algorithms like FIFO, optimal, and LRU manage memory efficiently. The working set of a process is related to its page-fault rate, which fluctuates as the process accesses different data and code sections over time.

Uploaded by

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

p6 Virtual Memory

Virtual memory is a technique that allows processes to execute without being fully loaded into physical memory, enabling larger programs and improved CPU utilization. Demand paging loads pages into memory only when needed, reducing swap time and memory usage, while various page replacement algorithms like FIFO, optimal, and LRU manage memory efficiently. The working set of a process is related to its page-fault rate, which fluctuates as the process accesses different data and code sections over time.

Uploaded by

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

Virtual memory

Mosab_2802
objectives

1. Define virtual memory and its benefits


2. Illustrate how pages are loaded into memory using demand paging
3. Apply several algorithms including FIFO, optimal, LRU page
replacement algorithms
4. Describe the working set of a process
1.Define virtual memory and
its benefits
Virtual memory is a technique that allows the execution of processes
that are not completely in memory.
Benefits

• A program would no longer be constrained by the amount of physical


memory that is available. Users would be able to write programs for an
extremely large virtual address space, simplifying the programming task.

• Because each user program could take less physical memory, more
programs could be run at the same time, with a corresponding increase in
CPU utilization and throughput but with no increase in response time or
turnaround time.

• Less I/O would be needed to load or swap user programs into memory, so
each user program would run faster
2.Illustrate how pages are loaded into
memory using demand paging
demand paging is commonly used in virtual memory systems.
With demand-paged virtual memory, pages are loaded only when they are
demanded during program execution. Pages that are never accessed are thus
never loaded into physical memory.

-When we want to execute a process, we swap it into memory. Rather than


swapping the entire process into memory, though, we use a lazy swapper.
A lazy swapper never swaps a page into memory unless that page will be
needed.

-When a process is to be swapped in, the pager guesses which pages will be
used before the process is swapped out again. Instead of swapping in a whole
process, the pager brings only those pages into memory. Thus, it avoids reading
into memory pages that will not be used anyway, decreasing the swap time
and the amount of physical memory needed.
With this scheme, we need some form of hardware support to distinguish
between the pages that are in memory and the pages that are on the disk.
The valid –invalid bit scheme described in Section 8.5.3 can be used for this
purpose.
3.Apply several algorithms including FIFO, optimal, LRU page
replacement algorithms

FIFO replacement algorithm associates with each page the time when
that page was brought into memory. When a page must be replaced,
the oldest page is chosen. Notice that it is not strictly necessary to
record the time when a page is brought in. We can create a FIFO queue
to hold all pages in memory. We replace the page at the head of the
queue. When a page is brought into memory, we insert it at the tail of
the queue.

optimal Replace the page that will not be used for the longest period of
time.
Use of this page-replacement algorithm guarantees the lowest
possible page-
fault rate for a fixed number of frames.

LRU replacement associates with each page the time of that page’s last
use. When a page must be replaced, LRU chooses the page that has
not been used for the longest period of time. We can think of this
strategy as the optimal page-replacement algorithm looking backward
in time, rather than forward.
4.Describe the working set of a process

There is a direct relationship between the working set of


a process and its page-fault rate. Typically, as shown in
Figure 9.20, the working set of a process changes over
time as references to data and code sections move from
one locality to another. Assuming there is sufficient
memory to store the working set of a process (that is,
the process is not thrashing), the page-fault rate of the
process will transition between peaks and valleys over
time. This general behavior is shown below:
REFRENCES

● Abraham-Silberschatz-Operating-System-Concepts

You might also like