Thanks sedj for taking time to help out...
I 've made the change as suggested I still got the error...this is the piece of code after the change..
public PCB popFront()
{
int time[] = new int[4];
PCB p = null;
int shorttime = 0;
int temptime = 0;
if(vReady.size() == 0)
return null;
else
{
PCB pcb = (PCB) vReady.elementAt(0);
for (int i=0; i < vReady.size(); ++i){
p = (PCB) vReady.get(i);
time = p.getHistory();
temptime = time;
if ((temptime < shorttime) || (i == 0)) {
shorttime = temptime;
pcb = p;
}
}
vReady.remove(pcb);
return pcb;
}
}
*************************************
Exception: java.lang.ArrayIndexOutOfBoundsException: 4
java.lang.ArrayIndexOutOfBoundsException: 4
at opsys.sched.cpu.STSchedSJF.popFront(STSchedSJF.java:59)
at opsys.sched.Kernel.runKernel(Kernel.java:114)
at opsys.sched.CPU.clockTick(CPU.java:95)
at opsys.sched.Sim.doSim(Sim.java:82)
at opsys.sched.SimTrend.<init>(SimTrend.java:109)
at opsys.sched.SimSet.<init>(SimSet.java:36)
at opsys.sched.cpu.STSchedSJF.main(STSchedSJF.java:77)
**********************************************************
As for vReady ,it is use as Vector...
private Vector vReady = new Vector();
PCB is short for process control block ..
and pcb.history..everytime FIFO is run , record or histroy will be created.
thanks again