1. 11
  1. 10

    Traditionally, JVM threads were built around OS threads.

    Java started out with virtual/green threads. In fact the term “green threads” comes from the name of the the Sun research project that created Java.

    According to that WIkipedia article, they were replaced with native threads in JDK 1.3. La plus ce change…

    1. 2

      Interesting; while I was reading this my main thought was “why are these things that seem to clearly be green threads called virtual threads instead?” and now I’m guessing it’s to avoid ambiguity with that ancient 1.2-era construct?

      1. 2

        My understanding is that green threads and virtual threads are both user-space constructs that present a thread-style API, but the similarity pretty much ends there. Early JVM versions only ran on a single OS thread, so green threads didn’t have to deal with any parallelism concerns or with what happens when a single user-space thread gets scheduled on different OS threads over time (which has an impact on things like thread-local variables).

        1. 1

          Probably, although the original green threads were replaced with OS Threads without much change to the APIs IIRC