Operating System - HP-UX
1833732 Members
2398 Online
110063 Solutions
New Discussion

Process ID for a particular semaphore

 
Binu_5
Regular Advisor

Process ID for a particular semaphore

Hi All
Can I find the PID of the proceess which is holding the shd ID in HPUX
My problem is if I want to remove
the shemaphores from the memmory using
ipcrm -m shmid it doent remove ...
So I thought of kill the process which is holding the semphore

Thanks
Binu
5 REPLIES 5
Florian Heigl (new acc)
Honored Contributor

Re: Process ID for a particular semaphore

ipcs -p will list the last process to access the shm segment, You should be able to find it from here.

Also, from what I read one has to remove the shm key, not the id.

good luck :)
yesterday I stood at the edge. Today I'm one step ahead.
Binu_5
Regular Advisor

Re: Process ID for a particular semaphore

Hi Florian


ipcs -p give the folloing output
root@pdlint01 root]# ipcs -p

------ Shared Memory Creator/Last-op --------
shmid owner cpid lpid
32768 root 4509 4512


------ Message Queues PIDs --------
msqid owner lspid lrpid

[root@pdlint01 root]# kill -9 4509
[root@pdlint01 root]# ipcs -p

------ Shared Memory Creator/Last-op --------
shmid owner cpid lpid

491520 root 18457 18460

How can I SEE THE pid ???
Thanks
Binu

Rajesh SB
Esteemed Contributor

Re: Process ID for a particular semaphore

Hi,

Better you can use command ipcs with -a option it shows with detailed columns. So that easily you can trace the LPID and kill by noticing the ownership of process.

# ipcs -a
where,
LPID: The process ID of the last process to attach or detach the shared memory segment.

Regards,
Rajesh
Uday_S_Ankolekar
Honored Contributor

Re: Process ID for a particular semaphore

If you have access to Knowledge base there is a detailed instruction to how how to fine PID associated with semaphore with the help of a script and "ipcs -s -a" output
Here is the link

http://www2.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000079989616

Goodluck

-USA..
Good Luck..
Uday_S_Ankolekar
Honored Contributor

Re: Process ID for a particular semaphore


Read as "how to find" and not ..how how to fine!

Good Luck..