Interview Question
Country: United States
Well... I guess this is the Caller dependency...
For Normal Cases we can Say if Thread A only executes then the min value will be there.
and For both thread executes the max value will get generated, But Still there are more complexity involved if we keep discussing.
But i n Laymen Term.
Min=3 ,
Max =8
B reads i (stored value 0)
- Anonymous December 18, 2012A reads i (0)
A stores i + 1 (1)
A reads i (1)
A stores i + 1 (2)
B stores i + 1 (1)
A reads i (1)
B completes (5)
A stores i + 1 (2).
So, min = 2, max = 8.