When a thread is done executing- how does updates to the memory handled? Is it guaranteed that all the writes would be flushed to the main memory and visible to other thread