499 @{thm (lhs) cp_def} & @{text "\<equiv>"} & @{thm (rhs) cp_def} |
508 @{thm (lhs) cp_def} & @{text "\<equiv>"} & @{thm (rhs) cp_def} |
500 \end{tabular} |
509 \end{tabular} |
501 \end{isabelle} |
510 \end{isabelle} |
502 |
511 |
503 \noindent |
512 \noindent |
504 With these abbreviations we can introduce |
513 With these abbreviations in place we can introduce |
505 the notion of threads being @{term readys} in a state (i.e.~threads |
514 the notion of threads being @{term readys} in a state (i.e.~threads |
506 that do not wait for any resource) and the running thread. |
515 that do not wait for any resource) and the running thread. |
507 |
516 |
508 \begin{isabelle}\ \ \ \ \ %%% |
517 \begin{isabelle}\ \ \ \ \ %%% |
509 \begin{tabular}{@ {}l} |
518 \begin{tabular}{@ {}l} |
624 only one lock, can cause indefinite Priority Inversion for one of the |
633 only one lock, can cause indefinite Priority Inversion for one of the |
625 high-priority threads, invalidating their two bounds. |
634 high-priority threads, invalidating their two bounds. |
626 |
635 |
627 Even when fixed, their proof idea does not seem to go through for |
636 Even when fixed, their proof idea does not seem to go through for |
628 us, because of the way we have set up our formal model of PIP. One |
637 us, because of the way we have set up our formal model of PIP. One |
629 reason is that we allow that critical sections can intersect |
638 reason is that we allow critical sections to intersect |
630 (something Sha et al.~explicitly exclude). Therefore we have |
639 (something Sha et al.~explicitly exclude). Therefore we have |
631 designed a different correctness criterion for PIP. The idea behind |
640 designed a different correctness criterion for PIP. The idea behind |
632 our criterion is as follows: for all states @{text s}, we know the |
641 our criterion is as follows: for all states @{text s}, we know the |
633 corresponding thread @{text th} with the highest precedence; we show |
642 corresponding thread @{text th} with the highest precedence; we show |
634 that in every future state (denoted by @{text "s' @ s"}) in which |
643 that in every future state (denoted by @{text "s' @ s"}) in which |
635 @{text th} is still alive, either @{text th} is running or it is |
644 @{text th} is still alive, either @{text th} is running or it is |
636 blocked by a thread that was alive in the state @{text s} and was in |
645 blocked by a thread that was alive in the state @{text s} and was waiting |
637 the possession of a lock in @{text s}. Since in @{text s}, as in |
646 or in the possession of a lock in @{text s}. Since in @{text s}, as in |
638 every state, the set of alive threads is finite, @{text th} can only |
647 every state, the set of alive threads is finite, @{text th} can only |
639 be blocked a finite number of times. This is independent of how many |
648 be blocked a finite number of times. This is independent of how many |
640 threads of lower priority are created in @{text "s'"}. We will actually prove a |
649 threads of lower priority are created in @{text "s'"}. We will actually prove a |
641 stronger statement where we also provide the current precedence of |
650 stronger statement where we also provide the current precedence of |
642 the blocking thread. However, this correctness criterion hinges upon |
651 the blocking thread. However, this correctness criterion hinges upon |
1066 current precedence unchanged. For the others we have to recalculate the current |
1075 current precedence unchanged. For the others we have to recalculate the current |
1067 precedence. To do this we can start from @{term "th"} |
1076 precedence. To do this we can start from @{term "th"} |
1068 and follow the @{term "depend"}-edges to recompute using Lemma~\ref{childrenlem} |
1077 and follow the @{term "depend"}-edges to recompute using Lemma~\ref{childrenlem} |
1069 the @{term "cp"} of every |
1078 the @{term "cp"} of every |
1070 thread encountered on the way. Since the @{term "depend"} |
1079 thread encountered on the way. Since the @{term "depend"} |
1071 is loop free, this procedure will always stop. The following two lemmas show, however, |
1080 is assumed to be loop free, this procedure will always stop. The following two lemmas show, however, |
1072 that this procedure can actually stop often earlier without having to consider all |
1081 that this procedure can actually stop often earlier without having to consider all |
1073 dependants. |
1082 dependants. |
1074 |
1083 |
1075 \begin{isabelle}\ \ \ \ \ %%% |
1084 \begin{isabelle}\ \ \ \ \ %%% |
1076 \begin{tabular}{@ {}l} |
1085 \begin{tabular}{@ {}l} |