属猪的守护神是什么菩萨| 2008年出生的属什么| 两小无猜是什么意思| 鱼刺卡喉咙挂什么科| 抽烟是什么感觉| 鸡为什么喜欢吃泡沫| domestic是什么意思| 指甲的月牙代表什么| 胃酸吃什么可以缓解| 定性和定量是什么意思| 哕是什么意思| 梦见自己有孩子了是什么预兆| 王玉什么字| 贫血吃什么好| 培坤丸有什么作用功效| 门庭是什么意思| 肚子疼恶心想吐吃什么药| 京剧脸谱黑色代表什么| 带状疱疹是什么病| 合肥以前叫什么| 心悸是什么意思啊| 为什么会口腔溃疡| 羟苯乙酯是什么| 晚上总是做梦是什么原因引起的| 一什么彩虹| 丙氨酸氨基转移酶高吃什么药| 没收个人全部财产是什么意思| 小囡是什么意思| 0和1是什么意思| 小仓鼠吃什么| 出佛身血是什么意思| 微信转账为什么要验证码| 1965年属什么| 红肉是什么| 鱼龙混杂什么意思| 男人洁身自好什么意思| 清白是什么意思| 小孩反复发烧是什么原因| 人民币代码是什么符号| 高危型hpv阳性是什么意思| 秘辛是什么意思| 2月27号是什么星座| 乙肝通过什么传染| 什么是子公司| 为什么有钱人不去植发| 月食是什么意思| 授记是什么意思| 跑龙套是什么意思| 硬度不够吃什么好| 耳朵尖的人什么命| 日在校园讲的什么| 充气娃娃什么感觉| 黑长直是什么意思| 冶阳萎什么药最有效| 体虚是什么原因引起的| fk是什么意思| 王加玉念什么| 湿疹抹什么药膏| 五月二十日是什么星座| 什么的夏天| 肥猪拱门是什么生肖| 鼻涕带血是什么原因| 存款到100万算什么阶层| 眼睛充血用什么眼药水最好| 问号是什么意思| 上火吃什么最快能降火| 蕾丝是什么| 辗转是什么意思| 男生为什么喜欢女生叫爸爸| 什么叫有个性的人| 一声什么| 川崎病是什么原因引起的| 润滑油是干什么用的| 颈椎脑供血不足吃什么药| 吃什么补维生素| 水痘长什么样| 梦见孩子被蛇咬是什么意思| 前呼后拥是什么意思| 为什么空调| 健康证需要什么材料| 拮抗药物是什么药| 什么是可支配收入| 茉莉茶叶属于什么茶| 掉头发是什么原因女性| 脂肪肝吃什么水果好| 树膏皮是什么皮| 儿童回春颗粒主要治什么| 腹股沟淋巴结肿大是什么原因| 土阜念什么| 针对性是什么意思| 屈光和近视有什么区别| 铜绿假单胞菌用什么抗生素| 红班狠疮的早期症状是什么| 反酸是什么意思| 胎儿胆囊偏大有什么影响| 仰仗是什么意思| 狗鱼是什么鱼| 孕妇吃什么利尿排羊水| trp是什么氨基酸| 什么是地沟油| 1994年五行属什么| 受贿是什么意思| 素鲍鱼是什么做的| 什么是邮箱地址| w代表什么单位| 喝酒后呕吐是什么原因| 成吉思汗什么意思| 私生饭什么意思| 吃胡萝卜有什么好处| 卦是什么意思| 公元400年是什么朝代| 王牌是什么意思| 长期大便不成形是什么原因造成的| 艾草有什么作用| 血管属于什么组织| 幽门螺旋杆菌的症状吃什么药| 属鸡的本命佛是什么佛| primark是什么牌子| 肚子疼什么原因| 宫颈口大是什么原因| 杜甫被后人称为什么| 1997年属牛是什么命| 岳云鹏什么学历| 柿子不能跟什么一起吃| 抹胸是什么| mexican是什么牌子| 小孩不说话什么原因| 孕酮什么意思| 什么是升华| 赏脸是什么意思| 落枕吃什么药好得快| 两个人能玩什么游戏| 什么是处方药和非处方药| 1991年属羊是什么命| 心肌酶高吃什么药| 男性hpv检查挂什么科| 口腔溃疡要吃什么药| 星链是什么| dpoy什么意思| 15岁属什么| 布洛芬吃多了有什么后果| 64是什么| 甲亢病是什么原因引起的| 苯中毒是什么症状| 晚上睡觉咬牙齿是什么原因| 孕妇梦见坟墓是什么预兆| 叶酸买什么牌子的好| 爸爸的外婆叫什么| 为什么眼睛会疼| 大小脸挂什么科| 属猴的和什么属相最配| 成都五行属什么| 气体交换受损与什么有关| 男人下面流脓吃什么药| 梦见自己坐火车是什么意思| 女红是什么意思| 做什么运动能瘦肚子| 整编师和师有什么区别| 四月初七是什么星座| 红苕是什么| 血稠是什么原因造成的| 今天天气适合穿什么衣服| 什么血型会导致不孕| 腿毛长得快是什么原因| 5月12号是什么星座| 粉底液是干什么用的| 5月10号是什么星座| 月亮五行属什么| 人为什么会放屁| 地面铺什么最环保| 右肺小结节是什么意思| 舌苔发苦是什么原因| 碳十四检测是查什么的| 女人什么时候最想要| 鼻窦炎是什么| 林彪为什么要叛逃| 木有什么意思| 大姨妈吃什么水果| 胰岛素是什么| 很容易出汗是什么原因| 新婚志喜是什么意思| 眼角发黄是什么原因| 通勤什么意思| 6月15号是什么星座| 天下无双是什么生肖| 三文鱼又叫什么鱼| 晚上剪指甲有什么禁忌| 全程c反应蛋白高说明什么| 隐疾是什么意思| 吃什么补白细胞效果最好| 属虎的五行属什么| 小孩上火吃什么药| 晚上十点多是什么时辰| 蓝莓什么时候开花结果| 跳梁小丑指什么生肖| 放下执念是什么意思| 什么是银屑病| 夕阳朝乾是什么意思| 什么皮球| 河北有什么市| 七手八脚是什么意思| 木薯粉在超市里叫什么| 除日是什么意思| 慢性胃炎吃什么药效果好| mica是什么意思| 晨起口干口苦是什么原因| 弯的是什么意思| 小孩口腔溃疡是什么原因引起的| 舒肝健胃丸治什么病| 飞鱼籽是什么鱼的籽| 舌头发白吃什么药好| 手发麻什么原因| 外贸是什么| 如家是什么内涵| 梅花像什么| 十点多是什么时辰| 父亲节送什么| 潜血弱阳性是什么意思| 查宝宝五行八字缺什么| 丁火是什么火| 什么纸| 土霉素主要是治疗什么病| 肝介入治疗是什么意思| 肌肉紧张是什么症状| 什么最解渴| 血糖高吃什么可以降下来| 下体有异味是什么原因| 初级会计考什么科目| 什么是基数| 头晕是什么引起的| hpv检查什么| 铁公鸡是什么意思| 世界大同是什么意思| 胃肠道功能紊乱吃什么药| 琪是什么意思| 脱肛是什么原因造成的| 报销是什么意思| 321是什么意思| 六月出生的是什么星座| 稳重什么意思| 文化大革命是什么时候开始的| 移徙是什么意思| 无锡机场叫什么名字| 脂肪燃烧是什么感觉| 拔罐颜色紫黑代表什么| 早上起来口干口苦口臭是什么原因| 甲状腺结节忌口什么| 全身发抖是什么原因| 痰浊是什么意思| ambush是什么牌子| 动物的脖子有什么作用| 下午4点到5点是什么时辰| 新生儿上户口需要什么资料| 嬴姓赵氏是什么意思| 乾隆的名字叫什么| 臭鳜鱼是什么菜系| 囡囡是什么意思| 吃黄瓜有什么好处和坏处| 林黛玉属什么生肖| 试孕纸什么时候测最准| 梦见花椒是什么意思| 助听器什么品牌最好| 口臭舌苔白厚吃什么药| 一般什么人戴江诗丹顿| 百度Jump to content

