Virtual threads are one of the biggest new features of Java 21 since Lambdas. They have a big impact on how we implement concurrent code. As you probably know, you can have millions of them at the same time, something that wasn’t possible before with the virtual threads we had since Java 1.0. Before we dive deeper into what virtual threads are, it is good to know how threads we currently use work and what their limitations are.
To follow along with the examples in this ...