Friday, September 10, 2021

What is Java Virtual Machine (JVM) & Its Architecture

What is JVM?

JVM is a engine that provides runtime environment to drive the Java Code or applications. It converts Java bytecode into machines language. JVM is a part of JRE(Java Run Environment). It stands for Java Virtual Machine

  • In other programming languages, the compiler produces machine code for a particular system. However, Java compiler produces code for a Virtual Machine known as Java Virtual Machine.
  • First, Java code is complied into bytecode. This bytecode gets interpreted on different machines
  • Between host system and Java source, Bytecode is an intermediary language.
  • JVM is responsible for allocating memory space.

In this tutorial, you will learn-

  • What is JVM?
  • JVM Architecture
  • Software Code Compilation & Execution process
  • C code Compilation and Execution process
  • Java code Compilation and Execution process
  • Why is Java both interpreted and Compiled Language?
  • Why is Java slow?

JVM Architecture

Let’s understand the Architecture of JVM. It contains classloader, memory area, execution engine etc.

1) ClassLoader

The class loader is a subsystem used for loading class files. It performs three major functions viz. Loading, Linking, and Initialization.

2) Method Area

JVM Method Area stores class structures like metadata, the constant runtime pool, and the code for methods.

3) Heap

All the Objects, their related instance variables, and arrays are stored in the heap. This memory is common and shared across multiple threads.

4) JVM language Stacks

Java language Stacks store local variables, and it’s partial results. Each thread has its own JVM stack, created simultaneously as the thread is created. A new frame is created whenever a method is invoked, and it is deleted when method invocation process is complete.

5) PC Registers

PC register store the address of the Java virtual machine instruction which is currently executing. In Java, each thread has its separate PC register.

6) Native Method Stacks

Native method stacks hold the instruction of native code depends on the native library. It is written in another language instead of Java.

7) Execution Engine

It is a type of software used to test hardware, software, or complete systems. The test execution engine never carries any information about the tested product.

8) Native Method interface

The Native Method Interface is a programming framework. It allows Java code which is running in a JVM to call by libraries and native applications.

9) Native Method Libraries

Native Libraries is a collection of the Native Libraries(C, C++) which are needed by the Execution Engine.

Software Code Compilation & Execution process

In order to write and execute a software program, you need the following

1) Editor – To type your program into, a notepad could be used for this

2) Compiler – To convert your high language program into native machine code

3) Linker – To combine different program files reference in your main program together.

4) Loader – To load the files from your secondary storage device like Hard Disk, Flash Drive, CD into RAM for execution. The loading is automatically done when you execute your code.

5) Execution – Actual execution of the code which is handled by your OS & processor.

With this background, refer the following video & learn the working and architecture of the Java Virtual Machine.

C code Compilation and Execution process

To understand the Java compiling process in Java. Let’s first take a quick look to compiling and linking process in C.

Suppose in the main, you have called two function f1 and f2. The main function is stored in file a1.c.

Function f1 is stored in a file a2.c

Function f2 is stored in a file a3.c

All these files, i.e., a1.c, a2.c, and a3.c, is fed to the compiler. Whose output is the corresponding object files which are the machine code.

The next step is integrating all these object files into a single .exe file with the help of linker. The linker will club all these files together and produces the .exe file.

During program run, a loader program will load a.exe into the RAM for the execution.

Java code Compilation and Execution in Java VM

Let’s look at the process for JAVA. In your main, you have two methods f1 and f2.

  • The main method is stored in file
  • f1 is stored in a file as
  • f2 is stored in a file as

The compiler will compile the three files and produces 3 corresponding .class file which consists of BYTE code. Unlike C, no linking is done .

The Java VM or Java Virtual Machine resides on the RAM. During execution, using the class loader the class files are brought on the RAM. The BYTE code is verified for any security breaches.

Next, the execution engine will convert the Bytecode into Native machine code. This is just in time compiling. It is one of the main reason why Java is comparatively slow.

NOTE: JIT or Just-in-time compiler is the part of the Java Virtual Machine (JVM). It interprets part of the Byte Code that has similar functionality at the same time.

Why is Java both Interpreted and Compiled Language?

Programming languages are classified as

  • Higher Level Language Ex. C++, Java
  • Middle-Level Languages Ex. C
  • Low-Level Language Ex Assembly
  • finally the lowest level as the Machine Language.