乐视美国总部大楼并没有卖!因为那根本不是乐视的

From Wikipedia, the free encyclopedia
百度 移动互联网发展的时候,更多的是意念控制它。

Both processes need resources to continue execution. P1 requires additional resource R1 and is in possession of resource R2, P2 requires additional resource R2 and is in possession of R1; neither process can continue.
Four processes (blue lines) compete for one resource (grey circle), following a right-before-left policy. A deadlock occurs when all processes lock the resource simultaneously (black lines). The deadlock can be resolved by breaking the symmetry.

In concurrent computing, deadlock is any situation in which no member of some group of entities can proceed because each waits for another member, including itself, to take action, such as sending a message or, more commonly, releasing a lock.[1] Deadlocks are a common problem in multiprocessing systems, parallel computing, and distributed systems, because in these contexts systems often use software or hardware locks to arbitrate shared resources and implement process synchronization.[2]

In an operating system, a deadlock occurs when a process or thread enters a waiting state because a requested system resource is held by another waiting process, which in turn is waiting for another resource held by another waiting process.[3] If a process remains indefinitely unable to change its state because resources requested by it are being used by another process that itself is waiting, then the system is said to be in a deadlock.[4]

In a communications system, deadlocks occur mainly due to loss or corruption of signals rather than contention for resources.[5]

