银行家算法:
Allocation(已分配资源)
Request(还需要的资源)
Availiable(当前可用资源)
Max(每个进程的最大需求)
work(?)
finish(进程i是否完成)(注意进程完成后会释放资源)
细分为2个算法:即安全性算法和资源请求算法
安全性算法:确定系统状态是否安全(是否有一个进程处理顺序满足所有进程的资源分配)
资源请求算法:如果进程P向系统请求一系列资源,判断能否允许该请求。
例题1:
Considerthe following snapshot of a system:
Answer the following questions using the banker’s algorithm:
a. What is the content of the matrix Need?
b. Is the system in a safe state?
c. If a request from process P1 arrives for (0,4,2,0), can the request be granted immediately?