forked from Kashyap0312/OS-PageReplacement
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlru.html
104 lines (71 loc) · 3.91 KB
/
lru.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<!-- Java query for Navbar -->
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
<!-- Font awesome -->
<script defer src="https://use.fontawesome.com/releases/v5.0.7/js/all.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
<!-- bootstrap -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">
<!-- external css -->
<link rel="stylesheet" href="css/styles.css">
<title>Optimal</title>
</head>
<body>
<nav class="navbar navbar-expand-lg fixed-top navbar-dark bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="#">
Page Replacement > LRU
</a>
</div>
</nav>
<section class="fc1" id="fi1">
<a href="lru01.html">
<h2>Least Recently Used (LRU):</h2>
</a>
<br>
<p class="fifop">In 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.</p>
<br>
<p class="fifop"> In Least Recently Used (LRU) algorithm is a Greedy algorithm where the page to be replaced is least recently used. The idea is based on locality of reference, the least recently used page is not likely. </p>
<br>
<!-- <p class="fifop">This algorithm was introduced long back and is difficult to implement because it requires future knowledge of the program behaviour. However, it is possible to implement optimal page replacement on the second run by using the
page reference information collected on the first run.</p> -->
<hr>
<h3 class="h3exa">Example:</h3>
<p class="fifop"> <span class="point">•</span>Consider the page references 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, with 4 page frame. Find number of page fault. </p>
<img src="optimalss.png" alt="">
<ul class="ulfifo">
<li>Initially all slots are empty, so when 7 0 1 2 are allocated to the empty slots —> 4 Page faults </li>
<li>0 is already there so —> 0 Page fault. </li>
<li>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. </li>
<li>0 is already there so —> 0 Page fault.</li>
<li>4 will takes place of 1 —> 1 Page Fault. </li>
<li>Now for the further page reference string —> 0 Page fault because they are already available in the memory. </li>
</ul>
<hr>
<section class="ulfifo">
<h3>Advantage:</h3>
<ul>
<li>Easy to Implement.</li>
<li>Simple data structures are used.</li>
<li>Highly efficient.</li>
</ul>
<br>
<h3>Disadvantage:</h3>
<ul>
<li>Requires future knowledge of the program.</li>
<li>Time-consuming.</li>
</ul>
</section>
<hr>
</section>
<footer id="last">
<h2>Virtual project created by:</h2>
<p>Kashyap Barot(19BIT059) | Aditya Bhatt(19BIT007) | Abhi Patel(19BIT003)</p>
<p>Darshit(19BIT023) | Dax(19BIT024) | Devdutt(19BIT027)</p>
</footer>
</body>
</html>