当前位置:网站首页>Conditions and solutions of deadlock
Conditions and solutions of deadlock
2022-07-02 15:54:00 【lvhui321】
Multiple threads competing for resources wait for each other , The phenomenon that causes permanent blocking is called deadlock
Conditions for Deadlock
1. Mutual exclusivity : Shared resources can only be occupied by one thread
2. To possess and wait for : Threads T Shared resources have been obtained A, Waiting to share resources B Not released when A
3. Do not take : Other threads cannot forcibly occupy T Resources in possession
4. Cycle and wait : Threads T1 Wait for thread T2 Resources in possession , Threads T2 Wait for thread T1 Resources in possession
Crack deadlock
There are three conditions except mutex for the condition of breaking deadlock , as follows :
1. damage “ Occupy and wait ” Conditions , You can apply for all resources at once , So there is no waiting .
2. damage “ Do not take ” Conditions , When a thread occupying some resources further requests other resources , If the application does not arrive , Can actively release the resources it occupies , In this way, we can't seize this condition and destroy .
3. damage “ Loop waiting for ” Conditions , It can be prevented by applying resources in sequence . The so-called sequential application , Resources are in linear order
Of , When applying, you can first apply for a resource with a small serial number , And then apply for a large number of resources , In this way, after linearization, there will be no cycle
了 .
边栏推荐
- Floyed "suggestions collection"
- Some problems about pytorch extension
- (5) Flink's table API and SQL update mode and Kafka connector case
- 动态规划入门二(5.647.62)
- Deux séquences ergodiques connues pour construire des arbres binaires
- Wavedec2 in MATLAB, talk about the wavedec2 function [easy to understand]
- 2279. Maximum number of backpacks filled with stones
- 2303. Calculate the total tax payable
- /bin/ld: 找不到 -lpam
- Boot 事务使用
猜你喜欢
Introduction to dynamic planning I, BFS of queue (70.121.279.200)
处理gzip: stdin: not in gzip formattar: Child returned status 1tar: Error is not recoverable: exitin
Traversal before, during and after binary tree
如何实现十亿级离线 CSV 导入 Nebula Graph
树-二叉搜索树
又是一年毕业季
XPT2046 四线电阻式触摸屏
数仓中的维度表与事实表
Deux séquences ergodiques connues pour construire des arbres binaires
可视化技术在 Nebula Graph 中的应用
随机推荐
Review materials for the special topic of analog electronics with all essence: basic amplification circuit knowledge points
PTA ladder game exercise set l2-001 inter city emergency rescue
SQL FOREIGN KEY
如何实现十亿级离线 CSV 导入 Nebula Graph
Lseek error
【小白聊云】中小企业容器化改造建议
Application of visualization technology in Nebula graph
6092. Replace elements in the array
C # get PLC information (kepserver) II
6090. Minimax games
College entrance examination score line climbing
SQL修改语句
Ssh/scp does not prompt all activities are monitored and reported
Boot 事务使用
/bin/ld: 找不到 -lxml2
HMS core machine learning service helps zaful users to shop conveniently
Postgressql stream replication active / standby switchover primary database no read / write downtime scenario
6091. 划分数组使最大差为 K
Make p12 certificate [easy to understand]
Target detection - make your own deep learning target detection data set with labelimg