Overview and thread data area JVM is running third in

Overview and thread data area JVM is running third in

1 Overview

Memory is a very important system resources, CPU and hard disk storage and intermediate bridge, carrying real-time operating system and applications. JVM memory layout defines the Java application in operation, distribution and management strategies to ensure the efficient and stable operation of the JVM. JVM different ways and for dividing the memory management mechanisms exist partial differential.

(Before 1.7)

(After 1.8)

Java virtual machine will be used to define a number of programs running during run-time data area, some of which will start with a virtual machine is created, with the virtual machine exit and destroyed. Some are one to one thread, which corresponds to the thread of a data area will be created and destroyed with the thread begins and ends.

The above figure gray part is single-threaded private, red for multi-threaded shared. which is

  • Each thread: independence, including the program counter, stack, stack, local
  • Shared among threads: heap that the external memory (permanent and substituting element space, code cache)

About shared between threads Description

Only one instance of each JVM Runtime. Is the runtime environment, the equivalent of the middle of the memory structure of the frame: Runtime Environment

2. Thread

  • A thread is a program in the run unit. JVM allows an application to execute multiple threads in parallel.
  • In the Hotspot JVM, each thread is directly mapped to the local operating system thread
    • When a Java thread is ready to execute, this time a native operating system thread also created. After Java thread execution terminates, the local thread will recover.
  • The operating system is responsible for all arrangements threads jump to read on any of the available CPU, once the thread-local initialization is successful. She calls the run method of Java thread.

2.1JVM system thread

  • If using jconsole or any other debugging tools, you will see many threads running in the background. These threads call the public static void main (String []) in the main thread and the thread all the main threads that you create is not included.
  • These threads back-end systems in the Hotspot JVM where mainly the following:
    • 虚拟机线程:这种线程的操作时需要JVM到达安全点才会出现。这些操作必须在不同的线程中发生的原因是他们都需要JVM到达安全点,这样堆不会变化。这种线程的执行类型包括“stop-the-world”的垃圾收集,线程栈收集,线程挂起以及偏向锁撤销。
    • 周期任务线程:这种线程是时间周期时间的体现(比如终端),他们一般用于周期性操作的调度执行
    • GC线程:这种线程对在JVM里不同种类的垃圾收集器行为提供了支持
    • 编译线程:这种线程在运行时会将字节码编译成本地代码
    • 信号调度线程:这种线程接收信号并发送给JVM,在它的内部通过调用适当的方法进行处理。
      微信公众号
      在这里插入图片描述

Guess you like

Origin www.cnblogs.com/niugang0920/p/12400991.html