Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Advanced-java] Thread synchronization question.
- From: chase@xxxxxxxxxxxxx (David Chase)
- Subject: [Advanced-java] Thread synchronization question.
- Date: Wed, 30 Jan 2002 16:51:49 -0500
At 12:44 PM 1/30/2002 -0800, Hemendra Rana wrote: >Is it possible from the java code (not a profiler): > >1. Given an object, to find out what thread has taken a lock on the object. >2. Given a thread, to find out what all objects is it holding locks on. Except in the thread that is holding the lock, or if the thread holding the lock is stopped (deadlocked, blocked on another lock, or suspended) the question is not even well-defined. By the time you get your answer, it may have changed (and, as an implementer of such things, I have seen it this sort of change occur). And, in the case that the answer is well-defined, whether it can efficiently be answered depends upon the implementation. For example, in the VM that I've worked on, question #1 is easily answered, but question #2 is more difficult (one technique for implementing question #2 is to iterate over all the live locals in the stack, and for each one, ask question #1. With a precise GC, we know that the live-locals information is available, though not necessarily at the Java level, and we know that if a lock is held in non-native code, then it will be a live local in some frame). David
- References:
- [Advanced-java] Thread synchronization question.
- From: Hemendra Rana
- [Advanced-java] Thread synchronization question.
- Prev by Date: [Advanced-java] Thread synchronization question.
- Next by Date: [Advanced-java] RMI and Dynamic Class loading
- Previous by thread: [Advanced-java] Thread synchronization question.
- Next by thread: [Advanced-java] RMI and Dynamic Class loading
- Index(es):