Re: I/O Scheduler
Re: I/O Scheduler
- Subject: Re: I/O Scheduler
- From: Phil Jordan <email@hidden>
- Date: Wed, 08 Aug 2012 14:58:15 +0200
Hi Alistair
On Wed, Aug 8, 2012 at 1:44 PM, Alistair Lynn <email@hidden> wrote:
> I've been digging about a little, but to no avail. Whereabouts in the kernel might I find the I/O scheduler?
I assume you mean disk I/O scheduling?
It's a bit dated, but Amit Singh's Mac OS X Internals book mentions
that there is no explicit disk scheduler in OSX. (p. 1366)
Quote:
Note that Mac OS X does not use explicit disk scheduling. In particular,
I/O requests are not explicitly reordered, although the non-I/O Kit parts
of the kernel may defer a request in order to combine several requests
into a single large request.
To the best of my knowledge, nothing has changed about this since
10.4, which was the latest version at the time the book was published.
Maybe someone more knowledgeable can point out where in the VFS/UBC
system the request combining happens - all I can say is I've certainly
seen it in action from the requests it generates. There is also
speculative read-ahead that causes I/O request sizes to grow
exponentially when you read large files sequentially, which is
presumably done in the same place. (you can easily observe this in
action using dd and a filter scheme driver that logs requests)
The IOBlockStorageDriver class (much further down the stack) does
handle request deblocking, that is, ensuring that requests are aligned
to sector boundaries, and splitting them so they don't exceed hardware
limits for maximum request size etc. but that's not really scheduling
as such.
I suspect the reason why Apple never bothered to implement a scheduler
might be that storage devices these days have hardware support for
scheduling requests (SATA NCQ/SCSI TCQ) anyway, and requests to
solid-state storage don't need scheduling anyway. The storage stack
also doesn't support insertion of barriers, which would make
reordering dangerous. (IOStorage::synchronizeCache() essentially acts
as a crude barrier, though its semantics are a little fuzzy - see
darwin-drivers/darwin-kernel list archives from many years ago for
details)
As a comparison, Linux actually disables its I/O scheduler on devices
which support NCQ/TCQ. I think it does the same for non-rotational
devices.
Hope that helps (and I hope I got all of the above right)
phil
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden