0% found this document useful (0 votes)
20 views13 pages

Os Project

Uploaded by

Harsh Rathore
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)
20 views13 pages

Os Project

Uploaded by

Harsh Rathore
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/ 13

A PROJECT REPORT

ON
Virtual Memory Demonstration
Submitted
In partial fulfilment
For the award of the degree of Bachelor of technology
In the Department of Computer Science Engineering of Vivekananda
Global University , Jaipur

SUBMITTED TO SUBMITTED BY
Falguni Sharma 1.Harsh Raj (309)
Assistant Professor , 2.Diyansh kr Divya(286)
Department of engineering 3. Himanshu Kr (354)
4.Aniket verma (307)
Department of computer science Engineering Vivekananda Global
University, Jaipur
May ,2024
ACKNOWLEDGEMENT

We express our sincere thanks to my project guide,


Falguni Sharma assistant professor , Department of
computer science engineering , for guiding us right from
the inception till the successful completion of the project
.We sincerely acknowledge him for extending their
valuable guidance, support for literature , critical reviews
of project and this report and above all for the moral
support he provided us at all stages of the project .

Name of the Students :

1. Harsh Raj
2. Himanshu Kr
3. Diyansh Kr Divya
4. Aniket Verma
Abstract

Program objectives and machine advancements in the 1960s


made the predictions required for static allocation difficult, if not
impossible. Therefore, the dynamic allocation solution was
generally accepted, but opinions about implementation were still
divided. One group believed the programmer should continue to
be responsible for storage allocation, which would be
accomplished by system calls to allocate or deal locate memory.
The second group supported automatic storage allocation
performed by the operating system, because of increasing
complexity of storage allocation and emerging importance of
multiprogramming.
Introduction

Storage allocation has always been an important consideration in


computer programming due to the high cost of the main memory
and the relative abundance and lower cost of secondary storage.
Program code and data required for execution of a process must
reside in the main memory but the main memory may not be
large enough to accommodate the needs of an entire process.
Early computer programmers divided programs into the sections
that were transferred into the main memory for the period of
processing time. As the program proceeded, new sections moved
into the main memory and replaced sections that were not
needed at that time. In this early era of computing, the
programmer was responsible for devising this overlay system.
VIRTUAL MEMORY

It is common for modern processors to be running multiple


processes at one time. Each process has an address space
associated with it. To create a whole complete address space for
each process would be much too expensive, considering that
processes may be created and killed often, and also considering
that many processes use only a tiny bit of their possible address
space. Last but not the least, even with modern improvements in
hardware technology, machine resources are still finite. Thus, it
is necessary to share a smaller amount of physical memory
among many processes, with each process being given the
appearance of having its own exclusive address space.
The most common way of doing this is a technique called virtual
memory, which has been known since the 1960s but has become
common on computer systems since the late 1980s. The virtual
memory scheme divides physical memory into blocks and
allocates blocks to different processes. Of course, in order to do
this sensibly it is highly desirable to have a protection scheme
that restricts a process to be able to access only those blocks that
are assigned to it.
Virtual Memory Management

This section provides the description of how the virtual memory


manager provides virtual memory. It explains how the logical
and physical address spaces are mapped to one another and
when it is required to use the services provided by the Virtual
Memory Manager.
Before going into the details of the management of the virtual
memory, let us see the functions of the virtual memory manager.
It is responsible to:
• Make portions of the logical address space resident in physical
RAM
• Make portions of the logical address space immovable in
physical RAM
• Map logical to physical addresses
PAGING

In a multiprogramming system memory is divided into a number


of fixed-size or variable-sized partitions or regions that are
allocated to running processes. For example: a process needs m
words of memory may run in a partition of n words where n ≥
m. The variable size partition scheme may result in a situation
where available memory is not contiguous, but fragmented into
many scattered blocks. We distinguish between internal
fragmentation and external fragmentation. The difference (n –
m) is called internal fragmentation, memory that is internal to a
partition but is not being used. If a partition is unused and
available, but too small to be used by any waiting process, then
it is accounted for external fragmentation. These memory
fragments cannot be used.
In a multiprogramming system memory is divided into a number
of fixed-size or variable-sized partitions or regions that are
allocated to running processes.
For example: a process needs m words of memory may run in a
partition of n words where n ≥ m. The variable size partition
scheme may result in a situation where available memory is not
contiguous, but fragmented into many scattered blocks. We
distinguish between internal fragmentation and external
fragmentation. The difference (n – m) is called internal
fragmentation, memory that is internal to a partition but is not
being used.
Segmentation

Programs generally divide up their memory usage by function.


Some memory holds instructions, some static data, some
dynamically allocated data, some execution frames. All of these
memory types have different protection, growth, and sharing
requirements. In the monolithic memory allocation of classic
Virtual Memory systems, this model isn’t well supported.
Segmentation addresses this by providing multiple sharable,
protectable, growable address spaces that processes can access.
In pure segmentation architecture, segments are allocated like
variable partitions, although the memory management hardware
is involved in decoding addresses.
Pure segmentation addresses replace the page identifier in the
virtual address with a segment identifier, and find the proper
segment (not page) to which to apply the offset. The segment
table is managed like the page table, except that segments
explicitly allow sharing. Protections reside in the segment
descriptors, and can use keying or explicit access control lists to
apply them.
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 using FIFO Page
Replacement Algorithm.
Least Recently Used(LRU)

n operating systems that use paging for memory management,


page replacement algorithm are needed to decide which page
needed to be replaced when new page comes in. Whenever a
new page is referred and not present in memory, page fault
occurs and Operating System replaces one of the existing pages
with newly needed page. Different page replacement algorithms
suggest different ways to decide which page to replace. The
target for all algorithms is to reduce number of page faults.
In Least Recently Used (LRU) algorithm is a Greedy algorithm
where the page to be replaced is least recently used.
Example: Consider the page reference string 7, 0, 1, 2, 0, 3, 0,
4, 2, 3, 0, 3, 2, 3 with 4 page frames. Find number of page faults
using LRU Page Replacement Algorithm.
Optimal Page Replacement

In operating systems, whenever a new page is referred and not


present in memory, page fault occurs and Operating System
replaces one of the existing pages with newly needed page.
Different page replacement algorithms suggest different ways to
decide which page to replace. The target for all algorithms is to
reduce number of page faults. In this algorithm, OS replaces the
page that will not be used for the longest period of time in
future.
Example: Consider the page references 7, 0, 1, 2, 0, 3, 0, 4, 2, 3,
0, 3, 2, 3 with 4 page frame. Find number of page fault using
Optimal Page Replacement Algorithm.
Conclusion

page replacement algorithms are essential for managing a


computer’s memory efficiently. They help ensure that the system
runs smoothly by reducing the number of times it needs to fetch
data from slower storage. Different algorithms, like FIFO And
LRU, have their own pros and cons, and choosing the right one
depends on the specific needs of the system. Understanding
these algorithms can help improve system performance and
make our computers faster and more efficient.
Reference

1. Online Resource
YouTube ,Wikipedia, Google
2. Slide share
3. www.geeksforgeeks.org
4. Books
5. Other References

You might also like