⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 processschedule.java

📁 进程调度和存储管理模拟
💻 JAVA
字号:
package cn.edu.cauc.crab.ossimulate;import java.util.*;/** * <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 *//** * PCB for scheduling. * just use for scheduling. * * @author Crab * @version 0.1 */class PCB {    //init when the process arrive    Process process;    int pid;    int arriveTime;// when process add to queue.    int serveTime;// the cpu time process need.    int leftTime;// left how long the process will end.    int beginTime;// when process beging to work.    int finishTime;// process finish the work.    int rollTime;// = finishTime - arriveTime    float nullWorkRate;// = rollTime / serveTime    //for responsibility    int waitTime;    float responsibility = 0;// = (waitTime + serveTime) / serveTime}/** * To simulate process scheduling. * * @author Crab * @version 0.1 */abstract public class ProcessSchedule {    List PCBs;// pcb container    int pid = 0;    public ProcessSchedule() {        PCBs = new LinkedList();    }    public void addProcess(Process process, int arriveTime) {        PCB pcb = new PCB();        pcb.process = process;        pcb.pid = pid++;        pcb.arriveTime = arriveTime;        pcb.serveTime = process.getTime();        pcb.leftTime = pcb.serveTime;        PCBs.add(pcb);    }    abstract public void start();    /*    //For the Unit test.    public static void main(String[] args) {        ProcessSchedule pSch = new ProcessSchedule();        pSch.addProcess(new Process(10), 5);        PCB pcb = (PCB)pSch.PCBs.get(0);        System.out.println(pcb.arriveTime);    }    */}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -