Sunteți pe pagina 1din 4

Adaptive Standard Deviation Based Disk

Scheduling Algorithm
Shreyank N Gowda
Department of Computer Science And Engineering, R.V.College Of Engineering, Bangalore,
Karnataka, India
kini5gowda@gmail.com

AbstractHard drives are one of the slowest parts of the


computer. A computer deals with multiple requests over a period
of time. These multiple requests results in a list where the request
line builds up. For efficiency purposes all these requests are
aggregated together. The technique that the computer uses to
decide which request has to be satisfied first is determined by the
disk scheduling algorithms. Presently there are some standard
algorithms that are used for Disk scheduling namely First Come
First Serve (FCFS), Shortest Job First (SJF), Elevator (SCAN),
Circular Scan (C-SCAN), Look and C-Look. This paper provides
an alternative to the above mentioned algorithms by using the
Standard deviation of the values given. First an array is taken and
stores the absolute difference of the Standard deviation value with
each individual value. Next another array is taken and this stores
the absolute difference of the current position of the head and the
first array. The head moves to the position where the second array
has minimum value. Then a new standard deviation value is
calculated for the remaining values and the algorithm is repeated
till complete execution occurs.

already in existence[1]. The judgment over how good an


algorithm is can be decided by the total number of times the
head has to move to service all requests.
Following are the most popular algorithms in existence, we
will illustrate them with a request queue (0-199) with the
head pointer initially at 53. The following is the set of
requests: 98, 183, 37, 122, 14, 124, 65, 67.
1.

First Come First Serve (FCFS) Algorithm:


Requests are execute on a first come first serve basis
i.e the first job to arrive is executed, regardless of
the seek time or execution time for any other
process. There will be no reordering of the work
queue in this method[2] and since every method is
serviced there will be no starvation. This is easy to
understand. However the seek time is much higher
and hence this algorithm is seldom practiced in the
real world. An example can be seen in Fig. 1.

Index TermsDisk Scheduling, FCFS, Shortest Job First,


Standard Deviation, SCAN, LOOK

I. INTRODUCTION
One of the most important functions of the Operating System
is using the hardware present in an utmost efficient manner.
In terms for the disk drives, this means having a fast access
time and disk bandwidth. Access time is nothing but the time
needed for access and the bandwidth of the disk refers to the
rate of data transfer. Disk bandwidth is the total number of
bytes transferred, divided by the total time between the first
request for service and the completion of the last transfer.
Access time has two major components:
1.

Seek time: it is the time for the disk are to move the
heads to the cylinder containing the desired sector.

2.

Rotational latency: it is the additional time waiting


for the disk to rotate the desired sector to the disk
head.

Fig. 1. Example FCFS Algorithm


Total number of moves made by head is 421.
2.
The main objective of a disk scheduling algorithm is to
ensure that minimum seek time is required to execute all the
I/O requests that have been placed.
II. BACKGROUND
Before demonstrating the algorithm and it's effectiveness it is
important to recollect the major disk scheduling algorithms

Shortest Seek Time First (SSTF) Algorithm: In


this the shortest seek time from the current position
is calculated and the header moves to that position.
The least movement of the disk arm from its current
position is calculated regardless of direction. It
reduces the total seek time in comparison to FCFS.
It may however lead to starvation[3] in some cases
and also switching directions slows things down. In
fig 2 we can see the movement of the header and it
can be calculated that the total time needed for SSTF

is 273 cylinders which is much lesser than that of


FCFS.

So although this algorithm provides a more uniform


wait time, it drastically increases the seek time and
hence this algorithm is not generally preferred.

Fig. 2. Example for SSTF


3.

SCAN Algorithm: The disk arm starts at one end of


the disk, and moves toward the other end, servicing
requests until it gets to the other end of the disk,
where the head movement is reversed and servicing
continues. This is sometimes called the elevator
algorithm[4]. It reduces the variance in comparison
with SSTF. Below is an illustration of it. The total
moves made to service all requests equals 287.

Fig 4. Example for C-SCAN


