Disk Scheduling Algorithm

Hello, I’m researching various disk scheduling algorithms and recognize that
the Scsiport.sys and Atapi.sys drivers both implement a version of the disk
scheduling algorithm known as C-LOOK. Yes, Storport.sys does not implement
disk scheduling since it is commonly used for managing I/O’s directed at
storage arrays where there is no clearly-defined notion of a disk start and
end.

However, I’m trying to understand how the disk I/O requests are then
scheduled by the o/s in this situation where a higher priority disk request
is needed for either a multimedia application or some other real-time event;
or is it that in a SAN situation with fibre connectivity to the disk array
at a switched 2Gbps bandwidth that there really isn’t a queue of requests
that needs to be ‘reordered’ by the driver or o/s? I’d appreciate any
feedback on this topic.

Kind regards,
Newbie Pete

> However, I’m trying to understand how the disk I/O requests are then

scheduled by the o/s in this situation where a higher priority disk request
is needed for either a multimedia application or some other real-time event;

Windows does not support disk request priorities.

SCSIPORT just picks the next several (up to the LUN’s limit) requests from the
KeInsert/RemoveDeviceQueue mechanism (which is an elevator seek), assigns queue
tags for them and sends them to the adapter.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

Vista has some notion of prioritized I/O that I’m not entirely familiar
with (having left the storage team during its development). But before
then there’s really no concept of I/O prioritization in Windows.

There was something added so the memory manager could get its I/O
operations ahead of others in the queue so that kernel paging couldn’t
get blocked behind a huge flood of I/O. This might have been in Server
2003, or SP2 … I’m not quite sure.

Other than that, I/O is serviced when it’s serviced.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Manhardt
Sent: Tuesday, April 25, 2006 6:00 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Disk Scheduling Algorithm

Hello, I’m researching various disk scheduling algorithms and recognize
that the Scsiport.sys and Atapi.sys drivers both implement a version of
the disk scheduling algorithm known as C-LOOK. Yes, Storport.sys does
not implement disk scheduling since it is commonly used for managing
I/O’s directed at storage arrays where there is no clearly-defined
notion of a disk start and end.

However, I’m trying to understand how the disk I/O requests are then
scheduled by the o/s in this situation where a higher priority disk
request is needed for either a multimedia application or some other
real-time event; or is it that in a SAN situation with fibre
connectivity to the disk array at a switched 2Gbps bandwidth that there
really isn’t a queue of requests that needs to be ‘reordered’ by the
driver or o/s? I’d appreciate any feedback on this topic.

Kind regards,
Newbie Pete


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

That’s helpful and timely responses; thank you both. However, how does
Windows then deal with the situation where demand paging takes priority over
application I/O and where writes are more urgent than reads if the cache is
running out of free pages? Aren’t there situations where the operating
system needs to ensure the order of writes in certain circumstances to
protect the file system due to a system crash?

Thanks again in advance,
Pete

There’s a flag or some combination of flags in the IRP the memory
manager can set to indicate to the storage controller that that
particular I/O operation should have priority over other operations
without the right markings. This allows some demand paging I/Os to get
ahead of application I/O in the queue. Modifying CSCAN or CLOOK to have
this sort of simple prioritization is trivial (which I say so that I can
leave it as an exercise to the reader :slight_smile:

The Memory Manager will prioritize reads and writes on its own by
sending more of one and less of the other.

Ensuring the ordering of two writes is pretty trivial. You wait for the
first one to complete, then issue the second. If an application cares
about ordering then the app must take the steps to cause it to happen.
The file systems can do likewise to ensure metadata updates and log file
updates are ordered properly. Demand paging goes through the file
systems and so I subject to whatever ordering the file system wants to
impose.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Manhardt
Sent: Tuesday, April 25, 2006 4:20 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Disk Scheduling Algorithm

That’s helpful and timely responses; thank you both. However, how does
Windows then deal with the situation where demand paging takes priority
over application I/O and where writes are more urgent than reads if the
cache is running out of free pages? Aren’t there situations where the
operating system needs to ensure the order of writes in certain
circumstances to protect the file system due to a system crash?

Thanks again in advance,
Pete


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

> application I/O and where writes are more urgent than reads if the cache is

running out of free pages?

It stalls the apps trying to do cached writes (and dirtying more cache pages)
using CcCanIWrite/CcDeferWrite mechanism.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com