can application find out the physical address of it's buffer ?

May 09, 2007 2 Replies

Hello,



I would appreciate any help regarding the following problem.



I am writing user-space application, and I need to allocate moderately sized (few KBytes) buffer in such a way that my application knows which physical address the allocated buffer resides at.



The related question is, how can I lock the allocated buffer in RAM so that it will not be swapped out when my application exhaust it's time slice and is scheduled off the CPU, and will still be at the same physical address when my application will get back on the CPU.



Any advice is greatly appreciated.



Thanks and regards, Andray


The mlock() function might be of help here.

:wq ^X^Cy^K^X^C^C^C^C

I would work on the opposite direction: Reserve an area in physical memory for your buffer, and map it into the application's virtual memory using mmap(). The first step could be done by telling the kernel that it has less memory than what is physically available and using areas beyond that value for the buffer.

Roberto Waltman

[ Please reply to the group, return address is invalid ]

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required