Two processes competing for two resources in opposite order.
  1. A single process goes through.
  2. The later process has to wait.
  3. A deadlock occurs when the first process locks the first resource at the same time as the second process locks the second resource.
  4. The deadlock can be resolved by cancelling and restarting the first process.

Conditions

[edit]

A deadlock situation on a resource can arise only if all of the following conditions occur simultaneously in a system:[6]

  1. Mutual exclusion: multiple resources are not shareable; only one process at a time may use each resource.[7][8]
  2. Hold and wait or resource holding: a process is currently holding at least one resource and requesting additional resources which are being held by other processes.
  3. No preemption: a resource can be released only voluntarily by the process holding it.
  4. Circular wait: each process must be waiting for a resource which is being held by another process, which in turn is waiting for the first process to release the resource. In general, there is a set of waiting processes, P = {P1, P2, ..., PN}, such that P1 is waiting for a resource held by P2, P2 is waiting for a resource held by P3 and so on until PN is waiting for a resource held by P1.[4][9]

These four conditions are known as the Coffman conditions from their first description in a 1971 article by Edward G. Coffman, Jr.[9]

While these conditions are sufficient to produce a deadlock on single-instance resource systems, they only indicate the possibility of deadlock on systems having multiple instances of resources.[10]

Deadlock handling

[edit]

Most current operating systems cannot prevent deadlocks.[11] When a deadlock occurs, different operating systems respond to them in different non-standard manners. Most approaches work by preventing one of the four Coffman conditions from occurring, especially the fourth one.[12] Major approaches are as follows.

Ignoring deadlock

[edit]

In this approach, it is assumed that a deadlock will never occur. This is also an application of the Ostrich algorithm.[12][13] This approach was initially used by MINIX and UNIX.[9] This is used when the time intervals between occurrences of deadlocks are large and the data loss incurred each time is tolerable.

Ignoring deadlocks can be safely done if deadlocks are formally proven to never occur. An example is the RTIC framework.[14]

Detection

[edit]

Under the deadlock detection, deadlocks are allowed to occur. Then the state of the system is examined to detect that a deadlock has occurred and subsequently it is corrected. An algorithm is employed that tracks resource allocation and process states, it rolls back and restarts one or more of the processes in order to remove the detected deadlock. Detecting a deadlock that has already occurred is easily possible since the resources that each process has locked and/or currently requested are known to the resource scheduler of the operating system.[13]