compiler is a program which converts a program from one level of language to another. Example conversion of C++ program into machine code.

The java compiler converts high-level java code into bytecode (which is also a type of machine code).

An interpreter is a program which converts a program at one level to another programming language at the same level. Example conversion of Java program into C++

In Java, the Just In Time Code generator converts the bytecode into the native machine code which are at the same programming levels.

Hence, Java is both compiled as well as interpreted language.

Why is Java slow?

The two main reasons behind the slowness of Java are

  1. Dynamic Linking: Unlike C, linking is done at run-time, every time the program is run in Java.
  2. Run-time Interpreter: The conversion of byte code into native machine code is done at run-time in Java which furthers slows down the speed

However, the latest version of Java has addressed the performance bottlenecks to a great extent.

Summary :

  • JVM or Java Virtual Machine is the engine that drives the Java Code. It converts Java bytecode into machines language.
  • In JVM, Java code is compiled to bytecode. This bytecode gets interpreted on different machines
  • JIT or Just-in-time compiler is the part of the Java Virtual Machine (JVM). It is used to speed up the execution time
  • In comparison to other compiler machines, Java may be slow in execution.

Thanks for Reading 

Sunday, June 13, 2021

Top Certifications in 2021

We all know that Post COVID , most of the industries has started moving to digital era and in this digital transformation, we have many new opportunities in coming future. 

When companies started working remotely, Most toughest thing is to find the right resource and right skill set. Most of the companies has tie up with different resource firm where they hire the resource on contract basis first and then make full time employment offer for them OR companies now a days also started giving more preferences to certified resources by default , it gives them the confidence that the certification can somewhat justify someones skill sets.

Today I will discuss about Most demanding certification program in 2021 which can definitely help you to find a better job for you.

Before I go further , I would like to recommend SPOTO IT Certification for any certification exam preparation.If you are looking for some certifications , you can definitely check this website and can look for the training or exam preparation resources you are looking for.

1) PMP - PMP stands for Project Management Professional , as the word suggest , it is now a day very high in demand and most of the projects going to digitalized and Companies need Resources who can actually make sure that there project should be successfully delivered. so The Certification is internationally recognised which can make your bright in group of peoples of same skill set.
Learn more about What is PMP Certification.

2)AWS Certifications-If you have heard about Cloud , you definitely have heard about AWS as well , AWS stands for Amazon web service. AWS itself has so many Certification and because companies now host their data on cloud , the most loved and most preferred cloud service provider is AWS because of its vast managed services and unique billing system model. AWS is hot in market and if you are planning to become a cloud engineer , I would recommend you to go and take any AWS certification. You can actually go to SPOTO IT Certification where you can find AWS Dumps which will helpful for you to pass the exam.

3)CCIE- Ever green in market is Cisco certification why ? Because networking is the base of every company and when we talk about Networking , CISCO is world no. 1 Networking company. this is the only certification which 90-100% ensure that you will definetely get the Job after doing it as it is very tough to crack and it ensure that the one who crack it should sharpen his/her knowledge.

BTW CCIE stands for Cisco Certified Internetwork Expert. You can directly go to here and can look for dumps.

4) Microsoft Certifications-Microsoft is one of the most known IT Company in the world and in its certifications are always considered as one of the most valuable in IT Ecosystem. There are so many Certifications as below
There are so many certifications of microsoft which you can go for, You can check all the certification at this URL.

There are some of the Important URLs you can go through while you are preparing about any certifications.

I hope you will find these certification helpful for your next phase in job.
If you have any issue you can leave us a comment we will definitely try to help you.

Thanks for reading

Wednesday, August 12, 2020

[Interview Question ][Data Structure] Two Sum Problem -Array

Two sum problem is one of the most asked data structure questions for a java developer interview. There could be one or more ways to solve the problem but i am trying to give the optimized solution to this problem.

Lets first see the Problem Statement.

Problem Statement - Given an array, We need to find all the possible sets of 2 elements whose sum is equal to the target sum.

Solution: Given an array, lets say [10,-2,5,3,1,7,4] and given a target = 8 , We need to find all the possible 2 elements whose sum is equal to the 8.

the possible output will be 

[10,-2] ,[5,3],[1,7]

Pseudo code- 

  • Lets first sort the array.
  • After sorting, take 2 pointers, one is leftmost & second is rightmost.
  • we will start taking each element from left & right then check some of both the element.
  • If the sum is less then the target sum, then move the left pointer by one.
  • if the sum is greater than the target sum, then move the right pointer to left by one.
  • else if it is equal to target then put the elements one result array and move both left & right pointer by one.
