Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Feb 1998 23:36:21 -0700
From:      Nate Williams <nate@mt.sri.com>
To:        John Birrell <jb@cimlogic.com.au>
Cc:        nate@mt.sri.com (Nate Williams), SSANKARA.IN.oracle.com.ofcmail@in.oracle.com, freebsd-java@FreeBSD.ORG
Subject:   Re: TimeSlicing in  JVM
Message-ID:  <199802020636.XAA26813@mt.sri.com>
In-Reply-To: <199802020633.RAA00645@cimlogic.com.au>
References:  <199802020605.XAA26684@mt.sri.com> <199802020633.RAA00645@cimlogic.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
> > One of the really nasty things in the current green-thread port which
> > exists on all *nix platforms which don't use kernel threads is that a
> > single thread can sit in a tight loop and never let go, which means that
> > if you have one errant thread your entire VM is hosed.  This is a *bad*
> > thing, but I don't see any way around it w/out kernel support.
> 
> That's not quite true 8-) in all cases. By leaving a timer running, a
> thread running in a tight loop can be interrupted by a SIGVTALRM and the
> user-thread kernel can schedule another thread.  libc_r does this.

I'm with you so far. :)

> So tight loops or thread-hogs are OK provided that the thread doesn't
> hand on to locked resources.

And here-in lies the rub.  Doing this while avoiding races and deadlocks
in 'the hard thing'.  But, now that I've given it more than a nano-cycle
in my brain, it's probably not any harder than doing this sort of thing
with kernel threads, since they also get scheduled while holding onto
locks and such, so this problem must already be solved for the most part
inside of the JDK sources.

So, the moral of the story is to listen to John.  He knows what he's
talking about!

> It's non-blocking syscalls that end in tears.

*grin*

I also remember thinking seriously about this problem after reading a
Java threads book, and they brought up another point that I can't recall
right now that was also one of those 'syscall' types of problems.  If I
remember or find it I'll send something to the list.


Nate



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199802020636.XAA26813>