0% found this document useful (0 votes)
34 views14 pages

OSY (Operating System) Project by MD ABU SHALEM ALAM "Fifth Sem Msbte Computer"

OSY(operating System) project By MD ABU SHALEM ALAM "fifth sem Msbte Computer"
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)
34 views14 pages

OSY (Operating System) Project by MD ABU SHALEM ALAM "Fifth Sem Msbte Computer"

OSY(operating System) project By MD ABU SHALEM ALAM "fifth sem Msbte Computer"
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/ 14

A

PROJECT REPORT ON
“Virtual Memory”
SUBMITTED BY
Mr. MD ABU SHALEM ALAM - 2100340320

Under the guidance of


Prof . G.N JORVEKAR

DEPARTMENT OF COMPUTER TECHNOLOGY


Sanjivani Rural Education Society’s

SANJIVANI K.B.P POLYTECHNIC

KOPARGAON : 423603,DIST: AHMEDNAGAR


CERTIFICATE
This is certify that the project report entitied
“Virtual Memory”
SUBMITTED BY

Mr. MD ABU SHALEM ALAM - 2100340320

Of Fifth semester of Diploma in ‘Computer Technology’ institute of Sanjivani


K.B.P Polytechnic Kopargaon has submitted the Micro-project satisfactorily in
subject “Operating System” for academic year 2023 to 2024 as prescribed in the
curriculum.

Place: - Kopargaon

Date: ----------------

Subject Teacher HOD


INDEX

Sr.No Point Name

1. Requirements
2. Introduction
STEPS IN HANDLING A PAGE FAULT
3. PAGE REPLACEMENT ALGORITHMS
3. Conclusion
4. References
REQUIREMENTS

❖ HARDWARE:
• Processor with minimum 258GB hard disk
• 8 GB RAM

❖ SOFTWARE:
• Windows 10

❖ ANY OTHER RESOURCE USED :


Visual studio code
Python3 or above

Page table mechanism

Secondary storage (disk or network mechanism.)


fault handlers and page tables.

Architectural rules concerning restarting of instructions. (For instance, block moves


across faulted pages.)
Introduction
Virtual memory is a memory management technique used by operating systems to provide an
illusion of having more memory than physically available. It allows programs to use more
memory than what is physically installed on a computer.

In virtual memory, the operating system divides the memory into fixed-size blocks called
pages. These pages are stored in secondary storage, such as a hard disk, when they are not
actively used. When a program needs to access a page that is not currently in physical memory,
the operating system retrieves it from secondary storage and brings it into memory.

This process is facilitated by the use of a page table, which maps the virtual addresses used by
the program to the corresponding physical addresses in memory. The page table keeps track of
which pages are currently in memory and which ones are stored in secondary storage.

Virtual memory provides several benefits. It allows for efficient memory allocation, as
programs can be allocated memory in smaller chunks rather than requiring contiguous blocks
of physical memory. It also enables memory protection, as each program's memory is isolated
from others, preventing unauthorized access.

Additionally, virtual memory enables the concept of virtual addresses, which are used by
programs, while the physical addresses are handled by the operating system. This abstraction
allows for easier program development and portability across different systems.

However, the use of virtual memory comes with some overhead. The constant swapping of
pages between physical memory and secondary storage can lead to performance degradation,
known as paging or thrashing, if not managed properly. To mitigate this, operating systems
employ various techniques like page replacement algorithms to optimize the usage of physical
memory.

In summary, virtual memory is a crucial component of modern operating systems that allows
programs to utilize more memory than physically available. It provides memory isolation,
efficient allocation, and abstraction of physical addresses, enhancing the overall performance
and usability of the system.
WHY VIRTUAL MEMORY?

• We've previously required the entire logical space of the process to


be in memory before the process could run. We will now look at
alternatives to this.

• Most code/data isn't needed at any instant, or even within a finite time -
we can bring it in only as needed.

VIRTUES

• Gives a higher level of multiprogramming

• The program size isn't constrained (thus the term 'virtual memory').
Virtual memory allows very large logical address spaces.

• Swap sizes smaller.


Demand paging When a page is touched, bring it from secondary to main memory.

Overlays
Laying of code data on the same logical addresses - this is the reuse of logical memory.
Useful when the program is in phases or when logical address space is small.
Dynamic loading

A routine is loaded only when it's called.

