process.java

来自「操作系统实验的进程管理源代码」· Java 代码 · 共 40 行

JAVA
40
字号
package algo;
public class process extends Thread implements Resource {
	int Max[];
	int Need[]=new int[kinds];
	int Allocation[];
	int prime=0;
	String name="unnamed";
	public process(){
		Max=new int[kinds];
		Allocation=new int[kinds];
		Need=new int[kinds];
	}
	public void run(){
	}
	public process(int[] max ){
		this.Max=max;
		this.newNeed();
	}
	public process(int[] max,int[] allocation){
		for(int i=0;i<kinds;i++){
			if(max[i]<allocation[i]){
				System.out.println("alocation["+i+"] larger than max ");
				return;
			}
		}
		if(max.length==allocation.length){
		this.Max=max;
		this.Allocation=allocation;	
		this.newNeed();
		}
		else
		System.out.println("unfit!");
			
	}
	public void newNeed(){
		for(int i=0;i<kinds;i++){
			Need[i]=Max[i]-Allocation[i];
		}
	}
}

⌨️ 快捷键说明

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