银行家算法
//breaker.h文件代码
#include
using namespace std;
int Test_Request(int *,int *); //测试函数
void Assign(); //分配函数
int Check_Safe(); //安全检测函数
void Recover(); //回收函数
int Check_Finish(); //检测finish函数
int Finish[9]={0,0,0,0,0,0,0,0,0}; //已完成的进程序列
int Work[9]; //进程工作序列
int Max[9][9],MaxHF[9][9],MaxHFF[9][9];//[5][3]={{5,5,9},{5,3,6},{4,0,11},{4,2,5},{4,2,4}};// //进程最大需求
int Allocation[9][9],AllocationHF[9][9],AllocationHFF[9][9];//[5][3]={{2,1,2},{4,0,2},{4,0,5},{2,0,4},{3,1,4}};// //进程已得到的
int Need[9][9],NeedHF[9][9];//[5][3]={{3,4,7},{1,3,4},{0,0,6},{2,2,1},{1,1,0}}; //进程还需分配的
int Available[9],AvailableHF[9],AvailableHFF[9];//[3]={2,3,3}; //系统拥有的资源
int n; //告诉系统第几个进程需要申请
int Request[9];//[3]; //告诉系统申请每类资源的数量
int i,j,w=0;
//输出函数
void PutMax(int a,int m){
for(i=0;i
cout<
for(j=0;j
cout<
}
cout<
}
void PutAllocation(int a,int m){
for(i=0;i