<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Aravind Kumar</title>
    <description>The latest articles on DEV Community by Aravind Kumar (@ayzeys_dev).</description>
    <link>https://dev.to/ayzeys_dev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F609888%2F77a59b00-300d-45be-ad23-95a4f0103c27.jpg</url>
      <title>DEV Community: Aravind Kumar</title>
      <link>https://dev.to/ayzeys_dev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ayzeys_dev"/>
    <language>en</language>
    <item>
      <title>Part 1: React.js - Overview,  Virtual DOM and State </title>
      <dc:creator>Aravind Kumar</dc:creator>
      <pubDate>Sat, 17 Apr 2021 11:08:50 +0000</pubDate>
      <link>https://dev.to/ayzeys_dev/part-1-react-js-overview-virtual-dom-and-state-1cih</link>
      <guid>https://dev.to/ayzeys_dev/part-1-react-js-overview-virtual-dom-and-state-1cih</guid>
      <description>&lt;p&gt;React is one of the most popular JavaScript Framework on the Client side. In Part 1, we will be understanding the props, state and it's internal rendering process. Redux and Context API are conceptually different from React when it comes to handling of state, so we will be looking into those in Part 2 and 3 respectively. &lt;/p&gt;

&lt;h1&gt;
  
  
  Overview
&lt;/h1&gt;

&lt;p&gt;create-react-app allows to build react projects. The entry point to the application is the index.js. Goal of React is render HTML in a web page. It uses ReactDOM.render() which takes two arguments, HTML Code and HTML element. &lt;br&gt;
In index.js we can see this HTML Code is in form of &lt;code&gt;&amp;lt;App /&amp;gt;&lt;/code&gt; and HTML element to be "document.getElementById('root')". App is the root/top most component in the component tree. While, the root element in index.html which is passed as second argument, will be appended by JSX code we write inside the components. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Components:&lt;/strong&gt;&lt;br&gt;
React is all about Components. Components, the building block of React are reusable and reactive in nature, they are written as JSX (custom HTML and Javascript) which are nothing but JavaScript methods called on React objects. &lt;/p&gt;

&lt;p&gt;The tags in the JSX expression within the JavaScript file will be  converted into createElement() by babel complier/transpiler. &lt;/p&gt;

&lt;p&gt;Example: &lt;br&gt;
JSX code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let framework=
  &amp;lt;div className='library'&amp;gt;
    Hello, React!
  &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Converted JavaScript equivalent:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let framework=
  React.createElement(
    'div',
    { className: 'library' },
    "Hello, React!"
  )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Props:&lt;/strong&gt;&lt;br&gt;
