Running 10 Millions Threads in 7 Seconds | Java Virtual Threads

Publicado el: 19 agosto 2023
en el canal de: Made Easy
1,007
44

Full Video Link :    • Understanding Java Virtual Threads | ...  

What is a Virtual Thread?
Like a platform thread, a virtual thread is also an instance of java.lang.Thread. However, a virtual thread isn't tied to a specific OS thread. A virtual thread still runs code on an OS thread. However, when code running in a virtual thread calls a blocking I/O operation, the Java runtime suspends the virtual thread until it can be resumed. The OS thread associated with the suspended virtual thread is now free to perform operations for other virtual threads.

Virtual threads are implemented in a similar way to virtual memory. To simulate a lot of memory, an operating system maps a large virtual address space to a limited amount of RAM. Similarly, to simulate a lot of threads, the Java runtime maps a large number of virtual threads to a small number of OS threads. Unlike platform threads, virtual threads typically have a shallow call stack, performing as few as a single HTTP client call or a single JDBC query. Although virtual threads support thread-local variables, you should carefully consider using them because a single JVM might support millions of virtual threads. Virtual threads are suitable for running tasks that spend most of the time blocked, often waiting for I/O operations to complete. However, they aren't intended for long-running CPU-intensive operations.

JEP : https://openjdk.org/jeps/444
OpenJDK : https://openjdk.org/

Tags : #java #openjdk #jdk20 #jdk21 #jdk19 #java #javabasics #javaconcepts #javaprogramming #javamultithreading #javainterviewquestions


En esta página del sitio puede ver el video en línea Running 10 Millions Threads in 7 Seconds | Java Virtual Threads de Duración hora minuto segunda en buena calidad , que subió el usuario Made Easy 19 agosto 2023, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 1,007 veces y le gustó 44 a los espectadores. Disfruta viendo!