vault backup: 2025-03-03 09:02:47
This commit is contained in:
parent
d4234a5acb
commit
fd4c390b08
3 changed files with 22 additions and 2 deletions
|
@ -42,3 +42,22 @@ Different processes work to let all of them succeed in their task.
|
|||
- only produced data can be consumed
|
||||
- every datum can be consumed at most once
|
||||
|
||||
#### Competition
|
||||
Different processes aim at executing some action, but only one of them succeeds.
|
||||
Usually, this is related to the access of the same shared resource.
|
||||
|
||||
Example: two processes want to withdraw from a bank account.
|
||||
|
||||
```js
|
||||
function withdraw() {
|
||||
x := account.read();
|
||||
if x ≥ 1M€ {
|
||||
account.write(x – 1M€);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
While `read()` and `write()` may be considered as atomic, their sequential composition **is not**.
|
||||
|
||||
![[Pasted image 20250303090135.png]]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue