Simple Page Replacement
Simple Page Replacement
A MINI-PROJECT REPORT
Submitted By
Jeevayogi.S[RA2311003020127]
Arjun Manish[RA2311003020126]
Clarence Jenny[RA2311003020115]
SIGNATURE
Dr. C.SHANMUGANATHAN, M.E., Ph.D.,
Assistant Professor,
DECLARATION
We hereby declare that the entire work contained in this mini project report
titled “SIMPLE PAGE REPLACEMENT” has been carried out by
JEEVAYOGI.S [RA2311003020127], ARJUN MANISH
[RA2311003020126], CLARENCE JENNY [RA2311003020115] at SRM
Institute of Science and Technology, Ramapuram Campus, Chennai - 600089,
Place: Chennai
Date:
ABSTRACT
LIST OF FIGURES
Fig No. Figure Name Page No.
4.1 Use of RNN in the speaker 15
verification system
4.2 Use of CNN in the speaker 16
verification system
4.3 Architecture Diagram 17
4.4 Dataframe information 18
4.5 Dataset Row Counts 21
4.6 Random Seed 21
4.7 Pre-Processing of Each Word 22
4.8 Pre-Processing Architecture of Text 22
Data
4.9 Tokenization of Sentence 23
4.10 Normalization of text data 24
4.11 TF-IDF Vectorizer 25
4.12 Random Forest Hyperparameters 26
4.13 Random Forest Precision 27
4.14 Visual Representation of Random 28
Forest Classifier
LIST OF ABBREVIATIONS
CNN Convolutional Neural Network
RNN Recurrent Neural Network
NN Neural Network
ASR Automated Speech Recognition
NLTK Natural Language Toolkit
LSTM Long Short-Term Memory
GRU Gated Recurrent Unit
SV Speaker Verification
CHAPTER 1
INTRODUCTION
1.1 Overview
1
The primary aim of this project is to analyze and compare simple
page replacement algorithms, specifically Least Recently Used
(LRU), First-In-First-Out (FIFO), and Optimal Page
Replacement. The project seeks to:
1. Investigate the operational mechanisms of each algorithm.
2. Measure their performance in terms of page fault rates and
memory utilization.
3. Identify the conditions under which each algorithm performs
best.
2
The project will primarily target academic environments and
software development contexts where efficient memory
management is critical, thereby contributing valuable insights for
both researchers and practitioners in the field of operating systems.
CHAPTER 2
Processor:
3
Recommended: Quad-core CPU (3.0 GHz or higher)
Memory (RAM):
Minimum: 4 GB RAM
Storage:
Graphics:
Network:
1. Operating System:
2. Programming Language:
4
o Python (recommended) or C/C++ for implementing page
replacement algorithms.
3. Development Environment:
4. Libraries/Frameworks:
5. Simulation Tools:
6. Version Control:
PROJECT DESCRIPTION
3.1 Introduction
7
Optimal, Least Recently Used (LRU), and Least Frequently Used
(LFU). Each algorithm follows a different approach:
Optimal replaces the page that will not be used for the longest
period in the future.
LRU replaces the page that has not been used for the longest
time.
LFU replaces the page that has been used the least frequently.
8
The project implements four fundamental page replacement
algorithms commonly used in operating systems: First-In-First-Out
(FIFO), Optimal, Least Recently Used (LRU), and Least Frequently
Used (LFU). Each of these algorithms approaches the task of
selecting which page to replace in memory in a unique way, with
varying implications on system performance, complexity, and
frequency of page faults. Below is a detailed explanation of each
algorithm:
How It Works:
9
The Optimal page replacement algorithm is theoretically the best
possible algorithm, as it replaces the page that will not be needed for
the longest time in the future. However, in practice, it is not feasible
because it requires knowledge of future page requests, which is
impossible to predict. It is mainly used as a benchmark to compare
the performance of other algorithms.
How It Works:
o For each page fault, the system scans the future sequence
of page requests and replaces the page that will not be
used for the longest duration.
The LRU page replacement algorithm selects the page that has not
been used for the longest time. The logic behind LRU is that if a
page has not been accessed recently, it is unlikely to be used in the
near future, making it a good candidate for replacement. This
algorithm requires tracking the history of page usage, which can
introduce some computational overhead.
How It Works:
The LFU page replacement algorithm removes the page that has
been accessed the least frequently. The assumption here is that
pages with lower access frequency are less likely to be needed in the
future. This algorithm keeps a count of how many times each page
is accessed and selects the one with the lowest count when a
replacement is required.
How It Works:
Advantages:
o Simple to implement.
Disadvantages:
11
o Can lead to high page fault rates, especially in cases
where old pages are frequently accessed (known as the
"Belady’s Anomaly").
Advantages:
Disadvantages:
Advantages:
Disadvantages:
Disadvantages:
Architecture Diagram
13
RESULTS
Output
The confusion matrix is a table that compares the estimated and actual
values with test data to show how well the classification model is
performing.It can be used to assess the system's performance in terms of
correctly identifying speakers and excluding impostors in the context of
speaker verification.
14
True Negative (TN): the quantity of instances where the system rejects
the imposter
False Negative (FN): how many times a genuine speaker is mistakenly
rejected as a fake by the system.
Conclusion
15
APPENDIX
Source Code
class PageReplacementSimulator:
def __init__(self, num_frames):
self.num_frames = num_frames
self.frames = []
self.page_faults = 0
def reset(self):
self.frames = []
self.page_faults = 0
16
def fifo(self, page_references):
for page in page_references:
if page not in self.frames:
if len(self.frames) < self.num_frames:
self.frames.append(page)
else:
self.frames.pop(0)
self.frames.append(page)
self.page_faults += 1
print(f"Page: {page}, Frames: {self.frames}, Faults:
{self.page_faults}")
return self.page_faults
def get_user_input():
num_frames = int(input("Enter the number of frames: "))
reference_string = input("Enter the reference string (space-
separated integers): ")
page_references = list(map(int, reference_string.split()))
return num_frames, page_references
def main():
num_frames, page_references = get_user_input()
simulator = PageReplacementSimulator(num_frames)
algorithms = ["FIFO", "Optimal", "LRU", "LFU"]
if __name__ == "__main__":
main()
20
21