YoVDO

Java 21 New Feature - Virtual Threads

Offered By: Java via YouTube

Tags

Java Courses Asynchronous Programming Courses Imperative Programming Courses

Course Description

Overview

Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Explore Virtual Threads, a groundbreaking feature in JDK 21, in this 34-minute video tutorial. Discover how to implement and leverage Virtual Threads to address the complexities of asynchronous programming while maintaining high performance. Learn why traditional "one request per thread" models fall short and how Virtual Threads offer a solution. Follow along with practical examples, including an online shopping scenario, to understand the differences between blocking code, asynchronous programming with CompletableFuture API, and the simplicity of Virtual Threads. Gain insights into the inner workings of Virtual Threads, their creation and usage, and best practices for handling native code and synchronized blocks. By the end of this comprehensive guide, grasp why Virtual Threads are considered a game-changer in Java concurrency, offering the benefits of simple imperative blocking code without sacrificing throughput performance.

Syllabus

Intro
Why Virtual Threads have been added?
Analyzing the CPU usage of your blocking code
Why the "one request per thread" model cannot work
Solving this problem: less expensive threads or asynchronous code?
Introducing the asynchronous solution
Writing an imperative, blocking online shopping example
Making this code asynchronous the CompletableFuture API
Issues with the asynchronous code: debugging, testing, stack trace, exception handling, timeout handling
Making threads less expensive: by how much?
Creating and using virtual threads
How Virtual Threads are working under the hood
Running blocking code in a virtual thread
Handling native code and synchronized blocks: avoid pinning virtual threads
Wrapping up: virtual threads are cheap, blocking them is fine
Outro


Taught by

Java

Related Courses

Algorithms, Part I
Princeton University via Coursera
Introduction à la programmation orientée objet (en Java)
École Polytechnique Fédérale de Lausanne via Coursera
MongoDB for Java Developers
MongoDB University
Initiation à la programmation (en Java)
École Polytechnique Fédérale de Lausanne via Coursera
Intro to Java Programming
San Jose State University via Udacity