How to Calculate the Average Time to Read a Set Number of Bytes

Disk scheduling is done by operating systems to schedule I/O requests arriving for the disk. Disk scheduling is also known as I/O scheduling.

Deejay scheduling is important because:

  • Multiple I/O requests may get in by different processes and but one I/O asking can be served at a time by the disk controller. Thus other I/O requests need to wait in the waiting queue and need to be scheduled.
  • Two or more than request may be far from each other so can result in greater deejay arm motility.
  • Hard drives are 1 of the slowest parts of the computer system and thus need to be accessed in an efficient fashion.

In that location are many Disk Scheduling Algorithms but before discussing them let's have a quick look at some of the important terms:

  • Seek Time:Seek fourth dimension is the time taken to locate the disk arm to a specified rail where the information is to be read or write. So the deejay scheduling algorithm that gives minimum average seek time is meliorate.
  • Rotational Latency: Rotational Latency is the time taken by the desired sector of disk to rotate into a position and 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 information. It depends on the rotating speed of the deejay and number of bytes to be transferred.
  • Disk Access Time: Disk Access Time is:
          Disk Access Time = Seek Time +                           Rotational Latency +                           Transfer Time

os1

  • Disk Response Fourth dimension: Response Time is the boilerplate of fourth dimension spent by a asking waiting to perform its I/O operation. Average Response fourth dimension is the response fourth dimension of the all requests. Variance Response Fourth dimension is measure of how private request are serviced with respect to average response time. So the disk scheduling algorithm that gives minimum variance response time is better.

Disk Scheduling Algorithms

  1. FCFS: 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 u.s. understand this with the help of an example.

Example:

  1. Suppose the order of request is- (82,170,43,140,24,16,190)
    And current position of Read/Write head is : 50

  1. And so, total seek time:
    =(82-50)+(170-82)+(170-43)+(140-43)+(140-24)+(24-16)+(190-16)
    =642

Advantages:

  • Every request gets a fair take a chance
  • No indefinite postponement

Disadvantages:

  • Does not try to optimize seek time
  • May not provide the all-time possible service
  1. SSTF: In SSTF (Shortest Seek Time First), requests having shortest seek time are executed first. And then, the seek time of every request is calculated in advance in the queue and so they are scheduled co-ordinate to their calculated seek time. As a result, the request near the disk arm will get executed first. SSTF is certainly an improvement over FCFS as it decreases the average response fourth dimension and increases the throughput of organization.Permit united states of america understand this with the assist of an instance.

Example:

  1. Suppose the club of request is- (82,170,43,140,24,16,190)
    And electric current position of Read/Write caput is : l

And so, full seek time:

  1. =(50-43)+(43-24)+(24-xvi)+(82-16)+(140-82)+(170-140)+(190-170)
    =208

Advantages:

  • Average Response Time decreases
  • Throughput increases

Disadvantages:

  • Overhead to calculate seek time in advance
  • Can cause Starvation for a asking if it has higher seek time as compared to incoming requests
  • Loftier variance of response time every bit SSTF favours only some requests
  1. Browse: In SCAN algorithm the disk arm moves into a particular management and services the requests coming in its path and after reaching the end of deejay, it reverses its management and once more services the asking arriving in its path. And then, this algorithm works as an elevator and hence also known every bit elevator algorithm. As a upshot, the requests at the midrange are serviced more and those arriving behind the disk arm will have to wait.

Example:

  1. 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 motion "towards the larger value".

Therefore, the seek time is calculated as:

  1. =(199-50)+(199-16)
    =332

Advantages:

  • High throughput
  • Low variance of response time
  • Boilerplate response time

Disadvantages:

  • Long waiting fourth dimension for requests for locations just visited by deejay arm
  1. CSCAN : In Browse algorithm, the disk arm once again scans the path that has been scanned, later reversing its direction. So, information technology may be possible that likewise many requests are waiting at the other terminate 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 stop of the disk and starts servicing the requests from there. So, the disk arm moves in a circular way and this algorithm is also similar to SCAN algorithm and hence information technology is known every bit C-Scan (Circular SCAN).

Case:

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 motility "towards the larger value".

Seek fourth dimension is calculated every bit:

=(199-50)+(199-0)+(43-0)
=391

Advantages:

  • Provides more uniform expect time compared to SCAN
  1. LOOK: Information technology is like to the Scan deejay scheduling algorithm except for the difference that the deejay arm in spite of going to the end of the disk goes merely to the last request to be serviced in front of the caput and and so reverses its direction from there simply. Thus it prevents the extra delay which occurred due to unnecessary traversal to the finish of the disk.

Example:

  1. Suppose the requests to be addressed are-82,170,43,140,24,16,190. And the Read/Write arm is at fifty, and it is besides given that the disk arm should movement "towards the larger value".

