Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

operating system

Rating
-
Sold
1
Pages
29
Uploaded on
22-01-2022
Written in
2021/2022

operating system notes

Institution
Course

Content preview

UNIT -III

Virtual Memory Management

Virtual Memory is a storage mechanism which offers user an illusion of having a very big
main memory. It is done by treating a part of secondary memory as the main memory. In
Virtual memory, the user can store processes with a bigger size than the available main
memory.


Why Need Virtual Memory?
Here, are reasons for using virtual memory:

 Whenever your computer doesn’t have space in the physical memory it writes what it
needs to remember to the hard disk in a swap file as virtual memory.
 If a computer running Windows needs more memory/RAM, then installed in the
system, it uses a small portion of the hard drive for this purpose.

Virtual Memory is a space where large programs can store themselves in
form of pages while their execution and only the required pages or
portions of processes are loaded into the main memory. This technique is
useful as a large virtual memory is provided for user programs when a
very small physical memory is there. Thus Virtual memory is a technique
that allows the execution of processes that are not in the physical
memory completely.

Virtual Memory mainly gives the illusion of more physical memory than
there really is with the help of Demand Paging.

In real scenarios, most processes never need all their pages at once, for
the following reasons :

 Error handling code is not needed unless that specific error occurs,
some of which are quite rare.

 Arrays are often over-sized for worst-case scenarios, and only a
small fraction of the arrays are actually used in practice.

 Certain features of certain programs are rarely used.

In an Operating system, the memory is usually stored in the form of units
that are known as pages. Basically, these are atomic units used to store
large programs.

Virtual memory can be implemented with the help of:-

, 1. Demand Paging

2. Demand Segmentation

The Need for Virtual Memory
Following are the reasons due to which there is a need for Virtual
Memory:

 In case, if a computer running the Windows operating system needs
more memory or RAM than the memory installed in the system then
it uses a small portion of the hard drive for this purpose.

 Suppose there is a situation when your computer does not have
space in the physical memory, then it writes things that it needs to
remember into the hard disk in a swap file and that as virtual
memory.

Benefits of having Virtual Memory
1. Large programs can be written, as the virtual space available is
huge compared to physical memory.

1. /O required leads to faster and easy swapping of processes.
2. More physical memory available, as programs are stored on virtual
memory, so they occupy very little space on actual physical
memory.
3. Therefore, the Logical address space can be much larger than that
of physical address space.
4. Virtual memory allows address spaces to be shared by several
processes.
5. During the process of creation, virtual memory allows: copy-on-
write and Memory-mapped files

Execution of the Program in the Virtual memory
With the help of the Operating system few pieces of the program are
brought into the main memory:

 A portion of the process that is brought in the main memory is
known as Resident Set.

, Whenever an address is needed that is not in the main memory, then it
generates an interrupt. The process is placed in the blocked state by the
Operating system. Those pieces of the process that contains the logical
address are brought into the main memory.

Demand Paging
The basic idea behind demand paging is that when a process is swapped
in, its pages are not swapped in all at once. Rather they are swapped in
only when the process needs them(On-demand). Initially, only those
pages are loaded which will be required by the process immediately.

The pages that are not moved into the memory, are marked as invalid in
the page table. For an invalid entry, the rest of the table is empty. In the
case of pages that are loaded in the memory, they are marked as valid
along with the information about where to find the swapped-out page.

Page Replacement
As studied in Demand Paging, only certain pages of a process are loaded
initially into the memory. This allows us to get more processes into
memory at the same time. but what happens when a process requests for
more pages and no free memory is available to bring them in. Following
steps can be taken to deal with this problem :

1. Put the process in the wait queue, until any other process finishes
its execution thereby freeing frames.
2. Or, remove some other process completely from the memory to free
frames.
3. Or, find some pages that are not being used right now, move them
to the disk to get free frames. This technique is called Page
replacement and is most commonly used. We have some great
algorithms to carry on page replacement efficiently.

Thrashing
A process that is spending more time paging than executing is said to be
thrashing. In other words, it means, that the process doesn't have enough
frames to hold all the pages for its execution, so it is swapping pages in
and out very frequently to keep executing. Sometimes, the pages which
will be required in the near future have to be swapped out.

Connected book

Written for

Institution
Course

Document information

Uploaded on
January 22, 2022
Number of pages
29
Written in
2021/2022
Type
Class notes
Professor(s)
Kumar
Contains
All classes

Subjects

$3.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
chiranjeevijami

Also available in package deal

Get to know the seller

Seller avatar
chiranjeevijami sivani
Follow You need to be logged in order to follow users or courses
Sold
1
Member since
4 year
Number of followers
1
Documents
20
Last sold
4 year ago

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions