Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What exactly are shmpages in the grand scheme of kernel and memory terminology. If I'm hitting a shmpages limit, what does that mean?

I'm also curious if this applies to more than linux

share|improve this question
up vote 10 down vote accepted

User mode processes can use Interprocess Communication (IPC) to communicate with each other, the fastest method of achieving this is by using shared memory pages (shmpages).
This happens for example if banshee plays music and vlc plays a video, both processes have to access pulseaudio to output some sound.

Try to find out more about shared memory configuration and usage with some of the following commands:

Display the shared memory configuration:

sysctl kernel.shm{max,all,mni}

By default (Linux 2.6) this should output:

kernel.shmmax = 33554432
kernel.shmall = 2097152
kernel.shmmni = 4096

shmmni is the maximum number of allowed shared memory segments, shmmax is the allowed size of a shared memory segment (32 MB) and shmall is the maximum total size of all segments (displayed as pages, translates to 8 GB)

The currently used shared memory:

grep Shmem /proc/meminfo

If enabled by the distribution:

ls -l /dev/shm

ipcs is a great tool to find out more about IPC usage:

ipcs -m 

will output the shared memory usage, you can see the allocated segments with the corresponding sizes.

ipcs -m -i <shmid>

shows more information about a specified segment including the PID of the process creating (cpid) and the last (lpid) using it.

ipcrm can remove shared memory segments (but be aware that those are only get removed if no other processes are attached to them, see the nattach column in ipcs -m).

ipcrm -m <shmid>

Running out of shared memory could be a program heavily using a lot of shared memory, a program which does not detach the allocated segments properly, modified sysctl values, ...

This is not Linux specific and also applies to (most) UNIX systems (shared memory first appeared in CB UNIX).

share|improve this answer
A nitpick: use this command to find the currently used shared memory instead: grep Shmem /proc/meminfo This prevents a UUC (Useless Use of Cat ...) – Mei Feb 4 '12 at 2:20
Wow, great detailed answer, lots of little gems here :D – Gearoid Murphy Apr 6 '12 at 10:52

Your Answer


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.