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

Operating System

This document describes three page replacement algorithms: FIFO, LRU, and optimal. FIFO replaces pages in a first-in first-out order. LRU replaces the least recently used page. Optimal replaces the page that will not be used for the longest period of time in the future, minimizing page faults, but it is impossible to implement as the future is unknown. Examples are provided to demonstrate how each algorithm works on sample reference strings.

Uploaded by

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

Operating System

This document describes three page replacement algorithms: FIFO, LRU, and optimal. FIFO replaces pages in a first-in first-out order. LRU replaces the least recently used page. Optimal replaces the page that will not be used for the longest period of time in the future, minimizing page faults, but it is impossible to implement as the future is unknown. Examples are provided to demonstrate how each algorithm works on sample reference strings.

Uploaded by

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

A

MICRO PROJECT REPORT

ON

“OPERATING SYSTEM”

SUBMITTED TO THE MSBTE, MUMBAI IN PARTIAL FULFILLMENT OF THE


REQUIREMENTS FOR THE AWARD OF THE DIPLOMA

DIPLOMA OF ENGINEERING (COMPUTER ENGINEERING)

BY

Musale Vaishnavi. 2015200061


Nazirkar Kirti. 2015200062

UNDER THE GUIDANCE OF

Miss.Thorat J.B.

DEPARTMENT OF COMPUTER ENGINEERING


SHARADCHANDRA PAWAR INSTITUTE TECHNOLOGY,
SOMESHWARNAGAR TAL:-BARAMATI DIST:-PUNE Year 2022-2023
DEPARTMENT OF COMPUTER ENGINEERING
SHARADCHANDRA PAWAR INSTITUTE TECHNOLOGY,
SOMESHWARNAGAR
TAL:-BARAMATI DIST:-PUNE
Year 2022-2023

CERTIFICATE
This is to certify that the Project report entitled

“Different Page Replacement Algorithm Make


Comparative Statement”
Submitted by

Musale Vaishnavi. 2015200061


Nazirkar Kirti. 2015200062

Is a bonafide work carried out by them under the supervision Miss. Thorat J.B.
of and it is submitted towards the partial fulfillment of the requirement of MSBTE, Mumbai for
theAward of the Diploma of Computer Engineering

Miss. Gawade S.B Miss.Thorat J.B. Mr.Hajare Sir


(H.O.D) (Internal Guide) (Principal)
ACKNOWLEDGEMENT
We express our sincere thanks to Miss. Thorat J.B. Whose supervision,
inspiration and valuable discussion has helped us tremendously to complete
our project. Her guidance proved to the most valuable to overcome all the
hurdles in the fulfillment of this project on “Different Page Replacement
Algorithm Make Comparative Statement”.

We grateful to Miss. Gawade S.B. Head of Computer Dept. For direct or


indirect help in the completion of this project. Last but not least, this
acknowledgment would be incomplete without rendering my sincere gratitude
to all those who have helped us in the completion of this project.

Yours Sincerely,

Musale Vaishanvi
Nazirkar kirti
Action Plan:
Sr. Details of Activity Planned Planned Name of
No start date Finish date Responsible Team
Members

1 Finalization of Topic Musale Vaishnavi


2 Information Collection . Nazirkar Kirti
3 Information Collection .
4 Information Collection .
5 Information Collection .
6 Information Collection .
7 Information Collection .
8 Information Collection .
9 Information Collection .
10 Information Collection .

11 Result &Conclusion.
12 References
13 Report & Presentation.
14 Seminar
15 Viva voce(oral)
16 Final Submission

Resources Required:-

Sr.No Name of Specifications Qty Remarks


Resource/material
1 Desktop PC DELL Optiplex 380,Intel 1
core 2 Duo
[email protected],4G
B RAM,500GB HDD
2 Software Windows 10 1

3 Other Resources MS Word, Excel


Index:

Sr. no Title Page


