JVM Attach API Virtual Machine. What does "attach" mean?

I don’t quite understand what it means to “attach” to another virtual machine via attach api . I read that each java program runs on its own virtual machine (see here ). So, what exactly happens in memory for one program to “attach” a jvm process to another so that it can access other virtual machine data, such as MBeanServer? Is the bytecode of one virtual machine actually invoking a special request on another virtual machine to obtain permission to access memory, or is it the first virtual machine unloaded from memory, and then both sets of code use the same virtual machine? I would really appreciate if anyone could clarify the details of what this application looks like from the steps of matching the memory / virtual machine (if that is what is called). Thanks!

+4
source share
1 answer

A great example of explaining a scenario in which one jvm is connected to another is the use of the Java Profiler. Profilers are mainly used to get an idea of ​​another jvm for performance profiling. The application under examination is attached to the jvm profiler, which analyzes the heap / stack to determine various information about the jvm under study.

The standard jvisualvm profiler uses the JVM TI API , for example, to execute and control garbage collection. Java Management Extensions (JMX) is used as the general level of communication.

+1
source

Source: https://habr.com/ru/post/1491086/


All Articles