I am having an amiguity as to what the maximum value in shmmax should be set.

After having a look at my system's statistics, it shows the following:

#cat /proc/sys/kernel/shmmax 

#ipcs -l

------ Messages Limits --------
max queues system wide = 3675
max size of message (bytes) = 8192
default max size of queue (bytes) = 16384

------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 18014398509465599
max total shared memory (kbytes) = 18014398442373116
min seg size (bytes) = 1

------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 32
semaphore max value = 32767

Ideally the value of shared memory should not exceed the actual RAM size (Which comes to be 21474836480 bytes). Then is this thing possible? Or is this a garbage value.

  • Why do you even care about those values? Most systems are never going to hit those limits anyway. – kasperd Jul 1 '17 at 22:41
  • Was looking for the values and came across these. Hence, was curious as to why those are more the actual RAM? Now, since I got the confirmation that those are garbage values it's OK with me. – Parth Pathak Aug 2 '17 at 13:18

The value you show: 18446744073692774399

corresponds to: 0xFFFFFFFFFEFFFFFF

or 1111 1111 1111 1111 1111 1111 1111 1111 63 47 1111 1110 1111 1111 1111 1111 1111 1111 31 15

so it is not exactly the maximum value of 64 bit unsigned integer, but almost.


I'm googling for your question and found only documentation how to configure shmmax and shmall parameters. Best one was in this answer. So for your question, if your shmmax set to higher value, more then you have RAM, it's garbage value, system don't allow to use for shared memory more then you have RAM (don't know about swap).


The default is set at the maximum possible unsigned long on a 64 bit system (2^64) = 18446744073709551616 (minus some essential memory space I'm guessing).

If the maximum shared RAM value is > the actual RAM, that just means all the available RAM can be shared. You can always lower it, but by default it is (close to) everything.

They bit shift 1 unsigned long by 24 (1UL << 24) = 16777216, then subtract that from the theoretical maximum which gives you the value.

18446744073709551616 - 16777217 = 18446744073692774399

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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