0% found this document useful (0 votes)
14 views1 page

Disk Scheduling Distance Calculation

The document outlines a lab assignment for M.Tech students in Operating Systems, focusing on disk scheduling algorithms. It presents a scenario involving a disk drive with specific requests and asks students to calculate the total distance the disk arm moves using various algorithms: FCFS, SSTF, SCAN, and C-SCAN. Students are instructed to solve the problem manually and submit their work by a specified deadline.

Uploaded by

jakeklent262
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views1 page

Disk Scheduling Distance Calculation

The document outlines a lab assignment for M.Tech students in Operating Systems, focusing on disk scheduling algorithms. It presents a scenario involving a disk drive with specific requests and asks students to calculate the total distance the disk arm moves using various algorithms: FCFS, SSTF, SCAN, and C-SCAN. Students are instructed to solve the problem manually and submit their work by a specified deadline.

Uploaded by

jakeklent262
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ISWE204P-OPERATING SYSTEMS LAB

[Link]

LAB DA -6

Date: 06/11/2024 Marks: 2*2.5=10 Marks Last Date for Submission: 06/09/11/2024

1. Suppose that a disk drive has 5,000 cylinders, numbered 0 to 4,999. The
drive is currently serving a request at cylinder 2,150, and the previous
request was at cylinder 1,805. The queue of pending requests, in FIFO
order, is:

2,069; 1,212; 2,296; 2,800; 544; 1,618; 356; 1,523; 4,965; 3,681

Starting from the current head position, what is the total distance
(in cylinders) that the disk arm moves to satisfy all the pending requests
for each of the following disk-scheduling algorithms?

a. FCFS
b. SSTF
c. SCAN
d. C-SCAN

*** Note *** Do not code for the above algorithms instead

**** Try to solve manually and then upload it****

Common questions

Powered by AI

The SCAN algorithm is termed as the 'elevator' algorithm because it mimics the process of an elevator: it moves in one direction servicing requests until the end is reached, then reverses and services requests in the opposite direction. This operation can lead to more efficient disk performance because it avoids starvation of any requests and ensures a more uniform distribution of disk arm movement.

C-SCAN might not be optimal in mixed request scenarios as its strict reset can lead to inefficiencies; moving past many unserviced requests to the end before restarting may increase total seek times when dealing with clustered requests near the cycle ends or amidst long stretches. This idealized constant turnover doesn't account for optimal responsiveness in heterogeneous request mixes since some clusters might remain underserved longer, compared to SCAN or SSTF.

C-SCAN would likely show the most uniform seek times for uniformly distributed requests across disk cylinders. This algorithm's principle of consistent directional scanning and resetting maximizes the predictability of seek operations by handling each request in the same path order, minimizing variations in seek time due to position-dependent delays and provides equally accessible opportunities for all cylinder requests within its cycle framework.

SSTF reduces seek times by prioritizing the request closest to the current head position, minimizing immediate distance traveled. However, it can lead to starvation or unfairness if there are continuously nearby requests as more distant requests may be deferred indefinitely, creating an imbalance in service timing depending on request order and distribution patterns.

Using the FCFS algorithm, the disk arm will move from 2,150 to 2,069, then to 1,212, 2,296, 2,800, 544, 1,618, 356, 1,523, 4,965, and finally to 3,681. The total movement in cylinders is calculated by taking the absolute differences in sequence: (2,150-2,069) + (2,069-1,212) + (1,212-2,296) + (2,296-2,800) + (2,800-544) + (544-1,618) + (1,618-356) + (356-1,523) + (1,523-4,965) + (4,965-3,681) = 81 + 857 + 1,084 + 504 + 2,256 + 1,074 + 1,262 + 1,167 + 3,442 + 1,284 = 13,011 cylinders.

Using the SSTF algorithm, the disk arm moves to the closest cylinder from the current position. Starting at 2,150, the requests are 2,296, 2,069, 1,618, 1,523, 1,212, 356, 544, 3,681, 2,800, 4,965. The total movement is calculated as (2,150-2,069) + (2,069-2,296) + (2,296-2,800) + (2,800-3,681) + (3,681-4,965) + (1,618-1,523) + (1,523-1,212) + (1,212-544) + (544-356) = 81 + 227 + 504 + 881 + 1,284 + 95 + 311 + 668 + 188 = 5,239 cylinders.

Both SCAN and C-SCAN algorithms move the disk head in a systematic direction. SCAN moves towards the nearest end of the disk and then reverses direction, servicing requests on the return. C-SCAN moves towards one end, resets to the start, and services requests in that direction continuously. For SCAN, starting at 2,150, and going in one sweep covers requests up to the nearest end (0), then reverses. C-SCAN starts at 2,150 and continues in one sweep, resets at the end, and resumes from the start. Given the request list, SCAN is generally more efficient because it avoids a full disk traversal except for one pass and avoids reset to zero which might add to total seek distance depending on request locations. The exact mileage for both requires detailed calculations in context but usually SCAN will be more favorable for mixed distributions like the given example.

The FCFS algorithm processes requests in the order they arrive, potentially leading to significant disk arm movement, termed 'seek', if requests are widely spaced apart, causing high seek times and impacting performance negatively. Under variable workload patterns with non-sequential or clustered requests, FCFS can result in suboptimal performance due to possible long jumps across the disk, reducing throughput and increasing average service time.

SCAN can more effectively handle clustered requests by ensuring regular servicing over a defined pass direction before reversing. Unlike FCFS, which might result in unnecessarily repeated passes through a node or long jumps if requests are unevenly distributed, SCAN offers improved efficiency by orderly processing requests in one scan, minimizing redundant operations or delayed processing inherent in more chaotic sequences of FCFS.

C-SCAN provides more consistent service times by always moving the disk head in a uniform direction--after reaching the end, it resets, returning to the start of the disk without servicing any requests on the way back. This differs from SCAN, which services requests in both directions. By not servicing requests on the return trip, C-SCAN equalizes wait times for all request positions equally spaced along its path, beneficial in high-load scenarios with non-uniformly distributed reqeust patterns.

You might also like