I initially thought this was a programming question.
To be honest, I don't know the answer to your question. But what I do know, is that there isn't a single answer and each "type" of processor may have a different answer.
For example, a major difference between the 80386 and 80486 is the latter has support for multi CPU systems. It achieves this by pushing the problem of synchronisation out to the memory bus. The CPU can have an instruction restarted if necessary. I can't imagine a solution that sits on this will be compatible with a basic implementation.
But like I said, I don't know the answer to your question.
Note that we discuss here 2 cores, not 2 processes on the same core.
Two different thread are potentially executed on different cores (it is up to OS sheduler).
Atomic variables are those, operation on which cannot be interrupted. So when reading, nothing can write in the middle of the read etc.
On x86 reads and write of aligned memory are guaranteed to be atomic. So if your variable is integral variable no larger than register size (32 or 64 bit), you can use atomic types for no cost and get thread safety.
Otherwise you need mutex. Mutex is the thread-safe varable you can safely try to acquire and do operation on some other non-safe variable, while other threads who want to access same variable will have to wait their turn.
Basicly atomics are inherently safe, when mutex is like thread-safe flag denoting if it is safe to access shared memory.