/**This class serves as the Global Name Server(GNS). It also sends out message requesting *the PEs to compute their local min time, based on which it will compute the GVT. * *@version 1.9 (09/2006) *@author Yin Xiong */ public class Controller implements Runnable{ /** all the PEs in this simulation */ int sleepTime=500; Flag eosFlag=new Flag(); boolean endOfSim=false; Flag gvtFlag=new Flag(); boolean timeForGvt=false; PE[] PEs; int newGVT; /** * Constructer. */ public Controller(PE[] pes, Flag ef, Flag gf) { PEs=pes; eosFlag=ef; gvtFlag=gf; }//end constructor /** * Implements TimerTask's abstract run method. */ public void run(){ try{ while(!endOfSim){ if(gvtFlag.get()>0){ System.out.println("\nIt's time to compute GVT..."); newGVT=computeGVT(); System.out.println("new GVT: " + newGVT); //broadcast the new GVT for(int i=0;i