You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: rfcs/45-stageless.md
+18-8Lines changed: 18 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -230,14 +230,7 @@ In order to understand exactly what this means, we need to understand atomic ord
230
230
At least, as far as "directly after" is a meaningful concept in a parallel, nonlinear ordering.
231
231
Like the atom, they are indivisible: nothing can get between them!
232
232
233
-
To be fully precise, if we have system `A` that runs "atomically before" system `B` (`.add_system(a.atomically_before(b))`):
234
-
235
-
-`A` is strictly before `B`
236
-
- the "write" data locks of system `A` are relaxed to "read" data locks upon system `A`'s completion
237
-
- "read" data locks of system `A` will not be released until system `B` (and all other atomic dependents) has completed
238
-
- the data locks from system `A` are ignored for the purposes of checking if system `B` can run
239
-
- after all, they're not actualy locked, merely reserved
240
-
- competing read-locks caused by other systems will still need to complete before a data store can be mutated; the effect is to "ignore the locks of `A`", not "skip the check completely"
233
+
To be more precise, if a system `A` is `atomically_before` system `B`, nothing (other than system `B`) can mutate the data that system `A` could access.
241
234
242
235
In addition to their use in run criteria, atomic ordering constraints are extremely useful for forcing tight interlocking behavior between systems.
243
236
They allow us to ensure that the state read from and written to the earlier system cannot be invalidated.
@@ -450,6 +443,21 @@ struct SystemConfig {
450
443
}
451
444
```
452
445
446
+
### Atomic ordering constraints
447
+
448
+
To be fully precise, if we have system `A` that runs "atomically before" system `B` (`.add_system(a.atomically_before(b))`):
449
+
450
+
-`A` is strictly before `B`
451
+
- the "write" data locks of system `A` are relaxed to "read" data locks upon system `A`'s completion
452
+
- "read" data locks of system `A` will not be released until system `B` (and all other atomic dependents) have completed
453
+
- the data locks from system `A` are ignored for the purposes of checking if system `B` can run
454
+
- after all, they're not actualy locked, merely reserved
455
+
- competing read-locks caused by other systems will still need to complete before a data store can be mutated; the effect is to "ignore the locks of `A`", not "skip the check completely"
456
+
- if and only if `A` has multiple atomic dependents, they cannot mutate the data read by `A`, as that would invalidate the state created by `A` that other dependents may be relying on
457
+
458
+
In addition, atomic ordering constraints introduce a new form of schedule unsatisfiability.
459
+
If a system must run between `A` and `B`, but can mutate data that `A` has access to, the schedule is unsatisfiable.
460
+
453
461
### Flushed ordering constraints
454
462
455
463
Being able to assert that commands are processed (or state is flushed) between two systems is a critical requirement for being able to specify logically-meaningful ordering of systems without a global view of the schedule.
@@ -529,6 +537,8 @@ There are two reasons why this doesn't work:
529
537
In practice, almost all run criteria are extremely simple, and fast to check.
530
538
Verifying that the cache is still valid will require access to the data anyways, and involve more overhead than simple computations on one or two resources.
531
539
540
+
In addition, adding multiple atomic ordering constraints originating from a single system is extremely prone to dead-locks; we should not hand users this foot-gun.
541
+
532
542
### Why do we want to store multiple schedules in the `App`?
533
543
534
544
We could store these in a resource in the `World`.
0 commit comments