mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-27 23:04:05 -06:00
vault backup: 2022-10-30 15:25:53
This commit is contained in:
parent
3b674050e3
commit
e87d0dbde2
@ -107,7 +107,34 @@ again:
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## for mutual exclusion
|
semaphore without busy waiting 
|
||||||

|

|
||||||
|

|
||||||
|
|
||||||
|
range of semaphore init vals
|
||||||
|
- 1 for mutex
|
||||||
|
- 0 for process sync
|
||||||
|
- >1 for concurrent processes/threads
|
||||||
|
|
||||||
|
- negative values tell us how many processes are waiting
|
||||||
|
|
||||||
|
# Deadlock
|
||||||
|
Definition of deadlock: a set of processes is in a deadlocked state if every process is waiting for an event that can only be caused by another process in the set.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
conditions
|
||||||
|
- mutual exclusion: at least one of the held resources must be nonsharable
|
||||||
|
- hold and wait: must be at least one process holding a resource and one waiting
|
||||||
|
- no preemption: a resource can only be released by the process thats holding it
|
||||||
|
- circular wait:
|
||||||
|
- P1 is waiting on a resource held by P2;
|
||||||
|
- P2 is waiting on . . .
|
||||||
|
- Pn is waiting on a resource held by P1.
|
||||||
|
|
||||||
|
typical solution
|
||||||
|
- break wait by acquiring lock in the same order
|
||||||
|
- 
|
||||||
|
|
||||||
|
os solution
|
||||||
|
- 
|
||||||
|
|||||||
@ -50,6 +50,7 @@ tags:
|
|||||||
- [17-processes-communication](notes/17-processes-communication.md)
|
- [17-processes-communication](notes/17-processes-communication.md)
|
||||||
- [18-processes-sharing-and-threads](notes/18-processes-sharing-and-threads.md)
|
- [18-processes-sharing-and-threads](notes/18-processes-sharing-and-threads.md)
|
||||||
- [19-cpu-scheduling](notes/19-cpu-scheduling.md)
|
- [19-cpu-scheduling](notes/19-cpu-scheduling.md)
|
||||||
|
- [20-sync-deadlock](notes/20-sync-deadlock.md)
|
||||||
|
|
||||||
|
|
||||||
# Archive
|
# Archive
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user