<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to associate a semaphore with a PID? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751364#M70280</link>
    <description>Im not sure the formatting of my script came out to well when I pasted it so here it is as an attachment.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;Stefan&lt;BR /&gt;</description>
    <pubDate>Tue, 25 Jun 2002 08:48:49 GMT</pubDate>
    <dc:creator>Stefan Farrelly</dc:creator>
    <dc:date>2002-06-25T08:48:49Z</dc:date>
    <item>
      <title>How to associate a semaphore with a PID?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751356#M70272</link>
      <description>Can anybody tell me how can I associate a semaphore with a process ID?&lt;BR /&gt;#ipcs -sa&lt;BR /&gt;ixos3:/ #ipcs -sa&lt;BR /&gt;IPC status from /dev/kmem as of Tue Jun 25 16:29:17 2002&lt;BR /&gt;T      ID     KEY        MODE        OWNER     GROUP   CREATOR    CGROUP NSEMS   OTIME    CTIME&lt;BR /&gt;Semaphores:&lt;BR /&gt;s       0 0x411c38e8 --ra-ra-ra-      root      root      root      root     1 16:56:36 16:56:29&lt;BR /&gt;s       1 0x4e0c0002 --ra-ra-ra-      root      root      root      root     2 16:56:32 16:56:29&lt;BR /&gt;s       2 0x41204618 --ra-ra-ra-      root      root      root      root     2 16:57:48 16:56:30&lt;BR /&gt;s       3 0x01090522 --ra-r--r--      root      root      root      root     1 no-entry 16:57:50&lt;BR /&gt;s       4 0x61204080 --ra-ra-ra-      root      root      root      root     1 16:59:02 16:58:13&lt;BR /&gt;s       5 0x73204080 --ra-ra-ra-      root      root      root      root     1 16:27:07 16:58:13&lt;BR /&gt;s       6 0x70204080 --ra-ra-ra-      root      root      root      root     1 16:59:02 16:58:13&lt;BR /&gt;s       7 0x69204080 --ra-ra-ra-      root      root      root      root     1 16:59:02 16:58:13&lt;BR /&gt;s       8 0x75204080 --ra-ra-ra-      root      root      root      root     1 16:58:14 16:58:13&lt;BR /&gt;s       9 0x63204080 --ra-ra-ra-      root      root      root      root     1 16:58:13 16:58:13&lt;BR /&gt;s      10 0x64204080 --ra-ra-ra-      root      root      root      root     1 16:59:04 16:58:13&lt;BR /&gt;s      11 0x66204080 --ra-ra-ra-      root      root      root      root     1 no-entry 16:58:13&lt;BR /&gt;s      12 0x6c204080 --ra-ra-ra-      root      root      root      root     1 16:59:02 16:58:13&lt;BR /&gt;s      13 0x6d204080 --ra-ra-ra-      root      root      root      root     1 16:27:07 16:58:13&lt;BR /&gt;s      14 0x6f204080 --ra-ra-ra-      root      root      root      root     1 no-entry 16:58:13&lt;BR /&gt;s      15 0x410c0342 --ra-ra-ra-      root      root      root      root     1 16:58:15 16:58:15&lt;BR /&gt;s      16 0x00446f6e --ra-r--r--      root      root      root      root     1 no-entry 16:58:18&lt;BR /&gt;s      17 0x00446f6d --ra-r--r--      root      root      root      root     1 no-entry 16:58:18&lt;BR /&gt;s      18 0x52204080 --ra-ra-ra-      root      root      root      root     1 11:26:22 16:59:04&lt;BR /&gt;s   18219 0xf62f87d8 --ra-ra----    orasmo       dba    orasmo       dba    84 16:29:10 15:28:27&lt;BR /&gt;&lt;BR /&gt;Before I run ipcrm to remove certain crippled semaphore, how do I know it belongs to which process?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;</description>
      <pubDate>Tue, 25 Jun 2002 07:30:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751356#M70272</guid>
      <dc:creator>zhaogui</dc:creator>
      <dc:date>2002-06-25T07:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to associate a semaphore with a PID?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751357#M70273</link>
      <description>Run 'ipcs -ma'. Look for Column CPID (Create Pid). Column LPID shows the last PID to access the area.&lt;BR /&gt;&lt;BR /&gt;'ipcs' man page gives a very good description of these variables.&lt;BR /&gt;&lt;BR /&gt;Share and Enjoy! Ian</description>
      <pubDate>Tue, 25 Jun 2002 07:35:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751357#M70273</guid>
      <dc:creator>Ian Dennison_1</dc:creator>
      <dc:date>2002-06-25T07:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to associate a semaphore with a PID?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751358#M70274</link>
      <description>Hi,&lt;BR /&gt;ipcs -ma shows information on shared memory segments. You can only use ipcs -spc - it shows semaphore creator and owner id.&lt;BR /&gt;&lt;BR /&gt;Later,</description>
      <pubDate>Tue, 25 Jun 2002 07:56:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751358#M70274</guid>
      <dc:creator>Marcin Wicinski</dc:creator>
      <dc:date>2002-06-25T07:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to associate a semaphore with a PID?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751359#M70275</link>
      <description>No process id?</description>
      <pubDate>Tue, 25 Jun 2002 08:06:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751359#M70275</guid>
      <dc:creator>zhaogui</dc:creator>
      <dc:date>2002-06-25T08:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to associate a semaphore with a PID?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751360#M70276</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;See man ipcs.&lt;BR /&gt;&lt;BR /&gt;ipsc -p &lt;BR /&gt;&lt;BR /&gt;T      ID     KEY        MODE        OWNER     GROUP  CPID  LPID&lt;BR /&gt;Shared Memory:                                                  &lt;BR /&gt;m       0 0x2f100002 --rw-------      root      root   382  4066&lt;BR /&gt;m       1 0x411c061a --rw-rw-rw-      root      root   539   539&lt;BR /&gt;m       2 0x4e0c0002 --rw-rw-rw-      root      root   539   539&lt;BR /&gt;m       3 0x41200534 --rw-rw-rw-      root      root   539   551&lt;BR /&gt;m    8196 0x0c6629c9 --rw-r-----      root      root  1546 24873&lt;BR /&gt;m       5 0x06347849 --rw-rw-rw-      root      root  1546  1563&lt;BR /&gt;m       6 0xffffffff --rw-r--rw-      root      root  1526  1526&lt;BR /&gt;m    5127 0xacec9411 --rw-rw-rw-      root      root  1612 17250&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Paula</description>
      <pubDate>Tue, 25 Jun 2002 08:16:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751360#M70276</guid>
      <dc:creator>Paula J Frazer-Campbell</dc:creator>
      <dc:date>2002-06-25T08:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to associate a semaphore with a PID?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751361#M70277</link>
      <description>I think Process ID is only available to Message queue and Shared memory but not Semaphore, am I right?&lt;BR /&gt;&lt;BR /&gt;#ipcs -p&lt;BR /&gt;IPC status from /dev/kmem as of Tue Jun 25 17:21:40 2002&lt;BR /&gt;T      ID     KEY        MODE        OWNER     GROUP LSPID LRPID&lt;BR /&gt;Message Queues:&lt;BR /&gt;q       0 0x3c1c3905 -Rrw--w--w-      root      root     0     0&lt;BR /&gt;q       1 0x3e1c3905 --rw-r--r--      root      root     0     0&lt;BR /&gt;T      ID     KEY        MODE        OWNER     GROUP  CPID  LPID&lt;BR /&gt;Shared Memory:&lt;BR /&gt;m       0 0x411c38e8 --rw-rw-rw-      root      root   810   810&lt;BR /&gt;m       1 0x4e0c0002 --rw-rw-rw-      root      root   810   812&lt;BR /&gt;m       2 0x41204618 --rw-rw-rw-      root      root   810   812&lt;BR /&gt;m   22787 0x2e955e28 --rw-rw----    orasmo       dba 14236  5041&lt;BR /&gt;m    3076 0x00000000 D-rw-------    orasmo       dba 12269 12269&lt;BR /&gt;m       6 0x06347849 --rw-rw-rw-      root       sys 18724  9709&lt;BR /&gt;Semaphores:&lt;BR /&gt;s       0 0x411c38e8 --ra-ra-ra-      root      root&lt;BR /&gt;s       1 0x4e0c0002 --ra-ra-ra-      root      root&lt;BR /&gt;s       2 0x41204618 --ra-ra-ra-      root      root&lt;BR /&gt;s       3 0x01090522 --ra-r--r--      root      root&lt;BR /&gt;s       4 0x61204080 --ra-ra-ra-      root      root&lt;BR /&gt;s       5 0x73204080 --ra-ra-ra-      root      root&lt;BR /&gt;s       6 0x70204080 --ra-ra-ra-      root      root&lt;BR /&gt;s       7 0x69204080 --ra-ra-ra-      root      root&lt;BR /&gt;s       8 0x75204080 --ra-ra-ra-      root      root&lt;BR /&gt;s       9 0x63204080 --ra-ra-ra-      root      root&lt;BR /&gt;s      10 0x64204080 --ra-ra-ra-      root      root&lt;BR /&gt;s      11 0x66204080 --ra-ra-ra-      root      root&lt;BR /&gt;s      12 0x6c204080 --ra-ra-ra-      root      root&lt;BR /&gt;s      13 0x6d204080 --ra-ra-ra-      root      root&lt;BR /&gt;s      14 0x6f204080 --ra-ra-ra-      root      root&lt;BR /&gt;s      18 0x52204080 --ra-ra-ra-      root      root&lt;BR /&gt;s   18219 0xf62f87d8 --ra-ra----    orasmo       dba&lt;BR /&gt;</description>
      <pubDate>Tue, 25 Jun 2002 08:30:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751361#M70277</guid>
      <dc:creator>zhaogui</dc:creator>
      <dc:date>2002-06-25T08:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to associate a semaphore with a PID?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751362#M70278</link>
      <description>Yes -ma and -qa show the pids, -sa and -sp do not show the pids.  You will have to look at the create date/time and compare with that of the process, provided that the process creates the semaphores when it starts up; this is not a foolproof method if lots of processes start up at the same time, all creating semaphores.&lt;BR /&gt;&lt;BR /&gt;Secondly you can look at the semaphore key.  If the process uses the same key for semaphores and shared memory or message queues (which is more likely) then you can use one of the other ipcs commands (like ipcs -ma) cross-reference the KEY and get the pid from that.&lt;BR /&gt;&lt;BR /&gt;It helps to have separate usernames for different shared facilities, or even better, to use commands in your product to show its own semaphore IDs.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 25 Jun 2002 08:40:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751362#M70278</guid>
      <dc:creator>Steve Lewis</dc:creator>
      <dc:date>2002-06-25T08:40:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to associate a semaphore with a PID?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751363#M70279</link>
      <description>&lt;BR /&gt;here is a script which shows you the correct pid using each semaphore. Its slow as it needs to search the kernel tables and structures to match them up, but is the only accurate way I know of finding out the pid;&lt;BR /&gt;&lt;BR /&gt;#semaphores.sh&lt;BR /&gt;if [ `uname -r|grep 11 &amp;gt;/dev/null;echo $?` -eq 0 ]&lt;BR /&gt;then&lt;BR /&gt;/usr/contrib/bin/q4pxdb /stand/vmunix 2&amp;gt;&amp;amp;1|grep "already" &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;if [ $? -ne 0 ]&lt;BR /&gt;then&lt;BR /&gt;   echo "\n/usr/contrib/bin/q4pxdb says /stand/vmunix is not ready for degbugging!"&lt;BR /&gt;   echo "you need to run q4pxdb /stand/vmunix which will create a new vmunix "&lt;BR /&gt;   echo "with debug mode on. Backup your current /stand/vmunix file first!!"&lt;BR /&gt;   echo "Once you have done this you can rerun this script, dont forget to"&lt;BR /&gt;   echo "replace your /stand/vmunix file after running this script.\n"&lt;BR /&gt;   exit 1&lt;BR /&gt;fi&lt;BR /&gt;else&lt;BR /&gt;   /usr/contrib/bin/q4pxdb -s status /stand/vmunix|grep "ready for debug" &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;   if [ $? -ne 0 ]&lt;BR /&gt;   then&lt;BR /&gt;   echo "\n/usr/contrib/bin/q4pxdb says /stand/vmunix is not ready for degbugging!"&lt;BR /&gt;   echo "you need to run q4pxdb /stand/vmunix which will create a new vmunix "&lt;BR /&gt;   echo "with debug mode on. Backup your current /stand/vmunix file first!!"&lt;BR /&gt;   echo "Once you have done this you can rerun this script, dont forget to"&lt;BR /&gt;   echo "replace your /stand/vmunix file after running this script.\n"&lt;BR /&gt;   exit 1&lt;BR /&gt;   fi&lt;BR /&gt;fi&lt;BR /&gt;let V=0&lt;BR /&gt;let LOOP=`ipcs -bs|wc -l`&lt;BR /&gt;let LOOP=$LOOP-3&lt;BR /&gt;ipcs -bs|head -1&lt;BR /&gt;echo "T      ID     KEY        MODE          OWNER   GROUP NSEMS      PID\nSemaphores:"&lt;BR /&gt;ipcs -bs|tail -$LOOP|while read A B C D E F G&lt;BR /&gt;do&lt;BR /&gt;echo "$A $B $C $D $E $F $G \c"&lt;BR /&gt;ied q4 /stand/vmunix /dev/mem &amp;lt;&lt;EOF&gt;/tmp/tmp.$$ 2&amp;gt;/dev/null&lt;BR /&gt;load struct seminfo from &amp;amp;seminfo&lt;BR /&gt;load struct semid_ds from &amp;amp;sema count $LOOP&lt;BR /&gt;keep indexof == $V&lt;BR /&gt;load struct __sem from sem_base&lt;BR /&gt;print sempid&lt;BR /&gt;EOF&lt;BR /&gt;cat /tmp/tmp.$$|grep -v sem&lt;BR /&gt;let V=$V+1&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;/EOF&gt;</description>
      <pubDate>Tue, 25 Jun 2002 08:47:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751363#M70279</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2002-06-25T08:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to associate a semaphore with a PID?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751364#M70280</link>
      <description>Im not sure the formatting of my script came out to well when I pasted it so here it is as an attachment.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;Stefan&lt;BR /&gt;</description>
      <pubDate>Tue, 25 Jun 2002 08:48:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751364#M70280</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2002-06-25T08:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to associate a semaphore with a PID?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751365#M70281</link>
      <description>Im not sure the formatting of my script came out to well when I pasted it so here it is as an attachment.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;Stefan&lt;BR /&gt;</description>
      <pubDate>Tue, 25 Jun 2002 08:49:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751365#M70281</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2002-06-25T08:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to associate a semaphore with a PID?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751366#M70282</link>
      <description>Dont paste the script to a file - you will lose all the tab characters which are essential to the output formatting. Download the semaphores.sh script to a file then run it.&lt;BR /&gt;&lt;BR /&gt;When you run it you will get output like;&lt;BR /&gt;&lt;BR /&gt;IPC status from /dev/kmem as of Tue Jun 25 10:55:36 2002&lt;BR /&gt;T      ID     KEY        MODE          OWNER   GROUP NSEMS      PID&lt;BR /&gt;Semaphores:&lt;BR /&gt;s       0 0x411c061a --ra-ra-ra-        root    root    1       480&lt;BR /&gt;s       1 0x4e0c0002 --ra-ra-ra-        root    root    2       492&lt;BR /&gt;s       2 0x4120036e --ra-ra-ra-        root    root    2       492&lt;BR /&gt;s       3 0x00446f6e --ra-r--r--        root    root    1       593&lt;BR /&gt;s       4 0x00446f6d --ra-r--r--        root    root    1       599&lt;BR /&gt;s       5 0x01090522 --ra-r--r--        root    root    1       636&lt;BR /&gt;s       6 0x612016c4 --ra-ra-ra-        root    root    1       1126&lt;BR /&gt;s       7 0x732016c4 --ra-ra-ra-        root    root    1       12892&lt;BR /&gt;s       8 0x702016c4 --ra-ra-ra-        root    root    1       16663&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 25 Jun 2002 08:55:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751366#M70282</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2002-06-25T08:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to associate a semaphore with a PID?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751367#M70283</link>
      <description>A magic script! Although I don't understand it, I must say it is brilliant! Here is the output on me server,&lt;BR /&gt;#./sem1.sh&lt;BR /&gt;IPC status from /dev/kmem as of Wed Jun 26 08:44:59 2002&lt;BR /&gt;T      ID     KEY        MODE          OWNER   GROUP NSEMS      PID&lt;BR /&gt;Semaphores:&lt;BR /&gt;s       0 0x411c38e8 --ra-ra-ra-        root    root    1       810&lt;BR /&gt;s       1 0x4e0c0002 --ra-ra-ra-        root    root    2       822&lt;BR /&gt;s       2 0x41204618 --ra-ra-ra-        root    root    2       822&lt;BR /&gt;s       3 0x01090522 --ra-r--r--        root    root    1       1242&lt;BR /&gt;s       4 0x61204080 --ra-ra-ra-        root    root    1       1866&lt;BR /&gt;s       5 0x73204080 --ra-ra-ra-        root    root    1       9125&lt;BR /&gt;s       6 0x70204080 --ra-ra-ra-        root    root    1       1866&lt;BR /&gt;s       7 0x69204080 --ra-ra-ra-        root    root    1       1866&lt;BR /&gt;s       8 0x75204080 --ra-ra-ra-        root    root    1       1866&lt;BR /&gt;s       9 0x63204080 --ra-ra-ra-        root    root    1       1866&lt;BR /&gt;s       10 0x64204080 --ra-ra-ra-       root    root    1       2254&lt;BR /&gt;s       11 0x66204080 --ra-ra-ra-       root    root    1       1866&lt;BR /&gt;s       12 0x6c204080 --ra-ra-ra-       root    root    1       1866&lt;BR /&gt;s       13 0x6d204080 --ra-ra-ra-       root    root    1       9125&lt;BR /&gt;s       14 0x6f204080 --ra-ra-ra-       root    root    1       1866&lt;BR /&gt;s       15 0x410c0342 --ra-ra-ra-       root    root    1       1976&lt;BR /&gt;s       16 0x00446f6e --ra-r--r--       root    root    1       2081&lt;BR /&gt;s       17 0x00446f6d --ra-r--r--       root    root    1       2087&lt;BR /&gt;s       18 0x52204080 --ra-ra-ra-       root    root    1       2256&lt;BR /&gt;s       18219 0xf62f87d8 --ra-ra----    orasmo  dba     84      14236&lt;BR /&gt;&lt;BR /&gt;But when I run ps -ef|grep 14236, it says the process does not exist, why? Is it because this is an old process and it has become a history?  Some processes do exist but how do I verify them? How do I know whether or not a process did create a particular semaphore?  Sorry for my ignorance of semaphore.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 25 Jun 2002 23:52:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751367#M70283</guid>
      <dc:creator>zhaogui</dc:creator>
      <dc:date>2002-06-25T23:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to associate a semaphore with a PID?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751368#M70284</link>
      <description>&lt;BR /&gt;Yes, some of the pids listed may well have died by the time you use ps to view them. But the kernel doesnt lie - these were the pids that created these semaphores (the output from this script comes direct from the running kernel). &lt;BR /&gt;&lt;BR /&gt;Sometimes semaphores are not cleaned up properly if processes didnt die properly (in which case you can use the ipcrm command to remove them) but the above script is accurate.&lt;BR /&gt;&lt;BR /&gt;Dont forget to assign points.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;Stefan&lt;BR /&gt;HPO&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Jun 2002 06:07:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751368#M70284</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2002-06-26T06:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to associate a semaphore with a PID?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751369#M70285</link>
      <description>[This response talks mainly about semaphores, but is equally applicable to other IPC facilities, i.e. messages and shared-memory segments.]&lt;BR /&gt;&lt;BR /&gt;As other have, implicitly or explicitly, indicated, IPC resources like semaphores are not owned by *processes*, but by *users*.&lt;BR /&gt;&lt;BR /&gt;So 'the system' can not clean up 'left-over' semaphores and neither can the user, at least not without *additional* information about the allocation, use and deallocation.&lt;BR /&gt;&lt;BR /&gt;Why? Because it is perfectly OK for a process (A) to allocate a semaphore and then terminate. So there is *no* (relevant) process, but still the semaphore can not be deallocated, because at anytime a process (A, B, whatever) could come along that wants to use the semaphore.&lt;BR /&gt;&lt;BR /&gt;So basically, the documentation of the application should document how *this* application allocates, uses and deallocates IPC resources like semaphores and how 'left-over' IPC resources should be determined/deallocated.&lt;BR /&gt;&lt;BR /&gt;What is normally the problem is that someone/something has abnormally terminated (i.e. kill, etc.) one or more processes which are supposed to deallocate (semctl(..., IPC_RMID)) semaphores ), so they remain allocated but not used. &lt;BR /&gt;&lt;BR /&gt;If you do not have the above mentioned application documentation, you can do the following to *try* to solve *future* occurences of the problem:&lt;BR /&gt;&lt;BR /&gt;Use "ipcs -a" to make 'reference listings' (in files) of different stages of system use, i.e. after boot, after starting applicationA, after starting applicationB, after starting a second instance of applicationA, etc., etc..&lt;BR /&gt;&lt;BR /&gt;This will give an indication of which software is using which IPC facilities. Then, if there is a problem with running out of IPC resources, you can check if the ipcs list still matches what you expect.&lt;BR /&gt;&lt;BR /&gt;Now when you have 'too many' semaphores, you *probably* can figure out which ones are left-over by comparing the current ipcs output to your reference list. If unsure, don't ipcrm the semaphore! If you are sure, pray, do the ipcrm and hope for the best!&lt;BR /&gt;&lt;BR /&gt;Be aware that this method is a hack, not guaranteed and possibly dangerous. I do not support it and neither does HP.&lt;BR /&gt;&lt;BR /&gt;Moral: Do not use "kill -&lt;DANGEROUS_OPTION&gt;" et al, or be prepared for the consequences! :-) Note that depending on the process, "&lt;DANGEROUS_OPTION&gt;" may be as innocently-looking as "HUP", etc.! If the documentation of a particular process does not specifically say so, then do *not* assume that intr, quit or "kill -&lt;ANY_SIGNAL&gt;" is safe!&lt;BR /&gt;&lt;BR /&gt;*If* you 'have to' kill a process, then *document* what you did (i.e. process numbers and program names/paths/parameters (parent, children, etc.), when you did it and why.&lt;BR /&gt;&lt;BR /&gt;&lt;/ANY_SIGNAL&gt;&lt;/DANGEROUS_OPTION&gt;&lt;/DANGEROUS_OPTION&gt;</description>
      <pubDate>Thu, 27 Jun 2002 11:16:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-associate-a-semaphore-with-a-pid/m-p/2751369#M70285</guid>
      <dc:creator>Frank Slootweg</dc:creator>
      <dc:date>2002-06-27T11:16:04Z</dc:date>
    </item>
  </channel>
</rss>

