The file /dev/mem is a special file that is an image of the physical memory of the computer. The file /dev/kmem is a special file
that is an image of the kernel virtual memory of the computer. Either may be used, for example, to examine, and even patch the system.
Byte addresses in /dev/mem are interpreted as physical memory addresses. Byte addresses in /dev/kmem are interpreted as kernel virtual memory addresses. References
to non-existent locations cause errors to be returned.
The file /dev/kmem accesses up to 4GB of kernel virtual memory. The file /dev/mem accesses physical memory; the size of the file is equal to the amount of
physical memory in the computer. This can be larger than 4GB; in which case, memory beyond 4GB can be accessed using a series of read(2) and write(2)
commands or a combination of llseek(2) and read(2) and write(2).