Friday, April 25, 2014
How to clean up semaphores
A. Identify all semaphores
ipcs -a
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 9043975 yingbin 600 160525768 1 dest
0x00000000 9306129 yingbin 600 160525768 1 dest
0x00000000 9076754 yingbin 600 160525768 1 dest
------ Semaphore Arrays --------
key semid owner perms nsems
0x00000000 17924096 yingbin 600 25
0x00000000 17956865 yingbin 600 25
0x00000000 17989634 yingbin 600 1
0x00000000 17137682 yingbin 600 25
0x00000000 17170451 yingbin 600 25
0x00000000 17203220 yingbin 600 1
0x00000000 17235992 yingbin 600 25
0x00000000 17268761 yingbin 600 25
0x00000000 17301530 yingbin 600 1
------ Message Queues --------
key msqid owner perms used-bytes messages
B. Identify the process ID (pid) that are associated with the semaphores
ipcs -s -i 17301530
Semaphore Array semid=17301530
uid=1005 gid=100 cuid=1005 cgid=100
mode=0600, access_perms=0600
nsems = 1
otime = Mon Apr 7 09:27:24 2014
ctime = Mon Apr 7 09:27:24 2014
semnum value ncount zcount pid
0 1000 0 0 27036
C. Find if the process 27036 is still active or has been killed.
ps -ef |grep 27036
D. If the process has been killed, the associated semaphores can be safely cleaned.
ipcrm -s 17301530
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment