Java-jvm-1

Source: Internet
Author: User
Tags jconsole

Review--------------1, the re-entry lock under the concurrent library is less CPU resource than synchronized.        Granularity is finer, can control to share read lock and exclusive write lock, the lower level realizes unsafe to the digital control realization, these digital control are the atomic weight realization. The atomic weight underlying control implementation principle is the CAS (compareandswap, compare and exchange, iterative process, rather than blocking the CPU).        Trylock () Try to lock, if not, return immediately. Java.util.concurrent.ReentrantLock//can be re-entered lockJava.util.concurrent.ReentrantReadWriteLock//can be re-entered read-write lockJava.util.concurrent.Executors//ExecutionJava.util.concurrent.ThreadPoolExector//thread PoolJava.util.concurrent.AtomicInteger//Atomic WeightJava.util.concurrent.BlockingQueue//ListJava.util.concurrent.ConcurrentMap//Map2, Reflection Class Method Field Constructor3, introspection introspector BeanInfo propertydescriptor4, Agent Proxy interface set target object INVOCATIONHANDLERJVM----------------Java virtual Machine.sand box, sandbox. [Runtime Data area], the [method area] Methods zone, shared by all threads, the information of the classes stored, and if there is a concurrent load class, only one ClassLoader is added    Load, waiting for the other.        Heap, shared by all threads, storing objects and arrays.        The inside of the heap is divided into young generations and older generations.        The young generation was divided into the Eden area and the surviving area.        The surviving area is divided into surviving areas and surviving two districts. Heap|----Young Generation|----Eden District|----the surviving zone (two surviving zones are intended for memory defragmentation.) )|----surviving a district|----surviving zone two .|----older generations (at least 512K) The object recycling process was created from the Eden District, followed by a surviving zone (Zone II), to the surviving zone two (zone), and finally to the old generation. Java.lang.OutOfMemoryError:Java heap space, heap overflow//Resize heap space, MX: max MS: initial valueJAVA-XMX4G-XMS4G uses JVISUALVM to examine the internal structure of the JVM. CMDVisual GC, Tools---installation. -xms1g//Heap Initial Size-xmx1g//Heap Maximum Value-xmn1g//Young Generation Size-xx:newsize=1g//Young Generation Initial value-xx:maxnewsize=1g//Young Generation Max-xx:newratio=1//set a multiplier (ratio) of old age and youth, which is 2 by default.-xx:survivorratio=1//set the ratio of the Eden area to the single surviving zone, the default value is 6//Adjust heap spacejava-xmx500m-xms500m-xmn500m//OKjava-xmx500m-xms500m-xmn0m//Not OK, young generation at least > 1.5mJava-xms1g-xmx1g-xx:newsize=750m-xx:maxnewsize=750m-xx:survivorratio=1The condition that the [garbage Collection] object is reclaimed is that no arbitrary reference can reach the object directly or indirectly. Full GC//occurs in the old generation GC. Minor GC//occurred in young generation. [Examining memory structure through Jconsole software] cmd-Jconsole [swapping memory from heap angle]1. Memory in heap, old generation +Young Generation2, non-heap memory (NON-HEAP), JVM-heap, stack space, method area. Metaspace (1.8 Renaming, corresponding to the method area) + code buffer +compresses the class space. 3. Off-heap memory (off-heap) and memory outside the JVM.            In the operating system's memory, but not in the JVM, Java is called direct access.  Public Static voidMain (string[] args) {//Direct Memory                 for(;;) {Directbuffer buf= (Directbuffer) bytebuffer.allocatedirect (1024 * 1024 * 500);                    Buf.cleaner (). Clean (); //error because the memory from the heap has been reclaimed.                     intn = ((Bytebuffer) buf). Get (0);                    SYSTEM.OUT.PRINTLN (n);                System.GC ();        }} [Java stack] Java stack advanced after a thread, an application has at least one stack, the main thread corresponding to the stack (main stack).        The stack operates with push and stack (POP).        The stack frame that is pressed into the Java stack is also called a method frame.        Dead recursion is prone to stack overflow, which can be set by JVM parameters.        The default is 1m. //Adjust Stack spaceJava-xss1m [nativemethod Stack] Local methods stack, [program Counter Register] procedure counter, cumulative program instruction

Java-jvm-1

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.