When a page is referenced, either as code execution or data access, and that page isn’t in
memory, then get the page from disk and re-execute the statement

Here’s migration between memory and disk


One instruction may require several pages. For example, a block move of data.
May page fault part way through an operation - may have to undo what was done. Example:
an instruction crosses a page boundary Time to service page faults demands that they happen
only infrequently.

Note here that the page table requires a "resident" bit showing that page is/isn't in memory.
(Book uses "valid" bit to indicate residency. An "invalid" page is that way because a legal page
isn't resident or because the address is illegal.

It makes more sense to have two bits - one indicating that the page is legal (valid) and a second
to show that the page is in memory.
STEPS IN HANDLING A PAGE FAULT

1. The process has touched a page not currently in memory.

2. Check an internal table for the target process to determine if the reference was valid
(do this in hardware.)

3. If page valid, but page not resident, try to get it from secondary storage.

4. Find a free frame; a page of physical memory not currently in use. (May need to free
up a page.)

5. Schedule a disk operation to read the desired page into the newly allocated frame.

6. When memory is filled, modify the page table to show the page is now resident.

7. Restart the instruction that failed.


REQUIREMENTS FOR DEMAND PAGING (HARDWARE AND SOFTWARE )
INCLUDE:

Page table mechanism

Secondary storage (disk or network mechanism.)


fault handlers and page tables.

Architectural rules concerning restarting of instructions. (For instance, block moves


across faulted pages.)

PERFORMANCE OF DEMAND PAGING

We are interested in the effective access time: a combination of "normal" and "paged" accesses.
It’s important to keep fraction of faults to a minimum. If fault ratio is "p", then

effective_access_time = (1-p) * memory_access_time

+ p * page_fault_time.

Calculate the time to do a fault as shown in the text:

fault time= 10 milliseconds ( why )


normal access= 100 nanoseconds
(why)
The picture when all pages are not in memory

PAGE REPLACEMENT ALGORITHMS:

When memory is overallocated, we can either swap out some process, or overwrite some
pages. Which pages should we replace?? <--- here the goal is to minimize the number of
faults.
Here is an example reference string we will use to evaluate fault mechanisms:
Reference string: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5

FIFO

Conceptually easy to implement; either use a time-stamp on pages, or organize on a queue.


(The queue is by far the easier of the two methods.)
OPTIMAL REPLACEMENT

• This is the replacement policy that results in the lowest page fault rate.
• Algorithm: Replace that page which will not be next used
for the longest period of time.
• Impossible to achieve in practice; requires crystal ball.
Reference string: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5

4 1

6 page faults 2

5 4
Conclusion
virtual memory is a crucial aspect of operating systems that allows programs to utilize more
memory than physically available. It provides benefits such as efficient memory allocation,
memory protection, and abstraction of physical addresses. However, it also introduces
overhead and the potential for performance degradation if not managed properly. Overall,
virtual memory plays a vital role in enhancing the performance and usability of operating
systems.
virtual memory is like a superpower for operating systems! It allows programs to use more
memory than what's physically available. This helps with efficient memory management,
protection, and makes things easier for developers. However, it can slow things down if not
managed properly. Overall, virtual memory is a game-changer for operating systems!
To wrap it up, virtual memory is a crucial feature in operating systems that allows programs
to utilize more memory than what's physically available. It offers benefits like efficient
memory allocation, protection, and portability. However, it can introduce performance
overhead if not managed effectively. Overall, virtual memory is a game-changer that enhances
the functionality and performance of operating systems.
References

1. Title: "Operating System Concepts"


Authors: Abraham Silberschatz, Peter B. Galvin, Greg Gagne
Publisher: Wiley
Year: 2018
2. Title: "Modern Operating Systems"
Author: Andrew S. Tanenbaum
Publisher: Pearson
Year: 2014
3. Title: "Virtual Memory: Concepts, Implementation, and Performance"
Authors: E. Denning, P. J. Denning
Publisher: ACM Computing Surveys (CSUR)
Year: 1970
4. Title: "Understanding the Linux Virtual Memory Manager"
Authors: Mel Gorman
Publisher: Prentice Hall
Year: 2004
5. Title: "Windows Internals, Part 1: System architecture, processes, threads, memory
management, and more"
Authors: Mark E. Russinovich, David A. Solomon, Alex Ionescu
Publisher: Microsoft Press
Year: 2017

You might also like