|
|
@@ -29,43 +29,45 @@ In a normal program, you can increment a counter like so:
|
|
|
|
|
|
This is what they would expect to happen:
|
|
|
|
|
|
-+------------------------------------+------------------------------------+
|
|
|
-| Instance 1 | Instance 2 |
|
|
|
-+====================================+====================================+
|
|
|
-| read very_important_count (5) | |
|
|
|
-+------------------------------------+------------------------------------+
|
|
|
-| add 1 (6) | |
|
|
|
-+------------------------------------+------------------------------------+
|
|
|
-| write very_important_count (6) | |
|
|
|
-+------------------------------------+------------------------------------+
|
|
|
-| | read very_important_count (6) |
|
|
|
-+------------------------------------+------------------------------------+
|
|
|
-| | add 1 (7) |
|
|
|
-+------------------------------------+------------------------------------+
|
|
|
-| | write very_important_count (7) |
|
|
|
-+------------------------------------+------------------------------------+
|
|
|
-
|
|
|
-Table: Expected Results
|
|
|
+
|
|
|
+.. table:: Expected Results
|
|
|
+
|
|
|
+ +------------------------------------+------------------------------------+
|
|
|
+ | Instance 1 | Instance 2 |
|
|
|
+ +====================================+====================================+
|
|
|
+ | read very_important_count (5) | |
|
|
|
+ +------------------------------------+------------------------------------+
|
|
|
+ | add 1 (6) | |
|
|
|
+ +------------------------------------+------------------------------------+
|
|
|
+ | write very_important_count (6) | |
|
|
|
+ +------------------------------------+------------------------------------+
|
|
|
+ | | read very_important_count (6) |
|
|
|
+ +------------------------------------+------------------------------------+
|
|
|
+ | | add 1 (7) |
|
|
|
+ +------------------------------------+------------------------------------+
|
|
|
+ | | write very_important_count (7) |
|
|
|
+ +------------------------------------+------------------------------------+
|
|
|
|
|
|
This is what might happen:
|
|
|
|
|
|
-+------------------------------------+------------------------------------+
|
|
|
-| Instance 1 | Instance 2 |
|
|
|
-+====================================+====================================+
|
|
|
-| read very_important_count (5) | |
|
|
|
-+------------------------------------+------------------------------------+
|
|
|
-| | read very_important_count (5) |
|
|
|
-+------------------------------------+------------------------------------+
|
|
|
-| add 1 (6) | |
|
|
|
-+------------------------------------+------------------------------------+
|
|
|
-| | add 1 (6) |
|
|
|
-+------------------------------------+------------------------------------+
|
|
|
-| write very_important_count (6) | |
|
|
|
-+------------------------------------+------------------------------------+
|
|
|
-| | write very_important_count (6) |
|
|
|
-+------------------------------------+------------------------------------+
|
|
|
-
|
|
|
-Table: Possible Results
|
|
|
+.. table:: Possible Results
|
|
|
+
|
|
|
+ +------------------------------------+------------------------------------+
|
|
|
+ | Instance 1 | Instance 2 |
|
|
|
+ +====================================+====================================+
|
|
|
+ | read very_important_count (5) | |
|
|
|
+ +------------------------------------+------------------------------------+
|
|
|
+ | | read very_important_count (5) |
|
|
|
+ +------------------------------------+------------------------------------+
|
|
|
+ | add 1 (6) | |
|
|
|
+ +------------------------------------+------------------------------------+
|
|
|
+ | | add 1 (6) |
|
|
|
+ +------------------------------------+------------------------------------+
|
|
|
+ | write very_important_count (6) | |
|
|
|
+ +------------------------------------+------------------------------------+
|
|
|
+ | | write very_important_count (6) |
|
|
|
+ +------------------------------------+------------------------------------+
|
|
|
+
|
|
|
|
|
|
Race Conditions and Critical Regions
|
|
|
------------------------------------
|