Backend development

Stage 1 · Lesson 6 of 10

Threads and virtual threads

Your language and how HTTP works

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

  • GuideFree
    Dev.java: Learn Java

    Oracle · Beginner

    The official path through modern Java: records, collections, generics and exceptions

  • CourseFree
    Java Programming MOOC

    University of Helsinki · Beginner

    Free Helsinki course with hundreds of graded exercises, the best way to get fluent

Practise

  • Your language track: small exercises with free mentor feedback on idiomatic code

Keep handy

  • Quick syntax lookups for your language when you forget how something is written

  • Read the HTTP overview, methods, headers and status code pages until they feel obvious

Also worth your time

Mark this stage as not done?