0% found this document useful (0 votes)
61 views

OS - Chapter 6 Secondary Storage Structure - Disk ManagementUpdated

Uploaded by

Shubham Gupta
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views

OS - Chapter 6 Secondary Storage Structure - Disk ManagementUpdated

Uploaded by

Shubham Gupta
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 46

Chapter 6 :

Secondary Storage Structure

•Disk Management
Overview of Mass-Storage Structure

•Secondary storage devices are those devices whose memory is


non volatile, meaning, the stored data will be intact even if the
system is turned off.
•Secondary storage is also called auxiliary storage.
•Secondary storage is less expensive when compared to primary
memory like RAMs.
•The speed of the secondary storage is also lesser than that of
primary storage.
•Hence, the data which is less frequently accessed is kept in the
secondary storage.
•A few examples are magnetic disks, magnetic tapes, etc.
Magnetic Disk Structure
Magnetic Disk Structure

•A magnetic disk contains several platters.


• Each platter is divided into circular shaped tracks.
• The length of the tracks near the centre is less than
the length of the tracks farther from the centre.
•Each track is further divided into sectors
•Tracks of the same distance from centre form a
cylinder.
• A read-write head is used to read data from a
sector of the magnetic disk.
Disk Scheduling Algorithms

•On a typical multiprogramming system, there will


usually be multiple disk access requests at any point
of time.
• So those requests must be scheduled to achieve
good efficiency.
•Disk scheduling is similar to process scheduling.
Disk Scheduling Algorithms

•FCFS
•SSTF
•SCAN
•C-SCAN
•LOOK
•C-LOOK
Criteria of Disk Scheduling Algorithms

1.Transfer time: It is the time taken to transfer the data from the
disk to the application.
2. Seek time is the time taken by the arm to move to the required
track.
3. Rotational latency is defined as the time taken by the arm to
reach the required sector in the track.
4. Disk access time: It is the total time required to access the
data. It means total time required to read/write the data from the
disk.
Disk access time= Seek time+ Rotational latency+ Transfer time
•Disk Response Time:
•Response Time is the average of time spent by a
request waiting to perform its I/O operation.
•Average Response time is the response time of the
all requests.
•Variance Response Time is measure of how
individual request are serviced with respect to
average response time.
•So the disk scheduling algorithm that gives
minimum variance response time is better.
First Come First Serve [FCFS] Disk
Scheduling Algorithms
•This algorithm performs requests in the same order
asked by the system.
•Let's take an example where the disk queue has the
following I/O requests with cylinder numbers as
follows:
•Ex: 98, 183, 37, 122, 14, 124, 65, 67
•Assume the head is initially at cylinder 56. The head
moves in the given order in the queue
i.e., 56→98→183→...→67.
First Come First Serve Disk Scheduling
Algorithms

Ex: 98, 183, 37, 122, 14, 124, 65, 67


First Come First Serve
Disk Scheduling Algorithms

Request Head Movement Total head


movements
98 56-98 42
183 98-183 85
37 183-37 146
122 37-122 85
14 122-14 108
124 14-124 110
65 124-65 59
67 65-67 2
Total Head Movement 637

Ex: 98, 183, 37, 122, 14, 124, 65, 67


Shortest Seek Time First (SSTF)
Disk Scheduling Algorithms
•Here the position which is closest to the current
head position is chosen first.
•Consider the previous example where disk queue
looks like,
EX: 98, 183, 37, 122, 14, 124, 65, 67
•Assume the head is initially at cylinder 56. The next
closest cylinder to 56 is 65, and then the next nearest
one is 67, then 37, 14, so on.
Shortest Seek Time First (SSTF)
Shortest Seek Time First (SSTF)

Head Movement Total head movements

56-65 9
65-67 2
67-37 30
37-14 23
14-98 84
98-122 24
122-124 2
124-183 59
Total Head Movement 233

Ex: 98, 183, 37, 122, 14, 124, 65, 67


SCAN Disk Scheduling Algorithms

•This algorithm is also called the elevator algorithm


because of it's behavior.
•Here, first the head moves in a direction (say
backward) and covers all the requests in the path
and reaches to 0.
•Then it moves in the opposite direction and covers
the remaining requests in the path.
Ex: Request sequence = {176, 79, 34, 60, 92, 11, 41,
114}
Initial head position = 50
Direction = left (We are moving from right to left)
SCAN Disk Scheduling Algorithms

Therefore, the total seek count is calculated as:


