thread #1: local a = x[i] a = a + 1 context_switch() thread #2: local b = x[i] b = b + 1 x[i] = b context_switch() thread #1: x[i] = a