diff --git a/School/Analyse/Periode 2/Week 1.md b/School/Analyse/Periode 2/Week 1.md index 6155c51..7e8996d 100644 --- a/School/Analyse/Periode 2/Week 1.md +++ b/School/Analyse/Periode 2/Week 1.md @@ -111,10 +111,29 @@ These bugs are hard to detect and fix. # Correctness Sequetial programs wil always give the same result. Debugging makes sense. -Concurrent programs do not behave like this. Some instances may give correct output and some not. - - - +Concurrent programs do not behave like this. Some instances may give correct output and some not. (Without protections) + +This implies that we cannot debug a concurrent program in the +normal way, because each time we run the program, we will likely +have a different order of interleaving. + +Correctness of (non-terminating) concurrent programs is defined in +terms of properties of computations, rather than a functional result. + +Types: +- Safety properties: the property must always be true. + Example: Always, mouse cursor is displayed. + +- Liveness properties: The property must become true at some point. + Example: Click with a mouse, eventually the mouse cursor changes. + +# Fairness +Arbitrary interleaving assumes no order of speed executing statements for diffrent processes/tasks. +- However, it does not make sense to assume that statements from any +specific process are never selected in the interleaving. + +A scenario of executing statements is (weakly) fair if a statement that +is continually enabled, eventually is selected to execute.