java memory model and the relationship between memory and cpu

  

 

The relationship between main memory and cpu, because cpu is processing too fast. Therefore , the general cpu has a cpu cache . The above picture means the main memory---"cpu cache---"cpu register---"cpu performs processing, and vice versa when writing.

 

 

 

 Looking at the figure above, it is the general steps of java operation variables in the case of multi-threading. It should be noted that the variables of multi-threading operations are all copies of the variables obtained from the main memory , and then assigned to the main memory after a series of operations. memory, so in this case, it will lead to the problem of data inconsistency in the case of multi-threading.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325072499&siteId=291194637