-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
234 additions
and
338 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
Author: | ||
- Xinyang YU | ||
Author Profile: | ||
- https://linkedin.com/in/xinyang-yu | ||
tags: | ||
- OS | ||
Creation Date: 2023-10-18T19:12:00 | ||
Last Date: 2023-12-14T19:06:05+08:00 | ||
References: | ||
--- | ||
## Abstract | ||
--- | ||
- Waiting for something for *infinite time*, in which there is *no progress* for waiting [[Process]] | ||
- When all [[#Coffman conditions]] are fulfilled, it doesn't guarantee one, just prone to one | ||
- We have [[#Handling Strategies]] to handle deadlocks | ||
- Can only happen if there is *more than one lock* | ||
|
||
|
||
## Coffman conditions | ||
--- | ||
- Useful for understanding and diagnosing [[Deadlock (死锁)]] situations | ||
- Provide a foundation for designing algorithms and systems that avoid deadlocks | ||
- 4 *necessary* conditions - [[#Mutual Exclusion]], [[#Hold and Wait]], [[#No Preemption]] & [[#Circular Wait]] | ||
### Mutual Exclusion | ||
- At least one resource must be held in a *non-shareable mode*. | ||
- This means that only *one* [[Process]] can use the resource at any given time | ||
- If another process requests the resource, that process must wait until the resource has been released | ||
|
||
### Hold and Wait | ||
- A process must be holding at least one resource and waiting to acquire additional resources that are currently being held by other processes | ||
|
||
### No Preemption | ||
- Resources cannot be [[Preemption]] from a process. They can only be released by the process holding them, typically after the process has finished its task. | ||
|
||
### Circular Wait | ||
- There exists a set of waiting processes such that P0 is waiting for a resource held by P1, P1 is waiting for a resource held by P2, and so on, with Pn waiting for a resource held by P0 | ||
|
||
## Handling Strategies | ||
--- | ||
### Prevention | ||
- Ensure that at least one of the [[[Deadlock (死锁)#Coffman conditions]] does not hold. For example, by implementing a **resource allocation policy** that ensures no [[#Circular Wait]] | ||
- | ||
- ### Avoidance | ||
- The system has some additional a *prior information* available. | ||
- The most famous algorithm used for deadlock avoidance is the [[Banker's Algorithm]] | ||
|
||
### Detection | ||
- The system periodically checks for [[Deadlock (死锁)]]. If detected, actions are taken to recover from it | ||
|
||
### Ignorance | ||
- Simply ignore the problem and assume Deadlock (死锁) will never occur. | ||
- This is suitable for some environments where deadlocks are rare and the overhead of other handling strategies is not justified | ||
|
33 changes: 0 additions & 33 deletions
33
content/OS/Main Components/Deadlock (死锁)/Coffman Conditions.md
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
content/OS/Main Components/Deadlock (死锁)/Deadlock Handling Strategies.md
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletions
23
content/OS/Main Components/File System/File System (Directory Hierarchy).md
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.