Stage 1 · Lesson 6 of 10
Threads and virtual threads
A is one line of work the computer can run alongside others. Traditional Java servers give each request its own platform thread, which is an expensive operating system thread. So a pool of a few hundred threads limits how many requests can wait on the database at once.
, final since Java 21 (from Project Loom), are cheap threads managed by the itself. When one makes a blocking call, it steps aside and frees the real thread underneath for other work. So you can write simple, blocking code and still serve many requests at the same time.
can run requests on them with one property. Learn the basics first: what a thread is, why data shared between threads needs synchronisation, and ExecutorService.
Common trapexpecting virtual threads to speed up CPU-heavy work; they help with waiting, not computing.
A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- GuideFreeDev.java: Learn Java
Oracle · Beginner
The official path through modern Java: records, collections, generics and exceptions
- CourseFreeJava Programming MOOC
University of Helsinki · Beginner
Free Helsinki course with hundreds of graded exercises, the best way to get fluent
Practise
Keep handy
Also worth your time
The DNS, TCP, TLS and HTTP steps behind every request your backend will handle