資源簡介
高質量操作系統(tǒng)實驗——銀行家算法,內涵報告+實驗,采用 Java+Intel IDEA 進行開發(fā)!!!

代碼片段和文件信息
package?com.yason.bankalgorithm;
import?com.yason.bankalgorithm.base.baseWindow;
import?javax.swing.*;
import?java.awt.*;
import?java.awt.event.ActionEvent;
import?java.awt.event.ActionListener;
public?class?HomeWindow?extends?baseWindow?{
????private?JPanel?jp1;
????private?JComboBox?jcb1;//選擇框
????private?JTextField?jtf1;//輸入框
????private?JTextField?jtf2;
????private?JTextField?jtf3;
????private?JTextField?jtf4;
????private?JButton?jb1;
????private?JTextArea?jta1;
????private?String?pname[];//進程數(shù)量
????private?int?Source[];//系統(tǒng)各種資源的總量
????private?int?Max[][];?//?最大需求矩陣
????private?int?Allocation[][];//?每個進程現(xiàn)在所分配的各種資源類型的實例數(shù)量
????private?int?Available[];?//?可利用資源向量,即每種資源的現(xiàn)有實例數(shù)
????private?int?Need[][];?//?每個進程還需要的剩余資源
????//????private?int?Work[];?//?系統(tǒng)可供給進程的各類資源數(shù)量
//????private?boolean?Finish[];?//?標志一個進程是否可以得到其所需要的資源
//????private?int?Request[];?//?進程對每個資源的實例數(shù)的請求數(shù)量
????private?int?rowCount;//矩陣行數(shù)
????private?int?columnCount;//矩陣列數(shù)
????@Override
????protected?Jframe?setRootView()?{
????????Jframe?jf?=?new?Jframe();
????????jf.setSize(500?350);//大小
????????jf.setResizable(false);//不可拖動
????????jf.setLayout(new?BorderLayout());
????????jf.settitle(“銀行家算法“);
????????return?jf;
????}
????@Override
????protected?void?initView(Jframe?root)?{
????????String?s[]?=?{“Allocation“?“Max“?“Available“?“Request“};
????????jcb1?=?new?JComboBox(s);
????????jp1?=?new?JPanel();
????????jp1.setBackground(new?java.awt.Color(128?255?128));
????????jp1.add(jcb1);
????????jp1.add(new?JLabel(“PID:“));
????????jtf1?=?new?JTextField(3);
????????jp1.add(jtf1);
????????jp1.add(new?JLabel(“A:“));
????????jtf2?=?new?JTextField(3);
????????jp1.add(jtf2);
????????jp1.add(new?JLabel(“B:“));
????????jtf3?=?new?JTextField(3);
????????jp1.add(jtf3);
????????jp1.add(new?JLabel(“C:“));
????????jtf4?=?new?JTextField(3);
????????jp1.add(jtf4);
????????jb1?=?new?JButton(“確定“);
????????jb1.addActionListener(new?ActionListener()?{
????????????@Override
????????????public?void?actionPerformed(ActionEvent?e)?{
????????????????performClick();
????????????}
????????});
????????jp1.add(jb1);
????????root.add(jp1?“South“);
????????jta1?=?new?JTextArea();
????????jta1.setLineWrap(true);
????????jta1.setBackground(Color.white);
????????jta1.setEditable(false);
????????root.add(jta1?“Center“);
????}
????@Override
????protected?void?loadData()?{
????????Source?=?TestData.Source;
????????Max?=?TestData.Max;
????????Allocation?=?TestData.Allocation;
????????pname?=?TestData.pname;
????????rowCount?=?Max.length;
????????columnCount?=?Source.length;
????????Available?=?new?int[columnCount];
????????Need?=?new?int[rowCount][columnCount];
????????//計算Available
????????for?(int?columnIndex?=?0;?columnIndex?????????????Available[columnIndex]?=?Source[columnIndex]
????????????????????-?Allocation[0][columnIndex]
????????????????????-?Allocation[1][
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????273??2018-01-16?21:18??操作系統(tǒng)實驗\BankAlgorithm\.idea\misc.xm
?????文件????????266??2018-01-16?21:19??操作系統(tǒng)實驗\BankAlgorithm\.idea\modules.xm
?????文件???????8792??2018-01-17?00:03??操作系統(tǒng)實驗\BankAlgorithm\.idea\uiDesigner.xm
?????文件??????32482??2018-01-17?11:25??操作系統(tǒng)實驗\BankAlgorithm\.idea\workspace.xm
?????文件????????423??2018-01-16?21:18??操作系統(tǒng)實驗\BankAlgorithm\BankAlgorithm.iml
?????文件????????648??2018-01-16?22:48??操作系統(tǒng)實驗\BankAlgorithm\out\production\BankAlgorithm\com\yason\bankalgorithm\ba
?????文件????????796??2018-01-17?09:19??操作系統(tǒng)實驗\BankAlgorithm\out\production\BankAlgorithm\com\yason\bankalgorithm\HomeWindow$1.class
?????文件???????9373??2018-01-17?09:19??操作系統(tǒng)實驗\BankAlgorithm\out\production\BankAlgorithm\com\yason\bankalgorithm\HomeWindow.class
?????文件????????480??2018-01-17?09:19??操作系統(tǒng)實驗\BankAlgorithm\out\production\BankAlgorithm\com\yason\bankalgorithm\Main.class
?????文件????????668??2018-01-17?02:59??操作系統(tǒng)實驗\BankAlgorithm\out\production\BankAlgorithm\com\yason\bankalgorithm\TestData.class
?????文件????????402??2018-01-16?22:15??操作系統(tǒng)實驗\BankAlgorithm\src\com\yason\bankalgorithm\ba
?????文件??????15222??2018-01-17?23:02??操作系統(tǒng)實驗\BankAlgorithm\src\com\yason\bankalgorithm\HomeWindow.java
?????文件????????148??2018-01-17?09:19??操作系統(tǒng)實驗\BankAlgorithm\src\com\yason\bankalgorithm\Main.java
?????文件????????488??2018-01-17?00:32??操作系統(tǒng)實驗\BankAlgorithm\src\com\yason\bankalgorithm\TestData.java
?????文件??????62784??2018-01-16?23:20??操作系統(tǒng)實驗\操作系統(tǒng)實驗.docx
?????目錄??????????0??2018-01-16?22:48??操作系統(tǒng)實驗\BankAlgorithm\out\production\BankAlgorithm\com\yason\bankalgorithm\ba
?????目錄??????????0??2018-01-17?09:19??操作系統(tǒng)實驗\BankAlgorithm\out\production\BankAlgorithm\com\yason\bankalgorithm
?????目錄??????????0??2018-01-16?22:48??操作系統(tǒng)實驗\BankAlgorithm\out\production\BankAlgorithm\com\yason
?????目錄??????????0??2018-01-16?22:15??操作系統(tǒng)實驗\BankAlgorithm\src\com\yason\bankalgorithm\ba
?????目錄??????????0??2018-01-16?22:48??操作系統(tǒng)實驗\BankAlgorithm\out\production\BankAlgorithm\com
?????目錄??????????0??2018-01-17?09:19??操作系統(tǒng)實驗\BankAlgorithm\src\com\yason\bankalgorithm
?????目錄??????????0??2018-01-16?22:48??操作系統(tǒng)實驗\BankAlgorithm\out\production\BankAlgorithm
?????目錄??????????0??2018-01-16?21:20??操作系統(tǒng)實驗\BankAlgorithm\src\com\yason
?????目錄??????????0??2018-01-16?21:20??操作系統(tǒng)實驗\BankAlgorithm\.idea\inspectionProfiles
?????目錄??????????0??2018-01-16?22:07??操作系統(tǒng)實驗\BankAlgorithm\out\production
?????目錄??????????0??2018-01-16?21:20??操作系統(tǒng)實驗\BankAlgorithm\src\com
?????目錄??????????0??2018-01-17?11:25??操作系統(tǒng)實驗\BankAlgorithm\.idea
?????目錄??????????0??2018-01-16?22:07??操作系統(tǒng)實驗\BankAlgorithm\out
?????目錄??????????0??2018-01-16?21:20??操作系統(tǒng)實驗\BankAlgorithm\src
?????目錄??????????0??2018-01-16?22:07??操作系統(tǒng)實驗\BankAlgorithm
............此處省略4個文件信息
評論
共有 條評論