NonStop Server for Java 4.2 Programmer's Reference
 private final static int NUMRUNNERS = 2;
 public static void main(String[] args) {
 SelfishRunner[] runners=new SelfishRunner[NUMRUNNERS];
 for (int i = 0; i < NUMRUNNERS; i++) {
 runners[i] = new SelfishRunner(i);
 runners[i].setPriority(2);
 }
 for (int i = 0; i < NUMRUNNERS; i++)
 runners[i].start();
 }
}
SelfishRunner.java
public class SelfishRunner extends Thread {
 private int tick = 1;
 private int num;
 public SelfishRunner(int num) {
 this.num = num;
 }
 public void run() {
 while (tick < 400000) {
 tick++;
 if ((tick % 50000) == 0)
 System.out.println("Thread #"+num+", tick = "+tick);
 }
 }
}
On the NonStop system, the execution of threads is not time-sliced. Messages from one thread precede those from
the other thread as shown below for thread 0 and thread 1.
Thread #0, tick = 50000
Thread #0, tick = 100000
Thread #0, tick = 150000
Thread #0, tick = 200000
Thread #0, tick = 250000
Thread #0, tick = 300000
Thread #0, tick = 350000
Thread #0, tick = 400000
Thread #1, tick = 500000
Thread #1, tick = 100000
Thread #1, tick = 150000










