?? sjfprocessschedule.java~4~
字號:
package cn.edu.cauc.crab.ossimulate;/** * <p>Title: OS simulate</p> * <p>Description: This is my home work.</p> * <p>Copyright: Copyleft (c) 2004</p> * <p>Company: CAUC</p> * @author Crab * @version 0.1 *//** * To simulate short process first process scheduling. * * @author Crab * @version 0.1 * @see cn.edu.cauc.crab.ossimulate.ProcessSchdule */public class SPFProcessSchedule extends ProcessSchedule { /** * extends from ProcessSchedule a List named PCBs */ public SPFProcessSchedule() { super(); } /** * extends from ProcessSchedule * After addProcess() is calling, * use to start scheduling. */ public void start() { int time = 0;//set the beging time while (!PCBs.isEmpty()) { PCB pcb = (PCB)PCBs.get(0);//get the fist come process PCBs.remove(0);// remove it from PCBs after finish. if (time >= pcb.arriveTime) {// the process must run >= arrive time pcb.beginTime = time; time += pcb.serveTime; pcb.finishTime = time; pcb.rollTime = pcb.finishTime - pcb.arriveTime; // use tr ts to rise the precesion. float tr = pcb.rollTime; float ts = pcb.serveTime; pcb.nullWorkRate = tr / ts; System.out.println("Arrive: " + pcb.arriveTime + " Serve: " + pcb.serveTime + " Finish: " + pcb.finishTime + " Roll: " + pcb.rollTime + " nullWorkRate: " + pcb.nullWorkRate); } } } public static void main(String[] args) { SPFProcessSchedule SPFProcessSchedule1 = new SPFProcessSchedule(); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -