4

Java virtual threads hit with pinning issue

 6 months ago
source link: https://www.infoworld.com/article/3713220/java-virtual-threads-hit-with-pinning-issue.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Java virtual threads hit with pinning issue

The Java team at Oracle is working to address two common cases in which a virtual thread parks or blocks and the underlying native thread is not released.

By Paul Krill

Editor at Large,

InfoWorld | Feb 22, 2024 4:01 pm PST

shutterstock 365534981 closeup of colorful sewing threads on spools

Oksana Shufrych / Shutterstock

Java’s virtual threads, introduced in JDK 21 in September 2023 to make it easier to write and maintain concurrent applications, has suffered from a “pinning” issue that arises with synchronized methods or synchronized statements.  

Oracle detailed the virtual thread pinning issue this week on the Inside Java website. The two most common cases involve a virtual thread parking while in a synchronized method, and a virtual thread blocking when entering a synchronized method, because the object’s associated monitor is held by another thread. In both cases, the carrier or native thread is not released to do other other work. Virtual thread pinning could impact performance and scalability and potentially result in starvation and deadlock, according to the blog post.

New early access builds for Java’s Project Loom introduce changes to the object monitor implementation that do not pin in these two common cases. The Loom team is seeking help from users to test the reliability and performance of these updated object monitors with code that uses virtual threads and with libraries that are heavily synchronized. To report an issue, developers should use the Loom mailing list.

Project Loom is the OpenJDK project that develops JVM features and APIs to support lightweight concurrency. Previewed in JDK 19 and JDK 20, virtual threads are lightweight threads that dramatically reduce the effort of writing, maintaining, and observing high-throughput concurrent applications, according to Oracle. Despite the pinning issue, Oracle said virtual threads have been extremely well-received by the Java community and ecosystem.

0 seconds of 30 secondsVolume 0%
This ad will end in 24

Paul Krill is an editor at large at InfoWorld, whose coverage focuses on application development.

Copyright © 2024 IDG Communications, Inc.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK