Passing tokens between threads

Y. Srinivas Ramakrishna y.s.ramakrishna at
Thu May 6 16:11:04 PDT 2010

Tony -- let us say the set T of all mutator threads is
partitioned into disjoint clusters {T_k}, i.e. T = U_k {T_k},
and for each i, j. T_i \intersect T_k = \empty. I am guessing that
once a thread t_i becomes a member of a cluster T_k, it stays in
that cluster until it dies, and that as threads are created
they either become members of existing clusters or start new clusters?

Is it the case that there is a single "token" per each cluster,
and each member of the cluster knows the id of any other member to
which it wants to pass the token?

Is that a reasonable description of yr "communication architecture"?

PS: what is the token used for? is it like a capability or a mutual
exclusion token?

I am not sure I understand what is meant by "thread triggering relationship"
or "how to co-relate two threads together"? Are you talking about how
to take two arbitrary threads and tell them they are part of
a cluster and given them the address of the token that they will

Anyway, a clear statement of what you want to do would
probably allow you to find the solution to the problem you are
trying to solve. (i.e. ask the right questions and the answer
will reveal itself.)

best wishes!
-- ramki

On 05/06/10 11:59, Tony Guan wrote:
> Hi David,
> Thanks for the reply.
> Actually, my aim is to manipulate the mutator threads inside the VM,
> because my project is to cluster some threads together, to allocate
> the objects from the same group(not the ThreadGroup) in certain area
> of the heap.
> Inside the VM, I don't quite know how to co-relate two thread together
> based on the thread triggering relationship.  This is what I am trying
> to figure out.
> Thanks again!
> Tony (Xiaohua Guan)
> On Wed, May 5, 2010 at 8:28 PM, David Holmes <David.Holmes at> wrote:
>> Tony,
>> Tony Guan said the following on 05/05/10 02:03:
>>> In my current project, I need to be able to pass tokens between
>>> certain threads inside VM. While it's easy when Thread A is directly
>>> calling the Thread B's start().
>>> But usually, the thread B is not directly created and started by
>>> thread A, for example, thread pooling. In this case, if I need to pass
>>> a token from thread A to thread B(which is triggered by A), I guess I
>>> will need to monitor the object that B is waiting on.
>>> While I am still pondering over this, is there any other advice?
>> I don't quite understand what you are asking. In shared-memory
>> multi-threading the primary communication path between threads is
>> shared-memory. So passing a "token" is a matter of writing some data into a
>> memory location known to both threads. Then it is just a matter of how much
>> encapsulation/abstraction you want to put around that memory location.
>> David Holmes

More information about the hotspot-runtime-dev mailing list