86.1k views
3 votes
I. Explain what Race Condition is and how it can be prevented.

User Yuli
by
8.1k points

1 Answer

2 votes

Answer:

In layman terms, a race condition can be defined as, a condition in which two or more threads compete together to get certain shared resources. For example, if thread A is reading data from the linked list and another thread B is trying to delete the same data.

Step-by-step explanation:

To prevent the race conditions from occurring, you can lock shared variables, so that only one thread at a time has access to the shared variable.

User Travis Beck
by
6.8k points