4

According to the rhel document, the total amount of shared memory available on the system equals to shmall*PAGE_SIZE. After I completed the installation of RHEL6, the value of the shmall kernel parameter defaults to 4294967296,which means that the total amount of shared memory pages that can be used system wide is 4294967296, and the page size is 4096B. So, based on the formula, the size of shared memory is

4294967296*4096/1024/1024/1024/1024=16TB

which is much more than the size of RAM(8GB) the operating system has.How an os can find 16TB shared memory to allocate?

So, is the size of /dev/shm actually equal to the size of shared memory? If not, how can I get the actual size of shared memory?

  • Please don't ask multiple questions in a single post. I have removed the second one, you can ask it as a separate question. Also, please edit your question and i) clarify why you say the system has less memory than what you show. What kind of memory are you referring to? How do you measure it? ii) How do you get 16TB from your formula? What you show is 16 gigabits, not 16 terabytes. – terdon Nov 2 '16 at 9:24
0

Your calculation is correct. shmall can be set higher than the available virtual memory. If you would try to use all of it then it would not fail because of shmall is exceeded but because of other reasons.

BTW there are also commands to find these IPC limits:

ipcs -l
lsipc  # util-linux>=2.27

Note that even the virtual memory is unlimited on Linux by default, greater-than RAM+swap. See

https://serverfault.com/questions/606185/how-does-vm-overcommit-memory-work

How the OOM killer decides which process to kill first?

On the other hand you could limit the virtual memory per process using ulimt -v which wouldn't affect kernel's /proc/sys/kernel/shmall neither.

  • the result of ipcs -l is depend on the setting shmall,it does not show the real limits – user4535727 Nov 2 '16 at 11:42
  • @user4535727 Probably a bug because of integer overflow. Maybe it's correct for smaller values echo $(( 1024*1024*1024 )) > /proc/sys/kernel/shmall; ipcs -l – rudimeier Nov 2 '16 at 11:59

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.