After a deadlock is detected, it can be corrected by using one of the following methods:[citation needed]

  1. Process termination: one or more processes involved in the deadlock may be aborted. One could choose to abort all competing processes involved in the deadlock. This ensures that deadlock is resolved with certainty and speed.[citation needed] But the expense is high as partial computations will be lost. Or, one could choose to abort one process at a time until the deadlock is resolved. This approach has a high overhead because after each abort an algorithm must determine whether the system is still in deadlock.[citation needed] Several factors must be considered while choosing a candidate for termination, such as priority and age of the process.[citation needed]
  2. Resource preemption: resources allocated to various processes may be successively preempted and allocated to other processes until the deadlock is broken.[15][failed verification]

Prevention

[edit]
(A) Two processes competing for one resource, following a first-come, first-served policy. (B) Deadlock occurs when both processes lock the resource simultaneously. (C) The deadlock can be resolved by breaking the symmetry of the locks. (D) The deadlock can be prevented by breaking the symmetry of the locking mechanism.

Deadlock prevention works by preventing one of the four Coffman conditions from occurring.

  • Removing the mutual exclusion condition means that no process will have exclusive access to a resource. This proves impossible for resources that cannot be spooled. But even with spooled resources, the deadlock could still occur. Algorithms that avoid mutual exclusion are called non-blocking synchronization algorithms.
  • The hold and wait or resource holding conditions may be removed by requiring processes to request all the resources they will need before starting up (or before embarking upon a particular set of operations). This advance knowledge is frequently difficult to satisfy and, in any case, is an inefficient use of resources. Another way is to require processes to request resources only when it has none; First, they must release all their currently held resources before requesting all the resources they will need from scratch. This too is often impractical. It is so because resources may be allocated and remain unused for long periods. Also, a process requiring a popular resource may have to wait indefinitely, as such a resource may always be allocated to some process, resulting in resource starvation.[16] (These algorithms, such as serializing tokens, are known as the all-or-none algorithms.)
  • The no preemption condition may also be difficult or impossible to avoid as a process has to be able to have a resource for a certain amount of time, or the processing outcome may be inconsistent or thrashing may occur. However, the inability to enforce preemption may interfere with a priority algorithm. Preemption of a "locked out" resource generally implies a rollback, and is to be avoided since it is very costly in overhead. Algorithms that allow preemption include lock-free and wait-free algorithms and optimistic concurrency control. If a process holding some resources and requests for some another resource(s) that cannot be immediately allocated to it, the condition may be removed by releasing all the currently being held resources of that process.
  • The final condition is the circular wait condition. Approaches that avoid circular waits include disabling interrupts during critical sections and using a hierarchy to determine a partial ordering of resources. If no obvious hierarchy exists, even the memory address of resources has been used to determine ordering and resources are requested in the increasing order of the enumeration.[4] Dijkstra's solution can also be used.

Deadlock avoidance

[edit]

Similar to deadlock prevention, deadlock avoidance approach ensures that deadlock will not occur in a system. The term "deadlock avoidance" appears to be very close to "deadlock prevention" in a linguistic context, but they are very much different in the context of deadlock handling. Deadlock avoidance does not impose any conditions as seen in prevention but, here each resource request is carefully analyzed to see whether it could be safely fulfilled without causing deadlock.

Deadlock avoidance requires that the operating system be given in advance additional information concerning which resources a process will request and use during its lifetime. Deadlock avoidance algorithm analyzes each and every request by examining that there is no possibility of deadlock occurrence in the future if the requested resource is allocated. The drawback of this approach is its requirement of information in advance about how resources are to be requested in the future. One of the most used deadlock avoidance algorithms is Banker's algorithm.[17]

Livelock

[edit]

A livelock is similar to a deadlock, except that the states of the processes involved in the livelock constantly change with regard to one another, none progressing.

The term was coined by Edward A. Ashcroft in a 1975 paper[18] in connection with an examination of airline booking systems.[19] Livelock is a special case of resource starvation; the general definition only states that a specific process is not progressing.[20]

