2022年操作系统进程调度用java写的源代码 .pdf
《2022年操作系统进程调度用java写的源代码 .pdf》由会员分享,可在线阅读,更多相关《2022年操作系统进程调度用java写的源代码 .pdf(24页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、操作系统进程调度用java 写的源代码package tc; public class Begin public static void main(String args) new MyFrame(); package tc; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.a
2、wt.event.ActionListener; import java.util.ArrayList; import java.util.Iterator; import java.util.Vector; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 24 页 - - - - - - - - - import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; impo
3、rt javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; public class MyFrame extends JFrame int minx = 0; int n; String m; String s; ArrayList list1 = new ArrayList(); ArrayList list2 = new ArrayList(); Vector v =
4、new Vector(); JPanel jp = new JPanel(); JPanel jp1 = new JPanel(); JPanel jp2 = new JPanel(); JPanel jp3 = new JPanel(); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 24 页 - - - - - - - - - JPanel jp4 = new JPanel(); JPanel jp5 = new JPanel(); JTextArea area1
5、= new JTextArea(); JTextArea area2 = new JTextArea(); JList list = new JList(); static JTextField jt1 = new JTextField(5); static JTextField jt2 = new JTextField(5); static JTextField jt3 = new JTextField(5); JTextField jt4 = new JTextField(); JTextField jt5 = new JTextField(); JTextField jt6 = new
6、JTextField(); JLabel jl1 = new JLabel(进程名 , 0); JLabel jl2 = new JLabel(id, 0); JLabel jl3 = new JLabel(优先数 , 0); JButton jb1 = new JButton( 就绪 ); JButton jb2 = new JButton( 优先数轮转法 ); JButton jb3 = new JButton( 阻塞 ); JButton jb4 = new JButton( 唤醒 ); JButton jb5 = new JButton( 创建 ); JButton jb6 = new
7、 JButton( 先来先服务 ); JButton jb7 = new JButton( 撤销(就绪) ); JButton jb8 = new JButton( 撤销(阻塞) ); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 24 页 - - - - - - - - - JScrollPane js1 = new JScrollPane(this.list, 22, 30); Toolkit kit = Toolkit.getDefaultToolkit(); p
8、rivate final int x = 0; private final int y = 0; private final int width = this.kit.getScreenSize().width / 3 * 2; private final int height = this.kit.getScreenSize().height / 5 * 4; public MyFrame() super(进程管理系统 ); setBounds(0, 0, this.width, this.height); add(this.jp1, Center); this.jp1.setLayout(
9、new GridLayout(2, 2, 20, 0); this.jp1.add(this.jp2); this.jp1.add(this.jp3); this.jp1.add(this.jp4); this.jp1.add(this.jp); this.jp2.setLayout(new BorderLayout(); this.jp2.add(this.jt4, North); this.jt4.setText( 进程名 tidt 优先数 ); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - -
10、- - - 第 4 页,共 24 页 - - - - - - - - - this.jt4.setEditable(false); this.jp2.add(this.area1); this.area1.setEditable(false); this.jp3.setLayout(new BorderLayout(); this.jp3.add(this.jt5, North); this.jt5.setText( 进程名 tidt 优先数 ); this.jt5.setEditable(false); this.jp3.add(this.list); this.jp4.setLayout(
11、new BorderLayout(); this.jp4.add(this.jt6, North); this.jt6.setText( 进程名 tidt 优先数 ); this.jt6.setEditable(false); this.jp4.add(this.area2); this.jp.add(this.jb2); this.jp.add(this.jb6); this.jp.add(this.jb3); this.jp.add(this.jb4); this.jp.add(this.jb8); this.jp.setLayout(new FlowLayout(); this.jb8.
12、addActionListener(new ActionListener() public void actionPerformed(ActionEvent e) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 5 页,共 24 页 - - - - - - - - - String a = (String)MyFrame.this.list.getSelectedValue(); MyFrame.this.v.remove(a); MyFrame.this.list.setListD
13、ata(MyFrame.this.v); ); this.jb2.addActionListener(new ActionListener() public void actionPerformed(ActionEvent e) Iterator it2 = MyFrame.this.list2.iterator(); if (!it2.hasNext() int min = 1000; Running r = new Running(1, 1, a, b); Iterator it = MyFrame.this.list1.iterator(); while (it.hasNext() Ru
14、nning re = (Running)it.next(); if (re.number = min) min = re.number; r = re; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 6 页,共 24 页 - - - - - - - - - MyFrame.this.list2.add(r); MyFrame.this.area2.append(r.getRecord(); MyFrame.this.list1.remove(r); MyFrame.this.are
15、a1.setText(null); Iterator it1 = MyFrame.this.list1.iterator(); while (it1.hasNext() Running re = (Running)it1.next(); MyFrame.this.area1.append(re.getRecord(); MyFrame.this.area1.append(n); ); this.jb6.addActionListener(new ActionListener() public void actionPerformed(ActionEvent e) Iterator it2 =
16、MyFrame.this.list2.iterator(); if (!it2.hasNext() int min = 1000; Running r = new Running(1, 1, a, b); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 7 页,共 24 页 - - - - - - - - - Iterator it = MyFrame.this.list1.iterator(); while (it.hasNext() Running re = (Running)i
17、t.next(); if (re.i = min) min = re.i; r = re; MyFrame.this.list2.add(r); MyFrame.this.area2.append(r.getRecord(); MyFrame.this.list1.remove(r); MyFrame.this.area1.setText(null); Iterator it1 = MyFrame.this.list1.iterator(); while (it1.hasNext() Running re = (Running)it1.next(); MyFrame.this.area1.ap
18、pend(re.getRecord(); MyFrame.this.area1.append(n); ); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 8 页,共 24 页 - - - - - - - - - this.jb3.addActionListener(new ActionListener() public void actionPerformed(ActionEvent e) Iterator it3 = MyFrame.this.list2.iterator();
19、Iterator aa = MyFrame.this.list1.iterator(); while (it3.hasNext() & aa.hasNext() Running runn = (Running)it3.next(); MyFrame.this.v.addElement(runn.getRecord(); MyFrame.this.list.setListData(MyFrame.this.v); MyFrame.this.list.setVisibleRowCount(10); MyFrame.this.list2.remove(runn); MyFrame.this.area
20、2.setText(null); Iterator it2 = MyFrame.this.list2.iterator(); if (!it2.hasNext() int min = 1000; Running r = new Running(1, 1, a, b); Iterator it = MyFrame.this.list1.iterator(); while (it.hasNext() Running re = (Running)it.next(); if (re.number = min) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - -
21、 - - - - - 名师精心整理 - - - - - - - 第 9 页,共 24 页 - - - - - - - - - min = re.number; r = re; MyFrame.this.list2.add(r); MyFrame.this.area2.append(r.getRecord(); MyFrame.this.list1.remove(r); MyFrame.this.area1.setText(null); Iterator it1 = MyFrame.this.list1.iterator(); while (it1.hasNext() Running re =
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2022年操作系统进程调度用java写的源代码 2022 操作系统 进程 调度 java 源代码
限制150内