Mutual Exclusion Problem Last updated on 2014/2558 10 8, a full moon day;
For 2 channels, 2 conditional statements exist TRUE; For 4 channels, 4 conditional statements exist TRUE; For 8 channels, 8 conditional statements exist TRUE; And, notice that those invariance properties must be developed in ACT2 and ACT3 stages.
For 2 channels | For 4 channels, also see: Time interleaved 4 channels; | For 8 channels | ... |
{ ... if TRUE then do enter into critical region;
Exit;
if TRUE then do enter into critical region; Exit; ... }
|
{{ ... if TRUE then do enter into critical region;
Exit;
OR if TRUE then do enter into critical region; Exit; ... } OR { ... if TRUE then do enter into critical region; Exit; OR if TRUE then do enter into critical region; Exit; ... }} |
{{{ ... if TRUE then do enter into critical
region; Exit;
OR if TRUE then do enter into critical region; Exit; ... } OR { ... if TRUE then do enter into critical region; Exit; OR if TRUE then do enter into critical region; Exit; ... }} OR {{ ... if TRUE then do enter into critical region; Exit; OR if TRUE then do enter into critical region; Exit; ... } OR { ... if TRUE then do enter into critical region; Exit; OR if TRUE then do enter into critical region; Exit; ... }}} |
Example 1
Commonly known invariance properties in C++ problem is
if ( variable = 0 ); // proper code should be if ( variable == 0 )
Because invariance value 0 zero is bool data type false, non-zero value is bool data type true. However, in Java, the whole expression variable = 0 as integer expression which cannot be converted as Boolean data type, therefore Java programmers do not have the problem.