Linux - Shared Memory (SHM) (/dev/shm)

About

Shared memory (SHM) in Linux.

The shared memory system can also be used to set permissions on memory.

There are two different types of shared memory implementations:

Management

By default, your operating system includes an entry in /etc/fstab to mount /dev/shm.

File structure

/dev/shm

shm / shmfs is also known as tmpfs.

tmpfs means temporary file storage facility. It is intended to appear as a mounted file system, but one which uses virtual memory instead of a persistent storage device.

How to check its size ?

To check the size of the shared memory file system, enter the following command:

df –k /dev/shm

Limit

To determine current shared memory limits you can use the ipcs command.

ipcs -lm
------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 1073741824
max total shared memory (kbytes) = 17179869184
min seg size (bytes) = 1

Parameters

shmmax

shmmax define the Maximum size (in bytes) for a shared memory segment.

We gan get the parameters limit by using the proc Filesystem such as:

cat /proc/sys/kernel/shmmax
1099511627799

shmall total shared memory avail: 2097152

cat /proc/sys/kernel/shmall
4294967296

  • shmseg - max # of shared memory segs per process: (doesn't exist in FC6)
  • shmmni - max # of shared memory segs system-wide
cat /proc/sys/kernel/shmmni
4096

segments

ipcs -m

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x45110010 1774485506 oracle    660        1048576    2
0x00000000 3112963    oracle    660        67108864   51
0x00000000 3145732    oracle    660        1543503872 51
0x910ac490 3178501    oracle    660        2097152    51
0x6611c0d9 1774518278 oracle    660        126921994088 1                 locked
0x6711c0d9 1774551047 oracle    660        33554432   1
0x1111c0df 1775206408 oracle    660        273722634328 2                 locked
0x1211c0df 1775239177 oracle    660        33554432   2

Process

ipcs -pm
------ Shared Memory Creator/Last-op --------
shmid      owner      cpid       lpid
1774485506 oracle     30581      11420
3112963    oracle     24249      11377
3145732    oracle     24249      11377
3178501    oracle     24249      11377
1774518278 oracle     30572      11420
1774551047 oracle     30572      11420

where:

  • cpid is the process ID of the job that created the shared memory segment.
  • lpid is the process ID of the last job to attach or detach from the shared memory segment or change the semaphore value.

top

SHR – Shared Mem size (kb)

        The  amount of shared memory used by a task.  It simply reflects mem-
        ory that could be potentially shared with other processes.

Documentation / Reference





Discover More
Azure Firewall Public Ip Restriction
Azure - Oracle Database Manually Installation on Linux

The installation of the Oracle database on bare-bone Linux. For a quick an dirty installation, see Creation of a VM with Oracle Linux 7 Update 4 and a Standard_DS1_v2...
Linux - IPCS command

The ipcs command provides information on the ipc facilities. Resources may be specified as follows: -m: shared memory segments -q: message queues -s: semaphore arrays -a: all (this is...
Linux - Memory

Process memory reports on Linux are difficult to interpret for various reasons. One of the main reasons is the way processes can share or re-use memory allocated to another process. Linux normally allocates...
Linux - System V Shared Memory IPC

System V IPC is meant to provide and entire IPC mechanism which provides three methods of communication: message queues, semaphores, and shared memory segments.
Card Puncher Data Processing
SAP ERP 6 EHP5 - Installation Java Linux

can be the same as the must follow the same restriction than the . Using the SAP Management Console (SAP MC) Using commands Installation...
Timesten Component
Timesten - (Memory|Database) (Size|Space|Partition)

TimesTen manages database space using two separate memory partitions within a single contiguous memory space. One partition contains: permanent data and the other contains temporary data. ...
Timesten Component
Timesten - Database Installation and configuration on Linux

On UNIX/Linux systems before installing application, you must in general configure the following: The number of semaphores Allowable shared memory In addition for timesten, you need to perform the...



Share this page:
Follow us:
Task Runner