Search code examples
operating-systemcomputer-science

Can an application running on a system with a paging memory management system directly access the physical memory?


In the context of operating systems, does an application have direct access to primary memory?


Solution

  • Speaking from a Linux perspective, assuming we're talking about user-level (non-root) processes, then no they can't directly access physical memory. Nor should they for security and functionality reasons. The whole point of paging is to abstract away physical memory from applications so that they only think they have the entire physical memory, but behind the scenes, their memory may or not be resident in physical memory (see: page faults, non-contiguous allocation, page replacement policies).

    For root processes though, there is at least one way I know of: through /dev/mem. This discussion mentions how to mmap into /dev/mem to get access to specific physical addresses. Use at your own risk though.