七.银行家算法程序代码 #include #include #include using namespace std; typedef struct Max1 // 资源的最大需求量 { int m_a; int m_b; int m_c; }Max; typedef struct Allocation1 //已分配的资源数 { int a_a; int a_b ; int a_c; }Allocation; typedef struct Need1 //还需要的资源数 { int n_a;
#include #include #include const int MAXSIZE=1000;//定义最大页面数 const int MAXQUEUE=3;//定义页框数 typedef struct node { int loaded; int hit; }page; page pages[MAXQUEUE]; //定义页框表 int queue[MAXSIZE]; int quantity; //初始 化结构函数 void initial() { int i; for(i=0;i&l
操作系统的上机实验,银行家算法, int ALL_RESOURCE[W]; int AVAILABLE[R]; //可利用资源向量 int MAX[W][R]; //最大需求矩阵 int ALLOCATION[W][R]; //分配矩阵 int NEED[W][R]; //需求矩阵 int Request[R]; //进程请求向量 void inputdata(); //数据输入 void showdata(); //数据显示 void changdata(int k);//进程请求资源数据改