= (50-41)+(41-34)+(34-11) +(11-0)+(60-0)+(79-60) +(92-79)+(114-92)+(176-114) = 226
LOOK Disk Scheduling
Algorithm

•LOOK is the advanced version of SCAN disk scheduling


algorithm which gives slightly better seek time than other
algorithm.
•It “looks” ahead as if there are more tracks that are needed to
be serviced in the same direction.
• If there are no pending requests in the moving direction the
head reverses the direction and start servicing requests in the
opposite direction.
•In this algorithm the head is not allowed to move till the end
of the disk.
Look Disk Scheduling Algorithms

Ex 1: 98, 183, 37, 122, 14, 124, 65, 67

Total head movements : (56-14)+(183-14)


=211
LOOK Disk Scheduling Algorithm

EX 2 : 176, 79, 34, 60, 92, 11, 41, 114

Total seek time: (176-50)+(176-11)= 291


C-SCAN (Circular Elevator) Disk
Scheduling Algorithm

•Like SCAN (Elevator Algorithm) C-SCAN moves the head from


one end servicing all the requests to the other end.
•However, as soon as the head reaches the other end, it
immediately returns to the beginning of the disk without
servicing any requests on the return trip and starts servicing
again once reaches the beginning.
• This is also known as the “Circular Elevator Algorithm” as it
essentially treats the cylinders as a circular list that wraps
around from the final cylinder to the first one.
C-SCAN (Circular Elevator) Disk
Scheduling Algorithm

= (60-50)+(79-60)+(92-79) +(114-92)+(176-114)+(199-
176)+(199-0) +(11-0)+(34-11)+(41-34) = 389
C-LOOK Disk Scheduling Algorithm

Therefore, the total seek count = (60 – 50) + (79 – 60) + (92 – 79) +
(114 – 92) + (176 – 114) + (176 – 11) + (34 – 11) + (41 – 34) = 321
Practice Problem Ex 3
Consider a disk queue with I/O request on the following
cylinders in their arriving order:

54,97,73,128,15,44,110,34,45

The disk head is assumed to be at cylinder 23 and moving in


the direction of decreasing number of cylinders.The disk consist
of total 150

Calculate and show with diagram the disk head movement


using all disk scheduling algorithm
Practice Problem Ex 4

Consider a disk queue with I/O request on the following


cylinders in their arriving order:

6,10,12,54,97,73,128,15,44,110,34,45

The disk head is assumed to be at cylinder 23 and moving in


the direction of decreasing number of cylinders.
The disk consist of total 150 (ie. 0 to 149)

Calculate and show with diagram the disk head movement


using all disk scheduling algorithm
•Consider a disk with 200 tracks and the
queue has random requests from different
processes in the order:
•55, 58, 39, 18, 90, 160, 150, 38, 184
•Initially arm is at 100. Find the Average Seek
length using SSTF, SCAN algorithm.
•Consider a disk queue with requests for I/O
to blocks on cylinders 98, 183, 41, 122, 14,
124, 65, 67. The LOOK scheduling algorithm
is used. The head is initially at cylinder
number 53 moving towards larger cylinder
numbers on its servicing pass. The cylinders
are numbered from 0 to 199. Count total
head movement (in number of cylinders)
incurred while servicing these requests.
Illustrate about File system implementation.
Illustrate about Directory operations.
Illustrate File Attributes.

Write about Seek time and transfer time.


Write about Magnetic Disk Structure
Write about RAID levels.

Formulate FCFS Disk Scheduling algorithm with example.

Illustrate Directory and Structure of Directory.


OR
Illustrate File Access Methods.
Consider a disk with 200 tracks and the queue has random requests from different processes in the order:
55, 58, 39, 18, 90, 160, 150, 38, 184
Initially arm is at 100. Find the Average Seek length using SSTF, SCAN algorithm.

OR
Consider a disk queue with requests for I/O to blocks on cylinders 98, 183, 41, 122, 14, 124, 65, 67. The LOOK
scheduling algorithm is used. The head is initially at cylinder number 53 moving towards larger cylinder numbers on its
servicing pass. The cylinders are numbered from 0 to 199. Count total head movement (in number of cylinders)
incurred while servicing these requests.
RAID
(Redundant Arrays of Independent Disks)

•RAID or Redundant Array of Independent Disks, is


a technology to connect multiple secondary storage
devices and use them as a single storage media.

•RAID consists of an array of disks in which multiple


disks are connected together to achieve goals like
increased performance(How good is the response
time? How high is the throughput?) , data
redundancy (disk reliability?)
Key evaluation points for a RAID System

