Consider the concurrent program
x := 1; cobegin x := x + x + 1 || x := x + 2 coend;
Reading and writing of a variable is atomic, but evaluation of an expression is not atomic. The set of possible values of variable $x$ at the end of execution of the program is
Repeated question:
https://gateoverflow.in/18751/tifr2010-b-28
Since it is given that the evaluation of an expression is not atomic, can 4 be an answer as well? (Although not mentioned in options)
While evaluating the first expression x = x+x+1, if after evaluation of x=x+x, resulting in value of x equal to 2, can the process preempt to the other condition , i.e x= x+2, to give the value 4?
64.3k questions
77.9k answers
243k comments
79.7k users