Then, the seek fourth dimension is calculated as:

  1. =(190-50)+(190-16)
    =314
  1. CLOOK: As Wait is similar to SCAN algorithm, in similar way, CLOOK is similar to CSCAN disk scheduling algorithm. In CLOOK, the disk arm in spite of going to the end goes simply to the final request to be serviced in front of the caput and so from at that place goes to the other end's concluding asking. Thus, it as well prevents the extra delay which occurred due to unnecessary traversal to the end of the deejay.

Example:

  1. Suppose the requests to be addressed are-82,170,43,140,24,sixteen,190. And the Read/Write arm is at 50, and it is also given that the disk arm should motility "towards the larger value"

And then, the seek time is calculated every bit:

  1. =(190-50)+(190-16)+(43-xvi)
    =341

  2. RSS– It stands for random scheduling and just like its name information technology is nature. It is used in situations where scheduling involves random attributes such as random processing time, random due dates, random weights, and stochastic machine breakdowns this algorithm sits perfect. Which is why it is ordinarily used for and assay and simulation.
  3. LIFO– In LIFO (Last In, Showtime Out) algorithm, newest jobs are serviced earlier the existing ones i.due east. in gild of requests that get serviced the job that is newest or last entered is serviced first and so the rest in the same lodge.

    Advantages

    • Maximizes locality and resources utilization
    • Can seem a little unfair to other requests and if new requests proceed coming in, it cause starvation to the sometime and existing ones.
  4. N-Step SCAN – It is also known every bit Due north-Step LOOK algorithm. In this a buffer is created for N requests. All requests belonging to a buffer volition be serviced in one go. Likewise once the buffer is full no new requests are kept in this buffer and are sent to another 1. Now, when these N requests are serviced, the time comes for another peak N requests and this way all become requests get a guaranteed service

    Advantages

    • It eliminates starvation of requests completely
  5. FSCAN– This algorithm uses two sub-queues. During the scan all requests in the first queue are serviced and the new incoming requests are added to the second queue. All new requests are kept on halt until the existing requests in the beginning queue are serviced.
    Advantages
    • FSCAN forth with N-Step-SCAN prevents "arm stickiness" (phenomena in I/O scheduling where the scheduling algorithm continues to service requests at or near the current sector and thus prevents any seeking)

Each algorithm is unique in its own fashion. Overall Performance depends on the number and type of requests.
Note:Average Rotational latency is mostly taken as 1/ii(Rotational latency).
Practice

1) Suppose a disk has 201 cylinders, numbered from 0 to 200. At some time the disk arm is at cylinder 100, and there is a queue of deejay admission requests for cylinders thirty, 85, 90, 100, 105, 110, 135 and 145. If Shortest-Seek Time First (SSTF) is existence used for scheduling the deejay access, the request for cylinder 90 is serviced later servicing ____________ number of requests. (GATE CS 2014
(A) 1
(B) ii
(C) three
(D) 4
Encounter this for solution.

two) Consider an operating organization capable of loading and executing a single sequential user process at a fourth dimension. The disk head scheduling algorithm used is First Come up First Served (FCFS). If FCFS is replaced by Shortest Seek Time Commencement (SSTF), claimed by the vendor to give 50% meliorate benchmark results, what is the expected improvement in the I/O operation of user programs? (GATE CS 2004)
(A) 50%
(B) xl%
(C) 25%
(D) 0%
See this for solution.

3) Suppose the post-obit disk request sequence (track numbers) for a disk with 100 tracks is given: 45, xx, 90, ten, 50, 60, 80, 25, 70. Assume that the initial position of the R/W head is on track 50. The additional altitude that will be traversed past the R/W head when the Shortest Seek Time Commencement (SSTF) algorithm is used compared to the SCAN (Lift) algorithm (assuming that SCAN algorithm moves towards 100 when it starts execution) is _________ tracks
(A) 8
(B) 9
(C) 10
(D) 11
Encounter this for solution.

iv) Consider a typical deejay that rotates at 15000 rotations per infinitesimal (RPM) and has a transfer rate of l × 10^vi bytes/sec. If the average seek time of the deejay is twice the boilerplate rotational delay and the controller's transfer fourth dimension is 10 times the disk transfer time, the boilerplate time (in milliseconds) to read or write a 512 byte sector of the deejay is _____________
See this for solution.

This commodity is contributed by Ankit Mittal. Please write comments if you find anything incorrect, or you want to share more information almost the topic discussed above.


parkgropen49.blogspot.com

Source: https://www.geeksforgeeks.org/disk-scheduling-algorithms/

0 Response to "How to Calculate the Average Time to Read a Set Number of Bytes"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel