Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write code to simulate the disk scheduling algorithms using information on the current position of the Read/Write Head and number of tracks to be traversed.

Write code to simulate the disk scheduling algorithms using information on the current position of the Read/Write Head and number of tracks to be traversed. The track numbers will be entered by the user and the program will calculate the average movement of the Read/Write head. By reducing the head movement, we can improve the seek time. i. First Come First Served ii. Elevator (SCAN) FCFS: Serve the next number in the queue INPUTS Enter current position of the Read/Write Head: 50 Enter Total Number of Tracks: 9 Enter the queue sequence: 95, 118, 70, 18, 62, 64, 11, 123, 45 OUTPUTS

Track No. No. of Head Movements 95 45 118 23 70 48 18 52 62 44 64 2 11 53 123 112 45 78

Average Head Movement: 50.778

Elevator (SCAN) In this algorithm, the disk arm with the Read/Write head starts at one end, and moves towards the other end. When it reaches the other end, the direction of the Read/Write head is reversed and it seeks the data on its trip backwards like an elevator. INPUTS Enter current position of the Read/Write Head: 50 Enter Total Number of Tracks: 9 Enter the queue sequence: 95, 118, 70, 18, 62, 64, 11, 123, 45 OUTPUTS

Track No. No. of Head Movements 62 12 64 2 70 6 95 25 118 23 123 5 45 78 18 27 11 7 Average Head Movement: 20.556

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions