JVM overview

  • Classloader
  • Runtime memory area
  • Execution Engine
  • Bootstrap class loader — responsible for loading the core java runtime ( which is present in rt.jar before java 8 and from java 9 this has been modularized)
  • Extension class loader
  • Application class loaders — responsible for loading the classes from your application.
  • When a child class can’t find a class it delegates the behavior to the parent class. In the end, if no class is able to find the class then it throws the error “ClassNotFound”
  • A class is loaded only once and an object for it is being created in the runtime environment by the JVM.
  • Magic Number
  • Version — Major and minor version of the class
  • Constants — Constants of the class
  • Access flag — Decides if the class is abstract, static, etc.
  • This class — Refers to the name of the class
  • Superclass — Name of the superclass
  • Interfaces — Name of the interfaces implemented by the class
  • Fields — Any fields in the class
  • Methods — Any methods in the class
  • Attributes — Any attributes of the class e.g. name of the source file, etc.
  • Close to metal and zero-cost abstraction (C/C++ are based on this principle)
  • Favor developer productivity and get things done. (Java is based on this principle)
  • JIT watches the application while it’s running in the interpreted mode.
  • Identify the part of the byte code that is executed with high frequency.
  • Once the execution of a method surpasses a threshold limit, JIT will transform that piece of code into machine-level code and store it in the cache for future optimizations.
  • Hotspot
  • JIT compiler
  • Interpreter
  • GC
  • It is the place where the actual object in java is created.
  • -XMS indicates the minimum size of the heap.
  • -XMS indicates the maximum size of the heap.
  • It is also known as perm space and from java 8 this space is moved to OS native memory known as metaspace.
  • It allocates the space for the class definition and the static variables.
  • -XX: PermSpaceSize refers to method area size and the default size is 64 MB
  • PC register is used to track the next instructed need to be executed by the JVM interpreter.
  • There will be one PC register per thread.
  • When a method invokes another method, these methods and space allocated by them are being allocated in Java Stack.
  • Currently executing method will be at the top of the java stack.
  • -XSS to maintain the stack size
  • Native method stack is similar to java method stack except it is used for the native calls made by the JVM.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ajay Yadav

Ajay Yadav

Believer of Distributed Systems