Virtual threads (Project Loom)
How do virtual threads change concurrency design in Java 21+?
Answers use simple, clear English.
Audio N/AQuick interview answer
Virtual threads are lightweight threads scheduled by the JVM onto carrier platform threads. They make blocking I/O scalable, so you can write simple thread-per-request style code without reactive complexity for many services. Avoid pinning (synchronized blocks holding carrier threads during blocking) and very long CPU-bound work on huge numbers of virtual threads.
Detailed answer
Virtual threads are lightweight threads scheduled by the JVM onto carrier platform threads. They make blocking I/O scalable, so you can write simple thread-per-request style code without reactive complexity for many services. Avoid pinning (synchronized blocks holding carrier threads during blocking) and very long CPU-bound work on huge numbers of virtual threads. Spring Boot 3.2+ supports virtual thread executors. Great for JDBC-heavy services. Still measure; structured concurrency and semaphores help bound fan-out.
Full explanation
Spring Boot 3.2+ supports virtual thread executors. Great for JDBC-heavy services. Still measure; structured concurrency and semaphores help bound fan-out.