JVM Architecture

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
JVM architecture in this video I'm going to explain about the three major components of JVM architecture classloader runtime data area and execution engine classloader classloader is the first main component in JVM architecture which has three phases loading linking and initialization let's first look at the loading phase of class loader component as you already know we write Java program and save it in a file with dot Java extension when we compile the program the Java compiler compiles the dot Java files and creates dot class files the class loader is responsible for loading these dot class files to the memory the class loaders are of three types bootstrap class loader extension class loader and application class loader strap classloader is the one that is responsible for loading the class files from our t dot jar also known as runtime jar for example when you create a program with system dot out dot print in statements you would have noticed that we don't care about writing system class or where it comes from all we do is import the java dot lang package in fact we don't even need to import this java.lang package because it will be automatically taken care of by the IDE the system class under java.lang package is available within runtime jar resides in JRE /l IB folder under Java installation folder bootstrap class loader is what loads this pre-compiled pre trusted system dot class file from RTE jar to the runtime memory area extension class loader is the one that is responsible for loading the additional class files from JRE Li B ext folder for example if we are working on programs that interact with cues like ib q e we may use like AI specific jars to be able to connect to the q or if we are working on connecting to oracle databases we need a JDBC jar in these scenario we add these third-party jar files to the extension folder extension classloader makes these pre compiled class files available to JVM by loading the files to the memory area 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 next let's look at the linking phase of classloader component this linking phase consists of three steps verify prepare and resolve verify once the class files are loaded to the memory there is a verify phase where the bytecode class files are verified if they conform to the standards prepare in the prepare phase memory is allocated for these static variables and default values are assigned resolved in resolved phase all the symbolic references are replaced with actual references in the initialization phase of classloader component all the static variables are assigned with the actual values and it also executes the static initializers at this point of time runtime memory data areas second main components in JVM architecture is the runtime 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 five 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 module operand stack containing 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 jvm execution engine the third main component in JVM architecture is the execution engine this is the actual engine that converts the bytecode to machine code and execute 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 execute 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 a 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 three main components namely classloader runtime data engine and execution engine class loader intern has three subsystems which are loading phase linking phase and initialization phase second main component is the runtime data area which has five memory areas namely method area heap memory stack memory PC registers and j'ni the third main component is the execution engine this contains some components like interpreter JIT compiler j'ni and garbage collector in the next video we will look at the class structure and components part one
Info
Channel: BigDataElearning
Views: 30,771
Rating: 4.9322753 out of 5
Keywords: JVM Architecture, Class Loader, Bootstrap class loader, Extension class loader, Application class loader, 3 types of class loader, linking phase of class loader component, Run time memory data areas, Method area-, Heap memory, Stack memory, PC registers, Native method stacks, JVM Execution engine, Interpreter, JIT compiler, Intermediate code generator, Code optimizer, Target code generator, Profiler, Garbage collector, Java native method interface, java virtual machine
Id: QHIWkwxs0AI
Channel Id: undefined
Length: 8min 18sec (498 seconds)
Published: Thu Jan 09 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.