Science, asked by Anurag4726, 1 year ago

What is the famous producer consumer problem?

Answers

Answered by Dharmendra2120
0
In Simple term we can say, when two Process trying to access same(commonly shared) resource at the same time and one failed to do its operation because another process is using that resource.

Solution
We can solve this problem using synchronized keyword. synchronized takes care for accessing List<Integer>, while one thread is accessing the List<Integer> another thread has to wait until first thread finishes its work.
Attachments:
Similar questions