vault backup: 2025-03-10 08:34:43

This commit is contained in:
Marco Realacci 2025-03-10 08:34:43 +01:00
parent 78963dc45a
commit 2050469004

View file

@ -6,3 +6,23 @@ We can strenghten the model by adding specialized HW primitives, that essentiall
Usually, every operating system provides at least one specilized HW primitive. Usually, every operating system provides at least one specilized HW primitive.
##### Most common ones: ##### Most common ones:
- **Test&set:** atomic read+write of a boolean register
- **Swap:** atomic read+write of a general register (generalization of the above)
- **Fetch&add:** atomic read+increase of an integer register
- **Compare&swap:** tests the value of a general register, returns a boolean (result of the comparison, true if it is the same).
#### Test&Set
```
Let X be a boolean register
X.test&set() :=
tmp <- X
X <- 1
return tmp
(the function is implemented in an atomic way by the hardware by suspending the interruptions!)
```
###### How do we use it?
```
lock()