The answer is: all the permutations of 1,2,3 where all 3 numbers present
(there are six of them) + all the permultations of 1,2,3 where only
2 numbers present (also six of these) + all the permutations of 1,2,3 where only
1 number present (three possibilities) for a total of 15 possibilities.
- If all three numbers present, it's as if we were deterministic. Here's how it could happen (for this example order, all 6 permutations are possible = {123, 132, 213, 231, 312, 321}):
- finish starts empty
- 1 reads finish (), joins its 1, finish is now 1.
- 2 reads finish (1), joins its 2, finish is now 12.
- 3 reads finish (12), joins its 3, finish is now 123.
- finish is 123
- If only two numbers were present, we had a race condition, and here's how it could happen (again, all 6 combinations and permutations are possible = {12, 21, 13, 31, 23, 32}):
- finish starts empty
- 3 reads finish () into its hold
- 1 reads finish () into its hold
- 3 joins its 3 to the number it held (), finish is now 3
- 1 joins its 1 to the number it held () and sets finish to 1. The 3 is now lost, clobbered due to a race condition.
- 2 reads finish (1), joins its 2, finish is now 12.
- finish is 12
- If only one number were present, we also had a race condition, and here's how it could happen (again, all permutations possible = {1, 2, 3}):
- finish starts empty
- 1 reads finish () into its hold
- 2 reads finish () into its hold
- 3 reads finish () into its hold
- 3 joins its 3, finish is now 3
- 2 joins its 2 to the number it held () and sets finish to 2. The 3 is now lost, clobbered due to a race condition.
- 1 joins its 1 to the number it held () and sets finish to 1. The 2 is now lost, clobbered due to a race condition.
- finish is 1