java knowledge link

Java Memory Model referred jmm:

  

 

  It defines a thread to another thread is visible, the other is the concept of shared variables, because Java memory model is also called shared memory model, that is, multiple threads simultaneously access a variable that is also called shared variables,

  Shared variable is stored in the main memory, and the circumstances of each thread has its own local private memory, if there are multiple threads to access a variable, it may appear that the local data memory a thread in no time flushed to main memory, so that security problems thread.

Multithreading read shared variables: volaile and sychronized two ways

  https://www.cnblogs.com/zhengbin/p/5654805.html

 

Guess you like

Origin www.cnblogs.com/hdc520/p/11369649.html