Understanding the JVM

The aim to write this blog is that I want to summerize and NOTE what I have learned with the booked called as

Understanding the JVM Advandced features and Best prac

  
Now it‘s the first chapter reviews :

  ? This chapter didn‘t talk much ,just the history and future of technology in java system, also kinds of virtual macine(VM) 

  > what i deeply remembered is the version of my java VM ,because i teste it specially.

  

  u can see my version of VM is hotspot VM with mixed mode and it is usually common of java developer

It‘s the time to revise the second chapter:

  ?  In this chapter , i pick up lots of knowledge about VM 

    > the VM memories to be allocated particular data. ↓

    

    > next i will tell the detail function of these memories

      No1. program count register (pcr)

        function : to control the next bit code which will be launched , such as the loop and jump, branch, some exceptions...

        private : because java VM‘s multithreading ,so every threading will has it‘s own pcr to make sure every single pcr work

       No2. VM Stack and Native Stack -- In HotSpot, these two stacks are the one stack.

        function : purpose of stack is to describe the model launched in java or native methods --  every method begin to

               launch that means one thread starts with VM stack being set up, where there are the specific part vairables, such

              as (the basic type od variable) long, double and reference...

        private : every method has it‘s own form of specific part variables

        potential error : if the part variables are confirmed before launched, and u want apply more memories in stack, and then u will get

                  stackOverflowError... but if VM stack can be extend dynamicly(now most VM stack can make it) things are different

                  but if u can‘t apply more memories when u extend dynamicly , and u will get outOfMemoryError...

      No3. Heap -- the biggest area of memory

         function : heap is the homeland of kinds of class instance,  basically all instance lived in heap, but with the JIT developing, not all the

               instance in heap, also the stack can do it.

         public : all the instance in the heap,  so threads can get the all instance. By the way, there are also called GC heap, because garbage collected

              in this area divided into young_generation and old_generation

         potential error : java heap can be allocated in discontinuous physical area...so if there are not enough zone to allocate class instance,and this

                  heap can‘t be extended , u will get outOfMemoryError

      No4. Method Area -- like the heap

         function : store up the information of class which has already been loaded by VM, the static variable, the constant,and code by JIT...

         public : this area can be extended or not, and what amazed me is that u can achieve non-GC, so it‘s also called premanent generation...

         potential error : OutOfMemoryError

     No5. Runtime Constant pool -- part of Method Area

          function : during the runtime, u also can put the constanrt into the constant pool...    

          example : see this blog . String : intern() which is used most in actually develop

             http://www.cnblogs.com/AmoryWang-JavaSunny/p/6407996.html

    > then i will tell u how to visit the Object , and there are two ways to make it ...

    

    一般来说的虚拟机都是采用下面的直接访问的方法,因为这样节省时间一些,对于并发来说这就是一种客观的节约资源的方式,而上面的句柄池也有在用

   ? situations of OOM 

    (1) java heap : where the class instance lived

     (2) VM stack and native stack :

        - OOM

        - SOF     

      对于单线程来说,总是会出现sof情况,因为这两种在单线程方面来说就是一种情况,线程请求的栈空间大于虚拟机最大提供的空间,

      因为虚拟机无法再扩展更大的空间了,但是对于多线程来说,就不太一样,一般线程的栈空间越大,那么线程的数就会越少,剩下的

      空间很容易被线程整垮。。。如果出现了线程很多,但又不可避免的时候就要考虑减少最大堆或者栈空间,来确保多线程的运行,这种

      牺牲内存来成全线程的情况也是很牛的想法。。。

  

时间: 2024-08-26 14:47:53

Understanding the JVM的相关文章

JVM 类加载机制详解

