Question
--- Python Implementation --- In this project you will implement two real-time disk scheduling algorithms: shortest seek time first - real time ( SSTF_RT )
--- Python Implementation ---
In this project you will implement two real-time disk scheduling algorithms: shortest seek time first - real time (SSTF_RT) and earliest deadline first (EDF)
The SSTF_RT is a version of SSTF that works with requests (cylinder numbers) that have an associate real-time deadlines. The SSTF_RT goes through the list of requests exactly as SSTF would, with the difference that it drops those requests for which cannot complete the read/write head movement from the current position/cylinder to the requested cylinder. EDF services requests based on their associated deadline only - in other words, the next request served by EDF is based on the nearest deadline in contrast with SSTF where the next request served is the one which is closest in distance / seek time from the current position of the read/write head.
Let us consider examples that will help us understand these algorithms. Let us say we are given that the cylinder number range is 0...4999, and head speed is 1 (speed is defined as distance per unit time, where unit of distance = distance between cylinders of the hard drive, so a head with speed 1 moves from one cylinder to the next in a unit of time).
If the request list is 2069, 1212, 2296, 2800, 544, 1618, 356, 1523, 4965, 3681; the output of the SSTFalgorithm is shown below. Note we are also printing the time instances when these services are completed (assuming that other latencies like rotational and data transfer are all zero): Servicing request 2296, time = 204.0 Servicing request 2069, time = 431.0 Servicing request 1618, time = 882.0 Servicing request 1523, time = 977.0 Servicing request 1212, time = 1288.0 Servicing request 544, time = 1956.0 Servicing request 356, time = 2144.0 Servicing request 2800, time = 4588.0 Servicing request 3681, time = 5469.0 Servicing request 4965, time = 6753.0 Total movement in SSTF = 6753
Then for the same set of initial conditions, plus the deadlines list 2300, 2000, 80, 10, 1800, 7000, 3600, 8900, 97, 8800 the output of SSTF_RT is: Dropping service request 2296, time = 0 Dropping service request 2800, time = 0 Servicing request 2069, time = 431.0 Servicing request 1618, time = 882.0 Servicing request 1523, time = 977.0 Servicing request 1212, time = 1288.0 Dropping service request 544, time = 1288.0 Servicing request 356, time = 2144.0 Servicing request 3681, time = 5469.0 Dropping service request 4965, time = 5469.0 Total movement in real time SSTF = 5469
For the same set of initial conditions as in the previous example for SSTF_RT, the output of EDF is: Dropping service request 2800, time = 0 Dropping service request 2296, time = 0 Dropping service request 4965, time = 0 Dropping service request 544, time = 0 Servicing request 1212, time = 1288.0 Servicing request 2069, time = 2145.0 Dropping service request 356, time = 2145.0 Servicing request 1618, time = 2596.0 Servicing request 3681, time = 4659.0 Servicing request 1523, time = 6817.0 Total movement in EDF = 6817
This script file must have the definitions of functions named SSTF_RT and EDF. Both functions must take 3 input arguments: requests, deadlines, and the initial position. Both requests and deadlines are lists of integers of the same length, where the corresponding location in the deadlines list has the real-time deadline for a request (cylinder number). Both functionsSSTF_RT and EDF must print messages, examples of which are shown in the above examples.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started