LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Physical memory request to Linux Kernel (https://www.linuxquestions.org/questions/linux-newbie-8/physical-memory-request-to-linux-kernel-618995/)

tanmay.anjaria 02-06-2008 12:30 AM

Physical memory request to Linux Kernel
 
Hello,

I am running a multithreaded program for which I'm in need of acquiring some physical memory from linux kernel.

malloc() gives virtually memory mapped memory and then MMU translates that into physical memory...

Can someone show me the way to allocate Physical memory directly on linux? (without routing through virtual)

Thanks,
Tanmay

sundialsvcs 02-06-2008 08:11 AM

You can't do that.

All of the memory seen by any user process is virtual memory. And this is actually what you want.

The illusion that is presented to your program is that memory is big and that memory is "all yours." Behind the scenes, the kernel makes sure that this illusion is maintained, separately, for each and every user-program. It uses physical memory and disk-space to achieve that, and you can be assured that it will do that in the most-optimal manner possible under prevailing conditions.

tanmay.anjaria 02-06-2008 11:31 PM

Thanks for the reply...

I had the doubt that it may not be possible... but now the question is how do I make sure that my application 'thinks' that it has got its own memory area...

will "mmap" or "mlock" help me in this?


All times are GMT -5. The time now is 07:10 PM.