1

In java volatile has a hapens before relationship and ensures read of volatile will see the write to volatile done in another thread at cost of some performance overhead. I want to know if write to volatile(In writer thread and only one writer thread) are very infrequent say every half an hour and read is very frequent say every 500 ms . Will the volatile read be slower than non volatile read till the time its not updated by another thread.

Thanks.

user1846749
  • 2,165
  • 3
  • 23
  • 36
  • every 500 ms. is far from being "very frequent" for a modern computer. You don't need to optimiize this. – JB Nizet Dec 10 '16 at 10:56

0 Answers0