Livelock is a risk with some algorithms that detect and recover from deadlock. If more than one process takes action, the deadlock detection algorithm can be repeatedly triggered. This can be avoided by ensuring that only one process (chosen arbitrarily or by priority) takes action.[21]

Distributed deadlock

[edit]

Distributed deadlocks can occur in distributed systems when distributed transactions or concurrency control is being used.

Unlike in centralized systems, detecting and resolving distributed deadlocks is more complex due to the lack of shared memory and the need for coordination among nodes. Techniques like wait-for graphs, distributed algorithms (like edge chasing; e.g., Chandy-Misra-Haas), and deadlock prevention (e.g., timeout-based methods) are used to handle such scenarios. The challenge lies in ensuring consistency and avoiding false positives/negatives due to network delays or partial failures.

Phantom deadlocks are deadlocks that are falsely detected in a distributed system due to system internal delays but do not actually exist. For example, if a process releases a resource R1 and issues a request for R2, and the first message is lost or delayed, a coordinator (detector of deadlocks) could falsely conclude a deadlock (if the request for R2 while having R1 would cause a deadlock).

See also

[edit]

References

[edit]
  1. ^ Coulouris, George (2012). Distributed Systems Concepts and Design. Pearson. p. 716. ISBN 978-0-273-76059-7.
  2. ^ Padua, David (2011). Encyclopedia of Parallel Computing. Springer. p. 524. ISBN 9780387097657. Archived from the original on 18 April 2021. Retrieved 16 October 2020.
  3. ^ Falsafi, Babak; Midkiff, Samuel; Dennis, JackB; Dennis, JackB; Ghoting, Amol; Campbell, Roy H; Klausecker, Christof; Kranzlmüller, Dieter; Emer, Joel; Fossum, Tryggve; Smith, Burton; Philippe, Bernard; Sameh, Ahmed; Irigoin, Fran?ois; Feautrier, Paul; Praun, Christoph von; Bocchino, Robert L.; Snir, Marc; George, Thomas; Sarin, Vivek; Jann, Joefon (2011). "Deadlocks". Encyclopedia of Parallel Computing. Boston, MA: Springer US. pp. 524–527. doi:10.1007/978-0-387-09766-4_282. ISBN 978-0-387-09765-7. S2CID 241456017. A deadlock is a condition that may happen in a system composed of multiple processes that can access shared resources. A deadlock is said to occur when two or more processes are waiting for each other to release a resource. None of the processes can make any progress.
  4. ^ a b c Silberschatz, Abraham (2006). Operating System Principles (7th ed.). Wiley-India. p. 237. ISBN 9788126509621. Archived from the original on 25 January 2022. Retrieved 16 October 2020.
  5. ^ Schneider, G. Michael (2009). Invitation to Computer Science. Cengage Learning. p. 271. ISBN 978-0324788594. Archived from the original on 18 April 2021. Retrieved 16 October 2020.
  6. ^ Silberschatz, Abraham (2006). Operating System Principles (7 ed.). Wiley-India. p. 239. ISBN 9788126509621. Archived from the original on 18 April 2021. Retrieved 16 October 2020.
  7. ^ Operating System Concepts. Wiley. 2012. p. 319. ISBN 978-1-118-06333-0.
  8. ^ "ECS 150 Spring 1999: Four Necessary and Sufficient Conditions for Deadlock". nob.cs.ucdavis.edu. Archived from the original on 29 April 2018. Retrieved 29 April 2018.
  9. ^ a b c Shibu, K. (2009). Intro To Embedded Systems (1st ed.). Tata McGraw-Hill Education. p. 446. ISBN 9780070145894. Archived from the original on 18 April 2021. Retrieved 16 October 2020.
  10. ^ "Operating Systems: Deadlocks". www.cs.uic.edu. Archived from the original on 28 May 2020. Retrieved 25 April 2020. If a resource category contains more than one instance then the presence of a cycle in the resource-allocation graph indicates the possibility of a deadlock, but does not guarantee one. Consider, for example, Figures 7.3 and 7.4 below:
  11. ^ Silberschatz, Abraham (2006). Operating System Principles (7 ed.). Wiley-India. p. 237. ISBN 9788126509621. Archived from the original on 18 April 2021. Retrieved 16 October 2020.
  12. ^ a b Stuart, Brian L. (2008). Principles of operating systems (1st ed.). Cengage Learning. p. 446. ISBN 9781418837693. Archived from the original on 18 April 2021. Retrieved 16 October 2020.
  13. ^ a b Tanenbaum, Andrew S. (1995). Distributed Operating Systems (1st ed.). Pearson Education. p. 117. ISBN 9788177581799. Archived from the original on 18 April 2021. Retrieved 16 October 2020.
  14. ^ "Preface - Real-Time Interrupt-driven Concurrency". Archived from the original on 18 September 2020. Retrieved 1 October 2020.
  15. ^ "IBM Knowledge Center". www.ibm.com. Archived from the original on 19 March 2017. Retrieved 29 April 2018.
  16. ^ Silberschatz, Abraham (2006). Operating System Principles (7 ed.). Wiley-India. p. 244. ISBN 9788126509621. Archived from the original on 18 April 2021. Retrieved 16 October 2020.
  17. ^ "Deadlock Avoidance Algorithms in Operating System (OS)". Electronics Mind. 26 January 2022.
  18. ^ Ashcroft, E.A. (1975). "Proving assertions about parallel programs". Journal of Computer and System Sciences. 10: 110–135. doi:10.1016/S0022-0000(75)80018-3.
  19. ^ Kwong, Y. S. (1979). "On the absence of livelocks in parallel programs". Semantics of Concurrent Computation. Lecture Notes in Computer Science. Vol. 70. pp. 172–190. doi:10.1007/BFb0022469. ISBN 3-540-09511-X.
  20. ^ Anderson, James H.; Yong-jik Kim (2001). "Shared-memory mutual exclusion: Major research trends since 1986". Archived from the original on 25 May 2006.
  21. ^ Z?bel, Dieter (October 1983). "The Deadlock problem: a classifying bibliography". ACM SIGOPS Operating Systems Review. 17 (4): 6–15. doi:10.1145/850752.850753. ISSN 0163-5980. S2CID 38901737.

