Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Report.

 Introduction.
In this presentation we the last group are going to present on virtual memory. First of all, we are
going to define the virtual memory then we are going to talk on following sub topics (importance
of virtual memory, working, demand paging, page replacement algorithm.)

 Definition.
Virtual memory is a section of volatile memory created temporarily on the storage drive. It is
created when a computer is running many processes at once and RAM is running low.

 Importance of virtual memory.


 Multitasking

One important use of virtual memory is multitasking. When a computer user opens multiple
programs at once, the data for these programs must be stored in memory for quick access. The
more programs are open, the more memory is needed. When the computer's physical memory is
full, the excess data is stored in virtual memory.

 Data Security

Another important issue is data security. In general, a program can guess another program’s
physical address and gain access to sensitive and secret data.
If an OS uses the virtual memory technique, even if some programs have to access the same
address, they all have different mappings. This ensures that they will access different addresses
in the RAM or the disk. This is how virtual memory enables data security.
It also provides position independence to the data. We can store data at any position in the main
memory.
 Large Programs

In addition to multitasking, virtual memory allows programmers to create larger and more
complex applications. When these programs are running, they occupy physical memory as well
as virtual memory.

 Flexibility

If computers only relied on memory chips, far less memory would be available and the
usefulness of many software programs would be severely limited. Even though virtual memory is
slower, it is still useful because it greatly expands a computer's functionality.

 Working.
Virtual memory uses both the computer's software and hardware to work. It transfers processes
between the computer's RAM and hard disk by copying any files from the computer's RAM that
aren't currently in use and moving them to the hard disk. By moving unused files to the hard
disk, a computer frees up space in its RAM to perform current tasks, such as opening a new
application. If the computer later needs to use its RAM for a more urgent task, it can again swap
files to make the most of the available RAM.
RAM is a limited resource stored on chips that are built into the computer's CPU. Installing more
RAM chips can be expensive, so virtual memory allows the computer to move files between
systems as needed to optimize its use of the available RAM.

 Demand paging.
Demand paging is a technique used in virtual memory systems where the pages are brought in
the main memory only when required or demanded by the CPU. Hence, it is also named as lazy
swapper because the swapping of pages is done only when required by the CPU.

 Page replacement algorithm.


In an operating system that uses paging for memory management, a page replacement algorithm
is needed to decide which page needs to be replaced when a new page comes in.
1. First In First Out (FIFO) –
This is the simplest page replacement algorithm. In this algorithm, the operating system
keeps track of all pages in the memory in a queue, the oldest page is in the front of the
queue. When a page needs to be replaced page in the front of the queue is selected for
removal.

Example.
Consider page reference string 1, 3, 0, 3, 5, 6, 3 with 3 page frames.Find the number of page
faults.

2. Optimal page replacement.2. Optimal Page replacement –


In this algorithm, pages are replaced which would not be used for the longest duration of
time in the future.
Ex: Consider the page references 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, with 4 page frame. Find
number of page fault.
Optimal page replacement is perfect, but not possible in practice as the operating system cannot
know future requests. The use of Optimal Page replacement is to set up a benchmark so that
other replacement algorithms can be analyzed against it.

3. Least recently used.ast Recently Used –


In this algorithm, page will be replaced which is least recently used.
Ex: Consider the page reference string 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2 with 4 page frames. Find
number of page faults.

In an op

4. Last In First Out (LIFO) Page Replacement Algorithm.


This is the Last in First Out algorithm and works on LIFO principles. In this algorithm, the
newest page is replaced by the requested page. Usually, this is done through a stack, where we
maintain a stack of pages currently in the memory with the newest page being at the top.
Whenever a page fault occurs, the page at the top of the stack is replaced.
Ex: Let’s see how the LIFO performs for our example string of 3, 1, 2, 1, 6, 5, 1, 3 with 3-page
frames.rep

Conclusion.

 Virtual memory is a part of the system's secondary memory that acts and gives us an
illusion of being the main memory. When your computer's physical memory is full,
virtual memory is required.

 Virtual memory works mainly by transferring processes between the computer's RAM
and hard disk depending on the requirements. A Memory Management unit (MMU)
facilitates this purpose.
 Page tables are used to record the mapping between virtual and physical memory.
 A demand paging mechanism is similar to a paging system with swapping in that
processes and pages are loaded only on demand, rather than in preparation.
 When there isn't enough space in the main memory to store the applications, certain
applications can be swapped out of the RAM to the hard disk.
 When a certain application needs to be run and is in the hard disk currently, it can be
swapped into the RAM.
 It increases the degree of multiprogramming, effective CPU Usage, effective memory
that can be used and eases data sharing without the need for relocation.
 Virtual Memory can make a system slower, reducing hard disk space and system
stability.

You might also like