madvise(ptr, len, MADV_SEQUENTIAL)

Alan Bateman Alan.Bateman at Sun.COM
Tue Jun 16 05:53:55 PDT 2009


Jason Rutherglen wrote:
> Thanks Alan. 
>
> I cross posted this to the Lucene dev list where we are discussing 
> using madvise for minimizing unnecessary IO cache usage when merging 
> segments (where we really want the newly merged segments in the IO 
> cache rather than the old segment files). 
>
> How would the advise method work?  Would there need to be a hint in 
> the FileChannel.map method?
>
> -J
If we add it then it would probably be a new method on MappedByteBuffer 
that takes a range and an enum constant (that is the usage hint) as 
parameters. This would be slightly more flexible than specifying a hint 
for the entire region when mapping. Also, it would be awkward to 
retrofit MapMode to include hints because the parameter is a constant 
rather than a set of modes.

-Alan.





More information about the nio-discuss mailing list