In userspace Linux, I have a process blocking on a semaphore, as found by strace. Once the error condition occurs, the blocking is repeatable, so there must be another process that holds the semaphore and did not release it.
Is there a way to know which other process is currently holding the semaphore?
ipcs
lists the semaphore, so does /proc/sysvipc/sem. Where can I find info on the holding process?
Advertisement
Answer
Semaphores aren’t mutexes. You don’t “hold” them. If the process is blocked, that means it’s waiting for someone else to do an “up” or “V” operation on it in the future. There’s no kernel tool that will tell you what the future behavior of software will be.