educative.io

Remember that volatile doesn’t imply or mean thread-safety

Hi Team,
Can anyone explain this.

TIA


Type your question above this line.

Course: https://www.educative.io/collection/5307417243942912/5707702298738688
Lesson: https://www.educative.io/collection/page/5307417243942912/5707702298738688/5683127032741888

Hi Vinay!
Volatile variables are not thread-safe because they do not make other threads wait and they can easily make changes to variables. That’s why they do not show the expected behavior and are not thread-safe.

Hope it helps. If you still have any queries please let us know.
Thank you.