I have a doubt that when a thread A starts its operation on int q=1 and meanwhile the thread B starts operation on q
Both of them create a copy of the main memory in the local cache but when will the data are reflected back to main memory and get updated (not using volatile keyword) and using volatile keyword what is happening Can anyone please explain?