64位Linux机器中最大可能的共享内存大小 [英] Max possible shared memory size in 64-bit Linux machine
问题描述
我有64位Linux计算机(Intel Xeon L5410 @ 2.33GHz)。
I have 64-bit Linux machine(Intel Xeon L5410 @ 2.33GHz).
**meminfo:**
MemTotal: 24672736 kB
MemFree: 145372 kB
Buffers: 181896 kB
Cached: 22004648 kB
SwapCached: 195072 kB
Active: 9761028 kB
Inactive: 13964532 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 24672736 kB
LowFree: 145372 kB
SwapTotal: 17414452 kB
SwapFree: 15618852 kB
Dirty: 2125148 kB
Writeback: 0 kB
AnonPages: 1358396 kB
Mapped: 1069632 kB
Slab: 699464 kB
CommitLimit: 29750820 kB
Committed_AS: 9236252 kB
PageTables: 38620 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 17272 kB
VmallocChunk: 34359718843 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
Hugepagesize: 2048 kB
**Also the shm details are:**
shmall 2097152
shmmax 3294967296
shmmni 4096
我正在尝试在上方创建共享内存2 GB,shmget成功,但是后来发生核心转储,并显示无法访问内存的错误。
2GB以下的共享内存可以很好地工作。
我可以找到任何有效的原因,因为我的shmmax值约为3GB
I am trying to create shared memory above 2 GB, shmget is successful but later core dump occurs with the error that cannot access memory. While shared memory below 2GB works perfectly fine. I am able to find any valid reason for this as my shmmax value is around 3GB
推荐答案
最大 shm
的内存大小可以通过 / proc / sys / kernel / shmmax
获得,您可以写入该伪文件进行更改。它可能无法提高到物理RAM的某一部分(例如一半)以上。也许某些内核配置可以改变这种情况。
the maximum shm
memory size is available thru /proc/sys/kernel/shmmax
and you could write into that pseudo-file to change it. It probably cannot be raised above some portion (e.g. half) of physical RAM. Perhaps some kernel configuration can change that.
您还可以与 mmap 系统调用,带有 MAP_SHARED
标志。
You can also share memory with the mmap syscall with MAP_SHARED
flag.
这篇关于64位Linux机器中最大可能的共享内存大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!