Discussion:
allocating contiguous memory in user space
Alessandro Pistocchi
2021-05-16 01:17:03 UTC
Permalink
Hi all,
is there any way in openbsd to allocate contiguous memory pages in user
space?

Thanks,
A
gwes
2021-05-16 06:46:32 UTC
Permalink
Post by Alessandro Pistocchi
Hi all,
is there any way in openbsd to allocate contiguous memory pages in user
space?
Thanks,
A
mmap(2) will give you a block of contiguous virtual pages
mlock(2) will lock them down

The OS tries very hard to conceal physical page addresses
from a user program. There are a number of security attacks
via the virtual memory system which the OS is designed to mitigate.

The physical address of allocated memory is entirely
controlled by the VM system.

Some I/O devices require contiguous physical pages or memory
in a particular region.

In all other cases the physical address of a page doesn't matter,
can't be determined and can be reallocated.

Without more information about your application it's impossible
to give a more complete answer.

Geoff Steckel

Loading...