- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
操作系统习题课_1概要1
习题课 A computer system has 8 printers that were competed by K process, and each process can take up no more than 3 printers. What is the minimum value of K to must cause the system deadlock? What is the minimum value of K to may be cause the system deadlock? 先看一个简单的例子: 8个资源,K个进程,每个进程使用N ?3个资源 K=1 ? K=2 ? K=3 ? K=4: Suppose an infinite capacity warehouse can hold two type goods A and B. But the number of A and B must satisfy the inequality as follow: -M?the number of A-the number of B?N Here, M and N are positive integer. Please description A and B storage process by semaphores and PV operation. 问题分析: 已知条件 -M≤A物品数量-B物品数量≤N?可以拆成两个不等式,即 A物品数量-B物品数量≤N, B物品数量-A物品数量≤M。 这两个不等式的含义是:仓库中A物品可以比B物品多,但不能超过N个;B物品可以比A物品多,但不能超过M个。 若只放入A,而不放入B,则A最多可放N次后阻塞;若只放入B,不放入A,则B最多放M次后阻塞; 每放入一次A,就多一次放入B的机会。同理,每放入一次B,就对一次放入A的机会。 Semaphore s=?,pa=?,pb=? CoBegin Procedure A; Procedure B; While (true) { While (true) { P(sa); P(sb); P(s); P(s); //A产品入库 //B产品入库 V(s); V(s); V(sb); V(sa); } CoEnd; In an electronic funds transfer system, there are hundreds of identical processes that work as follows. Each process reads an input line specifying an amount of money, the account to be credited, and the account to be debited. Then it locks both accounts and transfers the money, releasing the locks when done. With many processes running in parallel, there is a very real danger that having locked account x it will be unable to lock y because y has been locked by a process now waiting for x. Devise a scheme that avoids deadlocks. Do not release an account record until you have completed the transactions. Two Approaches to avoid Deadlock Do not start a process if its demands might lead to deadlock Do not grant an incremental resource request to a process if this allocation might lead to deadlock To avoid circular wait, number the resourc
您可能关注的文档
最近下载
- 2025至2030中国蓝莓市场销售策略分析与发展前景研究报告.docx VIP
- 速食id8乐事包的正确打开姿势含进阶篇.pdf VIP
- macbookpro使用使用指南.doc VIP
- 九年级历史上册第三单元测试题(最新部编人教版)后附详尽解析及答案.pdf VIP
- 《南方CASS使用教程》教材.pptx VIP
- Mathematica教程(中科大教案).pdf VIP
- 2025年海峡杯数学竞赛真题三年级 2025-6-1 83955 1.pdf VIP
- 2018-2024年海峡杯数学竞赛真题及答案(三年级).pdf VIP
- 2025年海峡杯数学竞赛真题五年级 2025-6-1 83955 4.pdf VIP
- 最新[1942电影观后感500字]1942电影观后感350字左右范文赏析.doc VIP
文档评论(0)