JVM Architecture

ATTENTION DATA SCIENCE ASPIRANTS:
Click Below Link to Download Proven 90-Day Roadmap to become a Data Scientist in 90 days
www.bigdataelearning.com/the-...
Java Course for Data Science Beginners : www.bigdataelearning.com/courses
Official Website : bigdataelearning.com
This video explains about the internals of the JVM architecture. In this video, I am going to explain about the 3 major components of JVM architecture,
Class Loader, runtime data area, and execution engine.
class loader is the first main component in JVM architecture, which has 3 phases loading, linking, and initialization. First let’s look at the loading phase of class loader component. In the loading phase, we have 3 types of class loaders.
The class loaders are of 3 types. bootstrap class loader, extension class loader, and application class loader. Bootstrap class loader is the one that is responsible for loading the class files from Rt dot jar(rt.jar) also called as runtime jar. Extension class loader is the one that is responsible for loading the additional class files from jre lib ext (jre/lib/ext) folder. For example, if we are working on programs that interact with queues like IBM mq, we may need mq specific jars to be able to connect to the queue. Or if we are working on connecting to oracle databases, we need ojdbc dot jar. in these scenario, we add these third-party jar files to the extension folder. Application class loader is the one that loads the class files from the application specific jar. This is nothing but the application that you created. Once your java program is compiled, the JVM creates class files. The Application class loader loads these class files to the memory area.
Second main component in JVM architecture is the run time data area. Just like how a car needs a road, or how a train needs a railway track to run, similarly JVM needs memory area to store the class files and execute them.
There are 5 types of memory data area. They are method area, Heap memory, Stack memory, PC Registers, and Native method stacks
Method area- all the class level data are stored in this memory area. For example, class level static variables are stored in this memory area.
Heap memory - all the objects and instance variables are stored in this memory area.
Stack memory - this contains three sections of memory areas.
Local variable - memory area that stores all the local variables that is used within a method
Operand stack - contains all the operands that are used within a method.
Frame data - this contains any catch block information, in case any exception occurs within method.
PC registers - this memory area holds the current executing instructions
Native method stacks - memory area which holds the native method information
The 3rd main component in JVM architecture is the execution engine. This is the actual engine that converts the bytecode to machine code and executes the instructions. This contains Interpreter, JIT compiler, Garbage collector, and Java Native method interface.
Interpreter - Interpreter is the one that reads the class files or bytecode and executes it one by one. The problem with the interpreter is that, when a method is called multiple times, it interprets those lines of bytecode again and again.
JIT compiler - JIT compiler helps in overcoming the problem of the interpreter. When repeated method calls occur, JIT compiler compiles the bytecode to native code. This native code will be used directly for repeated method calls. JIT compiler contains few components to achieve this feature
Intermediate code generator - generates intermediate code
Code optimizer - optimizes the intermediate code for better performance
Target code generator - converts intermediate code to native machine code
Profiler - it is responsible for finding the hotspots, methods which are called repeatedly.
Garbage collector - Garbage collector is responsible for destroying the objects that are no longer used.
Java native method interface - It is responsible for interacting with native libraries and makes it available for the JVM execution engine.
In this video, we saw that the JVM architecture has 3 main components namely class loader, run time data area, and execution engine.
Class loader in turn has 3 subsystems, which are loading phase, linking phase, and initialization phase.
Second main component is the Runtime data area, which has 5 memory areas namely method area, heap memory, stack memory, PC registers and JNI.
The 3rd main component is the execution engine. This contains some components like interpreter, JIT compiler, JNI, and Garbage collector.
In the next video, we will look at the “Class structure and components”

