SlideShare a Scribd company logo
6
Most read
7
Most read
14
Most read
B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar
Operating System
KCS – 401
Disk Scheduling
Dr. Pankaj Kumar
Associate Professor – CSE
SRMGPC Lucknow
Background
B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar
Magnetic disks provide bulk of secondary storage of modern computers
Drives rotate at 60 to 250 times per second
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 -- That’s bad
Disks can be removable
Drive attached to computer via I/O bus
Busses vary, including EIDE, ATA, SATA, USB, Fibre Channel, SCSI, SAS, Firewire
Host controller in computer uses bus to talk to disk controller built into drive or storage
array
Hard Disk Mechanism
B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar
Platters range from .85” to 14” (historically)
Commonly 3.5”, 2.5”, and 1.8”
Range from 30GB to 3TB per drive
Performance
Transfer Rate – theoretical – 6 Gb/sec
Effective Transfer Rate – real – 1Gb/sec
Seek time from 3ms to 12ms – 9ms common
for desktop drives
Average seek time measured or calculated
based on 1/3 of tracks
Latency based on spindle speed
1 / (RPM / 60) = 60 / RPM
Average latency = ½ latency
Hard Disk Performance
B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar
Access Latency = Average access time = average seek time + average latency
For fastest disk 3ms + 2ms = 5ms
For slow disk 9ms + 5.56ms = 14.56ms
Average I/O time = average access time + (amount to transfer / transfer rate) + controller
overhead
For example to transfer a 4KB block on a 7200 RPM disk with a 5ms average seek time, 1Gb/sec
transfer rate with a .1ms controller overhead =
5ms + 4.17ms + 0.1ms + transfer time =
Transfer time = 4KB / 1Gb/s * 8Gb / GB * 1GB / 10242KB = 32 / (10242) = 0.031 ms
Average I/O time for 4KB block = 9.27ms + .031ms = 9.301ms
Hard Disk Performance
B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar
Disk drives are addressed as large 1-dimensional arrays of logical blocks, where the logical block
is the smallest unit of transfer
Low-level formatting creates logical blocks on physical media
The 1-dimensional array of logical blocks is mapped into the sectors of the disk sequentially
Sector 0 is the first sector of the first track on the outermost cylinder
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
Logical to physical address should be easy
Except for bad sectors
Non-constant # of sectors per track via constant angular velocity
Disk Scheduling
B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar
The operating system is responsible for using hardware efficiently — for the disk drives, this
means having a fast access time and disk bandwidth
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
There are many sources of disk I/O request
OS
System processes
Users processes
I/O request includes input or output mode, disk address, memory address, number of sectors to
transfer
OS maintains queue of requests, per disk or device
Idle disk can immediately work on I/O request, busy disk means work must queue
Optimization algorithms only make sense when a queue exists
Disk Scheduling
B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar
• Seek Time: Seek time is the time taken to locate the disk arm to a specified track where the data is to be
read or write. So the disk scheduling algorithm that gives minimum average seek time is better.
• Rotational Latency: Rotational Latency is the time taken by the desired sector of disk to rotate into a
position so that it can access the read/write heads. So the disk scheduling algorithm that gives minimum
rotational latency is better.
• Transfer Time: Transfer time is the time to transfer the data. It depends on the rotating speed of the disk
and number of bytes to be transferred.
• 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.
• Disk Access Time: Disk Access Time is:
Disk Access Time = Seek Time + Rotational Latency + Transfer Time
First Come First Serve (FCFS)
B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar
FCFS is the simplest of all the Disk Scheduling Algorithms. In FCFS, the requests are addressed
in the order they arrive in the disk queue. Let us understand this with the help of an example.
Example:
Suppose the order of request is- (82,170,43,140,24,16,190)
And current position of Read/Write head is : 50
Advantages:
•Every request gets a fair chance
•No indefinite postponement
Disadvantages:
•Does not try to optimize seek time
•May not provide the best possible service
So, total seek time: =(82-50)+(170-82)+(170-43)+(140-43)+(140-24)+(24-16)+(190-16) =642
Shortest Seek Time First (SSTF)
B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar
Advantages:
• Average Response Time decreases
• Throughput increases
Disadvantages:
• Overhead to calculate seek time in advance
• Can cause Starvation for a request if it has higher seek time
as compared to incoming requests
• High variance of response time as SSTF favors only some
requests
So, total seek time: = (50-43)+(43-24)+(24-16)+(82-16)+(140-82)+(170-40)+(190-170) =208
In SSTF (Shortest Seek Time First), requests having shortest seek time are executed first. So, the
seek time of every request is calculated in advance in the queue and then they are scheduled
according to their calculated seek time. As a result, the request near the disk arm will get
executed first.
Example:
Suppose the order of request is- (82,170,43,140,24,16,190) And current position of Read/Write
head is : 50
(SCAN)
B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar
Advantages:
• High throughput
• Low variance of response time
• Average response time
Disadvantages:
• Long waiting time for requests for locations just
visited by disk arm
So, total seek time: =(199-50)+(199-16) =332
In SCAN algorithm the disk arm moves into a particular direction and services the requests
coming in its path and after reaching the end of disk, it reverses its direction and again services
the request arriving in its path. So, this algorithm works as an elevator and hence also known
as elevator algorithm. As a result, the requests at the midrange are serviced more and those
arriving behind the disk arm will have to wait.
Example:
Suppose the requests to be addressed are-82,170,43,140,24,16,190. And the Read/Write arm is at
50, and it is also given that the disk arm should move “towards the larger value”.
(CSCAN)
B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar
So, total seek time: =(199-50)+(199-0)+(43-0)=391
In SCAN algorithm, the disk arm again scans the path that has been scanned, after reversing its direction. So,
it may be possible that too many requests are waiting at the other end or there may be zero or few requests
pending at the scanned area.
These situations are avoided in CSCAN algorithm in which the disk arm instead of reversing its direction
goes to the other end of the disk and starts servicing the requests from there. So, the disk arm moves in a
circular fashion and this algorithm is also similar to SCAN algorithm and hence it is known as C-SCAN
(Circular SCAN).
Example:
Suppose the requests to be addressed are-82,170,43,140,24,16,190. And the Read/Write arm is at 50, and it is
also given that the disk arm should move “towards the larger value”.
(LOOK)
B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar
So, total seek time: =(190-50)+(190-16) =314
It is similar to the SCAN disk scheduling algorithm except for the difference that the disk arm in
spite of going to the end of the disk goes only to the last request to be serviced in front of the
head and then reverses its direction from there only. Thus it prevents the extra delay which
occurred due to unnecessary traversal to the end of the disk.
Example:
Suppose the requests to be addressed are-82,170,43,140,24,16,190. And the Read/Write arm is at
50, and it is also given that the disk arm should move “towards the larger value”.
(CLOOK)
B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar
So, total seek time: =(190-50)+(190-16)+(43-16) =341
It is similar to the SCAN disk scheduling algorithm except for the difference that the disk arm in
spite of going to the end of the disk goes only to the last request to be serviced in front of the
head and then reverses its direction from there only. Thus it prevents the extra delay which
occurred due to unnecessary traversal to the end of the disk.
Example:
Suppose the requests to be addressed are-82,170,43,140,24,16,190. And the Read/Write arm is at
50, and it is also given that the disk arm should move “towards the larger value”.
(CLOOK)
B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar
So, total seek time: =(190-50)+(190-16)+(43-16) =341
It is similar to the SCAN disk scheduling algorithm except for the difference that the disk arm in
spite of going to the end of the disk goes only to the last request to be serviced in front of the
head and then reverses its direction from there only. Thus it prevents the extra delay which
occurred due to unnecessary traversal to the end of the disk.
Example:
Suppose the requests to be addressed are-82,170,43,140,24,16,190. And the Read/Write arm is at
50, and it is also given that the disk arm should move “towards the larger value”.

