Ans : 2
Initially count = 0
Suppose P1 and P2 are two processes started parallelly.
P1 : i=1 Read count = 0; increment by 1 and pre-empt (Here count=1; not yet written).
P2 : i=1 Read count = 0; increment by 1; write count = 1
P2 : i=2 Read count = 1; increment by 1; write count = 2
P2 : i=3 Read count = 2; increment by 1; write count = 3
P2 : i=4 Read count = 3; increment by 1; write count = 4 and pre-empt.
P1 : Write count = 1 and pre-empt.
P2: i=5 Read count = 1; increment by 1 and pre-empt (Here count=2; not yet written)
P1 : i=2 Read count = 1; increment by 1; write count = 2
P1 : i=3 Read count = 2; increment by 1; write count = 3
P1 : i=4 Read count = 3; increment by 1; write count = 4
P1 : i=5 Read count = 4; increment by 1; write count = 5
P1 completed.
P2 : Write count = 2
P2 completed.
Final value of count is 2.