Пікірлер: 40

  • @mushfiqfuad249
    @mushfiqfuad2493 жыл бұрын

    Very informative and very basic video. All other videos are just telling about coding without clearing the concept of how programming Languages work. Many many thanks to BigDataElearning.

  • @aniruddhasardar723
    @aniruddhasardar7234 жыл бұрын

    It's simple and solid and crisp... very well organised tutorial on JVM architecture

  • @tamaghnadey3050
    @tamaghnadey30503 жыл бұрын

    I learned a lot than I expected. Thank you sir!

  • @alexisarcegomez8698
    @alexisarcegomez8698 Жыл бұрын

    Wow, that was an amazing explanation, I have seen many courses and tutorials and I can say that this is the first one where I truly learned this concepts.

  • @sikandermehmood3374
    @sikandermehmood33743 жыл бұрын

    --------------------------------------------------------------------JVM ARCHITECTURE----------------------------------------------- 1)Class Loader 2)Runtime Data area 3)Execution Engine 1) Class Loader ClassLoader has three phases Phase-1 =>(Loading) ...1) Bootstrap ClassLoader It loads preCompiled preTrusted System class files to runtime memory area.Files from RT.jar in the jre directory under java installation. ...2)Extension ClassLoader it loads preCompiled classes from jre/lib/ext directory , when you use third party jar files in your project , they are added into extension folder by the extensionClassLoader. So extension ClassLoader makes these preCompiled classes available to the JVM by loading the files to the memory area. ...3)Application ClassLoader Its role is to load your compiled classes to the memory the program you wrote. Phase-2 (Linking) Verify : in this part of linking all the class file loaded into the memory by classLoaders in the form of byteCode are verified if the conform to the standards. Prepare: In this part of linking memory is allocated the static variables are default values are assigned. Resolve: In this part of linking all the symbolic references are replaced with actual references. Phase-3) Initialization In this part all the static variables are assigned with there actual values and also executes the static initializer at this point of time. 2) RunTime Data Area JVM needs memory area to store the class files and execute them. Five types of memory data area. 1) Method area: In this part class level data is stored. e.g -> All the static variables of the class will be stored in the part of jvm memory. 2) Heap memory: All the objects and instance variables are stored in this memory ares. 3) Stack Memory This contain three sections of memory area -> Local variable:stores all the local variables that are used in a module. ->Operand stack:Contain all the operands that are used in a stack. ->Frame data : This part of memory area contain the catch exception block information in case any exception occur in the method. 4) PC Register : This memory area holds the current executing instructions. 5) Native method stack: Memory area that holds the native method information. 3) JVM EXECUTION ENGINE: This engine converts the bytecode to machine code and executes the instructions. 1) Interpreter : Reads the classFiles(ByteCode) and executes it one by one. Flaw of Interpreter is when a method is called multiple times it interprets those lines of code again and again. 2) JIT compiler: JIT compiler compiler to byteCode to native code , it solves the flaw in interpreter. Native code will be used directly for repeated method calls.It has few components ->intermediate code generator = generate intermediate code. ->Code optimizer = optimizes the code for better performance. ->Target code generator:converts intermediate code to native code, ->Profiler->responsible for finding hotspots ,means methods that are called repeatedly. 3) Garbage Collector: To destory objects that are no longer used. 4) jvm native method interface: responsible for interacting with native libraries and makes it available for JVM execution engine. For reference : kzread.info/dash/bejne/g3x9uc2wqNaWcaw.html

  • @dipeshbhandari4746
    @dipeshbhandari47462 жыл бұрын

    Clear and thorough!

  • @SandeepReddy-eq5lg
    @SandeepReddy-eq5lg4 жыл бұрын

    It's simply superb.👍

  • @sayanjashu6044
    @sayanjashu60442 жыл бұрын

    Simple and awesome.Thanks a lot😀

  • @JameS00989
    @JameS009892 жыл бұрын

    Best video available on JVM thanks

  • @chetanreddy106
    @chetanreddy1063 жыл бұрын

    Best one on Internet!!!

  • @dhineshs8973
    @dhineshs89734 жыл бұрын

    Very clear explanation 👌👍

  • @sowmyaks8386
    @sowmyaks8386 Жыл бұрын

    Thankyou for the detailed explanation 🙂

  • @atulmadawi29
    @atulmadawi292 жыл бұрын

    Very concise information!!

  • @shubhampawar.7776
    @shubhampawar.77762 жыл бұрын

    great presentation and excellent explanation

  • @ponnulingam8674
    @ponnulingam8674Ай бұрын

    Best explanation i ever seen

  • @vijaykrish3264
    @vijaykrish32644 жыл бұрын

    That was cool 😎..

  • @applaboratoryspace4724
    @applaboratoryspace4724 Жыл бұрын

    Great explanation

  • @AbdullahAlMamun-fh9gs
    @AbdullahAlMamun-fh9gs4 жыл бұрын

    nice description.

  • @raysun1794
    @raysun17943 жыл бұрын

    Hi, I learned a lot. And I have confusion, can you tell me which software do you use to make this animation ? thank you.

  • @naveenchebolu6757
    @naveenchebolu67572 жыл бұрын

    Nice explanation

  • @EliasEH89
    @EliasEH89 Жыл бұрын

    amazing

  • @ashuzguitar
    @ashuzguitar2 жыл бұрын

    Nice video!

  • @1xplorer
    @1xplorer Жыл бұрын

    That’s Java I spent 7 years engaging with the technology and still haven’t got enough it’s ecosystems!

  • @user-vi7zx1wh2l
    @user-vi7zx1wh2l7 ай бұрын

    wow nice class

  • @ahmedmohammed9462
    @ahmedmohammed94624 жыл бұрын

    very helpful video thank you so much i have a question, is there any way to know all classes loaded in the method area section?

  • @bigra580

    @bigra580

    Жыл бұрын

    You can use the option: -verbose:class So the command to run the application would be: java -verbose:class classfilename

  • @user-do8mv9ow6d
    @user-do8mv9ow6d8 күн бұрын

    This this truely the best explanation..❤ I have heard that bootstrap class loader starts the other two class loaders.Can you explain it for me?

  • @ThePomelo09
    @ThePomelo093 жыл бұрын

    Hi, great explanations. I have a question, where are static final instance variables and final method local variables are stored?

  • @ashuzguitar

    @ashuzguitar

    2 жыл бұрын

    You cannot have static instance variables. Static variables are class variables. Final method local variables are stored in Heap.

  • @vijaynarwade7454
    @vijaynarwade74543 жыл бұрын

    What we do in resolve phase

  • @TheBytao7mao
    @TheBytao7mao Жыл бұрын

    finnaly found someone with coherent english grammar to teach me java :))

  • @jvsnyc
    @jvsnyc3 жыл бұрын

    At ~2:02, you call it "RTE.jar" and also, hasn't RT.jar started to go away in the most recent JDK versions? Great video tho.

  • @lyesweb309
    @lyesweb3092 жыл бұрын

    🤩

  • @blackoutsangli9171
    @blackoutsangli91712 жыл бұрын

    what is symbolic reference and actual reference?

  • @harodrone
    @harodrone4 жыл бұрын

    Does anybody know which programming language is written the JVM in?

  • @osamabassam7517

    @osamabassam7517

    3 жыл бұрын

    C++ or C.

  • @azamatsoodaev1130

    @azamatsoodaev1130

    3 жыл бұрын

    According to Geeksforgeeks article, namely "How JVM Works", it says Java Native Interface (JNI) and Native Method Libraries use C, C++ which are required by the Execution Engine. Sourse: www.geeksforgeeks.org/jvm-works-jvm-architecture/

  • @BillBennettTV
    @BillBennettTV2 жыл бұрын

    Has anyone pointed out that the word "extension" is spelled incorrectly?

  • @swarnalatha-up4gi
    @swarnalatha-up4gi2 жыл бұрын

    That's a lot of information to get in 497 seconds....

  • @MrGarg10may
    @MrGarg10may2 жыл бұрын

    This video is great but outdated, in Java8+ there is no method area.