0% found this document useful (0 votes)
41 views17 pages

Page Replacement Algorithms: A Project Report On

The document is a project report submitted by four students on the topic of "Page Replacement Algorithms". It discusses memory management in operating systems and how page replacement algorithms are used to decide which pages to replace when new pages are needed. The report aims to study different page replacement algorithms. It provides an overview of common algorithms like FIFO, Optimal, LRU, and Random replacement. The methodology, resources, and action plan are also outlined to complete the project.

Uploaded by

Bhushan Karguppi
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)
41 views17 pages

Page Replacement Algorithms: A Project Report On

The document is a project report submitted by four students on the topic of "Page Replacement Algorithms". It discusses memory management in operating systems and how page replacement algorithms are used to decide which pages to replace when new pages are needed. The report aims to study different page replacement algorithms. It provides an overview of common algorithms like FIFO, Optimal, LRU, and Random replacement. The methodology, resources, and action plan are also outlined to complete the project.

Uploaded by

Bhushan Karguppi
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/ 17

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION, MUMBAI

A
Project Report
On
“Page Replacement Algorithms”
For the requirement of partial fulfillment curriculum of
DIPLOMA IN COMPUTER ENGINEERING
Submitted by:
Mr. Bhushan Siddhappa Karguppi
Mr. Shankar Maruti Morti
Mr. Shreyash Tanaji Magdum
Mr. Prathmesh Yashwant Sardesai

Under guidance of,

Mr. R. B. More

DEPARTMENT OF COMPUTER ENGINEERING

SANT GAJANAN MAHARAJ RURAL POLYTECHNIC,


MAHAGAON
ACADEMIC YEAR 2023-2023
SANT GAJANAN MAHARAJ RURAL POLYTECHNIC
A/P –MAHAGAON, SITE –CHINCHEWADI, TAL-GADHINGLAJ, DIST-KOLHAPUR

Certificate
This is to certify that the following students of Fifth semester of Diploma in
COMPUTER ENGINEERING of Institute SANT GAJANAN RURAL
POLYTECHNIC, MAHAGAON-416503.(CODE-0965) has completed micro-project
on “Page Replacement Algorithms” satisfactory in subject „OSY‟ subject code
(22516) for academic year 2023 to2024 as prescribed in the curriculum.

ENROLLMENT
ROLL EXAM. NAME OF STUDENT
NO NO SEAT NO
22 2109650147 Bhushan Karguppi
33 2109650173 Shankar Morti
35 2109650175 Shreyash Magdum
28 2109650163 Prathmesh Sardesai

DATE: PLACE: Mahagaon

Mr. R. B. More Mr. G. K. Birangaddi Mrs. R. S. Patil


(Project Guide) (Head of Department) (Principal)
INDEX

Sr.no Content Page No.

1. Micro-project Proposal -Annexure -I 1-3

2. Micro-project -Annexure -II 4-10

3. Micro-project Evaluation Annexure-III 11-13


Part – A Micro-Project Proposal
Title: - Calculate Page Fault Of Using Different Page Replacement Algorithms

1.0 Rationale

Memory management is the most important part of operating system in which all activities related to the memory
are perform . The replacement of page is the main concept. Pages is required to be in the main memory . Computer
system objective is to execute program of different sizes. The program should be in main memory when program
is executed. But main memory has limited size to accommodate programs which is large. Execution of program
that may not be entirely in main memory is called virtual memory. Virtual memory paved the way to execute
program that is larger than main memory. The process in which we provisionally moves process from primary
memory to the hard disk or secondary memory, so that the memory available for other processes, which is known
as swapping .
On operating systems which use paging for memory management, it is needed a page replacement algorithm to
decide which pages to replace when a new page is entered. Good replacement can reduce the cost of page fault
that result in higher performance of the system.
Page Fault occurs when a process references to a page that is not present in the main memory and needs to be
through from secondary memory. When a program currently executing, accessing a memory page that is mapped
to the virtual address space, but is not loaded into physical memory. Because actual physical memory is much
smaller than virtual memory, a page fault occurs. In this case, the operating system may have to replace one of
the existing pages with the new page it needs. There are several page replacement algorithms for this replacement.
One of them is the random page replacement algorithm

2.0 Aim
 To study different types of page replacement algorithm.

3.0 Course Outcomes


 Use operating system tools to perform various functions.
 Install operating system and configure it.

4
4.0 Literature review
There are several algorithms of page replacement proposed by experts, namely :

