0% found this document useful (1 vote)
2K views13 pages

Disk Structure and Scheduling in OS

The document provides an overview of hard disk structure, detailing how data is stored in tracks and sectors, and explaining key performance parameters such as seek time and data transfer rate. It also discusses various disk scheduling algorithms, including First-Come-First-Serve, Shortest-Seek-Time-First, SCAN, C-SCAN, LOOK, and C-LOOK, emphasizing their roles in optimizing disk access time. The document highlights the importance of these algorithms in improving overall system performance in operating systems.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
2K views13 pages

Disk Structure and Scheduling in OS

The document provides an overview of hard disk structure, detailing how data is stored in tracks and sectors, and explaining key performance parameters such as seek time and data transfer rate. It also discusses various disk scheduling algorithms, including First-Come-First-Serve, Shortest-Seek-Time-First, SCAN, C-SCAN, LOOK, and C-LOOK, emphasizing their roles in optimizing disk access time. The document highlights the importance of these algorithms in improving overall system performance in operating systems.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Disk Structure in OS

What is Hard Disk ?


Hard Disk is a secondary storage device. It is a type of electro
mechanical device. A hard disk stores and retrieves digital data
using magnetic storage.

How Data is Stored in a Hard Disk ?


● Data is stored in Disk in form of tracks and sectors.

● Disk surface is divided into tracks.

● Track is further dived in to sectors.

● Sector is the addressable unit in disk.


Step wise description of Disk Structure is given below
● Disk surfacе is dividеd into tracks
● A rеad/writе hеad positionеd just abovе thе disk surfacе
● Information storеd by magnеtic rеcording on thе track undеr
rеad/writе hеad
● Fixеd hеad disk
● Moving hеad disk
● Dеsignеd for largе amount of storagе for Binary Tree in Data
Structure.
●Primary dеsign considеration cost, sizе, and spееd
Hardwarе for disk systеm

●Disk drivе, Dеvicе motor, Rеad/writе hеad, Associatеd logic


Disk controllеr
Role of disk controller is given below –
● Dеtеrminеs thе logical intеraction with thе computеr
● Can sеrvicе morе than onе drivе (ovеrlappеd sееks)

Cylindеr

● Thе samе numbеrеd tracks on all thе disk surfacеs


● Еach track contains bеtwееn 8 to 32 sеctors

Sеctor
● Smallеst unit of information that can bе rеad from/writtеn into
disk
● Rangе from 32 bytеs to 4096 bytеs.
● Sector is the addressable unit in hard disk.

Disk Performance Parameters


Some important parameters used to measure the performance of
hard disk are as follow
Sееk timе
● Seek Timе is time rеquirеd by rеad/writе hеad to movе to

rеquеstеd track
● Includеs thе initial startup timе and thе timе rеquirеd to
travеrsе thе tracks to bе crossеd oncе thе accеss arm is up to
spееd.

Latеncy or rotational dеlay


● Timе rеquirеd for thе rеquеstеd sеctor to comе undеr thе

rеad/writе hеad.
● Rotational delay is generally the half of the time taken in one

rotation.

Data Transfer Rate


Data transfer rate is define as the amount of data transfer in per
unit time for example 30 MB/Sec.
Data Transfer Time
Data Transfer time is the total time taken to transfer a specific
amount of data from the disk. Data Transfer time depends on the
data transfer rate of the disk.
Average Access Time
Average access time is calculated as
Average Access Time = Seek Time + Rotational Latecny +
Data Transfer Time

DISK SCHEDULING

Disk scheduling is an important process in operating systems


that determines the order in which disk access requests are
serviced.
The objective of disk scheduling is to minimize the time it takes
to access data on the disk and to minimize the time it takes to
complete a disk access request.

Disk access time is determined by two factors: seek time and


rotational latency. Seek time is the time it takes for the disk head
to move to the desired location on the disk, while rotational
latency is the time taken by the disk to rotate the desired data
sector under the disk head.

Disk scheduling algorithms are an essential component of


modern operating systems and are responsible for determining
the order in which disk access requests are serviced. The
primary goal of these algorithms is to minimize disk access time
and improve overall system performance.

First-Come-First-Serve
The First-Come-First-Served (FCFS) disk scheduling algorithm
is one of the simplest and most straightforward disk scheduling
algorithms used in modern operating systems. It operates on the
principle of servicing disk access requests in the order in which
they are received. In the FCFS algorithm, the disk head is
positioned at the first request in the queue and the request is
serviced. The disk head then moves to the next request in the
queue and services that request. This process continues until all
requests have been serviced.

Example
Suppose we have an order of disk access requests: 20 150 90 70
30 60. The disk head is â

currently located at track 50.

The total seek time = (50-20) + (150-20) + (150-90) + (90-70) +


(70-30) + (60-30) = 310

Shortest-Seek-Time-First
Shortest Seek Time First (SSTF) is a disk scheduling algorithm
used in operating systems to efficiently manage disk I/O
operations. The goal of SSTF is to minimize the total seek time
required to service all the disk access requests. In SSTF, the disk
head moves to the request with the shortest seek time from its
current position, services it, and then repeats this process until
all requests have been serviced. The algorithm prioritizes disk
access requests based on their proximity to the current position
of the disk head, ensuring that the disk head moves the shortest
possible distance to service each request.

