Your question is tagged assembler but asks about i++. You have no guarantee that an i++
in your C code will compile to a single instruction that changes memory. If you have multiple threads that load i
from memory with one instruction, increments it with another and writes it back to memory with a third, a thread switch between the first and third of those can cause some updates to i
to be lost.