首页 > 代码库 > IPC介绍——10个ipcs例子

IPC介绍——10个ipcs例子

IPC介绍——10个ipcs例子semaphorearrays2010performancesystemaccessipcs是一个uinx/linux的命令。用于报告系统的消息队列、信号量、共享内存等1、列出所有的ipcs参数: -a    他是默认选项及ipcs等效于ipcs -a[root@test ~]# ipcs -a------ Shared Memory Segments --------key        shmid      owner      perms      bytes      nattch     status     0x00000000 0          root       644        52         2                      0x00000000 32769      root       644        16384      2                      0x00000000 65538      root       644        268        2                     ------ Semaphore Arrays --------key        semid      owner      perms      nsems    0x00000000 0          root       600        1        0x00000000 98305      root       600        1        0x000000a7 131074     root       600        1       ------ Message Queues --------key        msqid      owner      perms      used-bytes   messages 2、列出进程中的消息队列: -q当前范例中为空[root@test ~]# ipcs -q------ Message Queues --------key        msqid      owner      perms      used-bytes   messages 3、列出所有的信号量: -s[root@test ~]# ipcs -s------ Semaphore Arrays --------key        semid      owner      perms      nsems    0x00000000 0          root       600        1        0x00000000 98305      root       600        1        0x000000a7 131074     root       600        1 4、列出所有的共享内存信息: -m[root@test ~]# ipcs -m------ Shared Memory Segments --------key        shmid      owner      perms      bytes      nattch     status     0x00000000 0          root       644        52         2                      0x00000000 32769      root       644        16384      2                      0x00000000 65538      root       644        268        2       5、要列出进程更详细信息: -i+pid[root@test ~]# ipcs -m -i 32769Shared memory Segment shmid=32769uid=0   gid=0   cuid=0  cgid=0mode=0644       access_perms=0644bytes=16384     lpid=1051       cpid=1047       nattch=2att_time=Fri Aug 13 09:10:30 2010 det_time=Fri Aug 13 09:10:30 2010 change_time=Fri Aug 13 09:10:30 2010 6、列出系统中的限额: -l(列出全部,也可指定要查看的限额)[root@test ~]# ipcs -l------ Shared Memory Limits --------max number of segments = 4096max seg size (kbytes) = 32768max total shared memory (kbytes) = 8388608min seg size (bytes) = 1------ Semaphore Limits --------max number of arrays = 128max semaphores per array = 250max semaphores system wide = 32000max ops per semop call = 32semaphore max value = 32767------ Messages: Limits --------max queues system wide = 998max size of message (bytes) = 8192default max size of queue (bytes) = 16384 7、列出创建者以及属主的uid和gid: -c[root@test ~]# ipcs -c------ Shared Memory Segment Creators/Owners --------shmid      perms      cuid       cgid       uid        gid      0          644        root       root       root       root     32769      644        root       root       root       root     65538      644        root       root       root       root    ------ Semaphore Arrays Creators/Owners --------semid      perms      cuid       cgid       uid        gid      0          600        root       root       root       root     98305      600        root       root       root       root     131074     600        root       root       root       root    ------ Message Queues: Creators/Owners --------msqid      perms      cuid       cgid       uid        gid 8、列出最后的访问时间: -t[root@test ~]# ipcs -t------ Shared Memory Attach/Detach/Change Times --------shmid      owner      attached             detached             changed           0          root       Aug 13 09:10:30      Aug 13 09:10:30      Aug 13 09:10:30   32769      root       Aug 13 09:10:30      Aug 13 09:10:30      Aug 13 09:10:30   65538      root       Aug 13 09:10:30      Aug 13 09:10:30      Aug 13 09:10:30   ------ Semaphore Operation/Change Times --------semid    owner      last-op                    last-changed             0        root        Fri Aug 13 09:10:19 2010   Fri Aug 13 09:10:16 2010 98305    root        Fri Aug 13 09:10:24 2010   Fri Aug 13 09:10:20 2010 131074   root        Fri Aug 13 09:10:32 2010   Fri Aug 13 09:10:30 2010------ Message Queues Send/Recv/Change Times --------msqid    owner      send                 recv                 change 9、列出创建者和对应的进程id: -p [root@test ~]# ipcs -p------ Shared Memory Creator/Last-op --------shmid      owner      cpid       lpid     0          root       1047       1051     32769      root       1047       1051     65538      root       1047       1051 10、列出当前的使用状况: -u[root@test ~]# ipcs -u------ Shared Memory Status --------segments allocated 3pages allocated 6pages resident  6pages swapped   0Swap performance: 0 attempts     0 successes------ Semaphore Status --------used arrays = 3allocated semaphores = 3------ Messages: Status --------allocated queues = 0used headers = 0used space = 0 bytes1、列出所有的ipcs参数: -a    他是默认选项及ipcs等效于ipcs -a[root@test ~]# ipcs -a------ Shared Memory Segments --------key        shmid      owner      perms      bytes      nattch     status     0x00000000 0          root       644        52         2                      0x00000000 32769      root       644        16384      2                      0x00000000 65538      root       644        268        2                      ------ Semaphore Arrays --------key        semid      owner      perms      nsems    0x00000000 0          root       600        1        0x00000000 98305      root       600        1        0x000000a7 131074     root       600        1        ------ Message Queues --------key        msqid      owner      perms      used-bytes   messages2、列出进程中的消息队列: -q当前范例中为空[root@test ~]# ipcs -q------ Message Queues --------key        msqid      owner      perms      used-bytes   messages3、列出所有的信号量: -s[root@test ~]# ipcs -s------ Semaphore Arrays --------key        semid      owner      perms      nsems    0x00000000 0          root       600        1        0x00000000 98305      root       600        1        0x000000a7 131074     root       600        14、列出所有的共享内存信息: -m[root@test ~]# ipcs -m------ Shared Memory Segments --------key        shmid      owner      perms      bytes      nattch     status     0x00000000 0          root       644        52         2                      0x00000000 32769      root       644        16384      2                      0x00000000 65538      root       644        268        2      5、要列出进程更详细信息: -i+pid[root@test ~]# ipcs -m -i 32769Shared memory Segment shmid=32769uid=0   gid=0   cuid=0  cgid=0mode=0644       access_perms=0644bytes=16384     lpid=1051       cpid=1047       nattch=2att_time=Fri Aug 13 09:10:30 2010 det_time=Fri Aug 13 09:10:30 2010 change_time=Fri Aug 13 09:10:30 20106、列出系统中的限额: -l(列出全部,也可指定要查看的限额)[root@test ~]# ipcs -l------ Shared Memory Limits --------max number of segments = 4096max seg size (kbytes) = 32768max total shared memory (kbytes) = 8388608min seg size (bytes) = 1------ Semaphore Limits --------max number of arrays = 128max semaphores per array = 250max semaphores system wide = 32000max ops per semop call = 32semaphore max value = 32767------ Messages: Limits --------max queues system wide = 998max size of message (bytes) = 8192default max size of queue (bytes) = 163847、列出创建者以及属主的uid和gid: -c[root@test ~]# ipcs -c------ Shared Memory Segment Creators/Owners --------shmid      perms      cuid       cgid       uid        gid      0          644        root       root       root       root     32769      644        root       root       root       root     65538      644        root       root       root       root     ------ Semaphore Arrays Creators/Owners --------semid      perms      cuid       cgid       uid        gid      0          600        root       root       root       root     98305      600        root       root       root       root     131074     600        root       root       root       root     ------ Message Queues: Creators/Owners --------msqid      perms      cuid       cgid       uid        gid8、列出最后的访问时间: -t[root@test ~]# ipcs -t------ Shared Memory Attach/Detach/Change Times --------shmid      owner      attached             detached             changed            0          root       Aug 13 09:10:30      Aug 13 09:10:30      Aug 13 09:10:30    32769      root       Aug 13 09:10:30      Aug 13 09:10:30      Aug 13 09:10:30    65538      root       Aug 13 09:10:30      Aug 13 09:10:30      Aug 13 09:10:30    ------ Semaphore Operation/Change Times --------semid    owner      last-op                    last-changed             0        root        Fri Aug 13 09:10:19 2010   Fri Aug 13 09:10:16 2010 98305    root        Fri Aug 13 09:10:24 2010   Fri Aug 13 09:10:20 2010 131074   root        Fri Aug 13 09:10:32 2010   Fri Aug 13 09:10:30 2010 ------ Message Queues Send/Recv/Change Times --------msqid    owner      send                 recv                 change9、列出创建者和对应的进程id: -p [root@test ~]# ipcs -p------ Shared Memory Creator/Last-op --------shmid      owner      cpid       lpid     0          root       1047       1051     32769      root       1047       1051     65538      root       1047       105110、列出当前的使用状况: -u[root@test ~]# ipcs -u------ Shared Memory Status --------segments allocated 3pages allocated 6pages resident  6pages swapped   0Swap performance: 0 attempts     0 successes------ Semaphore Status --------used arrays = 3allocated semaphores = 3------ Messages: Status --------allocated queues = 0used headers = 0used space = 0 bytes1、列出所有的ipcs参数: -a    他是默认选项及ipcs等效于ipcs -a[root@test ~]# ipcs -a------ Shared Memory Segments --------key        shmid      owner      perms      bytes      nattch     status     0x00000000 0          root       644        52         2                      0x00000000 32769      root       644        16384      2                      0x00000000 65538      root       644        268        2                      ------ Semaphore Arrays --------key        semid      owner      perms      nsems    0x00000000 0          root       600        1        0x00000000 98305      root       600        1        0x000000a7 131074     root       600        1        ------ Message Queues --------key        msqid      owner      perms      used-bytes   messages2、列出进程中的消息队列: -q当前范例中为空[root@test ~]# ipcs -q------ Message Queues --------key        msqid      owner      perms      used-bytes   messages3、列出所有的信号量: -s[root@test ~]# ipcs -s------ Semaphore Arrays --------key        semid      owner      perms      nsems    0x00000000 0          root       600        1        0x00000000 98305      root       600        1        0x000000a7 131074     root       600        14、列出所有的共享内存信息: -m[root@test ~]# ipcs -m------ Shared Memory Segments --------key        shmid      owner      perms      bytes      nattch     status     0x00000000 0          root       644        52         2                      0x00000000 32769      root       644        16384      2                      0x00000000 65538      root       644        268        2      5、要列出进程更详细信息: -i+pid[root@test ~]# ipcs -m -i 32769Shared memory Segment shmid=32769uid=0   gid=0   cuid=0  cgid=0mode=0644       access_perms=0644bytes=16384     lpid=1051       cpid=1047       nattch=2att_time=Fri Aug 13 09:10:30 2010 det_time=Fri Aug 13 09:10:30 2010 change_time=Fri Aug 13 09:10:30 20106、列出系统中的限额: -l(列出全部,也可指定要查看的限额)[root@test ~]# ipcs -l------ Shared Memory Limits --------max number of segments = 4096max seg size (kbytes) = 32768max total shared memory (kbytes) = 8388608min seg size (bytes) = 1------ Semaphore Limits --------max number of arrays = 128max semaphores per array = 250max semaphores system wide = 32000max ops per semop call = 32semaphore max value = 32767------ Messages: Limits --------max queues system wide = 998max size of message (bytes) = 8192default max size of queue (bytes) = 163847、列出创建者以及属主的uid和gid: -c[root@test ~]# ipcs -c------ Shared Memory Segment Creators/Owners --------shmid      perms      cuid       cgid       uid        gid      0          644        root       root       root       root     32769      644        root       root       root       root     65538      644        root       root       root       root     ------ Semaphore Arrays Creators/Owners --------semid      perms      cuid       cgid       uid        gid      0          600        root       root       root       root     98305      600        root       root       root       root     131074     600        root       root       root       root     ------ Message Queues: Creators/Owners --------msqid      perms      cuid       cgid       uid        gid8、列出最后的访问时间: -t[root@test ~]# ipcs -t------ Shared Memory Attach/Detach/Change Times --------shmid      owner      attached             detached             changed            0          root       Aug 13 09:10:30      Aug 13 09:10:30      Aug 13 09:10:30    32769      root       Aug 13 09:10:30      Aug 13 09:10:30      Aug 13 09:10:30    65538      root       Aug 13 09:10:30      Aug 13 09:10:30      Aug 13 09:10:30    ------ Semaphore Operation/Change Times --------semid    owner      last-op                    last-changed             0        root        Fri Aug 13 09:10:19 2010   Fri Aug 13 09:10:16 2010 98305    root        Fri Aug 13 09:10:24 2010   Fri Aug 13 09:10:20 2010 131074   root        Fri Aug 13 09:10:32 2010   Fri Aug 13 09:10:30 2010 ------ Message Queues Send/Recv/Change Times --------msqid    owner      send                 recv                 change9、列出创建者和对应的进程id: -p [root@test ~]# ipcs -p------ Shared Memory Creator/Last-op --------shmid      owner      cpid       lpid     0          root       1047       1051     32769      root       1047       1051     65538      root       1047       105110、列出当前的使用状况: -u[root@test ~]# ipcs -u------ Shared Memory Status --------segments allocated 3pages allocated 6pages resident  6pages swapped   0Swap performance: 0 attempts     0 successes------ Semaphore Status --------used arrays = 3allocated semaphores = 3------ Messages: Status --------allocated queues = 0used headers = 0used space = 0 bytes1、列出所有的ipcs参数: -a    他是默认选项及ipcs等效于ipcs -a[root@test ~]# ipcs -a------ Shared Memory Segments --------key        shmid      owner      perms      bytes      nattch     status     0x00000000 0          root       644        52         2                      0x00000000 32769      root       644        16384      2                      0x00000000 65538      root       644        268        2                      ------ Semaphore Arrays --------key        semid      owner      perms      nsems    0x00000000 0          root       600        1        0x00000000 98305      root       600        1        0x000000a7 131074     root       600        1        ------ Message Queues --------key        msqid      owner      perms      used-bytes   messages2、列出进程中的消息队列: -q当前范例中为空[root@test ~]# ipcs -q------ Message Queues --------key        msqid      owner      perms      used-bytes   messages3、列出所有的信号量: -s[root@test ~]# ipcs -s------ Semaphore Arrays --------key        semid      owner      perms      nsems    0x00000000 0          root       600        1        0x00000000 98305      root       600        1        0x000000a7 131074     root       600        14、列出所有的共享内存信息: -m[root@test ~]# ipcs -m------ Shared Memory Segments --------key        shmid      owner      perms      bytes      nattch     status     0x00000000 0          root       644        52         2                      0x00000000 32769      root       644        16384      2                      0x00000000 65538      root       644        268        2      5、要列出进程更详细信息: -i+pid[root@test ~]# ipcs -m -i 32769Shared memory Segment shmid=32769uid=0   gid=0   cuid=0  cgid=0mode=0644       access_perms=0644bytes=16384     lpid=1051       cpid=1047       nattch=2att_time=Fri Aug 13 09:10:30 2010 det_time=Fri Aug 13 09:10:30 2010 change_time=Fri Aug 13 09:10:30 20106、列出系统中的限额: -l(列出全部,也可指定要查看的限额)[root@test ~]# ipcs -l------ Shared Memory Limits --------max number of segments = 4096max seg size (kbytes) = 32768max total shared memory (kbytes) = 8388608min seg size (bytes) = 1------ Semaphore Limits --------max number of arrays = 128max semaphores per array = 250max semaphores system wide = 32000max ops per semop call = 32semaphore max value = 32767------ Messages: Limits --------max queues system wide = 998max size of message (bytes) = 8192default max size of queue (bytes) = 163847、列出创建者以及属主的uid和gid: -c[root@test ~]# ipcs -c------ Shared Memory Segment Creators/Owners --------shmid      perms      cuid       cgid       uid        gid      0          644        root       root       root       root     32769      644        root       root       root       root     65538      644        root       root       root       root     ------ Semaphore Arrays Creators/Owners --------semid      perms      cuid       cgid       uid        gid      0          600        root       root       root       root     98305      600        root       root       root       root     131074     600        root       root       root       root     ------ Message Queues: Creators/Owners --------msqid      perms      cuid       cgid       uid        gid8、列出最后的访问时间: -t[root@test ~]# ipcs -t------ Shared Memory Attach/Detach/Change Times --------shmid      owner      attached             detached             changed            0          root       Aug 13 09:10:30      Aug 13 09:10:30      Aug 13 09:10:30    32769      root       Aug 13 09:10:30      Aug 13 09:10:30      Aug 13 09:10:30    65538      root       Aug 13 09:10:30      Aug 13 09:10:30      Aug 13 09:10:30    ------ Semaphore Operation/Change Times --------semid    owner      last-op                    last-changed             0        root        Fri Aug 13 09:10:19 2010   Fri Aug 13 09:10:16 2010 98305    root        Fri Aug 13 09:10:24 2010   Fri Aug 13 09:10:20 2010 131074   root        Fri Aug 13 09:10:32 2010   Fri Aug 13 09:10:30 2010 ------ Message Queues Send/Recv/Change Times --------msqid    owner      send                 recv                 change9、列出创建者和对应的进程id: -p [root@test ~]# ipcs -p------ Shared Memory Creator/Last-op --------shmid      owner      cpid       lpid     0          root       1047       1051     32769      root       1047       1051     65538      root       1047       105110、列出当前的使用状况: -u[root@test ~]# ipcs -u------ Shared Memory Status --------segments allocated 3pages allocated 6pages resident  6pages swapped   0Swap performance: 0 attempts     0 successes------ Semaphore Status --------used arrays = 3allocated semaphores = 3------ Messages: Status --------allocated queues = 0used headers = 0used space = 0 bytes转载自:http://blog.csdn.net/i_am_jojo/article/details/7697155也可参考http://blog.csdn.net/henulwj/article/details/8181957

 

IPC介绍——10个ipcs例子