5. Circular-LOOK Algorithm: It is a version of C-SCAN
algorithm. The main enhancement is that the arm only goes as
far as the last request in each direction, then reverses
direction immediately, without first going all the way to the
end of the disk[6]. This significantly reduces the seek time as
can be seen in fig. 5. The moves made now equals 297.

Fig. 3. Example for SCAN


Fig 5. Example for C-LOOK
4.

Circular-SCAN Algorithm: Popularly called as


the C-Scan algorithm but it provides a more uniform
wait time than SCAN. The head moves from one
end of the disk to the other. servicing requests as it
goes. When it reaches the other end, however, it
immediately returns to the beginning of the disk,
without servicing any requests on the return trip[5].
It treats the cylinders as a circular list that wraps
around from the last cylinder to the first one.
As can be seen from the illustration the seek time is
now increased to 366.

6. LOOK Algorithm: This algorithm bears a lot of similarity


with the SCAN algorithm. The main difference and
enhancements is that the arm only goes as far as the last
request in each direction, then reverses direction
immediately, without first going all the way to the end of the
disk. This significantly reduces the seek time[7] as can be
seen in fig. 6. When the SCAN algorithm was initially made
use of the total moves was 287. With the use of the LOOK
algorithm this value has now been reduced to 241. Which is a
vast difference and also most importantly an enhancement.

Fig. 6. Example for LOOK


III. PROPOSED ALGORITHM
Before looking at the algorithm let us recollect some
important statistical terms. Let's assume the 'n' requests
placed are a sequence of 'n' numbers to derive it's statistical
significance. The key to the algorithm is determining the
standard deviation of the 'n' numbers. Standard deviation is a
quantity expressing by how much the members of a group
differ from the mean value for the group. The mean of the
group is the average of all the terms of the group.
In terms of the mathematical aspect the following depict the
formulae for mean and Standard Deviation.
Fig. 6. Flow Chart of algorithm
Sample Mean:

Standard Deviation:
Where x means the sum of the 'n' terms.
Now that we know the formulae let us proceed to the working
of the algorithm. We will be having the head pointer as a
variable pointing towards something. We will be having 3
temporary arrays A[ ] ,B[ ] and C[ ].
Step 1: Store all the 'n' elements into A[ ]
Step 2: Do while n is not equal to 0
Calculate std_dev, the standard deviation of all terms
A[ ]
Create B[ ] and store in it the absolute difference of all
terms in A[ ] with std_dev
Create C[ ] and in it store the difference in
corresponding elements of B[ ] and head
Find minimum value in C[ ], store position in pos and
move head to pos. Remove from A[ ] all elements
between head and A[pos]. Simultaneously remove
corresponding elements from B and C.
Step 3: Delete A,B and C.
Step 4: Stop
So as the head moves to a new point all the requests in
between are serviced. This helps reducing the amount of
moves that have to be made by the head later on.
The work flow is as shown in fig. 6.

Working is as follows. Let us consider the same input used


for above examples. The sequence is 23, 89, 132, 42, 187
starting with head at 100. The mean for this data when
calculated comes out to be 94.6. Let us now calculate the
Standard Deviation. It is found out to be, 66.82, on rounding
to simplify calculation let's set Std_Dev to 69.
The array A[ ] contains the sequence. B[ ] will contain the
difference of corresponding elements in A with Std_Dev. So
now B[ ] = 46,20,63,27,118.
Next we calculate C[ ] as absolute difference of B[ ] with
head value. Head = 100, hence C[ ] =54,80,37,73,18.
Now we calculate the minimum which is 18, pos = 4.
Therefore head = A[pos] = 187. While moving to 187 from
100, 132 is also serviced. Seek is equal to 87.
Now A[ ]=23,89,42. 'n' = 3, still not zero. Calculating new
Std_Dev we get 33.97, rounding to 34.
So B[ ]=11,55,8. Finding C we get, C[ ]=176,132,169. The
minimum being 132 which corresponds to 89 in A[ ].
Therefore Head moves to 89. This leads to a seek of 185.
Now A[ ]=23,42. So we first go to 42 and then 23. This gives
a total seek time of 251.
The illustration can be seen in fig. 7. The total seek time is
only bettered by the LOOK algorithm in this case. When you
compare the results with the FCFS gives a total seek of 421,
whereas SSTF, the most used algorithm gives a total seek
time of 273, SCAN gives 287, C-SCAN gives 366, C-LOOK
gives 296. The only algorithm giving a better result is the
LOOK algorithm for this case. Hence the proposed
algorithm could be used as an alternative.

