InterviewSolution
| 1. |
What Do You Mean By An Atomic Operation? |
|
Answer» In programming, an atomic operation is one that effectively happens all at once. An atomic operation cannot stop in the MIDDLE: it either happens completely, or it doesn’t happen at all. No SIDE effects of an atomic operation are visible until the action is complete.
Atomic actions cannot be INTERLEAVED, so they can be used without fear of thread interference. However, this does not eliminate all need to synchronize atomic actions, because memory consistency errors are still possible. In programming, an atomic operation is one that effectively happens all at once. An atomic operation cannot stop in the middle: it either happens completely, or it doesn’t happen at all. No side effects of an atomic operation are visible until the action is complete. Atomic actions cannot be interleaved, so they can be used without fear of thread interference. However, this does not eliminate all need to synchronize atomic actions, because memory consistency errors are still possible. |
|