-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsstf-info.html
271 lines (228 loc) · 8.85 KB
/
sstf-info.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>SSTF - Disk Scheduling Algorithms</title>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css"
integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<!-- Font Awesome 5 -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css"
integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<!-- Custom style -->
<link rel="stylesheet" type="text/css" href="css/style.css">
<!-- Favicon -->
<link rel="icon" href="images/icon.png">
</head>
<body>
<!-- ============================================
===================== HEADER =================== -->
<header class="shadow-md">
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-dark">
<div class="container">
<!-- Logo -->
<a class="navbar-brand mr-5" href="index.html"><img src="images/heading.png" href="index.html" alt=""
width="400px"></a>
<!-- menu -->
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<!-- ID = DATA TARGET FOR COLLAPSE BUTTON-->
<ul class="navbar-nav ml-auto">
<!-- margin left auto: ml-auto: does auto margin to left -->
<li class="nav-item">
<a class="nav-link" href="index.html">Home</a>
</li>
<!-- dropdown menu -->
<li class="nav-item dropdown active">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
style="cursor: pointer;">Simulate</a>
<div class="dropdown-menu" id="custom-dropdown-menu">
<a class="dropdown-item" href="FCFS/fcfs.html">FCFS</a>
<a class="dropdown-item" href="SSTF/sstf.html">SSTF</a>
<a class="dropdown-item" href="SCAN/scan.html">SCAN</a>
<a class="dropdown-item" href="CSCAN/cscan.html">C-SCAN</a>
<a class="dropdown-item" href="LOOK/look.html">LOOK</a>
<a class="dropdown-item" href="CLOOK/clook.html">C-LOOK</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="about.html">About Us</a>
</li>
</ul>
</div>
<!-- /menu -->
</div>
</nav>
<!-- /Navbar -->
</header>
<!-- ============================================
===================== MAIN =================== -->
<div class="py-3 mb-3">
<div class="container">
<h1>SSTF: Shortest Seek Time First</h1>
</br>
<p>In SSTF (Shortest Seek Time First) disk scheduling algorithm we have to calculate the seek time first. <br>
That is, before serving any request, seek time is calculated for each request and then the request with least
seek time will be served. <br> If we define in terms of hardware then, the request which are closure to disk
head position will be served first. SSTF also aims to overcome some of the limitations in FCFS.
</p>
</br>
<h3> Advantages:</h3>
<ul>
<li>
Better Performance compared to FCFS.
</li>
<li>
Response time and waiting time is less.
</li>
<li>
In FCFS, fair chance given to each request.
</li>
<li>
Increased throughput, helps in Batch Processing System.
(Throughput is the amount of completed work against time consumed)
</li>
</ul>
</br>
<h3> Disadvantages:</h3>
<ul>
<li>
SSTF can be time consuming due to frequent switching.
</li>
<li>
There might be chance of Starvation since it is designed to serve the closer requests first compared to the
farther ones.
</li>
<li>
Lack of Predictability.
</li>
<li>
There are chances of Overhead (Indirect computation time) since seek time is calculated for each request in
advance.
</li>
</ul>
<h3> Example: </h3>
<ul>
<li>
Consider a disk that contains 200 tracks (0-199). The request queue includes track number 176, 79, 34, 60, 92,
11, 41, 114 respectively. <br>The current position of the read/write head is 50.
</li>
<li>
Before solving the above example, we have to know about the seek time. <br>
Seek time = Destination - Source or Source - Destination
</li>
<li>
As mentioned in the following example, disk contains 200 tracks. So, we will take a track line between 0 to
199.
</li>
<li>
The current position of the read/write head is 50. So, we start at 50.
</li>
<br>
<img src="images/sstf-eg-graph.png" alt="graph of example">
<br> <br>
<li>
We can see in the following figure that the current or initial position of read/write head is 50. Now for
further movement of read/write head, we calculate the seek time.
</li>
<li>
Total Number of cylinders moved by the head <br>
= (50-41)+(41-34)+(34-11)+(60-11)+(79-60)+(92-79)+(114-92)+(176-114) <br>
= 204
</li>
</ul>
<h3>Steps to Implement Algorithm:</h3>
<ol>
<li>
Let Request array represents an array storing indexes of tracks that have been requested. ‘head’ is the
position of disk head.
</li>
<li>
Find the positive distance of all tracks in the request array from head.
</li>
<li>
Find a track from requested array which has not been accessed/serviced yet and has minimum distance from head.
</li>
<li>
Increment the total seek count with this distance.
</li>
<li>
Currently serviced track position now becomes the new head position.
</li>
<li>
Go to step 2 until all tracks in request array have not been serviced.
</li>
</ol>
<p>
<b> Time Complexity: O ( N<sup>2</sup> )   Auxiliary Space: O ( N ) </b>
</p>
<a class="simulate" href="SSTF/sstf.html">Simulate</a>
</div>
<!-- /container -->
</div>
<!-- ============================================
===================== FOOTER =================== -->
<div class="footer">
<div class="container">
<!-- Logo - About - Contact -->
<div class="row py-3 text-light">
<!-- Logo -->
<div class="col-lg-3">
<a href="index.html"><img src="images/footer.png" class="footer-logo img-fluid" width="200" draggable="false"
alt="Logo">
</a>
</div>
<!-- About -->
<div class="col-lg">
<h3>About</h3>
<p>
This project was done by Team 2 Group 5 as a part of Operating
Systems Lab.
</p>
</div>
<div class="col-lg-2">
<h3>Quick Links</h3>
<div class="footer-links">
<a href="fcfs-info.html">FCFS</a>
<a href="sstf-info.html">SSTF</a>
<a href="scan-info.html">SCAN</a>
<a href="cscan-info.html">C-SCAN</a>
<a href="look-info.html">LOOK</a>
<a href="clook-info.html">C-LOOK</a>
</div>
</div>
<!-- /contact me -->
</div>
<!-- /Logo - About - Contact -->
</div>
<!-- /container -->
</div>
<!--/footer-->
<!-- Bootstrap core JavaScript -->
<!-- jQuery.js -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<!-- Bootstrap.min.js -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"
integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k"
crossorigin="anonymous"></script>
<!-- Navbar -->
<script src="js/bootstrap.bundle.min.js"></script>
<script type="text/javascript">
var nav = document.querySelector('nav');
window.addEventListener('scroll', function () {
if (window.pageYOffset > 20) {
nav.classList.add('navbar-scrolled', 'shadow');
} else {
nav.classList.remove('navbar-scrolled', 'shadow');
}
});
</script>
</body>
</html>