harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Weldon Washburn" <weldon...@gmail.com>
Subject Re: [drlvm][threading] Is it safe to use hythread_suspend_all and hythread_resume_all?
Date Tue, 17 Oct 2006 23:07:10 GMT
On 10/17/06, Nikolay Kuznetsov <nikolay.kuznetsov@gmail.com> wrote:
>
> > The simplest model is to grab the thread lock whenever thread A wants to
> > suspend thread B at a safepoint.  While this serializes thread
> suspension
> > and can potentially be a bottleneck, let's wait until its a proven
> > performance problem to change this model.  For thread A to be ready to
> grab
> > the thread lock, thread A must have all its java live references put in
> a
> > place where the GC will see them.  Why?  Because thread A may
> block.  Once
> > thread A obtains the lock, it can disable suspension if it likes, reload
> the
> > java live refs and do whatever it needs but make certain it is quick and
> non
> > blocking.  If thread A needs to block on some OS call, etc, it will need
> to
> > re-enable suspension and abandon the thread lock.  Why? Because if
> thread A
> > blocks while holding the global thread lock, there may be deadlock or
> > latency problems.
> >
> >
> > Did you try the above approach?  ARe there deadlocks?
>
> I wonder if suspend_disable call can be treated as a thread lock and
> if yes we do have nearly the same scheme related to stop_the_world
> suspension.


hmm.... I never thought of it that way.  My initial reaction is no.  Suspend
enable/disable and global thread lock are seperate, distinct concepts.  The
thread lock should protect the VM internal thread structs when they
are being modified.   For example, the thread lock should allow only
one thread create/die at any given instant.  The enable/disable state is
incidental to this event. This is independent of the concept of a thread
running native code being in a state where the GC can find all its live
references.  If a thread needs to grab the thread lock, of course, it needs
to put itself in a suspend enable mode because it might have to wait for the
lock.

Nik.
>
> ---------------------------------------------------------------------
> 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
>
>


-- 
Weldon Washburn
Intel Middleware Products Division

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message