没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
试读
48页
本文将对如何避免死锁展开研究,我们采取的方法是银行家算法。银行家算法是一种最有代表性的避免死锁的算法。 我们可以把操作系统看作是银行家,操作系统管理的资源相当于银行家管理的资金,进程向操作系统请求分配资源相当于用户向银行家贷款。 操作系统按照银行家制定的规则为进程分配资源,当进程首次申请资源时,要测试该进程对资源的最大需求量,如果系统现存的资源可以满足它的最大需求量则按当前的申请量分配资源,否则就推迟分配。 当进程在执行中继续申请资源时,先测试该进程已占用的资源数与本次申请的资源数之和是否超过了该进程对资源的最大需求量。 若超过则拒绝分配资源,若没有超过则再测试系统现存的资源能否满足该进程尚需的最大资源量,若能满足则按当前的申请量分配资源,否则也要推迟分配。
资源推荐
资源详情
资源评论
2
目 录
中文摘要………………………………………………..……………(4)
英文摘要……………………………………………………………..(5)
1 绪 论……………………..………………………………….……(6)
1.1 综述………………………………………………..………………...…….(6)
1.2 产生死锁的原因及必要条件……………………………………… …… (6)
1.2.1 产生死锁的原因…………..……………………..……….……… (6)
1.2.2 产生死锁的必要条件………………..………………………… …(6)
1.3 处理死锁的基本方法……………………………..………………………(7)
1.4 本文主要研究工作…………………………………………………… …(8)
2 银行家算法的研究……………………………………………..…..(8)
2.1 系统安全状态……………………………………………………………..(8)
2.1.1 安全状态…………………………………………………………(8)
2.2 利用银行家算法避免死锁………………………………………………..(9)
2.2.1 银行家算法中的数据结构……………………………………...…(9)
2.2.2 银行家算法………………………………………………………...(9)
2.2.3 安全性算法………………………………………………………(9)
3 需求分析……………………………………………....…………(10)
4 逻辑设计……………………………………………………...…..(11)
4.1 实验原理…………………………………………………...…..(11)
4.2 基本技术路线图……………………………………………..…..(12)
5 系统设计………………………………………………..………..(13)
3
5.1 数据结构定义……………………………………………..…....(13)
5.2 主要变量…………………………………………………..…..(13)
5.3 定义函数…………………………………………………..…..(13)
6 测试与分析……………………………………………..…..…..(14)
6.1 实验过程原始记录…………………………………………….(14)
7 程序运行…………………………………………………....…..(23)
7.1 程序运行截图……………………………………………..…..(23)
7.2 实验结果………………………………………………….…..(23)
8 结论 ……………………………………………………………(28)
致谢…………………………………………………………………(29)
参考文献……………………………………………………………(30)
附录…………………………………………………………………(31)
4
银行家算法
摘 要
在银行中,客户申请贷款的数量是有限的,每个客户在第一次申请贷款时要
声明完成该项目所需的最大资金量,在满足所有贷款要求时,客户应及时归还。
银行家在客户申请的贷款数量不超过自己拥有的最大值时,都应尽量满足客户的
需要。在这样的描述中,银行家就好比操作系统,资金就是资源,客户就相当于
申请资源的进程。银行家算法是一种最有代表性的避免死锁的算法。在避免死锁
方法中允许进程动态地申请资源,但系统在进行资源分配之前,应先计算此次分
配资源的安全性,若分配不会导致系统进入不安全状态,则分配,否则等待。
关键词:操作系统,银行家算法,避免死锁
5
Visionbanker algorithm
Abstract
In the bank, the number of customers applying for loans is limited. Each
customer shall declare the maximum amount of funds needed to complete the project
when applying for loans for the first time. When all the loan requirements are met, the
customer shall return them in time. Bankers should try their best to meet the needs of
customers when the amount of loans they apply for does not exceed the maximum
amount they have. In such a description, the banker is just like the operating system,
the capital is the resource, and the customer is the process of applying for the
resource. Banker algorithm is one of the most representative algorithms to avoid
deadlock. In the deadlock avoidance method, the process is allowed to apply for
resources dynamically; but before the system allocates resources, the security of the
allocated resources should be calculated first. If the allocation will not lead to the
system entering an unsafe state, then the allocation, or wait.
Key Words: Operating system, banker algorithm, deadlock avoidance
剩余47页未读,继续阅读
资源评论
秋到亦天凉
- 粉丝: 517
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功