no.
1. Introduction of Page Replacement Algorithm 6
2. Page Replacement Algorithm use in operating 7
System
3. Types of Page Replacement Algorithm 8
4. FIFO Algorithm & Example 9
5. Least Recently used (LRU) Algorithm & 10
example
6. Optimal page Replacement Algorithm & 11
example
7. Make Comparative Statement FIFO , LRU & 12
Optimal
8. Conclusion 13
9. Reference 14
Introduction:
Page Replacement Algorithms:
Page replacement is needed in the operating systems that use virtual
memory using Demand Paging. As we know that in Demand paging, only a
set of pages of a process is loaded into the memory. This is done so that we
can have more processes in the memory at the same time.
When a page that is residing in virtual memory is requested by a process
for its execution, the Operating System needs to decide which page will be
replaced by this requested page. This process is known as page
replacement and is a vital component in virtual memory management.
After page fault handling to accommodate the new page ,it is
possible that frames will remain always free.so it is needed to replace the
existing page gram main memory. for that purpose ,there are many page
replacement algorithm. All these algorithm can be evaluated by running it
on a particular string of memory reference.it is expected that the number of
page faults should be minimum to get the performance. Reference string is
the string of memory references. The generation of the reference string is
carried out artificially.
The reference string can also be generated by listing the
address of each memory reference by tracing the system. The important
factor to determine number of page faults is the number of page frames
available. The number of frames available is inversely proportional to
number of page faults. It means that if more frames are available less
number of faults will occur.
Page Replacement Algorithm use in Operating System:
In a computer operating system that uses paging for virtual memory
management, page replacement algorithms decide which memory pages to
page out, sometimes called swap out, or write to disk, when a page of
memory needs to be allocated. Page replacement happens when a
requested page is not in memory (page fault) and a free page cannot be
used to satisfy the allocation, either because there are none, or because the
number of free pages is lower than some threshold.
Types of Page Replacement Algorithm:
1. FIFO Algorithm :
The simplest page- replacement algorithm and work on the basis of
first in first out (FIFO). It throws out the pages in the order in which
they were brought in. the time is associated with each page when it
was brought into main memory. This algorithm always choose oldest
page for replacement. Since replacement is FIFO a queue can be
maintained to hold all the pages in main memory.
This algorithm doesn’t care about which pages are
accessed frequently and which are not. However, it is used in
windows 2000.
Example 1: Consider page reference string 1, 3, 0, 3, 5, 6, 3 with 3 page frames. Find
the number of page faults. 

Initially, all slots are empty, so when 1, 3, 0 came they are allocated to the
empty slots —> 3 Page Faults. 
when 3 comes, it is already in memory so —> 0 Page Faults. Then 5 comes,
it is not available in memory so it replaces the oldest page slot i.e 1. —>1
Page Fault. 6 comes, it is also not available in memory so it replaces the
oldest page slot i.e 3 —>1 Page Fault. Finally, when 3 come it is not
available so it replaces 0 1 page fault.

2. Least Recently used (LRU) Algorithm:


The time of page’s last use in Associated with each page. When a page must
be replaced, LRU choose that page that was used farthest back in the past.
LRU is a good approximation to the optimal algorithm. This algorithm looks
backward in time while optimal replacement algorithm look forward in
time. This policy suggests that replace a page whose last usage is farthest
from current time.
The algorithm can be implemented with some hardware support
and is considered to be a good solution for page replacement. This
algorithm does suffer through belady’s anomaly.

Example-3: 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.

Initially, all slots are empty, so when 7 0 1 2 are allocated to the empty slots
—> 4 Page faults
0 is already their so —> 0 Page fault. When 3 came it will take the place of
7 because it is least recently used —>1 Page fault
0 is already in memory so —> 0 Page fault.
4 will takes place of 1 —> 1 Page Fault
Now for the further page reference string —> 0 Page fault because they are
already available in the memory.
3. Optimal page Replacement Algorithm:

Compare to all other page-Replacement Algorithm, this Algorithm


has the lowest page-fault rate. This algorithm replace that page which
not be used for the longest period of time. This delays the
unavoidable page fault as much as possible, and thus decreases the
total number of page faults. As algorithm replace the page on the
basis of future use of page, it is impossible to implement. The optimal
algorithm is unrealizable because it is impossible to determine the
number of instruction that will be executed in the future before the
page will be referenced. This algorithm does suffer through belady’s
anomaly.
Example-2: 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.

Initially, all slots are empty, so when 7 0 1 2 are allocated to the empty slots —> 4 Page
faults 
0 is already there so —> 0 Page fault. when 3 came it will take the place of 7 because it is
not used for the longest duration of time in the future.—>1 Page fault. 0 is already there so
—> 0 Page fault. 4 will takes place of 1 —> 1 Page Fault. Now for the further page
reference string —> 0 Page fault because they are already available in the memory. 

Make Comparative Statement FIFO , LRU & Optimal :


Sr. No FIFO LRU Optimal

1 Number of Page Fault is Number of Page fault is Number of page fault


More than LRU and more than optimal and less is less than from both
Optimal than FIFO

2 Suffer from belady’s Does not suffer from Does not suffer from
anomaly belady’s anomaly belady’s anomaly

3 Used in operating system Used in operating system Not Used in


operating system

4 Future prediction is not Future prediction is not Future prediction is


required required required

5 Simple to implement Considered to be good Difficult to


implement
Conclusion:-

 The objective of page replacement algorithms is to minimize


the page faults. FIFO page replacement algorithm replaces the
oldest page in the memory.
 Optimal page replacement algorithm replaces the page which
will be referred farthest in the future.
 LRU page replacement algorithm replaces the page that has not
been used for the longest duration of time.
 LIFO page replacement algorithm replaces the newest page in
memory. Random page replacement algorithm replaces any
page at random.
 Optimal page replacement algorithm is considered to be the
most effective algorithm but cannot be implemented in
practical scenarios due to various limitations.
Reference:-
https://www.scaler.com/topics/operating-system/page-
replacement-algorithm/
https://www.javatpoint.com/os-page-replacement-algorithms

You might also like