vault backup: 2025-03-10 19:32:06
This commit is contained in:
parent
e206c6bcf7
commit
67736a6535
1 changed files with 3 additions and 3 deletions
|
@ -265,15 +265,15 @@ It looks like I can experience at most $2n-1$ other critical sections, but it is
|
||||||
- $p_{n}$ has to wait all other processes to complete their CSs
|
- $p_{n}$ has to wait all other processes to complete their CSs
|
||||||
- when $p_{n-1}$ completes its CS, its new DATE will be $n+(n-1)+1=2n$ -> RESET
|
- when $p_{n-1}$ completes its CS, its new DATE will be $n+(n-1)+1=2n$ -> RESET
|
||||||
- now all $p_{1}\dots p_{n-1}$ invoke lock again and complete their CSs (after that $p_i$ completes its CS, now it has `DATE[i] <- n+i`, because as everyone invoked lock after the RESET, max date was `n`)
|
- now all $p_{1}\dots p_{n-1}$ invoke lock again and complete their CSs (after that $p_i$ completes its CS, now it has `DATE[i] <- n+i`, because as everyone invoked lock after the RESET, max date was `n`)
|
||||||
- so $p_n$ has to wait n-1 CSs for the reset, and another n-1 CSs before entering again
|
- so $p_n$ has to wait n-1 CSs for the reset, and another n-1 CSs before entering again. **Literally the worst case is when the process is the first of the first round, and the last of the last round.**
|
||||||
|
|
||||||
|
|
||||||
#### Improvement of Aravind’s algorithm
|
#### Improvement of Aravind’s algorithm
|
||||||
```
|
```
|
||||||
unlock(i) :=
|
unlock(i) :=
|
||||||
∀j≠i.if DATE[j] > DATE[i] then
|
∀j≠i.if DATE[j] > DATE[i] then
|
||||||
DATE[j] <- DATE[j]-1
|
DATE[j] <- DATE[j]-1
|
||||||
DATE[i] <- n STAGE[i] <- 0
|
DATE[i] <- n
|
||||||
|
STAGE[i] <- 0
|
||||||
FLAG[i] <- down
|
FLAG[i] <- down
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue