Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Feb 1998 23:05:41 -0700
From:      Nate Williams <nate@mt.sri.com>
To:        "SIVA SANKARAN" <SSANKARA.IN.oracle.com.ofcmail@in.oracle.com>
Cc:        freebsd-java@FreeBSD.ORG
Subject:   Re: TimeSlicing in  JVM
Message-ID:  <199802020605.XAA26684@mt.sri.com>
In-Reply-To: <199802020552.AAA08800@dwarpal.in.oracle.com>
References:  <199802020552.AAA08800@dwarpal.in.oracle.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> 	In the standard JDK code, for Solaris Green-threads the 'Timeslicing' 
> (i.e if more  than one thread, runs at the same priority using Round-Robin 
> method of scheduling) is disabled.

Yes, that is true (for many reasons).

> Therefore other threads, waiting in the 
> Runnable Queue of the same priority of the currently running thread has to 
> wait, till the running thread finishes or yields.  

Right again.

> 	The code is in 
> src/freebsd/java/green_threads/src/clock.c . The function is timeSlicer. But 
> the variable 
> TimeSlice is initialized to 0 (=> no TimeSlice ) 

BTW, this file is an exact copy of the solaris code.  (It's a symlink in
the FreeBSD-JDK development tree.)

> 	Is this the desired behavior. Can I make Round-Robin fashion of 
> scheduling for 
> equal priority threads.

You can try, but how do you propose 'interrupting' a running thread?
Remember, everything runs in a single process space (w/out kernel
threads), and that if a running thread is in a system call there is no
way to pre-empt it reliably.

Because of this 'feature', I suspect the authors gave up trying to
implement a fair-scheduling algorithm, because it would not
deterministic enough due to the above issue (and other similar to it).

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.


Nate



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