0

I know that between the threads in the same process, race condition can happen because there are many information explaining about it.

But, I cannot find any information explaining that between processes, race condition can happen.

So, can race condition happen between processes? If so, how can we prevent it?

Super Kai - Kazuya Ito
  • 22,221
  • 10
  • 124
  • 129
  • "Race condition" can happen between two different computers on a network. It can happen between two different gates in an electronic circuit. It can happen in a purely mechanical system. If the state of some system depends on the order in which two (or more) events happen, and if the ordering of those events is indeterminate, then you've got a race condition. – Solomon Slow Nov 04 '22 at 16:31

1 Answers1

1

Yes a race condition can happen when processes share a common resource, such as a region of memory. It is possible for one or more or the processes to write to the shared memory while one or more processes are reading from that same memory. The result of this race condition is memory corruption since the data is in the process of changing while it is being read or the data is being changed simultaneously by several processes.

The solution is conceptually the same as it is for threads. Access to the shared resource must be synchronized so that no process may write to the shared resource while any other process is accessing the resource.

Jim Rogers
  • 4,822
  • 1
  • 11
  • 24