Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 64 bit addressing again



I got this working after a lot of help from this list a couple of months back. If you search the archives for my posts you should see how!

Basically, you need to have a scheme that manages your large blocks of memory. I used C++ objects to do this.

You can use vm_allocate() to allocate blocks. You need to get a memory entry to each allocated block as well using mach_make_memory_entry().

To "purge" a block you use vm_deallocate(). However the block will stay around in the VM system (though not mapped into any processes address space) because of the memory entry you have hold of.

To "restore" a block you use vm_map() to map the memory object back in.

To really delete a block you need to both vm_deallocate() the address (if it is mapped) and dispose the memory entry using mach_port_deallocate().

Some caveats:

- If possible, don't purge blocks unless you need to. There is a cost to remapping the block even if it is in physical memory (each page you touch in the newly mapped block will cause a page fault). I did this by purging blocks only when an allocation fails.

- I tried mmap() but it was more fiddly. The advantage of this scheme is that you don't have to allocate any files - the default pager will do all this for you. I also found that mmap() was significantly slower than this scheme, probable because it was trying to keep data on the disk up to date even though it doesn't have to.

- vm_*() are private functions and could go away in a future version of Mac OS, though this is very unlikely.

Cheers,

Steve.

On 11 Feb 2004, at 16:31, Josh de Cesare wrote:

Andreas,
While there is no way for an application to access more than 4 GB of data at one time, there are way to cheat and keep ~8 GB of data live in memory. mmap can be used to map parts of a large file (data set) into an application. The mappings can be changed at any time. The systems buffer cache will keep any part of the file accessed in memory as long as there is room. Multiple processes can also share the data.
If your application is truly random access this will not work. However it will work for access patterns that are more localized. The window(s) into the file can be moved as the progress needs change.
Josh


At 11:57 AM +0100 2/11/04, Andreas Lachner wrote:
On Tuesday, Sep 16, 2003, at 15:50 US/Eastern, Mike Vannorsdel wrote:

Did anyone see the "Optimizing for the PowerMac G5" article today. It
says:

"Today, Mac OS X provides full 64-bit support in the kernel, the
virtual memory subsystem, the file system, and some additional core
components of the OS."

This seems to imply 64-bit addressing is already there. However, from
discussions in here it seems it's not implemented.

My real question is, does anyone know the lowdown on this; does Mac OS
X currently allow 64-bit addressing and if so, where can one find the
documentation to implement it (allocation functions, compiler flags,
ect.)?

There was an answer: no 64-bit addressing support.

Did it change meanwhile?

How can I address 8 GB of ram at all?

Thanks.

CU
Andreas
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.


--
Steve Baxter
Software Development Manager
Improvision
+44-2476-692229
email@hidden
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.

References: 
 >64 bit addressing again (From: Andreas Lachner <email@hidden>)
 >Re: 64 bit addressing again (From: Josh de Cesare <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.