Further reading

[edit]
[edit]
南瓜和什么相克 爱到什么时候 脂蛋白高说明什么问题 低钾血症吃什么药 眼开大财主是什么生肖
什么痣不能点 爱放屁是什么原因 脾大是什么原因 阑尾炎检查什么项目 3D硬金是什么意思
福布斯是什么意思 13岁属什么生肖 为什么老是做梦 脚气是什么菌 附件炎用什么药最好
莫名其妙是什么意思 96166是什么电话 胎盘低要注意什么 无创和羊水穿刺有什么区别 女生没有腋毛代表什么
三月18号是什么星座的hcv9jop4ns8r.cn 物尽其用什么意思hcv8jop8ns7r.cn 去减一笔变成什么字hcv8jop4ns4r.cn 二米饭是什么hcv9jop4ns0r.cn 水果之王是什么水果hcv9jop2ns3r.cn
一喝牛奶就拉肚子是什么原因hcv8jop3ns8r.cn 血小板低吃什么补的快ff14chat.com 什么是豆制品hcv8jop3ns5r.cn 打开什么clwhiglsz.com 白带多用什么药效果好hcv9jop0ns1r.cn
夏天种什么水果hcv8jop9ns7r.cn 孙悟空被压在什么山下hcv8jop6ns1r.cn 距离产生美是什么意思hcv7jop6ns2r.cn 疼风是什么原因引起的mmeoe.com 管型尿是什么意思hcv7jop6ns3r.cn
避讳是什么意思hcv9jop5ns4r.cn 肾疼是什么原因hcv9jop6ns3r.cn 乳头很痒是什么原因hcv7jop7ns1r.cn 土地出让和划拨有什么区别hcv7jop6ns7r.cn 右上眼皮跳是什么预兆hcv9jop7ns2r.cn
百度