Props or Properties are a system for passing data from "parent" to "child" components. Let's look at an example in which we will see how props can only be passed from parent to child but there is a bottom up way of approach where we can call a method in parent component from a child component.&lt;br&gt;
Example: &lt;br&gt;
Here AddName is a parent component and ClickName is a Child component. handleOnSubmit method reference is passed as a property from parent to child.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const AddName= () =&amp;gt; {

  const handleOnSubmit = (name) =&amp;gt; {
    concole.log("Rendered from AddName, called from ClickName with value: " + name);
  }

  return (
    &amp;lt;React.Fragment&amp;gt;
      &amp;lt;ClickName handleOnSubmit={handleOnSubmit} /&amp;gt;
    &amp;lt;/React.Fragment&amp;gt;
  )
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will receive the props ClickName and call the parent function by using props.handleOnSubmit.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const ClickName = (props) =&amp;gt; {
    return (
        &amp;lt;div&amp;gt;
            &amp;lt;button onClick={() =&amp;gt; props.handleOnSubmit("React")}&amp;gt;
             Click Child
            &amp;lt;/button&amp;gt;   
        &amp;lt;/div&amp;gt;
    )
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;//Output: From AddName, called from ClickName with value: React.&lt;/p&gt;

&lt;h1&gt;
  
  
  State
&lt;/h1&gt;

&lt;p&gt;State are JavaScript objects that are relevant to a component. They must be initialized when they are created.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class demo extends React.Component {
  constructor(props) {
    super(props);
    this.state = {title: "React", firstName: "Dev", lastName: "tools"};
  }
  render() {
    return (
      &amp;lt;div&amp;gt;
        &amp;lt;h1&amp;gt;Demo {this.state.title}&amp;lt;/h1&amp;gt;
        &amp;lt;p&amp;gt;
          My name is {this.state.firstName}
          {this.state.lastName}.
        &amp;lt;/p&amp;gt;
      &amp;lt;/div&amp;gt;
    );
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;//Output: Demo React&lt;br&gt;
My name is Dev tools.&lt;br&gt;
State can be updated and when doing so the component gets re-rendered. To change the state always use the setState() method.&lt;/p&gt;

&lt;p&gt;Example: From the previous demo example, let's add a method&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;changeTitleName() {
   this.setState({title: "Redux"});
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside the render method let's include a button below the paragraph,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;render() {
    return (
      &amp;lt;div&amp;gt;
        &amp;lt;h1&amp;gt;Demo {this.state.title}&amp;lt;/h1&amp;gt;
        &amp;lt;p&amp;gt;
          My name is {this.state.firstName}
          {this.state.lastName}.
        &amp;lt;/p&amp;gt;
        &amp;lt;button
          type="button"
          onClick={this.changeTitleName}
        &amp;gt;Change Title&amp;lt;/button&amp;gt;
      &amp;lt;/div&amp;gt;
    );
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This change in state triggers component's render() method, it's other lifecycle methods and causes re-rendering.  &lt;/p&gt;

&lt;p&gt;//Output: Demo Redux&lt;br&gt;
My name is Dev tools.&lt;/p&gt;

&lt;p&gt;Let us look into the React's way of re-rendering components before we see more about states. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Virtual DOM and State&lt;/strong&gt;&lt;br&gt;
It is React's virutal DOM which ultimately deals with the HTML elements in the screen. React on other hand notices the changes in state, that component that needs to be changed, the differences in previous state compared to the current state and these information are passed on the React's Virutal DOM. Virtual DOM then passes this information to the Real DOM which is part of the browser. &lt;br&gt;
To sum up, the Primary feature that React care about are the data (props, state and component wide data). So, whenever the data change, components that use these data are basically updated and React lets virtual DOM know about these differences and the latest change is brought on to the screen after the browser's DOM gets the communication from virtual DOM. &lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
Before update&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div&amp;gt; 
   &amp;lt;h2&amp;gt;React&amp;lt;/h2&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After update&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div&amp;gt; 
   &amp;lt;h2&amp;gt;React&amp;lt;/h2&amp;gt;
   &amp;lt;h3&amp;gt;Only this content will be re-rendered&amp;lt;/h3&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;React does diffing and let's virtual DOM know about the changes, virtual DOM then updates the browser's DOM to insert &lt;code&gt;&amp;lt;h3&amp;gt;&lt;/code&gt;. The entire DOM will not be re-rendered. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stateful and Stateless&lt;/strong&gt;&lt;br&gt;
State is similar to props, they are private to the component and it's fully controlled . Components can either maintain state which are Stateful or can remain stateless and contain no state in them. &lt;br&gt;
Stateless components are simple functional components which try to print something or call some parent functions through props or render always the same thing. They are also called as dumb/presentational components.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const ProjectList = ({projects}) =&amp;gt; {
 return (
   &amp;lt;Row&amp;gt;
     {projects.map(project =&amp;gt; {
       return &amp;lt;Col&amp;gt;project&amp;lt;/Col&amp;gt;
     })}
   &amp;lt;/Row&amp;gt;
 )
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Stateful components keeps track of it's changing data. These components gets re-rendered on change of state. They are also called as Container/Smart components. &lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Demo extends Component {
  constructor() {
    super()
    this.state = {
      titles: []
    }
  }
  render() {
    return (
      &amp;lt;div&amp;gt;
        &amp;lt;p&amp;gt;List of Titles&amp;lt;/p&amp;gt;
        &amp;lt;Row&amp;gt;
          {this.state.titles.map(title =&amp;gt; {
            return &amp;lt;Col&amp;gt;&amp;lt; {title} /&amp;gt;&amp;lt;/Col&amp;gt;
          })}
        &amp;lt;/Row&amp;gt;
      &amp;lt;/div&amp;gt;
    )
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We coved some basic grounds in React. I hope this article was helpful. Thanks for reading :)&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Threads and Node.js in a nutshell</title>
      <dc:creator>Aravind Kumar</dc:creator>
      <pubDate>Tue, 13 Apr 2021 11:15:20 +0000</pubDate>
      <link>https://dev.to/ayzeys_dev/threads-and-node-js-in-a-nutshell-2j22</link>
      <guid>https://dev.to/ayzeys_dev/threads-and-node-js-in-a-nutshell-2j22</guid>
      <description>&lt;p&gt;&lt;strong&gt;1. Overview of Node Internals:&lt;/strong&gt;&lt;br&gt;
Once we write JavaScript code(index.js) and execute the command "node index.js" from the command line, we are invoking the Node.js project. This thus invokes V8 (JavaScript engine) and Libuv (C/C++ Library, it abstracts non-blocking I/O operations). &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff68yoa2xuxu9di547dde.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff68yoa2xuxu9di547dde.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Above we can see the internal architecture of Node.js&lt;/p&gt;

&lt;p&gt;The purpose of node is to give us a consistent API for us to work with and the implementation internally is performed by one of V8 or Libuv.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. What are Threads, Scheduling and Execution?&lt;/strong&gt;&lt;br&gt;
A thread is a sequence of programmed instructions that are managed by scheduler. &lt;br&gt;
The computer we use are backed by multicore (Quad-core/ Octa-core) system which makes us perform simultaneous operations without any interruption. &lt;br&gt;
Thread Scheduling is a decision made by the operating system to process a thread at a given time. The executions of thread happens at the CPU.&lt;br&gt;
A Multicore systems support MultiThreading, which makes the process run on separate cores at the same time. This thus increases the overall speed of program execution. &lt;br&gt;
MultiProcessor System is two or more CPU's present in the same computer. The system is more reliable than multicore system(uses single CPU) since failure of one processor does not affect other processors. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi1qeoz9kskoyi5vvau21.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi1qeoz9kskoyi5vvau21.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Laptop that we use are backed by a single CPU with multiple cores. But, modern day laptop uses Hyperthreading which creates a logical processor(two virtual processors) thus improving the performance of CPU.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjcjgtz3mqndsxvxopj4c.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjcjgtz3mqndsxvxopj4c.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
Above picture highlights the CPU, Cores and Logical Processors.&lt;/p&gt;

&lt;p&gt;Note: Hyperthreading are outside the scope of current topic, the idea was to give how our system performs multiple processes at the same time. Now let's look into how Node.js performs the threading..&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. How Node.js uses Multithreading...&lt;/strong&gt;&lt;br&gt;
Not all of the code that we write are executed in a single thread in node. Some standard library function calls the Node C++ side(C++ Add-ons from the Node architecture) which then calls Libuv. Libuv internally makes use of thread pool that creates 4 threads. Libuv is a major dependency for node.js which features event loop and thread pool.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnthso4lbss8l3a7os33p.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnthso4lbss8l3a7os33p.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Event Loop:&lt;br&gt;
When we start the Node.js application, the single threaded Event loop executes all lightweight work, such as requiring the modules, the initialization, executing the callbacks. Also, it helps in offloading heavy tasks(file I/O) to the Thread pool. &lt;/p&gt;

&lt;p&gt;Thread Pool: &lt;br&gt;
Thread Pool handles the "heavy tasks". The works delegated are I/O intensive/CPU intensive. For example: DNS, File System (I/O) and Crypto, Zlib (CPU). By default the Thread pool creates 4 threads to execute a given task.&lt;br&gt;
If there are 5 calls involving I/O or CPU, the first 4 tasks are scheduled in the thread pool and once they are completed the 5th task is placed in the thread pool by the scheduler.&lt;/p&gt;

&lt;p&gt;Note: Non-blocking asynchronous network I/O tasks are performed by event loop and DNS tasks are performed by thread pool.  &lt;/p&gt;

&lt;p&gt;To increase the number of threads we can use the below piece of code in our js file,&lt;br&gt;
process.env.UV_THREADPOOL_SIZE = 5;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>node</category>
      <category>architecture</category>
    </item>
    <item>
      <title>JVM Architecture Model</title>
      <dc:creator>Aravind Kumar</dc:creator>
      <pubDate>Wed, 07 Apr 2021 11:00:51 +0000</pubDate>
      <link>https://dev.to/ayzeys_dev/jvm-architecture-model-3p2l</link>
      <guid>https://dev.to/ayzeys_dev/jvm-architecture-model-3p2l</guid>
      <description>&lt;p&gt;Once we write Java program in the IDE, the moment we press the run button the execution begins in the background. What happens behind the scenes are rarely thought or learnt. Here we will explore the underlying JVM (Java Virtual Machine) workings, it's internals and how it runs the Java code that we write.&lt;/p&gt;

&lt;p&gt;Before we dig deep into the JVM Model, a review on how Java works.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Source: Create a source document (.java file)&lt;/li&gt;
&lt;li&gt;Complier: Compile the document through a source code complier (.class file)
&lt;/li&gt;
&lt;li&gt;Output: The Complier creates a new Byte-Code version which is capable of running in any other Java Enabled System. (WORA)&lt;/li&gt;
&lt;li&gt;Virtual Machine: Runs the Byte-Code version (.class file) by starting the JVM. Translation of bytecode to underlying machine code happens here.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let's say we create a basic java program with a .java extension and we want it to be executed. We run the command "javac Filename.java" (compilation process). This creates a Filename.class file which is to be executed, so now we use the "java Filename" command to run your program. At the time we call this command we have created a JVM instance.&lt;/p&gt;

&lt;p&gt;The JVM Architecture Model is shown below. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--I3MaWR3z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/libeh4od0u4qwcx7xs89.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--I3MaWR3z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/libeh4od0u4qwcx7xs89.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Overview:
&lt;/h1&gt;

&lt;p&gt;JVM's primary purpose is to load and execute your application.&lt;br&gt;
Your application's .class file as well as built-in class files of Java API (Collections, Object..) are loaded by the Class loader. The bytecode instructions from the Class Loader are then fed into the Execution engine which then executes the bytecode. The Execution engine here talks to the Host OS through native method calls in order to execute the instructions and then the bytecode is translated to Machine code(the underlying language which the platform understands).&lt;/p&gt;

&lt;h1&gt;
  
  
  3 Component breakdown of JVM:
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;1. Class Loader Subsystem&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;2. Runtime Data Area&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;3. Execution Engine&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Class Loader Subsystem&lt;/strong&gt;:&lt;br&gt;
Responsible for loading the bytecode into memory from various sources(filesystem, .jar..). The activities the Class Loader performs are LOAD, LINK and INITIALIZE.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;LOAD&lt;/em&gt; -&lt;br&gt;
There are three types of class loaders Bootstrap, Extension and Application. The Java's internal class files(inside rt.jar distributed with JVM implementation), core API's are loaded by Bootstrap class loader. Extension class loader loads additional application jar(jre/lib/ext). The classes and values specified in your classpath environment variables are loaded by Application class loader.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;LINK&lt;/em&gt; -&lt;br&gt;
Verify verifies if the bytecode is valid (JVM Compatible). The Prepare phase is where memory for static variables are allocated. Example: Class variable, private static boolean isNum = false (default). Here a default initialization of value is allocated in the Prepare step.(Note: Memory Allocation happens only for class variables, not for instance variables). The Resolve stage is where the symbolic reference of the current class is changed to the actual reference.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;INITIALIZE&lt;/em&gt; -&lt;br&gt;
Here is where the class variables are initialized to the value in code, the static init block are run, the static variable values are set in memory locations. &lt;br&gt;
Example: Class variable, private static boolean isNum = true (actual value set in code is assigned)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Runtime Data Area&lt;/strong&gt;:&lt;br&gt;
The Memory of JVM. There are five different areas namely the Method Area, Heap, Stack, PC Register and Native method stack. Java Stacks, PC Register and Native method stacks are per thread, while Method Area and Heap are per JVM. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Method Area&lt;/em&gt; - &lt;br&gt;
Method area is where the metadata about the class are stored. Only class data such as static variables, class level constants are stored in memory of method area. 64mb is allocated for the method area which can be modified. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Heap&lt;/em&gt; -&lt;br&gt;
Heap is where Object data, Instance variables are stores. When we instantiate an object such as using a new keyword, that object's creation and storage happens in the Heap.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;PC Register&lt;/em&gt; -&lt;br&gt;
This is a per thread runtime data area. It contains program counter which is basically a pointer to the next instruction which needs to be executed per thread. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Java Stacks&lt;/em&gt; -&lt;br&gt;
Java Stacks contains stack frame(thread #1, #2, #3 will contain it's own stack frames) that contains data related to currently executing method. This is the memory area for Local Variables, Parameters, return values. Stacks are also executed per thread.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Native Method Stack&lt;/em&gt; -&lt;br&gt;
For each thread that calls a native method a native method stack will be created.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Execution Engine&lt;/strong&gt;:&lt;br&gt;
Until now the data is just present in the memory area and yet to be executed. The .class file(bytecode) needs to be executed and here in the Execution Engine is where the actual instruction to be executed takes place. The Execution Engine has the Interpreter, JIT Complier and Garbage Collector. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Interpreter&lt;/em&gt; - &lt;br&gt;
Interpreter takes the current instruction that has been set by the PC register and interprets the bytecode. It finds out native operation to be performed and executes it. The interpretation process is line by line and the disadvantage of that is, it interprets each time for the one method that has been called multiple times.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;JIT Complier&lt;/em&gt; -&lt;br&gt;
The efficiency and performance of the interpreter is important for the system to execute the code faster. The JIT Complier does just that. When Interpreter sees a repeated method call, JIT provides native code for that particular method on the fly so that re-interpretation does not happen. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Garbage Collector&lt;/em&gt; -&lt;br&gt;
Cleans up unused classes, unreferenced objects and memory area. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Java Native Interface&lt;/em&gt; -&lt;/p&gt;

&lt;p&gt;An Interface that interacts with the native method libraries. This loads the libraries during run-time which are required for execution.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Native Method Libraries&lt;/em&gt; -&lt;/p&gt;

&lt;p&gt;Native Libraries in C, C++ that are required during the execution.&lt;/p&gt;

&lt;p&gt;This is my first blog, I would like to contribute to the Tech Community on different topics. I started with JVM Architecture and hope this article provides you the concept of what happening behind the scenes.  &lt;/p&gt;

</description>
      <category>java</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
