[Hacking the JVM] The Hidden Cost of Thread Creation

Abstract Thread creation in Java is often cited as a heavyweight operation, but what makes it costly? This post explores the complete journey of thread creation—from calling `Thread.start()` in Java code through JNI boundaries, into JVM internals (jvm.cpp, thread.cpp), and finally to OS-level pthread creation on Linux. We examine stack allocation, guard pages, TLS adjustments, […]

Continue reading


[Hacking the JVM] Unraveling the Mystery of Object.hashCode()’s Native Implementation

A few weeks ago, while enjoying my afternoon coffee, I found myself Browse the OpenJDK source code. As I explored, the Object class’s hashCode() method, a method I’ve used and customized countless times, caught my eye. Like many, I’d always assumed its default implementation was directly tied to the object’s memory address. The public native […]

Continue reading