0
0
Operating Systemsknowledge~30 mins

SSTF (Shortest Seek Time First) in Operating Systems - Mini Project: Build & Apply

Choose your learning style9 modes available
SSTF (Shortest Seek Time First) Disk Scheduling
📖 Scenario: You are managing a disk drive that receives multiple read/write requests at different track positions. To reduce the time the disk head moves, you want to schedule these requests using the SSTF (Shortest Seek Time First) algorithm.
🎯 Goal: Build a step-by-step SSTF scheduling plan that selects the next disk request closest to the current head position until all requests are served.
📋 What You'll Learn
Create a list of disk requests with exact track numbers
Set the initial position of the disk head
Implement the SSTF logic to pick the closest request next
Complete the schedule showing the order of servicing requests
💡 Why This Matters
🌍 Real World
Disk scheduling algorithms like SSTF are used in operating systems to reduce the time it takes for the disk head to move between requests, improving overall system performance.
💼 Career
Understanding SSTF is important for roles in system administration, operating system development, and performance optimization where managing hardware resources efficiently is key.
Progress0 / 4 steps
1
Create the list of disk requests
Create a list called requests with these exact track numbers: 55, 58, 60, 70, 18, 90, 150, 38, 184.
Operating Systems
Need a hint?

Use a Python list with the exact numbers in the order given.

2
Set the initial disk head position
Create a variable called head and set it to 50 to represent the starting position of the disk head.
Operating Systems
Need a hint?

Assign the number 50 to the variable named head.

3
Implement SSTF scheduling logic
Create an empty list called schedule. Then use a while loop that runs while requests is not empty. Inside the loop, find the request closest to head by calculating the minimum absolute difference. Append this closest request to schedule, update head to this request, and remove it from requests.
Operating Systems
Need a hint?

Use min() with a key function to find the closest request to head.

4
Complete the SSTF schedule
After the loop, create a variable called final_schedule and assign it the value of schedule. This variable will hold the order in which disk requests are serviced using SSTF.
Operating Systems
Need a hint?

Simply assign schedule to final_schedule to complete the project.