This question is in continuation of Question 44.
Answer the question below based on the following code:
Global Variable: int count = 0; Thread1: for(int i = 1; i < 50000; i++) count++; Thread2: for(int i = 1; i < 20000; i++) count++;
Question #163: What can be said about the value of count?
Option:
- Value of count will always be less than or equal to 70000.
- Value of count will always be equal to 70000.
- Value of count will always be greater than or equal to 70000.
- Nothing can be said about value of count.
Solution: The correct answer is the first one. When there is no interleaving, value might be equal to 70000. When there is interleaving, value can only be less than 70000, and not greater.