On Sat, Jun 07, 2036 at 07:48:37PM -0700, Joseph Shraibman wrote:
> Run the following with green threads and you get only H's. Run it with native
> threads and you get H's mixed with L's
The native threading mechanism on Linux doesn't offer many thread
priority choices (run "man pthread_attr_init" and scroll down to the
info on "schedpolicy") - and processes not running as root have even
fewer choices (just one!). There's not much the JVM can do about this.
Nathan
>
>
> /**
> * threadtest.java
> *
> *
> * Created: Mon May 1 15:35:45 2000
> *
> * @author Joseph Shraibman
> * @version 1.0
> */
>
> public class threadtest {
>
> public threadtest() {}
>
> public Runnable getWT(String name){
> return new workThread(name);
> }
>
> class workThread implements Runnable{
> String name;
> public workThread(String n){name = n;}
> public void run(){
> //Thread.yield();
> while(true){
> System.out.print(name);
> System.out.flush();
> }
> }
> }
>
> public static void main(String[] args){
>
> threadtest tt = new threadtest();
>
> Thread t1 = new Thread(tt.getWT("H"));
> Thread t2 = new Thread(tt.getWT("L"));
>
>
> t2.setPriority( t2.getPriority() -1);
> t2.start();
> t1.start();
>
> }
>
>
> } // threadtest
>
> ____________________________________________________________________
> Get your own FREE, personal Netscape WebMail account today at
>http://webmail.netscape.com.
>
>
> ----------------------------------------------------------------------
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]