Thanks Peter for the extra detail.

I thought there may have been something more mysterious going on. But it sounds 
like it was just the semantics of the term "use".

Cheers
Aaron

On 18/02/2011, at 9:25 PM, Peter Schuller <peter.schul...@infidyne.com> wrote:

>> main argument for using mmap() instead of standard I/O is the fact
>> that reading entails just touching memory - in the case of the memory
>> being resident, you just read it - you don't even take a page fault
>> (so no overhead in entering the kernel and doing a semi-context
>> switch).
> 
> Oh and in the case of Java/Cassandra, as Jonathan clued me in on
> earlier, there is also the issue that byte[] arrays are mandated to be
> zeroed when allocated which causes overhead typically because there
> has to be a loop[1] somewhere writing a bunch of zeroes in, that
> you're then just going to replace immediately. Mapping a file has no
> such implications as long as you read directly from the underlying
> direct ByteBuffer.
> 
> [1] Not *necessarily*; a JVM could theoretically do byte[] allocations
> in such a way that it already knows the contents is zeroed, but it
> would be highly dependent on the GC/memory management technique used
> by the JVM whether this is practical. (It just occurred to me that
> Azul should get this for 'free' in their GC. Wonder if that's true.)
> 
> -- 
> / Peter Schuller

Reply via email to