当前位置:网站首页>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
了 .
边栏推荐
- [salesforce] how to confirm your salesforce version?
- 【题解】Educational Codeforces Round 82
- matlab中wavedec2,说说wavedec2函数[通俗易懂]
- Application of visualization technology in Nebula graph
- Pyobject to char* (string)
- [2. Basics of Delphi grammar] 3 Object Pascal constants and variables
- Floyed "suggestions collection"
- /Bin/ld: cannot find -llz4
- 【Salesforce】如何确认你的Salesforce版本?
- /Bin/ld: cannot find -lxml2
猜你喜欢
Experiment collection of University "Fundamentals of circuit analysis". Experiment 7 - Research on sinusoidal steady-state circuit
PostgresSQL 流复制 主备切换 主库无读写宕机场景
Pattern matching extraction of specific subgraphs in graphx graph Computing Practice
爱可可AI前沿推介(7.2)
数仓中的维度表与事实表
Application of visualization technology in Nebula graph
如何實現十億級離線 CSV 導入 Nebula Graph
使用 percona 工具给 MySQL 表加字段中断后该如何操作
【5G NR】RRC连接释放
Experiment collection of University "Fundamentals of circuit analysis". Experiment 4 - Research on linear circuit characteristics
随机推荐
已知两种遍历序列构造二叉树
仙人掌之歌——投石问路(3)
Deux séquences ergodiques connues pour construire des arbres binaires
PHP static members
(万字精华知识总结)Shell脚本编程基础知识
可视化技术在 Nebula Graph 中的应用
Use ffmpeg command line to push UDP and RTP streams (H264 and TS), and ffplay receives
Thoroughly understand browser strong cache and negotiation cache
数据湖(十一):Iceberg表数据组织与查询
Xpt2046 four wire resistive touch screen
/Bin/ld: cannot find -lxml2
Comparison between rstan Bayesian regression model and standard linear regression model of R language MCMC
Introduction to dynamic planning I, BFS of queue (70.121.279.200)
The sea of stars hidden behind the nebula graph
College entrance examination admission score line climbing
Pattern matching extraction of specific subgraphs in graphx graph Computing Practice
Tree binary search tree
奥比中光 astra: Could not open “2bc5/[email protected]/6“: Failed to set USB interface
2303. Calculate the total tax payable
Cultural scores of summer college entrance examination