Skip to content

Commit f02150d

Browse files
committed
[docs fix]修正对死锁的四个必要条件的描述
1 parent c5766c7 commit f02150d

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

docs/cs-basics/operating-system/operating-system-basic-questions-01.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -145,18 +145,22 @@ head:
145145

146146
🙋 **** :死锁描述的是这样一种情况:多个进程/线程同时被阻塞,它们中的一个或者全部都在等待某个资源被释放。由于进程/线程被无限期地阻塞,因此程序不可能正常终止。
147147

148-
### 死锁的四个条件
148+
### 死锁的四个必要条件
149149

150150
👨‍💻**面试官****产生死锁的四个必要条件是什么?**
151151

152-
🙋 ****如果系统中以下四个条件同时成立,那么就能引起死锁:
152+
🙋 ****
153153

154154
- **互斥**:资源必须处于非共享模式,即一次只有一个进程可以使用。如果另一进程申请该资源,那么必须等待直到该资源被释放为止。
155155
- **占有并等待**:一个进程至少应该占有一个资源,并等待另一资源,而该资源被其他进程所占有。
156156
- **非抢占**:资源不能被抢占。只能在持有资源的进程完成任务后,该资源才会被释放。
157157
- **循环等待**:有一组等待进程 `{P0, P1,..., Pn}``P0` 等待的资源被 `P1` 占有,`P1` 等待的资源被 `P2` 占有,......,`Pn-1` 等待的资源被 `Pn` 占有,`Pn` 等待的资源被 `P0` 占有。
158158

159-
注意,只有四个条件同时成立时,死锁才会出现。
159+
**注意 ⚠️** :这四个条件是产生死锁的 **必要条件** ,也就是说只要系统发生死锁,这些条件必然成立,而只要上述条件之一不满足,就不会发生产生死锁。
160+
161+
下面是百度百科对必要条件的解释:
162+
163+
> 如果没有事物情况 A,则必然没有事物情况 B,也就是说如果有事物情况 B 则一定有事物情况 A,那么 A 就是 B 的必要条件。从逻辑学上看,B 能推导出 A,A 就是 B 的必要条件,等价于 B 是 A 的充分条件。
160164
161165
### 解决死锁的方法
162166

Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<mxfile host="Electron" modified="2022-10-23T12:19:29.818Z" agent="5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/20.3.0 Chrome/104.0.5112.114 Electron/20.1.3 Safari/537.36" etag="tIu7qzNIn8AvCI8hyjhY" version="20.3.0" type="device"><diagram id="O1q-3gN19tnn94MyZq-a" name="Page-1">7VrbcqM4EP0aPSaFwNwejY1nZzbeSm1qazaPCsiYBCOPkG/79SuBMBfhlF02sSuZSipGrdaFc7pb6o6BMVpsv1G0nE9JiBOga+EWGGOg61DTXf4hJLtC4mpGIYhoHEqlSvAU/4fLkVK6ikOcNRQZIQmLl01hQNIUB6whQ5SSTVNtRpLmqksUYUXwFKBElf6MQzYvpI5uV/I/cBzNy5WhJV/4BQVvESWrVK4HdGNiTSYTp+heoHIu+aLZHIVkUxMZPjBGlBBWPC22I5wIbEvYinGTA737fVOcsmMG/PqBybMWhRBP4z+f/b9G9qt1J2fJ2K7EA4ccHtkklM1JRFKU+JXUC1Z0jcWkkDdyAPKWxlvVgAdCllLlFTO2k8SjFSNcNGeLRPZmjJK3PfQcFW9GUibVoZVrIMqGgmouCRKUZXFQiidxUk7EYaC7f8VG7qFTtp/lxvLGeNto7eqtR0zjBWaYSmGBiwDjINwldmRFA/wOxrq0akQjzN7Rs/ZGwZ0NE74buuPjKE4Qi9fNfSBp9dFebz/0kcR8h7omPVQ3pP1J/xw4WnOKYl9yVGU//KG2jUqUW9UJFibffo2SFS4dpWVylQ0JHjfzmOGnJcox3fCg07SXunWYos0tYEQSQvO5jJkT4CDY21XZk5JUmG72hlkwlxTvHbLie40pw9v3GVcZkgOcJtDQku1NFVYMTcrmtZCiW9phUht0nIq9oWA/evyHC/7GUZxxW8/OpKIJPYahie2joG+TeGkqoKHfmw029m5QYwO6psqG2RcZg24yWgTwd2ZdAbKFZh16KUJJHKUiQnKMRBjzBIIxP+iGsmMRh2EewLtobcZxJQQf9JtcU24fXoK5thc5Hbx1eZHRF2/m1Y/I2slmnnKwXexoveBhaB15GDqXOAz5m6FdTWEpDrns8FlpuE3jM+3Wleo0ff5Q7OCiB6qlxJEHHue1EQrm+KLxPETYmQUnhe7OWHWJqDBoXWJcNSqYXVGht2hu/44KF4wKzpFRAWrdZnJ0WDiLc0fxPG+VAd8C/IzyPODbwBsCbwL8CfBGwHFyyQi4BvBNMBwDl0sGwHOEvs//8t6BHD60hY4zBs5EdA198StG8V6x5vTpO/ANoenAqS8axRrueR5/vGe3r9kzbB2+Zvfg8ZZ2pMfbfXm8q7CfU8Y5GuW0cqILEjkztuTHHf5Aa/RNlDiAbiXiZvdCG3xZv1aiAJCDf5fl6A+5AjSX2xzIsp8/RfmnsCluSlA8DD3guvulXvlSeTXlPkhv9F6ZoBecePvCSXvxdmrH2zWb8/KffE7GvZ2kZUDrM6mDevuIN9X7qNNhh7AvOywnrhniFMWpCBJ4QeQCXyAi2Pq1IwKEChMPXKSN7/q8jN1ict1xHXPt+4/MrqFaZ8q5+N4DF7PZTD+yxtQ3F3rLKW6BCbXq9KD3k6CY2AkHN8GD6hNGR/nvYwtOcKCg/RmK+45xSrbTd3EfSkZ7r+6fZwqmenk9zxNvtgo/0Jp+eANleKiWbL5IHX5g2jdXh4d2Nxs3mTBdrxBvtv3o6oV4qNZffmfgnz8Dt1oZ+KDrYvWxGbhaCvoKeV9HML9+tqGr1ZCvkPeZ1u0x0VEN+fR5n+oTfeZ9vFl9X6z4f2L1pTzD/x8=</diagram></mxfile>
1+
<mxfile host="Electron" modified="2022-10-23T12:27:25.429Z" agent="5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/20.3.0 Chrome/104.0.5112.114 Electron/20.1.3 Safari/537.36" etag="nf-jpJDZ8wcK9o-f4CmB" version="20.3.0" type="device"><diagram id="O1q-3gN19tnn94MyZq-a" name="Page-1">7Vpbc6s2EP41ekwGgbk9GozTcxp3Ms102jwqIGMSjHyEfOuvrwTCBoQz9rGJPSedZGJ2tbqw3960MTD8+eaBosVsQiKcAl2LNsAYAV2Hmu7yD8HZlhxX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