2

Do "atomic" and "synchronous" mean the same thing or are there some minute differences?

Looking at the answers to this question, I think the answer to my question is yes, they're synonyms. Are the following true in general?

  • a synchronous operation will complete before the next operation starts
  • an atomic operation is the same as a synchronous operation
  • an asynchronous operation will complete at some point before or after the next operation starts
Community
  • 1
  • 1
Matt
  • 708
  • 7
  • 20

1 Answers1

11

Not quite the same. An atomic operation is one that can't be subdivided into smaller parts. So, in Java, assigning to an int is atomic: nothing can interrupt it, it either completes or doesn't.

A synchronous operation is one that simulates being atomic through some programming mechanism you invoke using the synchronized keyword. The implementation of that can vary.So in a synchronized block, the run time system enforces what's called a critical region in which only one thread of control can pass at the same time.

Charlie Martin
  • 107,118
  • 23
  • 189
  • 257