The Linux operating system has a limit on the size of shared memory. To find out what that is, we can use the ipcs command:
The E unit may look a little unfamiliar. It's in exabytes, which basically mean 18 zeros: kilo, mega, giga, tera, peta, and exa. Get it? So, we're in luck here, because the limit is so high that we will probably never reach. However, if you see a small number, then you may need to reconfigure the system. The three kernel parameters are as follows:
- Maximum number of segments (SHMMNI)
- Maximum segment size (SHMMAX)
- Maximum total shared memory (SHMALL)
We can find out the actual values using the sysctl command:
To adjust the values, we can again use the sysctl command. For example, to set the maximum segment size (shmmax) to 128 GiB, we can do the following:
We can see that the kernel setting is now updated.