Java memory model

Source: Internet
Author: User

Java memory model

Main memory vs. working memory

The Java memory model specifies that all variables are stored in main memory (where the main memory is analogous to the main memory name of the physical computer, but this is only part of the virtual machine memory), where variables include instance fields , static fields and elements that make up an array object , but do not include local variables and method parameters , because the latter is thread-private. Each thread also has its own working memory (which can be likened to the processor's cache), where the thread's working memory holds a copy of the master memory of the variable used by the thread, and all operations of the thread on the variable (read and write, etc.) must be in working memory and cannot be read directly to the variables in main memory. There is no direct access to variables in the other's working memory between different threads, and the transfer of variable values between threads must be done through main memory. The interaction between threads, main memory, and working memory

Java memory model

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.