Multithreading Program in Java

Purpose of Multithreading

Different States of a Thread in Java

  • New: A thread whose execution has not started comes in this stage.
  • Runnable: After the start() method is called, the thread is in the queue for processing and ready to run, i.e., the thread scheduler has not selected the thread to move it to the running state. In other words, threads in this stage are waiting for the CPU for execution.
  • Running: The thread scheduler has moved the thread from runnable to this stage, which means the thread gets the CPU, and its execution is started. Note that the Runnable and Running stages form the active state of a thread.
  • Blocked/ Waiting: A thread that is still alive but is not eligible to enter the active state. A thread may enter this stage if a high-priority thread intervenes.
  • Dead/ Terminated: A thread that can no longer be used in a program. Usually, a thread enters this stage when the thread has completed its task or is forcefully terminated.




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Hammer 1.6 — It’s All About Speed — Forge

MassBit Route Testnet Update

The Secret of Fast Programming — Stop Thinking

Mid-Level Developer

Accessibility Tips, Tricks, and Resources for Web Devs

This image shows a wheelchair user at a computer.

Answering StackOverflow questions can make you better

Object-Oriented Programming and How You Can Benefit as a Flutter-Dev

Image by cottonbro ( on pexels. With uncreative edits by author.

k-means in a nutshell

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
Amansingh Javatpoint

Amansingh Javatpoint

More from Medium

Java Consumer Interface

What is Spring Framework & IoC (Inversion Of Control) in Spring?

Profile Java Applications using VisualVM

In-memory cache in Spring Boot