银行家算法是用来避免死锁的,该方法将系统的状态分为安全和不安全,只要系统处于安全状态,便可避免死锁的发生。之所以成为银行家算法,是由于该算法能用于银行系统现金贷款的发放而得名。
[cpp]
#include "string.h"
#include <iostream>
using namespace std;
#define False 0
#define True 1
#define W 10 //资源数目 ...
#define R 20
int M ; //总进程数
int N ; //资源种类
int All_Resource[...