More Related Content

PPTX
Disk Scheduling In Operating System.pptx
PDF
Operating system notes _ computer science
PDF
fileallocationmethods1-220104151603.pdf
PPTX
File allocation methods (1)
PPTX
FILE SYSTEMS AND ORGANISATION STRUCTURE.pptx
PDF
Sucet os module_5_notes
PDF
DOC-20241118-WA0000osdiskschedulingslgoirths.pdf
PPTX
OPERATING SYSTEM-UNIT 4.pptxefficiency and performance –Recovery.
Disk Scheduling In Operating System.pptx
Operating system notes _ computer science
fileallocationmethods1-220104151603.pdf
File allocation methods (1)
FILE SYSTEMS AND ORGANISATION STRUCTURE.pptx
Sucet os module_5_notes
DOC-20241118-WA0000osdiskschedulingslgoirths.pdf
OPERATING SYSTEM-UNIT 4.pptxefficiency and performance –Recovery.

Similar to Disk Scheduling (20)

PPT
7 disk managment
PPTX
I/O buffering & disk scheduling
PPTX
disk Scheduling explanation hsbsjjsj1.pptx
PPTX
Disk Scheduling Algorithm in Operating System
PPT
Disk Scheduling
PPTX
Disk structure
PDF
CH10.pdf
PPT
Ch10
PPT
Operating Systems
PDF
unit-4.pdf
PPT
Disk scheduling algorithms
PDF
Ch9 mass storage systems
PPTX
Disk Scheduling concept of Operating System.pptx
PDF
Cs8493 unit 4
PPT
Disk storage systems bits wilp presentation
PPT
PPT
PPT
operating system
PPTX
Disk Scheduling
7 disk managment
I/O buffering & disk scheduling
disk Scheduling explanation hsbsjjsj1.pptx
Disk Scheduling Algorithm in Operating System
Disk Scheduling
Disk structure
CH10.pdf
Ch10
Operating Systems
unit-4.pdf
Disk scheduling algorithms
Ch9 mass storage systems
Disk Scheduling concept of Operating System.pptx
Cs8493 unit 4
Disk storage systems bits wilp presentation
operating system
Disk Scheduling
Ad

