Shared Memory is created using shmget(2) and not with filesystem operations. So what is the specific purpose of /run/shm as opposed to that of /run ?

Neither the Filesystem Hierarchy Standard FHS contains information about it, nor do the Ubuntu version of hier(7) or Wikipedia.

share|improve this question
up vote 1 down vote accepted

/run/shm which was previously /dev/shm is temporary world-writable shared-memory. It is strictly intended as storage for programs using the POSIX Shared Memory API. Itmake possible 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 too.

share|improve this answer
    
A search for "POSIX Shared Memory API" reveals man 7 shm_overview. Citation from there: On Linux, shared memory objects are created in a (tmpfs) virtual filesystem, normally mounted under /dev/shm. ... System V shared memory (shmget(2), shmop(2), etc.) is an older shared memory API. POSIX shared memory provides a simpler, and better designed interface; on the other hand POSIX shared memory is somewhat less widely available (especially on older systems) than System V shared memory. – Juergen Feb 5 '16 at 11:32
    
This answer was essentially copied from askubuntu.com/questions/169495/… without attribution. – Mokubai Feb 26 '16 at 19:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.