linux c 进程间 系统通信
ipcs -h
Usage:
ipcs [resource-option...] [output-option]
ipcs -m|-q|-s -i <id>
Show information on IPC facilities.
Options:
-i, --id <id> print details on resource identified by <id>
-h, --help display this help and exit
-V, --version output version information and exit
Resource options:
-m, --shmems shared memory segments
-q, --queues message queues
-s, --semaphores semaphores
-a, --all all (default)
Output options:
-t, --time show attach, detach and change times
-p, --pid show PIDs of creator and last operator
-c, --creator show creator and owner
-l, --limits show resource limits
-u, --summary show status summary
--human show sizes in human-readable format
-b, --bytes show sizes in bytes
For more details see ipcs(1).
ipcs -a
------ Message Queues --------
key msqid owner perms used-bytes messages
0x200258d4 0 jack 660 0 0
0x6b020001 32769 jack 666 16384 16
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 65536 lightdm 600 524288 2 dest
0x00000000 163841 lightdm 600 524288 2 dest
0x00000000 196610 lightdm 600 67108864 2 dest
0x00000000 327684 lightdm 600 1048576 2 dest
------ Semaphore Arrays --------
key semid owner perms nsems
used-bytes 是总共使用的字节数量
限制
ipcs -l
------ Messages Limits --------
max queues system wide = 32000
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 = 32000
max semaphores per array = 32000
max semaphores system wide = 1024000000
max ops per semop call = 500
semaphore max value = 32767
16384 字节 = 16k字节
ipcs -u
------ Messages Status --------
allocated queues = 2
used headers = 16
used space = 16384 bytes
------ Shared Memory Status --------
segments allocated 4
pages allocated 16896
pages resident 1327
pages swapped 0
Swap performance: 0 attempts 0 successes
------ Semaphore Status --------
used arrays = 0
allocated semaphores = 0