Go Java (We’re Going to Need a Better JVM)

Go Java (We’re Going to Need a Better JVM)

To get anything comparable to a goroutine in Java we look at an alternative OpenJDK called Project Loom that provides 'virtual threads', a new implementation of Thread that differs in memory footprint and scheduling.

If you like the go concurrency features of go_routines_ and would like something similar for high-throughput concurrent applications written in Java, then read on …


To get anything comparable to a goroutine in Java we look at an alternative OpenJDK called Project Loom that provides 'virtual threads', a new implementation of Thread that differs in memory footprint and scheduling.


Java does not have anything that is equivalent to a goroutine, the nearest match is a Thread, unlike Java threads though, you can run many more goroutines on a typical system, they will have a lower memory footprint, and will perform much better.

Java Threads

So whats the problem with Java Threads? In a nutshell, they are implemented in the JDK as trivial wrappers around operating system (OS) threads which introduces the following problems …

OS thread limit

If you try and create too many OS threads you’ll get:

[error] (run-main-0) java.lang.OutOfMemoryError: unable to create native thread

On my macbook (2.2 GHz Intel Core i7, 16 GB 1600 MHz DDR3) I could create 2048 threads before “running out of memory”, this is actually linked to the kern.num_taskthreads setting of 2048, so problem here was not so much to do with memory, but the number of threads the OS supports for my user. All platforms will impost limits though.

golang goroutines java project-loom go

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

How to Install OpenJDK 11 on CentOS 8

What is OpenJDK? OpenJDk or Open Java Development Kit is a free, open-source framework of the Java Platform, Standard Edition (or Java SE).

Top Android Projects with Source Code

Android projects with source code - Work on real-time android projects. We’ll start project ideas from beginners level and later move to advance projects.

What's new in the go 1.15

Go announced Go 1.15 version on 11 Aug 2020. Highlighted updates and features include Substantial improvements to the Go linker, Improved allocation for small objects at high core counts, X.509 CommonName deprecation, GOPROXY supports skipping proxies that return errors, New embedded tzdata package, Several Core Library improvements and more.

Learning by Doing: How to Learn Java Basics by Building Your Own Project

Check out some ideas for sample projects that can help you learn Java, and programming in general, in a fun and engaging way.

Golang Interface Example | Interface Implementation in Go

Golang interface example | Interface Implementation in Go. An interface is type defined using set of method signatures and implment using struct.