原文出处: ziwenxie 如下图所示,JVM类加载机制分为五个部分:加载,验证,准备,解析,初始化,下面我们就分别来看一下这五个过程. 加载 加载是类加载过程中的一个阶段,这个阶段会在内存中生成一个代表这个类的java.lang.Class对象,作为方法区这个类的各种数据的入口.注意这里不一定非得要从一个Class文件获取,这里既可以从ZIP包中读取(比如从jar包和war包中读取),也可以在运行时计算生成(动态代理),也可以由其它文件生成(比如将JSP文件转换成对应的Class类). 验证

JVM ,JIT ,GC RUNTIME 解析

https://www.infoq.com/articles/OpenJDK-HotSpot-What-the-JIT Understanding HotSpot JVM Performance with JITWatch How Facebook Redesigned the HHVM JIT Compiler for Performance Python JIT Compiler PyPy 4 Brings SMD Vectorization, Performance Improvement

聊聊JVM(一)相对全面的GC总结(转)

转至:http://blog.csdn.net/iter_zc/article/details/41746265 最近时间比较紧张,要写的东西也有很多,只能想到一点写一点.关于GC,网上的资料太多,之前对一个系统调优的时候又回顾了一下,找了几篇广泛流传的资料,大部分都是大同小异,这里总个总结,希望能够做个相对的全集,并写出一些新的点,比如Card Marking(卡片标记)等. 首先是大家都要提到的GC的基础算法:标记清除,标记整理,复制,分代.这些算法的第一步都是做的一件事: 标记(Mark)

JVM——成为Java GC专家(1)

原文: Understanding Java Garbage Collection JVM--成为Java GC专家(1) 理解Java垃圾回收机制(GarbageCollection,简称GC)是如何工作的有什么好处?做为一名软件工程师,为了满足自己的好奇心去了解他是其中的一个原因,并且理解GC工作原理更能让我们写出性能更好.更健壮的Java应用程序. 这仅仅是我个人观念,但是我相信.精通GC是做为一个优秀的Java工程师的必要条件.如果你对GC工作原理感兴趣.那么就意味着你已经具有了开发一定

JVM Guide

Java Virtual Machine: the Essential Guide October 8th, 2014 - By Alexey Zhebel Introduction Java Virtual Machine (JVM) is an execution environment for Java applications. In the general sense, the JVM is an abstract computing machine defined by a spec

初识JVM byte code

关于JVM和其上的byte code,网上其实有足够多的资料了,我这里就简单做个提纲和介绍,权当记录吧. stack-based VM Java byte code运行在JVM上,就像机器指令运行在物理机上,是需要遵循这个机器的指令规范的.所以认识JVM byte code,是需要稍微了解下JVM的.JVM是一个基于栈(stack-based)的虚拟机.很久以前我还写过类似简单的虚拟机. 基于栈的虚拟机其操作数和指令运算的中间结果全部都在一个虚拟栈中,与之对应的是基于寄存器(register-b

JVM 性能调优实战之:一次系统性能瓶颈的寻找过程

玩过性能优化的朋友都清楚,性能优化的关键并不在于怎么进行优化,而在于怎么找到当前系统的性能瓶颈.性能优化分为好几个层次,比如系统层次.算法层次.代码层次...JVM 的性能优化被认为是底层优化,门槛较高,精通这种技能的人比较少.笔者呆过几家技术力量不算弱的公司,每个公司内部真正能够进行 JVM 性能调优的人寥寥无几.甚至没有.如是乎,能够有效通过 JVM 调优提升系统性能的人往往被人们冠以"大牛"."大师"之类的称呼.其实 JVM 本身给我们提供了很多强大而有效的监

Understanding how SQL Server executes a query

https://www.codeproject.com/Articles/630346/Understanding-how-SQL-Server-executes-a-query https://www.codeproject.com/Articles/732812/How-to-analyse-SQL-Server-performance This article will help you write better database code and will help you get st

JVM virtual memory

This has been a long-standing complaint with Java, but it's largely meaningless, and usually based on looking at the wrong information. The usual phrasing is something like "Hello World on Java takes 10 megabytes! Why does it need that?" Well, h