I just want to know where and how /run/lock
and /run/shm
can help our PC .
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 56G 13G 41G 24% /
udev 983M 4.0K 983M 1% /dev
tmpfs 396M 840K 395M 1% /run
none 5.0M 8.0K 5.0M 1% /run/lock
none 990M 164K 990M 0% /run/shm
/run
is, in general, a temporary filesystem (tmpfs) residing in RAM (aka "ramdisk"); its meant for storing "temporary" system or state files which may be critical but do not require persistence across reboots./run
is actually a fairly new innovation, and was added a couple of years ago to replace the multiple tmpfs's that used to be created (including/var/lock
and/dev/shm
) with a single unified root tmpfs./run
replaces are:/run/lock
(formerly/var/lock
) contains lock files, i.e. files indicating that a shared device or other system resource is in use and containing the identity of the process (PID) using it; this allows other processes to properly coordinate access to the shared device./run/shm
(formerly/dev/shm
) is temporary world-writable shared-memory. Strictly speaking, it is intended as storage for programs using the POSIX Shared Memory API. It facilitates what is known as inter-process communication (IPC), where different processes can share and communicate via a common memory area, which in this case is usually a normal file that is stored on a "ramdisk". Of course, it can be and has been used in other creative ways as well ;)Do not be alarmed about the size: importantly, many people running
df -h
and knowing that/run
is backed by RAM are shocked that their precious memory is being "wasted" by these mysterious folders. Just like the Linux ate my RAM myth though, this belief is incorrect.ipcs -m
command to verify that the actual shared memory segments used match up to thedf
summary, and also see which PIDs are using them/run
is also eventually backstopped by your swap, so if you are using/run/shm
for "faster" compile times, keep that in mind ;)