Java Virtual machine Learning-Logging The run-time data region

Source: Internet
Author: User

To facilitate the understanding of the later learning, record!

Run-time Data area

1. Thread Sharing

1.1 Method Area

1.1.1 Running a constant-volume pool (runtime Constant)

1.2 Heaps (heap)

2. Thread-Private

2.1 Virtual machine stack (VM stack)

2.2 Local method Stack (Native)

2.3 Procedure Counter (program Counter Register)

3. Direct Memory

Virtual Machine Stack:

Thread-private, life-cycle synchronization with threads, used to execute Java methods.

Each Java method executes a stack frame, which is used to store the local variable table, the operand stack, the dynamic link, the method exit and other information, the method executes the process namely the stack and the stack process

Program Counter:

Occupies a small piece of memory space, is a thread-private, can be seen as a program run line number indicator, used to record the current thread is running a command to execute, in the Java Virtual machine, the bytecode interpreter works by changing the value of the counter to select the next need to execute bytecode instructions (can be understood as code, Because the value of the counter is empty when the native method is executed, this is not the Java code to execute.

Multithreading is essentially a CPU switching over multiple threads, giving each thread a small run time over a period of time, because the CPU switches too fast, so we feel that multiple threads are running concurrently. The program counter is the Java virtual machine to ensure that the CPU can accurately execute the next instruction in the case of the existence.

Local method Stack:

As with the virtual machine stack, but the difference is that the virtual machine stack is for Java methods, and the local method stack serves the native method.

Java heap:

All threads share an area that is intended to hold instance objects, so the Java heap is also the area where the garbage collector is primarily reclaimed.

Method Area:

All threads are shared to hold loaded class information, constants, static variables, immediately compiled code, and so on.

Because the information in the method area is generally used frequently, it is largely not recycled.

To run a constant-rate pool:

The method area is used to hold a block of constants, the so-called constants are basic values, cannot be changed such as a number, a string, and so on, in addition to the constants generated during the compilation, the constants generated during the run will be stored inside.

Direct Memory:

In general, Java applications are not confined to virtual machines, when it is necessary to interact with the outside world is the data exchange, external data when using external memory than the virtual machine is the native heap, that is, direct memory, NIO (New Input/out) class is based on the channel (Chanel ) and buffer IO streams, you can manipulate the local memory (native heap) directly through the native library, avoiding copying data back and forth in the Java heap and native heap (which is why the NIO stream is more efficient than the IO stream).

Java Virtual machine Learning-Logging The run-time data region

Related Article

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.