View
80
Download
2
Category
Preview:
Citation preview
DISK SCHEDULING& VARIOUS SCHEDULING ALGORITHMS
Course Title: PRINCIPLES OF OPERATING SYSTEMS
Course No. CSE213
Submitted by: Submitted to:
Rakesh soni Mrs. Sameep kaur
N1802 B30
CSE/5th semester
Acknowledgement
I would like to thank many peoples, but can only name a few here. First of all I would like to thanks my Teacher Mrs. Sameep kaur for guiding me, without which I would not have come to know about such wonderful field.
Then I would like to thanks all the people in Technologies department, faculty members. And with them I would also like to thanks the Lovely Professional University for providing with this kind of unique training were the student are given to work on real time projects.
I would like to thanks my friends Mr. kamalpreet cheema, Mr.Arshpreet singh saini AND Mr.Gaurav Sharma who have been with me in my hardships. All this is only possible due to my parent. So I am grateful to them for providing me with whenever and whatever was needed and for their moral support.
INDEX
Sr.no Topic page.no
1. OPERATING SYSYTEM 1-2
2. NEED OF OPERATING SYSTEM 2
3. DISK STRUCTURE 3-5
4. DISK SCHEDULING 5-6
5. TYPES OF SCHEDULING 6-12
5.1) FIFO: fair, but near random scheduling 7-8
5.2) SSTF: possible starvation 8-9
5.3) SCAN: favor requests for tracks near the ends 9-10
5.4) C-SCAN 10-11
5.5) LOOK 11-12
6. SELECTION OF SCHEDULING ALGO 12-13
7. REAL TIME DISK SCHEDULING 13
8. FUTURE SCOPE 13-14
9. REFRENCES
1. Operating system
Operating system is a program that manages the computer hardware. It also provides a
basis for application program and acts as an intermediary between the computer user
and the computer hardware. One of the responsibilities of the operating system is to use
the hardware efficiency. For the disk drives, meeting this responsibility entails having
fast access time and large disk bandwidth. The access time has two major
components .The seek time is the time for the disk arm to move the heads to the
cylinder containing the desired sector. The rotational latency is additional time for the
disk to rotate the desired sector to the disk head. The disk bandwidth is the total number
of bytes transferred, divided by the total time between the first request for service and
completion of the last transfer. We can improve both the access time and the bandwidth
by scheduling the servicing of disk I/O requests in a good order.
At the simplest level, an operating system does two things:
1. It manages the hardware and software resources of the system. In a desktop
computer, these resources include such things as the processor, memory, disk space,
etc. (On a cell phone, they include the keypad, the screen, the address book, the phone
dialer, the battery and the network connection.)
2. It provides a stable, consistent way for applications to deal with the hardware
without having to know all the details of the hardware.
The first task, managing the hardware and software resources, is very important, as
various programs and input methods compete for the attention of the central processing
unit (CPU) and demand memory, storage and input/output (I/O) bandwidth for their own
purposes. In this capacity, the operating system plays the role of the good parent,
making sure that each application gets the necessary resources while playing nicely
with all the other applications, as well as husbanding the limited capacity of the system
to the greatest good of all the users and applications.
The second task, providing a consistent application interface, is especially important if
there is to be more than one of a particular type of computer using the operating
system, or if the hardware making up the computer is ever open to change. A
consistent application program interface (API) allows a software developer to write an
application on one computer and have a high level of confidence that it will run on
another computer of the same type, even if the amount of memory or the quantity of
storage is different on the two machines.
Even if a particular computer is unique, an operating system can ensure that
applications continue to run when hardware upgrades and updates occur. This is
because the operating system and not the application is charged with managing the
hardware and the distribution of its resources. One of the challenges facing developers
is keeping their operating systems flexible enough to run hardware from the thousands
of vendors manufacturing computer equipment. Today's systems can accommodate
thousands of different printers, disk drives and special peripherals in any possible
combination.
2. Need of operating system
In earlier day’s user had to design the application according to the internal structure of
the hardware. Operating System was needed to enable the user to design the
application without concerning the details of the computer’s internal structure. In general
the boundary between the hardware & software is transparent to the user. There are the
several uses of the operating system and some as follow :
Providing security to users program.
Easy interaction between the human & computer.
Starting computer operation automatically when power in turned on.
Loading & scheduling users program.
Controlling input & output.
Controlling program execution.
Managing use of main memory.
3. DISK STRUCTURE
The Hard Disk is a bigger type of a CD-Rom with the same format of file Storage,
Tracks, Cylinders and Sectors. The Hard Disk Drive is originally of RAW format when its
a fresh copy. The data is recorded on different tracks which are concentric circles which
are placed on the surface of the platter and they are like a chain of rings. These hard
disks have thousands of tracks which are on the platters and while the hard disk’s
moving head moves over the inner to the outer part of the disk the data is accessed.
Each track can hold thousands of bytes of data in sectors which are a part of tracks.
Hard Disk Drive Structure
A disk is accessed as an array: sector 0 is the first sector of the top track of
the outmost cylinder. The next sectors of the same track are then ordered.
Then, sectors from the next track are ordered. After all the sectors of all the
tracks are ordered, we move to the next cylinder. The innermost is the last
cylinder.
Magnetic disks provide bulk of secondary storage of modern computers.the following
terms are used to explained the working curiosity of disk.
– Transfer rate is rate at which data flow between drive and computer
– Positioning time (random-access time) is time to move disk arm to desired cylinder
(seek time) and time for desired sector to rotate under the disk head (rotational latency)
– Head crash results from disk head making contact with the disk surface
Magnetic disk strucure
Disk drives are addressed as large 1-dimensional arrays of logical
blocks, where the logical block is the smallest unit of transfer.
The 1-dimensional array of logical blocks is mapped into the sectors
of the disk sequentially.
1. Sector 0 is the first sector of the first track on the outermost
cylinder.
2. Mapping proceeds in order through that track, then the rest of
the tracks in that cylinder, and then through the rest of the cylinders from
outermost to innermost.
4. DISK SCHEDULING
When a process wants to do disk I/O, it makes a call to the operating system. Since the
operation may take some time, the process is put into a blocked state, and the I/O
request is sent to a part of the OS called a device driver. If the disk is idle, the operation
can be started right away, but if the disk is busy servicing another request, it must be
added to a queue of requests and wait its turn. Thus the total delay seen by the process
has several components:
The overhead of getting into and out of the OS, and the time the OS spends
fiddling with queues, etc.
The queuing time spent waiting for the disk to become available.
The latency spent waiting for the disk to get the right track and sector.
The transfer time spent actually reading or writing the data.
The operating system is responsible for using hardware efficiently for the disk drives,
this means having a fast access time and disk bandwidth
Access time has two major components
1. Seek time is the time for the disk are to move the heads to the
cylinder containing the desired sector.
2. Rotational latency is the additional time waiting for the disk to rotate
the desired sector to the disk head.
Minimize seek time
Seek time » seek distance
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.
5. Types of scheduling
The processes running on a machine may have multiple outstanding requests for data
from the disk. In what order should requests be served and by which algo, Although It is
mentioned that in a “queue” of requests, there is no reason why the requests have to be
satisfied first-come first-served. In fact, that is a very bad way to schedule disk requests.
Since requests from different processes may be scattered all over the disk, satisfying
them in the order they arrive would entail an awful lot of jumping around on the disk,
resulting in excessive rotational latency and seek time -- both for individual requests and
for the system as a whole. Fortunately, better algorithms are not hard to devise , types
of disk scheduling algos and their policies are as follow:
FIFO: fair, but near random scheduling
SSTF: possible starvation
SCAN: favor requests for tracks near the ends
C-SCAN
LOOK
Several algorithms exist to schedule the servicing of disk I/O requests and the following
example or query of illustrating the request according to the scheduling algos:
Query: Illustrate these with a request queue (0-199)
98, 183, 37, 122, 14, 124, 65, 67
5.1 First-Come-First-Served (FCFS)
FIFO is an acronym for First In, First Out, an abstraction in ways of organizing and
manipulation of data relative to time and prioritization. This expression describes the
principle of a queue processing technique or servicing conflicting demands by ordering
process by first-come, first-served (FCFS) behaviour: what comes in first is handled
first, what comes in next waits until the first is finished, etc. This is how nachos works
right now. As processes arrive, they queue up for the disk and get their requests served
in order. In current version of nachos, queueing happens at the mutex lock .
Drawback:- May have long swings from one part of disk to another. It makes sense to
service outstanding requests from adjacent parts of disk sequentially.
Answer of query in FCFS and example of FCFS
5.2 SSTF(Shortest Service Time First)
In this the Disk scheduler looks at all outstanding disk requests, and services the one
closest to where the disk head currently is. Sort of like Shortest-Job-First task
scheduling. It Selects the request with the minimum seek time from the current head
position. SSTF scheduling is a form of SJF scheduling; may cause starvation of some
requests. It select the disk I/O request that requires the least movement of the disk arm
from its current position. it always choose the minimum seek time and new requests
may be chosen before an existing request. The shortest seek first algorithm has the
direct benefit of simplicity and is clearly advantageous in comparison to the FIFO
method, in that overall arm movement is reduced, resulting in lower average response
time.However, since the buffer is always getting new requests, these can skew the
service time of requests that may be farthest away from the disk head's current location,
if the new requests are all close to the current location; in fact, starvation may result,
with the faraway requests never being able to make progress.
Drawback:- in this , Starvation. A request for a remote part of the disk may
never get serviced.
Example of SSTF with solution of query
5.3 SCAN
The elevator algorithm (also SCAN) is a disk scheduling algorithm to determine the
motion of the disk's arm and head in servicing read and write requests.
This algorithm is named after the behavior of a building elevator, where the elevator
continues to travel in its current direction (up or down) until empty, stopping only to let
individuals off or to pick up new individuals heading in the same direction.
From an implementation perspective, the drive maintains a buffer of pending read/write
requests, along with the associated cylinder number of the request. Lower cylinder
numbers indicate that the cylinder is closest to the spindle, and higher numbers indicate
the cylinder is further away. When a new request arrives while the drive is idle, the initial
arm/head movement will be in the direction of the cylinder where the data is stored,
either in or out. As additional requests arrive, requests are serviced only in the current
direction of arm movement until the arm reaches the edge of the disk. When this
happens, the direction of the arm reverses, and the requests that were remaining in the
opposite direction are serviced, and so on.It reduces the variant as compare to SSTF.
Example and answer of query scheduling in SCAN :
5.4 C-SCAN (CIRCULAR SCAN)
Both SCAN and C-SCAN behave in the same manner until they reach the last track
queued. For the sake of this example let us assume that the SCAN algorithm is
currently going from a lower track number to a higher track number (like the C-SCAN
is doing). For both methods, one takes the difference in magnitude (i.e. absolute
value) between the next track request and the current track. It Provides a more
uniform wait time than SCAN. The head moves from one end of the disk to the other.
It 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. It Treats the cylinders as a circular list that wraps around from the last
cylinder to the first one.
Example with query solution sequence :
5.5 LOOK
LOOK is a disk scheduling algorithm used to determine the order in which new disk
read and write requests are processed. LOOK is similar to SCAN in that the heads
sweep across the disk surface in both directions performing reads and writes. However,
unlike SCAN, which visits the innermost and outermost cylinders each sweep, LOOK
will change directions when it has reached the last request in the current direction . One
variant of LOOK is C-LOOK, which fulfills requests in one direction only. That is, C-
LOOK starts at the innermost cylinder requested and moves outward fulfilling requests
until it reaches the last request. Then it moves back to the innermost request again.
LOOK has slightly better average seek times than SCAN. C-LOOK has a slight lower
variance in seek time than LOOK since the worst case seek time is nearly cut in half.
Examlpe and answer of query sequence
6. SELECTION OF SCHEDULING ALGO
Disk scheduling is the problem of deciding which particular request for data by
your computer from yourhard drive (or other storage medium) should be serviced first.
In other words, when several programs are trying to pull data from your hard drive at
once, which one gets the data first? It is a fundamental problem in operating
system scheduling in terms of minimizing the wait for the user when he or she simply
wants to do some things that require information from the hard drive.
SSTF is common and has a natural appeal
SCAN and C-SCAN perform better for systems that place a heavy load on the
disk.
Performance depends on the number and types of requests.
Requests for disk service can be influenced by the file-allocation method.
The disk-scheduling algorithm should be written as a separate module of the
operating system, allowing it to be replaced with a different algorithm if
necessary.
Either SSTF or LOOK is a reasonable choice for the default algorithm.
7. Real time disk scheduling
Previous real-time disk scheduling algorithms assume that each disk request incurs a
disk mechanical operation and only consider how to move the disk head under real-time
constraints. However, with the increased capacity of on-disk cache, modern disk drives
read-ahead data aggressively. Thus, the on-disk cache may service lots of requests
without incurring physical disk access. By exploring the design methodology of on-disk
cache, in this paper, we propose CARDS: a cache-aware real-time disk scheduling
algorithm that takes the on-disk cache into consideration during scheduling. Therefore,
the scheduling algorithm can help to minimize the cache miss ratio. Besides, the service
timing estimation is more accurate in schedulability analysis since the cache effect is
considered. A simulation-based evaluation shows CARDS to be highly successful as
compared to the classical real-time disk scheduling algorithms. For example, under
sequential workload with 10 sequential streams, the data throughput of CARDS is 1.1
times of DM-SCAN.
8. FUTURE SCOPE
Disk scheduling is an operating system process to service disk requests. It has an
important role in QOS guarantee of soft real-time environments such as video-on-
demand and multimedia servers. Since now, some disk scheduling algorithms have
been proposed to schedule disk requests in an optimized manner. Most of these
methods try to minimize makespan by decreasing the number of disk head seeks as
one of the slowest operations in modern computers and crucial for system performance
because it usually takes some milli-seconds. In this paper, we propose a new disk
scheduling method based on genetic algorithm that considers makespan and number of
missed tasks simultaneously. In the proposed method, a new coding scheme is
presented which employs simple GA procedures such as crossover and mutation and a
penalty function in fitness. To get the best performance of the proposed method, its
parameters such as number of chromosomes in initial population, mutation, and
crossover probabilities, etc have been adjusted by applying it on some sample
problems. The algorithm has been tested on several problems and its results were
compared with well-known related methods. Experimental results showed that the
proposed method worked very well and excelled most related works in terms of miss
ratio and average seeks
Proportional-share algorithms are designed to allocate an available resource,
such as network, processor, or disk, for a set of competing applications in proportion to
the resource weight allotted to each. While a myriad of proportional-share algorithms
were made for network and processor resources, little research work has been
conducted on disk resources, which exhibit non-linear performance characteristics
attributed to disk head movements. This paper proposes a new proportional-share disk-
scheduling algorithm, which accounts for overhead caused by disk head movements
and QoS guarantees in an integrated manner. Performance evaluations via simulations
reveal that the proposed algorithm improves I/O throughput by 11–19% with only 1–2%
QoS deterioration.
References
1. http://www.springerlink.com/content/tpw5bumjbjdkt6w7/
2. http://www.slideshare.net/J.T.A.JONES/disk-scheduling
3. http://www.ecs.umass.edu/ece/koren/architecture/Disk/help.htm
4. http://en.wikipedia.org/wiki/LOOK_algorithm
5. http://portal.acm.org/citation.cfm?id=98949.99156
6. http://everything2.com/title/disk+scheduling
Recommended