Let us now consider the average for all 3 sequences since all
the 3 gave us different best algorithms.
Table IV. Overall Comparison
Name of Algorithm
FCFS
SSTF
SCAN
C-SCAN
C-LOOK
LOOK
Proposed Algorithm

Seek Time Average


540.67
279.67
283.33
373.67
316.33
251.33
250.67

V. CONCLUSION
Fig. 7. Example for algorithm
IV. EXPERIMENTAL ANALYSIS
Following are example sequences and seek time needed for
all algorithms to perform a comparative study.
1) Sequence: 23, 89, 132, 42, 187 starting with head at 100.
Table I. Comparison for sequence 1
Name of Algorithm
FCFS
SSTF
SCAN
C-SCAN
C-LOOK
LOOK
Proposed Algorithm

Seek Time
421
273
287
366
296
241
251

2) Sequence: 98, 183, 37, 122, 14, 124, 65, 67 starting with
head at 100.

As can be seen the proposed algorithm performs better than


the most commonly used algorithm SSTF. However there is
one big disadvantage of using SSTF and that is that it could
cause starvation. The proposed algorithm does not suffer
from starvation.
The acknowledged most efficient algorithm is the LOOK
algorithm and it can be seen on average that the proposed
algorithm performs better than LOOK as well. Hence it can
be said that the proposed algorithm performs better than other
algorithms and hence should be used for future purposes.
ACKNOWLEDGEMENT
I would like to thank the Head Of Department of the
Computer Science Department Dr. Shoba G for her
invaluable support and guidance. I would also like to thank
my friends for their valuable inputs towards this idea. Last
but not the least I would like to thank my parents and brother
who have stood as an emotional boulder and supported me
through everything.
REFERENCES

Table II. Comparison for sequence 2


Name of Algorithm
FCFS
SSTF
SCAN
C-SCAN
C-LOOK
LOOK
Proposed Algorithm

Seek Time
597
307
283
376
328
255
252

3) Sequence: 95, 180, 34, 119, 11, 123, 62, 64 starting with
head at 100.
Table III. Comparison for sequence 3
Name of Algorithm
FCFS
SSTF
SCAN
C-SCAN
C-LOOK
LOOK
Proposed Algorithm

Seek Time
604
259
280
379
325
258
249

[1] John Ryan Celis , Dennis Gonzales , Erwinaldgeriko Lagda


and Larry Rutaquio Jr., "A Comprehensive Review for Disk
Scheduling Algorithms", IJCSI International Journal of
Computer Science Issues, Vol. 11, Issue 1, No 1, January 2014
pp 74-79
[2] Manish, K. M., An Improved First Come First Serve(IFCFS)
Disk Scheduling Algorithm, International Journal Of
Computer Applications, Volume 47 No.13, June 2012, pp.
20-24
[3] Margo Seltzer, Peter Chen, John Ousterhout, Disk Scheduling
Revisited, USENIX 90, pp. 313-324
[4] A. L. N. Reddy, Jim Wyllie and K. B. R. Wijayaratne, Disk
Scheduling in a Multimedia I/O System ACM Transactions
on
Multimedia
Computing,
Communications
and
Applications Vol. 1, No. 1, Feb 2005, pp. 37-59
[5] Abbott, R. K., & Garcia-Molina, H. (1990). Scheduling I/O
requests with deadlines: A performance evaluation.
In Proceedings, 11th real-time systems symposium, 1990 (pp.
113124).
[6] Rahmani, H., Arshad, S., & Moghaddam, M. E. (2009). A disk
scheduling algorithm based on ant colony optimization.
In ISCA PDCCS (3742). Louisville, KY.
[7] A. Silberschatz, P. B. Galvin, and G. Gagne, Operating
System Concepts, 7th Edn., John Wiley and Sons Inc,
2005,ISBN 0-471- 69466-5.

S-ar putea să vă placă și