Re: ReadFileScatter and WriteFileGather
- From: "Slava M. Usov" <stripit.slough@xxxxxxx>
- Date: Wed, 15 Mar 2006 01:27:03 +0100
"Beverly Brown" <beverly.brown@xxxxxxxxx> wrote in message
news:%23Pmjry7RGHA.4688@xxxxxxxxxxxxxxxxxxxxxxx
Looking at the docs for these functions, I see that the buffers in the
array must be page-sized and page-aligned. I haven't quite figured out how
this is useful in a real-world example. Why would an application want
discontiguous page-sized, page-aligned virtual buffers?
Page-aligned page-size buffers can be passed down to bare metal without any
transformations, which is required for maximum efficiency. If you don't care
about this, you should not care about scatter-gather IO, either.
The usefulness of discontiguous buffers cannot be seen in a example that can
be posted here.
One example is a DB server that must cache disk data without using the OS
cache. While the cache is relatively free, you can read contiguous disk data
into contiguous buffers. But eventually the cache will fill up, and then
parts of it will be purged, and you suddenly cannot read contiguous disk
data into contiguous buffers, unless you grow the cache, or de-fragment the
cache, or issue multiple IO requests, or just read contiguous data into
discontiguous buffers. Do I need to explain why the latter option is the
best?
In order to get such an array, VirutalAlloc would need to be called
repeatedly requesting single pages each time.
This can be done, but this is exactly what should not be done. Instead, you
allocate a big contiguous chunk and maintain a free page list/bitmap and use
whatever free pages that happen to be in the list. You do not re-allocate
each time you do IO.
[...]
Also, if the buffers need to be page-aligned as the docs say, why bother
having a member specifying Alignment in the FILE_SEGMENT_ELEMENT
structure?
It is not a structure, it is a union. This element ensures that each element
is 64 bit aligned.
S
.
- Follow-Ups:
- Re: ReadFileScatter and WriteFileGather
- From: Beverly Brown
- Re: ReadFileScatter and WriteFileGather
- References:
- ReadFileScatter and WriteFileGather
- From: Beverly Brown
- ReadFileScatter and WriteFileGather
- Prev by Date: Re: Canceling Overlapped I/O
- Next by Date: Accessing the DEVICE_EXTENSION of a disk
- Previous by thread: ReadFileScatter and WriteFileGather
- Next by thread: Re: ReadFileScatter and WriteFileGather
- Index(es):
Relevant Pages
|