1. First in First out (FIFO): This is the simplest page changing algorithm. In this algorithm, the operating system
keeps track of all the pages in memory that are in the queue, namely page that has been in front of the queue the
longest. When a page has to be replaced the page at the front of the queue is chosen to be deleted. An average of
hit ratio of 50 percent is reported by FIFO algorithm. The advantages and disadvantages of FIFO algorithm: Easy
to understand, very easy to be implemented, Performance not always good.

2. Optimal Page Replacement: In this algorithm, pages are replaced which will not be used for the next longest
duration of time. Optimal page replacement is a good algorithm, but it is impossible to implement practically,
because the operating system will not know the next request. The use of this algorithm is to create benchmarks
so that other replacement algorithms can be analyzed against this algorithm. On this algorithm, system select
victim whole reference is furthest. This algorithm has the best page fault behavior reported.

3. Least Recently Used: In this algorithm, the page will be replaced the least used (least recently used). An average
of 60 % hit ratio is reported by LRU algorithm. This algorithm selects the victim page as that which is not been
demanded for access for along time.

4. Random Page Replacement Algorithm: In this algorithm, the operating system will keep track of all the pages
in memory which are marked as the next replaced slot. And the selection of which slots to replace is done
randomly. Page replacement algorithm depends on the following parameters: Page fault rate, indicates by how
many misses occur for a set of page reference. The minimal the page fault rate, the higher the efficiency of the
algorithm. Hit rate, indicates how many hits occur on the page. The higher hit rate, the higher the efficiency of
the algorithm.

1. Methodology
 Focus on selection of appropriate topic for Micro project.
 Select the topic Batch Operating System
 To meet the subject teacher and take guidelines about it.
 Searching the information related to the topic of micro-project.
 Start the procedure for project and making soft copy of project report.
 We organize all information about our topic in proper manner.
 Show the soft copy of the project report to subject teacher and make corrections in it.
 Submit the hard copy of the project report to the subject teacher.

5
4.0 Actual Resource Required
Sr. Name of Resource Specification Quantity Remarks
No required
1 Computer system Intel (R) Core (TM) 1 used
i31450 CPU32 bit
operating System
2 Operating System Windows 10 1 used

3 Software Micosoft office- 1 used


word 2013

5.0 Action Plan


SR. Details of activity Plan Plan Name of responsible
No. start end team members
Date Date

1 Select micro project Bhushan Karguppi


12-07- 19-07-
2023 2023
2 Study of related material Shreyash
02-08- 09-08- Magdum
2023 2023

3 Present part A in front of teacher Prathmesh


16-08- 23-08- Sardesai
2023 2023

4 Collect information about part B Shreyash


30-08- 06-09- Magdum
2023 2023

5 Create Part B Shankar Morti

13-09- 27-09-
2023 2023
6 Submit project Bhushan Karguppi

29-10- 02-11-
2023 2023

6
5.0Resource Required

Sr. Name of Resource Specification Quantity Remarks


No required
1 Computer system Intel (R) Core (TM) 1 used
i31450 CPU32 bit
operating System
2 Operating System Windows 10 1 used

3 Software Micosoft office- 1 used


word 2013

7
Part – B Micro-Project Report
Title: - Calculate Page Fault Of Using Different Page Replacement Algorithms

1.0 Rationale
An Operating System is basically a system program that controls the execution of application programs and acts
as an interface between applications and the computer hardware. It manages the computer system the computer
system resources to be used in an efficient manner.

2.0 Course Outcomes


 Use operating system tools to perform various functions.
 Install operating system and configure it.

3.0 Actual Methodology Followed


In an operating system, page replacement is referred to a scenario in which a page from the main memory
should be replaced by a page from secondary memory. Page replacement occurs due to page faults. The various
page replacement algorithms like FIFO, Optimal page replacement, LRU, LIFO, and Random page
replacement help the operating system to decide which page to replace.

1.1 Literature Review:


 The project commenced with an extensive literature review, encompassing research papers, articles, and
books pertinent to the selected topic. This phase provided a robust theoretical foundation, offering
valuable insights and a broader perspective on the subject matter.

8
Page replacement is needed in the operating systems that use virtual memory using Demand Paging. As we
5.1
knowPage Replacement
that in Algorithms
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.
5.3.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.

9
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.
Belady’s anomaly proves that it is possible to have more page faults when increasing the number of page
frames while using the First in First Out (FIFO) page replacement algorithm. For example, if we consider
reference strings 3, 2, 1, 0, 3, 2, 4, 3, 2, 1, 0, 4, and 3 slots, we get 9 total page faults, but if we increase slots
to 4, we get 10-page faults.

Advantages

 Simple to understand and implement


 Does not cause more overhead

Disadvantages

 Poor performance
 Doesn’t use the frequency of the last used time and just simply replaces the oldest page.
 Suffers from Belady’s anomaly.

5.3.1 Optimal Page replacement

In this algorithm, pages are replaced which would not be used for the longest duration of time in the 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.

10
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.
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.

Advantages

 Excellent efficiency
 Less complexity
 Easy to use and understand
 Simple data structures can be used to implement
 Used as the benchmark for other algorithms

Disadvantages

 More time consuming


 Difficult for error handling
 Need future awareness of the programs, which is not possible every time

5.3.2 Least Recently Used(LRU)

In this algorithm, page will be replaced which 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.

11
-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.

Advantages

 It is open for full analysis


 Doesn’t suffer from Belady’s anomaly
 Often more efficient than other algorithms

Disadvantages

 It requires additional data structures to be implemented


 More complex
 High hardware assistance is required

5.3.4 Last In First Out (LIFO)

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.

12
Example: Let’s see how the LIFO performs for our example string of 3, 1, 2, 1, 6, 5, 1, 3 with 3-page frames:

 Initially, since all the slots are empty, page 3,1,2 causes a page fault and takes the empty slots.

Page faults = 3

 When page 1 comes, it is in the memory and no page fault occurs. 

Page faults = 3

 When page 6 comes, the page fault occurs and page 2 is removed as it is on the top of the stack and is
the newest page.

Page faults = 4

 When page 5 comes, it is not in the memory, which causes a page fault, and hence page 6 is
removed being on top of the stack.

Page faults = 5

 When page 1 and page 3 come, they are in memory already, hence no page fault occurs. 

Total page faults = 5

As you may notice, this is the same number of page faults as of the Optimal page replacement algorithm. So we
can say that for this series of pages, this is the best algorithm that can be implemented without the prior
knowledge of future references.

Advantages

 Simple to understand
 Easy to implement

13
 No overhead 

Disadvantages

 Does not consider Locality principle, hence may produce worst performance
 The old pages may reside in memory forever even if they are not used

5.3.5 Random Page Replacement

This algorithm, as the name suggests, chooses any random page in the memory to be replaced by the requested
page. This algorithm can behave like any of the algorithms based on the random page chosen to be replaced.

Example: Suppose we choose to replace the middle frame every time a page fault occurs. Let’s see how our
series of 3, 1, 2, 1, 6, 5, 1, 3 with 3-page frames perform with this algorithm:

Initially, since all the slots are empty, page 3,1,2 causes a page fault and takes the empty slots

 Page faults = 3

 When page 1 comes, it is in the memory and no page fault occurs.

Page faults = 3

 When page 6 comes, the page fault occurs, we replace the middle element i.e 1 is removed. 

Page faults = 4

 When page 5 comes, the page fault occurs again and middle element 6 is removed 

14
Page faults = 5

 When page 1 comes, there is again a page fault and again the middle element 5 is removed 

Page faults = 6

When page 3 comes, it is in memory, hence no page fault occurs.

Total page faults = 6

As we can see, the performance is not the best, but it's also not the worst. The performance in the random
replacement algorithm depends on the choice of the page chosen at random.

Advantages

 Easy to understand and implement


 No extra data structure needed to implement
 No overhead

Disadvantages

 Can not be analysed, may produce different performances for the same series
 Can suffer from Belady’s anomaly

15
Action Plan Implementation

SR. Details of activity Plan Plan Name of responsible


No. start end team members
Date Date

1 Select micro project Bhushan Karguppi


12-07- 19-07-
2023 2023
2 Study of related material Shreyash
02-08- 09-08- Magdum
2023 2023

3 Present part A in front of teacher Prathmesh


16-08- 23-08- Sardesai
2023 2023

4 Collect information about part B Shreyash


30-08- 06-09- Magdum
2023 2023

5 Create Part B Shankar Morti

13-09- 27-09-
2023 2023
6 Submit project Bhushan Karguppi

29-10- 02-11-
2023 2023

16
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
 www.guru.com
 www.geeksforgeek.com
 www.javatpoint.com

17

You might also like