Hi Greg,
Hi Bou,
Bou wrote:
assume that you have a linux kernel with MMU.
When you are trying to malloc() for a given size (1KB), the memory
returned to you is continuous for your application, e.g you get a
pointer to 0x10000000 and the memory you have been given is
0x10000000-0x10000400
On the RAM chip itself, does it have to be continuous, or the MMU can
gather fragments of smaller pieces and give you the virtual
0x10000000 continuous memory space?
1k is smaller than a page (on most modern architectures anyway),
and you will always be given a physically contiguous 1k region.
Modern paged MMU's work with whole pages for mapping.
Understood. However this was an example. My real concern is about
allocating 2Mbytes, while having 3Mbytes of free memory.
So, the real question is:
When you have 1.5 Mbyte of memory reported from the MMU, can you
malloc 1Mbyte of continuous memory even it may be fragmented?
Yes. The physical page addresses may be fragmented, but the process
virtual address space will see a contiguous region. (*)
Great!
(*) this is ignoring the DMA allocation case in kernel.
Good to have in mind.
Cheers,
Bou
Regards
Greg
------------------------------------------------------------------------
Greg Ungerer -- Chief Software Dude EMAIL: [EMAIL PROTECTED]
SnapGear -- a Secure Computing Company PHONE: +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com
_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev
_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev