harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nikolay Kuznetsov" <nikolay.kuznet...@gmail.com>
Subject Re: [drlvm][threading] Is it safe to use hythread_suspend_all and hythread_resume_all?
Date Wed, 18 Oct 2006 11:01:17 GMT

> > first of all I'd like to emphasize that suspend/resume_all functions
> > are potentially unsafe
> > and should be used with care.
> >
> > secondly, those methods were designed mainly to support
> > stop_the_world_enumeration
> > and thus usually being used under certain conditions.
> hmmm... it is strange to hear words like that. TM provides
> specification for this particular method and it should perform
> according to that specification. I as a developer don't want to care
> about particular use case scenario.

I'd say that w/o stop_the_world enumeration we would not include this function
to the interface, and w/o Thread,stop()(which is deprecated and
jvmtiThreadStop which is
used in debugger) we would not include even suspend function to the
interface, like pthread or original version of hythread.

Most of the others implementations have some special notes about suspend:
"This function is primarily designed for use by debuggers. It is not
intended to be used for thread synchronization."

HP pthread_suspend_np(not portable):
"This functionality enables a process that is multithreaded to
temporarily suspend all activity to a single thread of control. When
the process is single threaded, the address space is not changing, and
a consistent view of the process can be gathered."

So, this function is unsafe, and should be used with care and "In
specific, with a solid model of system behavior in mind."(c) Weldon;

And returning to the question of safepoints inside suspend_disable
regions, we have a lot
of such places inside a VM and suspend_all is probably the only place
where this safepoint was left intentionally(I mean cyclic suspends).

> Nikolay, I understand there is only one use case for now. Again I
> expect the method works according to the spec but not how it is used
> in some particular case. Could you clarify what you mean by saying
> "Till now suspend_all method was designed to work within one group(in
> particular default group, containing java
> threads), and called be GC." Why do you have such restriction? Where
> it is specified?

We have such restrictions, because it's extremly hard to implement
common(not only for GC + limited use of TI). The spec on
suspend/suspend_all function usage scenarious can be found at:
drlvm/trunk/vm/thread/doc/ThreadManager.htm paragraphs 6.2 and 6.3

Thank you.

Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org

View raw message