歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> Linux操作系統ipcs命令

Linux操作系統ipcs命令

日期:2017/3/1 14:50:59   编辑:關於Linux
Linux操作系統ipcs命令 ipcs: 主要提供調用進程讀取訪問一些ipc設備信息.如:共享內存,信號量,消息隊列 ipcs [ -asmq ] [ -tclup ] ipcs [ -smq ] -i id -m 輸出共享內存(shared memory segments)的信息 -s 輸出信號量(semaphore)的信息 -q 輸出消息隊列(message queues)的信息 -l limits 01 [email protected]:log# ipcs 02 03 ------ Shared Memory Segments -------- 04 key shmid owner perms bytes nattch status 05 06 ------ Semaphore Arrays -------- 07 key semid owner perms nsems 08 0x00002af9 131072 db 664 1 09 0x00002afb 163841 db 664 1 10 0x00002b03 65538 db 664 1 11 0x00002b05 98307 db 664 1 12 13 ------ Message Queues -------- 14 key msqid owner perms used-bytes messages 其中Key為應用程序存取資源使用的參數,id為資源條目的唯一標示號. 例如實際情況可能會遇到db用戶程序是用root賬戶啟動,這時首先root賬戶關掉db用戶的程序,但共享內存有可能未釋放,需要手動刪除.這就要用到ipcrm 命令. ipcrm - remove a message queue, semaphore set or shared memory id ipcrm [ -M key | -m id | -Q key | -q id | -S key | -s id ] -m shmid -q msqid -s semid 01 [email protected]:log# ipcs -s 02 03 ------ Semaphore Arrays -------- 04 key semid owner perms nsems 05 0x00002af9 131072 db 664 1 06 0x00002afb 163841 db 664 1 07 0x00002b03 65538 db 664 1 08 0x00002b05 98307 db 664 1 09 10 [email protected]:log# ipcrm -s 131072 11 [email protected]:log# ipcrm -s 163841 12 [email protected]:log# ipcrm -s 65538 13 [email protected]:log# ipcrm -s 98307 14 15 [email protected]:~# ipcs 16 17 ------ Shared Memory Segments -------- 18 key shmid owner perms bytes nattch status 19 20 ------ Semaphore Arrays -------- 21 key semid owner perms nsems 22 23 ------ Message Queues -------- 24 key msqid owner perms used-bytes messages 01 [email protected]:~# ipcs -l 02 03 ------ Shared Memory Limits -------- 04 max number of segments = 4096 05 max seg size (kbytes) = 32768 06 max total shared memory (kbytes) = 8388608 07 min seg size (bytes) = 1 08 09 ------ Semaphore Limits -------- 10 max number of arrays = 128 11 max semaphores per array = 250 12 max semaphores system wide = 32000 13 max ops per semop call = 32 14 semaphore max value = 32767 15 16 ------ Messages: Limits -------- 17 max queues system wide = 16 18 max size of message (bytes) = 8192 19 default max size of queue (bytes) = 16384 有2種方法改變其值 1.更改/etc/sysctl.conf ,添加kernel.msgmni = 1024,生效加載配置使用sysctl -p kernel.msgmni 該文件指定消息隊列標識的最大數目,即系統范圍內最大多少個消息隊列。 1 [email protected]:~# cat /proc/sys/kernel/msgmni 2 16 3 [email protected]:~# vim /etc/sysctl.conf 4 [email protected]:~# sysctl -p 5 kernel.msgmni = 1024 6 [email protected]:~# cat /proc/sys/kernel/msgmni 7 1024 2.在root下使用sysctl命令,直接生效. 1 [email protected]:~# sysctl -w kernel.msgmni=16 2 kernel.msgmni = 16 3 [email protected]:~# cat /proc/sys/kernel/msgmni 4 16
Copyright © Linux教程網 All Rights Reserved