On Mon, Aug 23, 2010 at 12:00 PM, Michael Torrie <[email protected]> wrote:
> On 08/23/2010 11:59 AM, Michael Torrie wrote:
> > Unlikely. On CPUS that have virtual memory tables, *every* page access
> > goes through the virtual memory system.
>
> Well actually I am just giving a guess as well. I really don't know the
> answer to your question. So I could be completely wrong.
I'm pretty confident you are right. AJ, I suggest you use malloc or
whatever. malloc will allocate a chunk of memory that is contiguous from
the software's perspective, and there will be no significant penalty
regardless what your memory subsystem is doing.
What you /do/ with that contiguous block is a different matter entirely. If
you malloc 100MB, don't treat it all as equivalent. A lot of sparse
operations is not a great idea - here is a great bad example.
for(int j = 0; j<pagesize; j++) {
for(int i = 0; i<sizeof(mem)/pagesize; i++){
op(mem[ptr+pagesize*i+j]);
}
}
David
--------------------
BYU Unix Users Group
http://uug.byu.edu/
The opinions expressed in this message are the responsibility of their
author. They are not endorsed by BYU, the BYU CS Department or BYU-UUG.
___________________________________________________________________
List Info (unsubscribe here): http://uug.byu.edu/mailman/listinfo/uug-list