Computer Science, asked by Harshit6173, 11 months ago

Explain thread Synchronization with suitable example?

Answers

Answered by DeviIQueen
1

Explanation:

When we start two or more threads within a program, there may be a situation when multiple threads try to access the same resource and finally they can produce unforeseen result due to concurrency issues. For example, if multiple threads try to write within a same file then they may corrupt the data because one of the threads can override data or while one thread is opening the same file at the same time another thread might be closing the same file.

example :

Java

Similar questions