Reliability: How many disk faults can the system tolerate?

Availability: What fraction of the total session time is a


system in uptime mode, i.e. how available is the system for
actual use?

Performance: How good is the response time? How high is


the throughput (rate of processing work)? Note that
performance contains a lot of parameters and not just the
two.

Capacity: Given a set of N disks each with B blocks, how


much useful capacity is available to the user?
Different RAID levels

1. RAID-0 (Stripping)
2. RAID-1 (Mirroring)
3. RAID-4 (Block-Level Stripping with Dedicated
Parity)
4. RAID-5 (Block-Level Stripping with Distributed
Parity)
5. Nested RAID levels(1+0)
Youtub video for RAID

https://www.youtube.com/watch?v=U-
OCdTeZLac
Why data redundancy?

• Data redundancy, although taking up extra space, adds


to disk reliability.
• This means, in case of disk failure, if the same data is
also backed up onto another disk, we can retrieve the
data and go on with the operation.
• On the other hand, if the data is spread across just
multiple disks without the RAID technique, the loss of a
single disk can affect the entire data.
RAID levels:
RAID Level 0 (Stripping)
•Data is distributed across all the disk in the form of strips ie. a
striped array of disks is implemented.
•The data is broken down into blocks and the blocks are
distributed among disks.
•Each disk receives a block of data to write/read in parallel.
•It enhances the speed and performance of the storage device.
• There is no parity and backup in Level 0.
RAID Level 1( mirroring)

•RAID 1 uses mirroring techniques.


• When data is sent to a RAID controller, it sends a copy of
data to other disks in the array there by reducing the storage
capacity.
•Fault tolerance is quite good as the data may be recovered
from the backup disk in case of any disk failure.
RAID Level 4

•In this level, an entire block of data is written onto data disks
and then the parity is generated and stored on a different disk.
•Note that level 3 uses byte-level striping, whereas level 4 uses
block-level striping.
•Both level 3 and level 4 require at least three disks to
implement RAID.
How to calculate parity?
•Parity can be calculated using an XOR function.
•If the data bits are 0,0,0,1 then the parity bits is XOR(0,0,0,1) = 1.
•If the parity bits are 0,0,1,1 then the parity bit is XOR(0,0,1,1)= 0.
•That means, even number of one results in parity 0 and an odd number
of one results in parity 1.

C1 C2 C3 C4 Parity
0 1 0 0 1
0 0 1 1 0

In the above table, if C2 is lost due to some disk failure, then using the
values of all the other columns and the parity bit, we can recompute the
data bit stored in C2.
RAID Level 5
•RAID 5 writes whole data blocks onto different
disks and the parity bits generated for data block
stripe are distributed among all the data disks
rather than storing them on a different dedicated
disk.
Nested RAID levels(1+0)
•Some RAID levels are referred to as nested RAID
because they are based on a combination of RAID
levels, such as RAID 10 (1+0)
•This level Combines RAID 1 and RAID 0 in a single
system, which offers higher performance than RAID 1,
but at a much higher cost.
•This is a nested or hybrid RAID configuration. It
provides security by mirroring all data on secondary
drives while using striping across each set of drives to
speed up data transfers.
•This is also called as “stripe of mirrors”
•Excellent redundancy ( as blocks are mirrored )
•Excellent performance ( as blocks are striped
•Minimum 4 disks.
Disk Attachment
• Disk storage- accessed by computers via
I/O ports called host attached storage
• Network attached storage- access is done
via remote host.
Host-attached Storage

• Local I/O porta are used to access host attached


storage.
• Desktop PC makes use of an I/O bus architecture
• SCSI (Small computer system interface) and fiber
channel(FC) are used by high-ended servers and
workstations
• Devices include up to 15 storage devices called as
SCSI targets.
• Common SCSI target is SCSI disk.
• FC is a speedy serial architecture which can
function over optical fiber.
Network Attached
Storage(NAS)
• It is accessed remotely over a data network.
• RPC interface such as NFS in UNIX or CIFS in
windows used by the clients to access NAS.
• It is implemented as a RAID array with
software that implements the RPC interface.
• NAS ia a storage access protocol that uses
RPC over TCP/IP.
Storage Area
Network(SAN)
• Limitation of NAS- network
communication and low bandwidth in
large client-server installation.
• Private Network- storage protocol.
• SANs have several ports and less costly
ports than storage arrays.
Disk Management

• Activities- disk initialization, booting from


disk and bad block recovery

You might also like