-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalgorithm2.html
More file actions
85 lines (72 loc) · 3.4 KB
/
Copy pathalgorithm2.html
File metadata and controls
85 lines (72 loc) · 3.4 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Peterson's Solution Simulator</title>
<link rel="stylesheet" href="algorithm2.css">
<link rel="stylesheet" href="animation.css">
</head>
<body>
<header>
<h1 class="logo">OPERATING SYSTEM PROJECT</h1>
<nav>
<ul class="nav-links">
<li><a href="index.html">Home</a></li>
<li><a href="read_more.html">Documentation</a></li>
<!-- <li><a href="simulators.html" target="_blank">Simulators</a></li> -->
<li class="dropdown">
<a href="simulator.html" class="dropbtn">Simulators</a>
<div class="dropdown-content">
<a href="priority_preemptive.html">Priority Preemptive</a>
<a href="fcfs_disk_scheduling.html">FCFS Disk Scheduling</a>
<a href="petersons.html">Peterson's Solution</a>
<a href="optimal_page_replacement.html">Optimal Page Replacement</a>
</div>
</li>
<li><a href="team.html">About Us</a></li>
<li><a href="contact.html">Contact Us</a></li>
</ul>
</nav>
</header>
<section class="container_docs" data-aos="zoom-in-up">
<h1>What is Peterson's Solution</h1>
<p>Peterson's solution is a software-based algorithm that prevents conflicts in concurrent programs by ensuring
mutual exclusion, progress, and bounded waiting. It uses two variables, turn and flag, to coordinate access to a
critical section. Each process checks the flag variable to see if the other process is in the critical section and
sets its own flag to indicate its interest in entering. The process then checks the turn variable to see if it's
its turn to enter. If not, it enters a waiting loop until signaled to continue. Peterson's solution is easy to
implement and requires only basic hardware support, making it an attractive choice for many applications. However,
it may not be suitable for complex or high-performance systems.<br>
</p>
<h4>
<li>Need for Peterson's Solution</li>
</h4>
<p>In operating systems, there may be a need for more than one process. In shared memory, if more than one process
is accessing a variable, then the value of that variable is determined by the last process to modify it. This may
result in losing important information written during the first process. The location where these processes occur
is called the critical section. This problem is called the Critical-Section problem, and one of the solutions to
this problem is the Peterson Solution. <br><br></p>
<h4>
<li>Disadvantages of Peterson's Solution</li>
</h4>
<p>1. The process may take a long time to wait for the other processes to come out of the critical region. It is termed as Busy waiting. <br><br>
2. This algorithm may not work on systems having multiple CPUs. <br><br>
3. The Peterson solution is restricted to only two processes at a time. <br><br>
</p>
<br>
</section>
<div class="prompt">
<button id="prompt-button">
<img src="quiz.jpg" alt="Chatbot Icon">
</button>
</div>
<script>
const promptButton = document.getElementById("prompt-button");
promptButton.addEventListener("click", function() {
window.location.href = "quiz.html";
});
</script>
</body>
</html>