当前位置:网站首页>JVM memory model concept

JVM memory model concept

2022-07-06 14:22:00 xmh-sxh-1314

watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAeG1oLXN4aC0xMzE0,size_13,color_FFFFFF,t_70,g_se,x_16JVM The memory model is divided into virtual machine stack , Pile up , Method area , Program counter , Five parts of the local method stack .

 

 

Java The virtual machine stack is the same as the program counter ,Java Virtual machine stack (Java Virtual Machine Stacks) It's also thread private , It has the same life cycle as a thread .

 

Java Heap for most applications ,Java Pile up (Java Heap) yes Java The largest chunk of memory managed by a virtual machine .Java The heap is an area of memory Shared by all threads , Created when the virtual machine starts .

 

Method area (Method Area) And Java Pile up , Is an area of memory Shared by each thread , It is used to store class information that has been loaded by the virtual machine 、 Constant 、 Static variables 、 Real time compiler compiled code and other data .

 

Program counter (Program Counter Register) It's a small amount of memory , Its function can be seen

 

It is the line number indicator of the bytecode executed by the current thread .

 

Native Method Stack (Native Method Stacks) It's very similar to what the virtual machine stack does , The difference is that the virtual machine stack executes for the virtual machine Java Method ( That's bytecode ) service , The local method stack is used by the virtual machine Native Method service .

 

JVM The advantages of memory model

 

Built in memory based concurrency model : Thread mechanism

 

Synchronization lock Synchronization

 

A large number of thread safe library packages support

 

Memory based concurrency mechanism , Flexible granularity control , Flexibility is higher than database lock .

 

Multi core parallel computing model

 

Thread based asynchronous model .

原网站

版权声明
本文为[xmh-sxh-1314]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202131401534133.html