1. What is race condition?
- If multiple threads are operating simultaneously on same java object then there may be a chance of data consistency problem, this is called race condition.
- We can overcome this problem by using synchronized keyword.
2. What is critical section?
- A critical section is a section of code that is executed by multiple threads and where the sequence of execution for the threads makes a difference in the result of the concurrent execution of the critical section.
- The section of code gives a problem called race condition.
3. Example of race condition?
4. How to avoid race condition?
- We can overcome this problem by using synchronized keyword.
No comments:
Post a Comment