Why Atomic Operations are Needed?

Let us understand this example by relate it to a program of incrementing value of a variable.

  • Initially, considered any variable let’s say A, which has initial value as 0.
  • An increment operation is performed over A, which turns its value to 1. However, this operation is interleaved in between due to any other process, which uses the same variable.
  • That process increments the value of A by 10, which turns the current value of A as 11.
  • Now when inter-leaved operation at point 2 starts executing again from its stopping point, the value of A must be 1 which is now 11, this generated inaccurate results.

If the increment operation at point 2 was performed by an atomic operation, then it doesn’t allow the inter-leaving process and ensures the accuracy of results generated.

Atomic Operations in OS

Atomic operations in Operating System are those operations, which execute without interruption of any other process in between their execution phase. They execute at the lowest level and can’t be broken down further. Formally, when an atomic operation is in its executing process, no other process can read, modify, or interrupt that operation’s data.

These types of operations are used very much in parallel processing where the operations are needed to run without being dependent or interrupted by any other process of an OS. These operations are the backbones of modern Operating Systems, which use parallel processing to execute tasks at a much faster speed. Parallel processing is a very popular method for making modern OS much faster. These atomic operations help to implement parallel processing.

Similar Reads

Types of Atomic Operations

There are two types of atomic operations, which small atomic operations and large atomic operations. Let us see the difference between them:...

Why Atomic Operations are Needed?

Let us understand this example by relate it to a program of incrementing value of a variable....

FAQs on Atomic Operations

Q.1: Which type of atomic operation is being used regularly?...

Contact Us