Thursday, April 23, 2026

Java Platform Threads Limit: Performance Impact & Cost Guide

Wondering what makes Java applications hard to scale up to thousands of concurrent tasks?

The solution is the cost of platform threads, which are the traditional Java threads. In this blog, we will discuss the behavior of platform threads when loaded, limitations, and why developers are moving to the new virtual threads of Java in order to scale.

Thread related topics

Java Platform Threads are Costly

Java platform threads are costly because of:

  • OS-level memory
  • Context switching
  • Lifecycle costs

Java platform threads are heavyweight operating system threads, which:

  • Use a lot of memory (usually 1MB stack memory)
  • Are costly to create and operate at large scale

The JVM throws errors like:

OutOfMemoryError: unable to create new native thread

What are Platform Threads in Java?

Java has a traditional thread supported by a native operating system thread called a platform thread.

Each thread:

  • Is created with new Thread API
  • Takes dedicated stack memory (1MB by default)
  • Is restricted by OS thread limits

Wednesday, July 23, 2025

Two ways to Unstage a File in Git git rm --cached and git reset Head)

Git Unstage file

Common question on git unstage :

This post covers the following questions with in-depth answers along with step-by-step example.
git reset - Why are there 2 ways to unstage a file in git? - Stack Overflow
version control - How to undo 'git add' before commit? - Stack Overflow
git - How can I unstage my files again after making a local commit.

More article on Git Series


Unstage a File in Git:

In Git, unstaging a file can be done in two ways.

1) git rm --cached <file-name>
2) git reset Head <file-name>

These commands are very useful when we add the files to git. But later or before commit, we realize that mistakenly added the files to git. we should remove the files from git. The process of removing a file from  staging area is called "Unstaging file" from git.

We will be discussing indepth in this tutorial.


Unstage a File in Git

Way 1) git rm --cached <file-name>:

This can be used in two ways.

1) On the brand new file which is not on github.
2) On existing file which exists on github.

We will see how this command behaves on above 2 scenarios.

Case 1: rm --cached on new file which is not committed.

rm --cached <brand-new-file-name>is useful when we want to remove only the file(s) from staging area where this file is not available on github ever. After executing this command, the file remains in the local machine, it just unstaged from staging area.

Example:

The below example is on the new file.

Venki@Venki-PC MINGW64 /d/Site/adeepdrive/git/practice/gitdemo (master)
$ ls 
fileone.txt

Venki@Venki-PC MINGW64 /d/Site/adeepdrive/git/practice/gitdemo (master)
$ echo "this is second file" >> filetwo.txt
Venki@Venki-PC MINGW64 /d/Site/adeepdrive/git/practice/gitdemo (master)
$ ls
fileone.txt  filetwo.txt

Venki@Venki-PC MINGW64 /d/Site/adeepdrive/git/practice/gitdemo (master)
$ git add filetwo.txt

Venki@Venki-PC MINGW64 /d/Site/adeepdrive/git/practice/gitdemo (master)
$ git status
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)
        new file:   filetwo.txt

Venki@Venki-PC MINGW64 /d/Site/adeepdrive/git/practice/gitdemo (master)

$ git rm --cached filetwo.txt
rm 'filetwo.txt'Venki@Venki-PC MINGW64 /d/Site/adeepdrive/git/practice/gitdemo (master)
$ git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        filetwo.txt
nothing added to commit but untracked files present (use "git add" to track)

Java 21 Virtual Threads Basic and Foundation

Introduction

Hey everyone 👋,

Welcome to the first post in our deep dive series on Java Virtual Threads! Before we jump into the nuts and bolts of virtual threads, it’s important to lay the foundation. Yes, the first couple of sections may feel basic—but they are essential to understand how things work under the hood, especially when we eventually zoom in on virtual threads.

So bear with me. This foundational knowledge will help you fully grasp the power and potential of virtual threads.

🚀 Starting Simple: Running a Java Program

Let’s imagine you’ve developed a simple Java application and packaged it into a JAR file.

 java -jar myapp.jar


When you run this command, your program is loaded into memory and a process is created.

Sunday, July 20, 2025

Java 8 - How to convert Calendar to LocalDateTime?

1. Overview

In this article, You'll learn how to convert Calendar to LocalDateTime object in java 8 DateTime api

LocalDateTime api can be used completely replacement to the Date class as all features of Date functions are done in a simple and precise way such as adding minutes to the current date.

Java 8 - How to convert Calendar to LocalDateTime?