Example
In this case, for the same order of success request, the total seek
time = (60-50) + (70-60) + (90-70) + (90-30) + (30-20) + (150-
20) = 240

SCAN
SCAN (Scanning) is a disk scheduling algorithm used in
operating systems to manage disk I/O operations. The SCAN
algorithm moves the disk head in a single direction and services
all requests until it reaches the end of the disk, and then it
reverses direction and services all the remaining requests. In
SCAN, the disk head starts at one end of the disk, moves toward
the other end, and services all requests that lie in its path. Once
the disk head reaches the other end, it reverses direction and
services all requests that it missed on the way. This continues
until all requests have been serviced.

Example
If we consider that the head direction is left in case of SCAN,
the total seek time = (50-30) + (30-20) + (20-0) + (60-0) + (60-
70) + (90-70) + (90-150) = 200

C-SCAN
The C-SCAN (Circular SCAN) algorithm operates similarly to
the SCAN algorithm, but it does not reverse direction at the end
of the disk. Instead, the disk head wraps around to the other end
of the disk and continues to service requests. This algorithm can
reduce the total distance the disk head must travel, improving
disk access time. However, this algorithm can lead to long wait
times for requests that are made near the end of the disk, as they
must wait for the disk head to wrap around to the other end of
the disk before they can be serviced. The C-SCAN algorithm is
often used in modern operating systems due to its ability to
reduce disk access time and improve overall system
performance.

Example

For C-SCAN, the total seek time = (60-50) + (70-60) + (90-70)


+ (150-90) + (199-150) + (199-0) + (20-0) + (30-20) = 378

LOOK
The LOOK algorithm is similar to the SCAN algorithm but
stops servicing requests as soon as it reaches the end of the disk.
This algorithm can reduce the total distance the disk head must
travel, improving disk access time. However, this algorithm can
lead to long wait times for requests that are made near the end of
the disk, as they must wait for the disk head to wrap around to
the other end of the disk before they can be serviced. The LOOK
algorithm is often used in modern operating systems due to its
ability to reduce disk access time and improve overall system
performance.

Example

Considering the head direction is right, in this case, the total


seek time = (60-50) + (70-60) + (90-70) + (150-90) + (150-30) +
(30-20) = 230
C-LOOK
C-LOOK is similar to the C-SCAN disk scheduling algorithm.
In this algorithm, goes only to the last request to be serviced in
front of the head in spite of the disk arm going to the end, and
then from there it goes to the other endâs last request. Thus, it
also prevents the extra delay which might occur due to
unnecessary traversal to the end of the disk.

Example
For the C-LOOK algorithm, the total seek time = (60-50) + (70-
60) + (90-70) + (150-90) + (150-20) + (30-20) = 240

Common questions

Powered by AI

C-LOOK improves upon C-SCAN by limiting disk head movement to the last request in its service direction rather than traversing to the disk's physical end. This reduces unnecessary movement, slightly enhancing efficiency and reducing the potential delay encountered by other processes .

The disk controller determines the logical interaction between the disk system and the rest of the computer. It manages disk drives, potentially servicing more than one drive at a time through overlapped seeks, thereby optimizing disk operations and performance .

Average access time is calculated by adding seek time, rotational latency, and data transfer time. Seek time is the duration needed for the read/write head to move to the track, rotational latency is the time for the desired sector to rotate under the head, and data transfer time depends on the rate at which data is transferred .

The C-SCAN algorithm optimizes performance by moving the disk head in a single direction until the end of the disk and then wrapping around to the start without servicing requests on the return path. This prevents unnecessary reversals and potential wastage of time, ensuring requests are processed efficiently, though it may increase wait times for requests near the end .

Disk scheduling determines the order of servicing disk access requests to minimize access time and enhance system performance. Efficient scheduling reduces seek time and rotational latency, thereby decreasing the total time the disk spends processing requests, which significantly boosts throughput and system responsiveness .

The primary design considerations for hard disk storage include cost, size, and speed. These factors are essential to ensure that the storage system is efficient, economical, and capable of handling large volumes of data .

The SSTF algorithm prioritizes disk access requests based on their proximity to the disk head's current position, minimizing the total seek time required by moving the shortest possible distance to service each request. This results in a reduced total seek time of 240, as shown in the example, compared to the 310 seek time of the FCFS algorithm, which manages requests in the order they arrive without regard to their location .

Tracks are concentric circles on the disk surface where data is magnetically recorded. Each track is subdivided into smaller units called sectors, which are the smallest addressable units of information on the disk, typically ranging from 32 bytes to 4096 bytes .

The SCAN algorithm moves the disk head in one direction to the end of the disk before reversing, servicing all requests along its path. In contrast, the LOOK algorithm also scans in one direction but does not go to the end of the disk if there are no further requests, thus stopping when the last request in the direction is serviced. This can reduce unnecessary travel, potentially improving access times .

Rotational latency significantly affects disk access time, as it is the duration required for the disk to rotate a sector under the read/write head. This latency typically constitutes about half of the time a complete disk rotation takes and, along with seek time, forms a critical component in the overall calculation of average access time .

You might also like