📄 priority.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -