priority.java

来自「模拟操作系统的进程调用」· Java 代码 · 共 29 行

JAVA
29
字号
public class PriorityTime {
	private List threadList = new List( "时间片调用" );
	private Inform thread1 , thread2 , thread3 , thread4;
	private JTextArea output;
	
	public PriorityTime {
    Inform thread1 = new Inform( "进程1" , (int)Math.random()*100 , (int)Math.random() , (int)Math.random()*3 );
    Inform thread2 = new Inform( "进程2" , (int)Math.random()*100 , (int)Math.random() , (int)Math.random()*3 );
    Inform thread3 = new Inform( "进程3" , (int)Math.random()*100 , (int)Math.random() , (int)Math.random()*3 );
    Inform thread4 = new Inform( "进程4" , (int)Math.random()*100 , (int)Math.random() , (int)Math.random()*3 );
	String s = thread1.getname();
	threadList.insertAtFront( thread1 );
	threadList.insertAtFront( thread2 );
	threadList.insertAtFront( thread3 );
	threadList.insertAtFront( thread4 );
	
	output = new JTextArea();
	output.append( thread1.getname() + "优先级为"+thread1.getpriority() + " 占用cup时间为"+thread1.gettimecpu()+"进程运行时间"+thread1.getusetime()+"状态"+thread1.getstatus() );
	output.append( thread2.getname() + "优先级为"+thread2.getpriority() + " 占用cup时间为"+thread2.gettimecpu()+"进程运行时间"+thread2.getusetime()+"状态"+thread2.getstatus() );
	output.append( thread3.getname() + "优先级为"+thread3.getpriority() + " 占用cup时间为"+thread3.gettimecpu()+"进程运行时间"+thread3.getusetime()+"状态"+thread3.getstatus() );
	output.append( thread4.getname() + "优先级为"+thread4.getpriority() + " 占用cup时间为"+thread4.gettimecpu()+"进程运行时间"+thread4.getusetime()+"状态"+thread4.getstatus() );
	}
	
	public void start()
	{
		
	   
	 
}

⌨️ 快捷键说明

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