-
Notifications
You must be signed in to change notification settings - Fork 0
/
lru.html
110 lines (75 loc) · 3.87 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
105
106
107
108
109
110
<!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">
<h2 class="subHead00">Least Recently Used (LRU):</h2>
<br>
<p class="fifop">LRU page replacement links with all pages the time of that page’s last use. At the point when a page must be replaced with LRU page replacement picks the page that has not been utilized for the longest time frame. We can think about this technique as the optimal page-replacement algorithm glancing in reverse in time, as opposed to advance.</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>
<a href="lru01.html">
<button class="btnRun">Simulation</button>
</a>
<br>
<a href="LRU_Graph.html">
<button class="btnRun">Graph</button>
</a>
<!-- <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 reference string 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2 with 4 page frames.Find number of page faults. </p>
<img src="lrusss.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 least recently used —>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>It is amenable to full statistical examination.</li>
<li>This algorithm is very efficient.</li>
<li>It never suffers from Belady’s anomaly.</li>
</ul>
<br>
<h3>Disadvantage:</h3>
<ul>
<li>Its execution is bit complicated.</li>
<li>Its execution may need substantial hardware assistance.</li>
</ul>
</section>
<hr>
</section>
<footer id="last">
<h2>Virtual project created by:</h2>
<p>Shivam Pansuriya(20BCP280)</p>
</footer>
</body>
</html>