More from Shri Ram Swaroop Memorial College of Engineering & Management (20)

PDF
Operating System: Process and synchronization
PDF
Operating System: interprocess Communication
Operating System: Process and synchronization
Operating System: interprocess Communication
Ad

Recently uploaded (20)

PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
PPH.pptx obstetrics and gynecology in nursing
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
Pre independence Education in Inndia.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Cell Structure & Organelles in detailed.
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
master seminar digital applications in india
PPTX
Pharma ospi slides which help in ospi learning
PDF
Computing-Curriculum for Schools in Ghana
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Anesthesia in Laparoscopic Surgery in India
PPH.pptx obstetrics and gynecology in nursing
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Pre independence Education in Inndia.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Microbial diseases, their pathogenesis and prophylaxis
102 student loan defaulters named and shamed – Is someone you know on the list?
Cell Structure & Organelles in detailed.
O5-L3 Freight Transport Ops (International) V1.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
master seminar digital applications in india
Pharma ospi slides which help in ospi learning
Computing-Curriculum for Schools in Ghana
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
Abdominal Access Techniques with Prof. Dr. R K Mishra
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
human mycosis Human fungal infections are called human mycosis..pptx

Disk Scheduling

  • 1. B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar Operating System KCS – 401 Disk Scheduling Dr. Pankaj Kumar Associate Professor – CSE SRMGPC Lucknow
  • 2. Background B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar Magnetic disks provide bulk of secondary storage of modern computers Drives rotate at 60 to 250 times per second 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 -- That’s bad Disks can be removable Drive attached to computer via I/O bus Busses vary, including EIDE, ATA, SATA, USB, Fibre Channel, SCSI, SAS, Firewire Host controller in computer uses bus to talk to disk controller built into drive or storage array
  • 3. Hard Disk Mechanism B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar Platters range from .85” to 14” (historically) Commonly 3.5”, 2.5”, and 1.8” Range from 30GB to 3TB per drive Performance Transfer Rate – theoretical – 6 Gb/sec Effective Transfer Rate – real – 1Gb/sec Seek time from 3ms to 12ms – 9ms common for desktop drives Average seek time measured or calculated based on 1/3 of tracks Latency based on spindle speed 1 / (RPM / 60) = 60 / RPM Average latency = ½ latency
  • 4. Hard Disk Performance B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar Access Latency = Average access time = average seek time + average latency For fastest disk 3ms + 2ms = 5ms For slow disk 9ms + 5.56ms = 14.56ms Average I/O time = average access time + (amount to transfer / transfer rate) + controller overhead For example to transfer a 4KB block on a 7200 RPM disk with a 5ms average seek time, 1Gb/sec transfer rate with a .1ms controller overhead = 5ms + 4.17ms + 0.1ms + transfer time = Transfer time = 4KB / 1Gb/s * 8Gb / GB * 1GB / 10242KB = 32 / (10242) = 0.031 ms Average I/O time for 4KB block = 9.27ms + .031ms = 9.301ms
  • 5. Hard Disk Performance B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar Disk drives are addressed as large 1-dimensional arrays of logical blocks, where the logical block is the smallest unit of transfer Low-level formatting creates logical blocks on physical media The 1-dimensional array of logical blocks is mapped into the sectors of the disk sequentially Sector 0 is the first sector of the first track on the outermost cylinder 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 Logical to physical address should be easy Except for bad sectors Non-constant # of sectors per track via constant angular velocity
  • 6. Disk Scheduling B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar The operating system is responsible for using hardware efficiently — for the disk drives, this means having a fast access time and disk bandwidth 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 There are many sources of disk I/O request OS System processes Users processes I/O request includes input or output mode, disk address, memory address, number of sectors to transfer OS maintains queue of requests, per disk or device Idle disk can immediately work on I/O request, busy disk means work must queue Optimization algorithms only make sense when a queue exists
  • 7. Disk Scheduling B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar • Seek Time: Seek time is the time taken to locate the disk arm to a specified track where the data is to be read or write. So the disk scheduling algorithm that gives minimum average seek time is better. • Rotational Latency: Rotational Latency is the time taken by the desired sector of disk to rotate into a position so that it can access the read/write heads. So the disk scheduling algorithm that gives minimum rotational latency is better. • Transfer Time: Transfer time is the time to transfer the data. It depends on the rotating speed of the disk and number of bytes to be transferred. • 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. • Disk Access Time: Disk Access Time is: Disk Access Time = Seek Time + Rotational Latency + Transfer Time
  • 8. First Come First Serve (FCFS) B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar FCFS is the simplest of all the Disk Scheduling Algorithms. In FCFS, the requests are addressed in the order they arrive in the disk queue. Let us understand this with the help of an example. Example: Suppose the order of request is- (82,170,43,140,24,16,190) And current position of Read/Write head is : 50 Advantages: •Every request gets a fair chance •No indefinite postponement Disadvantages: •Does not try to optimize seek time •May not provide the best possible service So, total seek time: =(82-50)+(170-82)+(170-43)+(140-43)+(140-24)+(24-16)+(190-16) =642
  • 9. Shortest Seek Time First (SSTF) B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar Advantages: • Average Response Time decreases • Throughput increases Disadvantages: • Overhead to calculate seek time in advance • Can cause Starvation for a request if it has higher seek time as compared to incoming requests • High variance of response time as SSTF favors only some requests So, total seek time: = (50-43)+(43-24)+(24-16)+(82-16)+(140-82)+(170-40)+(190-170) =208 In SSTF (Shortest Seek Time First), requests having shortest seek time are executed first. So, the seek time of every request is calculated in advance in the queue and then they are scheduled according to their calculated seek time. As a result, the request near the disk arm will get executed first. Example: Suppose the order of request is- (82,170,43,140,24,16,190) And current position of Read/Write head is : 50
  • 10. (SCAN) B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar Advantages: • High throughput • Low variance of response time • Average response time Disadvantages: • Long waiting time for requests for locations just visited by disk arm So, total seek time: =(199-50)+(199-16) =332 In SCAN algorithm the disk arm moves into a particular direction and services the requests coming in its path and after reaching the end of disk, it reverses its direction and again services the request arriving in its path. So, this algorithm works as an elevator and hence also known as elevator algorithm. As a result, the requests at the midrange are serviced more and those arriving behind the disk arm will have to wait. Example: Suppose the requests to be addressed are-82,170,43,140,24,16,190. And the Read/Write arm is at 50, and it is also given that the disk arm should move “towards the larger value”.
  • 11. (CSCAN) B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar So, total seek time: =(199-50)+(199-0)+(43-0)=391 In SCAN algorithm, the disk arm again scans the path that has been scanned, after reversing its direction. So, it may be possible that too many requests are waiting at the other end or there may be zero or few requests pending at the scanned area. These situations are avoided in CSCAN algorithm in which the disk arm instead of reversing its direction goes to the other end of the disk and starts servicing the requests from there. So, the disk arm moves in a circular fashion and this algorithm is also similar to SCAN algorithm and hence it is known as C-SCAN (Circular SCAN). Example: Suppose the requests to be addressed are-82,170,43,140,24,16,190. And the Read/Write arm is at 50, and it is also given that the disk arm should move “towards the larger value”.
  • 12. (LOOK) B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar So, total seek time: =(190-50)+(190-16) =314 It is similar to the SCAN disk scheduling algorithm except for the difference that the disk arm in spite of going to the end of the disk goes only to the last request to be serviced in front of the head and then reverses its direction from there only. Thus it prevents the extra delay which occurred due to unnecessary traversal to the end of the disk. Example: Suppose the requests to be addressed are-82,170,43,140,24,16,190. And the Read/Write arm is at 50, and it is also given that the disk arm should move “towards the larger value”.
  • 13. (CLOOK) B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar So, total seek time: =(190-50)+(190-16)+(43-16) =341 It is similar to the SCAN disk scheduling algorithm except for the difference that the disk arm in spite of going to the end of the disk goes only to the last request to be serviced in front of the head and then reverses its direction from there only. Thus it prevents the extra delay which occurred due to unnecessary traversal to the end of the disk. Example: Suppose the requests to be addressed are-82,170,43,140,24,16,190. And the Read/Write arm is at 50, and it is also given that the disk arm should move “towards the larger value”.
  • 14. (CLOOK) B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar So, total seek time: =(190-50)+(190-16)+(43-16) =341 It is similar to the SCAN disk scheduling algorithm except for the difference that the disk arm in spite of going to the end of the disk goes only to the last request to be serviced in front of the head and then reverses its direction from there only. Thus it prevents the extra delay which occurred due to unnecessary traversal to the end of the disk. Example: Suppose the requests to be addressed are-82,170,43,140,24,16,190. And the Read/Write arm is at 50, and it is also given that the disk arm should move “towards the larger value”.