Now let see the Java implementations.

public class TwoSumProblem {
	public static void main(String[] args) {
		int[] arr = {10,-2,5,3,1,7,4};
	public static void twoSumArray(int[] arr, int i) {
//		sort the array using Arrays  sort
		int size = arr.length;
		int left = 0;
		int right =size-1;
		List<Integer> list = new ArrayList<Integer>();
		while(left<right) {
			int diff = arr[left]+arr[right];
			if(diff<i) {
			}else if(diff>i) {
			}else {
		for(Integer it : list) {

If you run this program you will get the list of sub set whose sume is equal to 8.

Hope this will help you in your datastructre problem solving.

Thanks for reading.

Thursday, June 25, 2020

[Multi threading Interview Question ]Rate Limiter Implementation in java

There was one interesting problem I have encounter while preparing for a multithreading coding interview.

Question: We have an application for which we need to implement RateLimiter, 
Rate Limiter is an interface which will play a role to limit the number of Request client send to Server in a given time.

In the Current Question, it was asked to implement a rate limit who will do 2 things.

1) It will only allow one client to send 100 requests in 1 hrs. ( one client will be identified by the client Id).
2) It will allow a total of 10000 requests to be passed to the server in 1 hrs.

Rate Limiter Interface 
interface RateLimiter{

boolean accept(String clientId);

Java Implementation of Rate Limiter 

When we need to Implement such things where there is any restriction of accessing the resource for limited count We always start thinking using Semaphores  
Why Semaphores? 
Because it maintains the multi-access locking on its own with defined number of threads to access the critical section.

class MyRateLimiter  {
    private Semaphore semaphore;
    private int maxPermits;
    private TimeUnit timePeriod;
    private ScheduledExecutorService scheduler;
    public static MyRateLimiter create(int permits, TimeUnit timePeriod) {
    MyRateLimiter limiter = new MyRateLimiter(permits, timePeriod);
        return limiter;
    private MyRateLimiter(int permits, TimeUnit timePeriod) {
        this.semaphore = new Semaphore(permits);
        this.maxPermits = permits;
        this.timePeriod = timePeriod;
    public boolean tryAcquire() {
        return semaphore.tryAcquire();
    public void stop() {
    public void schedulePermit() {
        scheduler = Executors.newScheduledThreadPool(1);
        scheduler.scheduleAtFixedRate(() -> {
            semaphore.release(maxPermits - semaphore.availablePermits());
        }, 0, 1, timePeriod);


	class RateLimiterImpl implements RateLimiter{

private static long MINUTE_TIME_LIMIT=1000*60L; // update as per question
private static long REQUEST_ALLOWED_PER_MINUTE=10000; // Update as per question
Queue<Long> q = new LinkedList<>();
private static int minuteLimit=100;

private Map<String, Optional<MyRateLimiter>> limiters = new ConcurrentHashMap<>();
public boolean accept(String clientId) {
if(!hit(System.currentTimeMillis())) {
return false;
Optional<MyRateLimiter> rateLimiter = getRateLimiter(clientId);
if(rateLimiter.isPresent()) {
boolean canAcquire= rateLimiter.get().tryAcquire();
return q.add(System.currentTimeMillis());
return false;
private boolean hit(long timestamp) {
while(!q.isEmpty() && timestamp-q.peek() >= MINUTE_TIME_LIMIT) q.poll();
return true;
return false;
private Optional<MyRateLimiter> getRateLimiter(String clientId) {
        return limiters.computeIfAbsent(clientId, id -> {
            return Optional.of(createRateLimiter(id));
private MyRateLimiter createRateLimiter(String clientId) {
        return MyRateLimiter.create(minuteLimit, TimeUnit.MINUTES);


Main Class Calling

public class RateLimiterDemo {

public static void main(String[] args) {

RateLimiter limiter = new RateLimiterImpl();
        System.out.println("test1 " + limiter.accept("test1"));
        System.out.println("test1 " +limiter.accept("test1"));
        System.out.println("test1 " +limiter.accept("test1"));
        System.out.println("test1 " +limiter.accept("test1"));
        System.out.println("test2 " +limiter.accept("test2"));
        System.out.println("test2 " +limiter.accept("test2"));
        System.out.println("test2 " +limiter.accept("test2"));
        System.out.println("test2 " +limiter.accept("test2"));
        System.out.println("test1 " +limiter.accept("test1"));



You can also check the Code from HERE 

Hope this will help you in understanding the Code

Tuesday, June 16, 2020

101 Most Useful Websites on Internet

The Most Useful Websites and Web Apps

  1.— take a snapshot of any web page and it will exist forever even if the original page is gone.
  2. — create freehand doodles and watch them magically transform into beautiful drawings powered by maching learning.
  3.  — check the current speed of your Internet connection.
  4.  — create pixel-perfect slide decks and broadcast your presentations to an audience of any size from anywhere.
  5. — take high-resolution screenshots of web pages on mobile and desktops.
  6.  – accurate and quick voice recognition in your browser itself.
  7. — upload an image and find similar pictures on the web.
  8. – copy special characters and emojis that aren’t on your keyboard.
  9.  – the best place to learn coding online.
  10.  — ambient noises to help you improve focus and boost productivity.
  11.  – millions of icons for all kinds of projects. Also try 39 and 36.
  12.  – scan any suspicious file or email attachment for viruses.
  13.  – gets answers directly without searching – see more wolfram tips.
  14.  – track flight status at airports worldwide.
  15.  – the best place to download images absolutely free.
  16.  — an online library of free HD videos you can use everywhere. Also see 76.
  17.  – a less confusing view of the world time zones.
  18.  – a simple online timer for your daily needs.
  19.  – pick random numbers, flip coins, and more.
  20.  — replace your email with a mailbox that pays when you reply to someone’s email.
  21.  – upload an image of any text and quickly determine the font family.
  22.  – the best collection of open source fonts that you can use anywhere without restrictions.
  23.  — draw and build your own fonts and use them in any application.
  24.  — transform your handwriting into a real font.
  25. – find data hidden in your photographs – see more EXIF tools.
  26.  — broadcast yourself live over the Internet without any complicated setup.
  27.  — access other computers or allow others to remote access your computer over the Internet.
  28.  – design from scratch or re-model your home in 3D.
  29.  – lets you quickly edit PDF in the browser without Acrobat.
  30.  – create diagrams, wireframe and flowcharts in the browser.
  31.  — make voice and video calls in your browser with Skype.
  32.  – recognize text from scanned PDFs – see other OCR tools.
  33.  – for sharing really big files online.
  34. — peer to peer file transfer over WebRTC without any middleman.
  35.  — like Apple AirDrop but for the web. Share files directly between devices in the same network without having to upload them to any server first.
  36.  – the site lets you download free Kindle books.
  37.  — check your writing for spelling, style, andgrammatical errors.
  38.  – print music sheets, write your own music online ( review).
  39.  – translate web pages, PDFs and Office documents.
  40.  – create paintings and sketches with a wide variety of brushes.
  41.  – discover new sites that are similar to what you like already.
  42.  – create mind-maps, brainstorm ideas in the browser.
  43.  – get color ideas, also extract colors from photographs.
  44.  — make beautiful graphics, presentations, resumes and more with readymade template designs.
  45.  – when your friends are too lazy to use Google on their own.
  46.  – when you need to find the name of a song.
  47.  — see all your past Google searches, also among most important Google RLs
  48.  – send an online fax for free – see more fax services.
  49.  – setup your own private chat room in micro-seconds.
  50.  – create text notes that will self-destruct after being read.
  51.  – quickly search domain names for your next big idea!
  52.  – find if your favorite website is offline or not?
  53.  – the perfect tool for measuring your site performance online.
  54.  — find the web hosting company, email provider and everything else about a website.
  55.  – find definitions of slangs and informal words.
  56.  – consult this site before choosing a seat for your next flight.
  57.  – Track flight status at airports worldwide.
  58.  – create custom Google Maps with scribbles, pins and custom shapes.
  59.  – find if that email offer you received is real or just another scam.
  60.  – master touch-typing with these practice sessions.
  61.  — a beautiful todo app and task manager. Also see Trello.
  62.  – quickly capture effective notes during meetings.
  63.  — Turn Google Slides in animated GIF presentations.
  64.  – create a connection between all your online accounts.
  65.  — search for your desired username across hundreds of social networks and omain names.
  66.  — create anonymous and secret text notes and much more.
  67. — create flipbook animations, includes an onion skin tool to let you see the revious frame as you draw the next one.
  68.  — create engaging whiteboard videos and presentations with your own voiceovers. lso see
  69. — Record your own voice or upload an audio file without creating any account. Also see
  70.  — build one-page fully responsive websites that look good on every screen.
  71.  — make stunning video presentations with voice narration and wow everyone.
  72. — the easiest way to record a podcast that you can distribute on iTunes without have to pay for hosting.
  73.  — learn to speak Chinese, French, Spanish or any other language of your choice.
  74.  — an offline playground for building web projects in HTML, CSS and javascript.
  75.  — create your own comic strips with your own characters and move them into any one.
  76.  — a full-featured vector drawing tool that works everywhere.
  77.  – an excellent layer-based online image editor.
  78.  — create vector graphics and export them as SVG or PNG files.
  79. twitterbots — create your own Twitter bots that can auto-reply, DM, follow people and more.
  80.  — learn the art of meditation and reduct stress, focus more and even sleep better.
  81.  — a directory of free online courses offered by universities worldwide.
  82.  — discover museums, famous paintings and art treasure from all around the world.
  83.  — step-by-step guides on how to build anything and everything.
  84.  — make data-driven graphics, charts and infographics. Also see 18 and
  85.  — create interactive wireframes and product mockups.
  86. — make marketing videos and branded stories for Instagram, Facebook and YouTube trailers. Also, see 13 and 11.
  87.  — Take bite-sized courses on a variety of topics, chapters are delivered by email every morning.
  88. – send rich-text emails with gmail mail merge.
  89.  — whether you need a vacuum cleaner or an SD card, this is the best product recommendation website on the Internet.
  90.  — Create Amazon price watches and get email alerts when the prices drop.
  91.  — download mock data to fill the rows in your Excel spreadsheet.
  92.  — a WYSIWYG editor to draw ASCII diagrams that you can embed in emails and tweets.
  93.  — the easily way to post and schedule updates on Twitter, Instagram, LinkedIn, Google+ and Facebook.
  94.  — create disposable email addresses for putting inside sign-up forms.
  95. whereami — find the postal address of your current location on Google maps.
  96.  — create and share interactive reports, newsletters, presentations, and for storytelling.
  97.  — the perfect web scraping tool that lets you extract data from nearly any website.
  98.  — build your own apps for Android and iOS by dragging blocks instead of writing code. Also see: 36
  99.  — a huge collection of free movies curated from YouTube.
  100.  — find freelancers and subject experts to work on any kind of project.
  101.  – a clean alternative to google search that doesn’t track you on the Internet.

Know any useful website that is missing in the list? Please let me know via comment

Hope you hind these websites useful, 

Thanks for reading 

Sunday, July 7, 2019

Stock Buy & Sell Problem

Question: There is a given array of the stock price, each index denotes the price of the stock on that day. You need to find the max profit you will earn if you buy and sell the stock.

Example - Given an array - [10,5,6,8,9,3] where index 0 shows the prices of the stock on day 1 respectively.

Answer   Maxprofit=4
Explanation - first, we purchase at day 2 ( price - 5) and sell at day 5 (price 9 ) profit = 9-5=4

Code - 

package com.vp.learning;

public class StockBuyAndSellProblem {

 public static void main(String[] args) {

  //  given stock data as 
  int[] prices = {10,5,6,8,9,3};

 static int getMaxProfit(int[] prices) {

   return 0;

  int i = 0 ;
  int peak = prices[0];
  int valley = prices[0];
  int maxProfit = 0;
  while(i<prices.length-1) {
   while(i <prices.length-1 && prices[i]>= prices[i+1])
   valley = prices[i];
   while(i <prices.length-1 && prices[i]<= prices[i+1])
   peak = prices[i];

   maxProfit+=peak - valley ;

  return maxProfit;


Explanation :

 What we are doing here is as below

We are using Peak Valley Approach where are first calculate valley value in array

  • valley means lower value 
  • peak means higher value
Now while(i <prices.length-1 && prices[i]>= prices[i+1])

This is calculating the valley values, means the less value index in the array.

second, while loop is calculating the peak value in the array after this valley index.

if you see prices[i]>= prices[i+1] this means, price at current day is greater then the price at next day , that means the next day is valley or lower value, similarly for the next while as well, the price of current is less than the next day, so the next day will be peak value 

and the differences between peak and valley is actually the max profit we will earn for the day.

Time Complexity 

In this case, the time complexity will be O(n)

Hope this will help you in the interview. If you have any issue, please leave us a comment.

Thanks for reading 

Friday, May 17, 2019

Algorithm to find if String contains only Unique characters without using any additional data structure

The string is one of the most asked questions in the Interview of Java developers.

Today we will see one of the most asked questions as to how will you find if String does not contain any duplicate characters.

There are different ways to check them, But we will only discuss the most efficient way to implement this algorithm.


We know that characters have only 256 ascii values and there are only 128 values for alphabet characters. 
So what we will do is we will create one array of boolean of size 128 and we will update the index of array as true whenever we find the char value in the string , else if we get the same value in the string , the already true value will make the loop as false.
Also read - Find Longest Common Ancestor(LCA) Program in java

Time Complexity - O(n)
Space Complexity - O(1)

Code -

public class ArraysAndStringDemo {
 public static void main(String[] args) {
  String str = "programinjava";
 public static boolean isUnique(String str) {
  boolean[] char_set = new boolean[128];
  for(int i =0;i<str.length();i++) {
     int value =str.charAt(i); //getting the ascii value of character
     if(char_set[value])     // checking if it is already in the array
   return false;
     char_set[value] = true;
  return true;


If you have any issue in understanding the same , Please leave us a comment. Happy to help

Thanks for reading

Saturday, March 9, 2019

Real time Logs of AWS Elastic Beanstalk by Command Prompt

Many of us know that one of the most important services of AWS is Elastic beanstalks. We deployed our application on Beanstalk and AWS itself manage most of the thing in it. One of them is Logs of Applications.

People usually were not able to see the tail of the logs of the application what they need to do is to go to the beanstalk and under logs, they ask for the last 100 lines of logs or full logs (which include the of the application along with the other logs ).

Today we will learn how to connect with the beanstalk application through EB CLI and see the logs.

let's follow the below steps.
  1. Install the Python Once installed run below commands
  2. python --version
  3. pip --version
  4. pip install awsebcli --upgrade --user
  5. once ebcli installed successfully, you can check by 
  6. eb --version
  7. define the Python Home in your Environment Variable.
  8. Now Run your command prompt as Administrator  and write 
eb init --interactive
You will see the below image.
  • Now select the region you have deployed your application.
  • After that, you will be asked to Create a new Application 
  • Once your application will be created you will see below screen.
  • You need to select the appropriate platform you have used for your application.
  • Now Once you do it you will be asked to create the SSH 
Select Yes 
  • Then they will ask you to create the keypair 

  • Provide your password  and then you will see the below image 
  • Now you have successfully created your SSH and it is uploaded to your beanstalk as well.
  • you need to attach the SSH with the Application.

Follow below steps 

eb ssh <Application-name> --settings

  • You will get the list of options then it will ask for the keypair which you need to attach.
  • Select the appropraite one.
  • After selecting the one you will be asked to enter the password set earlier.
  • You will then have the Applicaiton connected.
  • Once connected successfully you will be getting below image.
Now go to 
/var/log/tomcat8 ( to see the application logs, if your application is deployed on tomcat)

I Hope you will be able to connect your local machine to EB , If you have any issue  ,Please leave us a comment we will look into it.

Also Read:
  1. Spring Boot and Hibernate Tutorials - Application using Spring Boot
  2. What is Spring boot ?
  3. How to read value from property file in spring boot ?
  4. First Rest API Application - Top Spring Framework Interview Questions
  5. Implementation of Swagger in Spring boot
  6. How to use h2 database in spring boot

Thanks for reading.

Saturday, February 16, 2019

Database Timezone issue -Solution in java

We have at least once in our development has encountered one issue with database and client location is Timezone difference. 

In most of the cases, Our Backend /Application server is in a different timezone and our client server is in a different timezone. So what actually the problem happens is the difference in data time because of Timezone.

Wednesday, November 28, 2018

Thread Pooling In Java Using Executors Class

Most of the Important and most of the developer found one topic in java they perform a task and then they get destroyed. Purpose of multithreading is to perform multiple tasks simultaneously for effective utilization of our resources (time and CPU).

Imagine that there are 10 tasks to perform, so using traditional multithreading mechanism we will need 10 threads. Do you see a drawback in this approach? I see it; creation of a new thread per task will cause resource overhead.