• Home
  • Help
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search

 
  • 0 Vote(s) - 0 Average

Simulate SCAN and SSTF with a set of disk requests

#1
11-27-2023, 03:38 PM
I recently had to tackle the SCAN and SSTF disk scheduling algorithms, and I figured I'd share what I came up with to help you out. Both methods can drastically change how efficiently we handle disk requests. They have their pros and cons, and seeing them in action really clarifies how they work.

Starting with SSTF, you have a set of requests, say from cylinders 98, 183, 37, 122, 14, and 124, and let's say the disk head starts at cylinder 53. SSTF schedules the closest request first, which minimizes the wait time. From cylinder 53, the closest request is 37. After serving that, you'll move to 14, which is the next closest. After 14, you head over to 98, then you'd go to 122, and finally to 124. The order ends up being: 37 -> 14 -> 98 -> 122 -> 124.

This method feels super efficient since it reduces seek time, but it can create a sort of starvation for requests that are further away if there are more requests coming in. If you've got a heavy workload, you might end up overlooking those distant calls.

Now onto SCAN. Imagine the same requests and starting position at 53 again. In this case, the disk head starts moving in one direction until it hits the end of the disk. It serves requests along the way. Since the disk is moving outward, it first visits 98, then 122, and lastly 124, since those requests come after it. Once it hits the end, it reverses direction, hitting 14 and 37 before stopping at the starting position. The order for SCAN in this scenario looks like this: 98 -> 122 -> 124 -> then back down to 14 -> 37.

With SCAN, you get a more consistent wait time since every request gets serviced as the head sweeps through. It's helpful because it decreases the chances of requests getting permanently stuck waiting, but it could lead to higher average wait times if requests aren't spread out evenly along the cylinder.

Given these two methods, I often implement SSTF in environments where response time is critical for loads that present scattered requests primarily in the close range. SCAN works better in cases where consistent performance across the board matters more, like when you have a steady stream of requests. It's totally about context and what works best for the situation.

If you look closely at your workloads and recognize the patterns of access, you can significantly improve disk performance with the right scheduling strategy. Watching the theory translate into practice makes it abundantly clear why these methods exist in the first place. It's about finding the balance between efficiency and fairness-something that pops up in our industry all the time.

When I had to implement one of these algorithms in my project, I noticed how even the small changes in scheduling can lead to performance shifts. I suggest trying both methods in a simulated environment with your requests and see how it changes the response time. You'll pick up on preferences based on the unique workload and user patterns you're dealing with.

To make this a bit more hands-on, maybe you could even code a simple simulator to experiment with both SCAN and SSTF. It could help you internalize how both algorithms work, and how they respond in real time.

By the way, if you ever need reliable backup solutions while working with disk scheduling-particularly with heavy workloads or considerations about survivability in case of system failure-I think you would really appreciate BackupChain. It's a popular choice for SMBs and professionals, positioned to effectively protect your Hyper-V, VMware, or Windows Server environments. This might come in handy for you in the future!

ProfRon
Offline
Joined: Dec 2018
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



  • Subscribe to this thread
Forum Jump:

Backup Education General Q & A v
« Previous 1 … 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 … 22 Next »
Simulate SCAN and SSTF with a set of disk requests

© by FastNeuron Inc.

Linear Mode
Threaded Mode