当前位置:   article > 正文

java操作系统进程调度管理,编写一个程序,利用Java语言模拟操作系统进程调度管理...

选择一个调度,编写java语言程序,模拟多道系统中在单处理器情况下的进程控制和进程

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

import java.util.PriorityQueue;

public class Process implements Comparable {

private String name;

private int priority;

public Process(String name, int priority) {

this.name = name;

this.priority = priority;

}

public String toString() {

return "(" + this.name + "," + this.priority + ")";

}

public int compareTo(Process p) {

// TODO Auto-generated method stub

return this.priority - p.priority;

}

}

class Process_ex {

public static void main(String args[]) {

Process process[] = {new Process("A", 4), new Process("B", 3), new Process("C", 5),

new Process("D", 4), new Process("E", 10), new Process("F", 1)

};

PriorityQueue que = new PriorityQueue();

System.out.print("入队进程:");

for (int i = 0; i < process.length; i++) {

que.add(process[i]);

System.out.print(process[i] + "");

}

System.out.print("\n出队进程");

Process p = null;

while (!que.isEmpty())

System.out.print(que.poll());

System.out.println();

}

}

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/151167?site
推荐阅读
相关标签
  

闽ICP备14008679号