Random Access Memory (RAM) is a block device, why Linux uses a character device file instead of a block device file for user-processes to interface with /dev/mem
?
$ ls -l /dev/mem
crw-r----- 1 root kmem 1, 1 Jul 24 19:05 /dev/mem
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityRandom Access Memory (RAM) is a block device, why Linux uses a character device file instead of a block device file for user-processes to interface with /dev/mem
?
$ ls -l /dev/mem
crw-r----- 1 root kmem 1, 1 Jul 24 19:05 /dev/mem
The answer is in the question: RAM isn’t a block device, it can be accessed and modified without constraints (physically) and doesn’t need any buffering.
/dev/mem
on Linux is handled by drivers/char/mem.c
which implements a number of character devices: /dev/mem
, /dev/kmem
(before 5.13), /dev/null
, /dev/port
, /dev/zero
, /dev/full
, /dev/random
, /dev/urandom
and /dev/kmsg
.