For Java 10 there has been work taking place under the hood to help improve performance. There are several changes that are taking place to improve performance under the hood of the JVM. One of these changes is JEP-312. When running an application the JVM needs to occasionally stop executing Java code in order to complete house keeping tasks such as garbage collection (we wrote an article explain the changes to Garbage Collection in Java 10 last week) and JIT compilation (we will be looking at this next time). In order to handle these the JVM enters a safe point.
What is a Safe Point?
In order for the JVM to perform various tasks of a thread it needs to stop the thread at a safe point. An example of when this might happen would be when we need to get a stack trace. In order to do this currently we need to enter a global safe point (a stop-the-world event). During this time all threads executing java code are stopped. Previously when controlling these threads it has been all or nothing. All threads are stopped.
What does JEP-312 do?
JEP-312 introduces Thread-Local handshakes. Instead of waiting for a global safe point to stop all the threads we use a callback to affect individual threads. The callback will trigger when a thread is in a safe point and allow it to be stopped as soon as possible. It can then be started again as soon as the JVM has finished any tasks it was performing to the thread. In short, threads are no longer all or nothing when it comes to stopping them. We can instead stop threads individually allowing others to continue, cutting down on the number of stops to all threads.
How do I use these features?
This new system is on by default in Java10. These changes have all taken place under the hood of the JVM, there is nothing you will need to do to take advantage of it. However you may find this feature may not be desirable. In that is the case there is a flag to let you control it. The following flag can be uses with true or false to turn the feature on or off.
It should be noted that these features will initially be implemented solely for x64 and SPARC. Other platforms will fall back on the original safe points.
At IDRsolutions we have been eagerly awaiting the release of Java 10 to see what improvements these features bring the library. What features in Java 10 can you not wait to start using?
Are you a Developer working with PDF files?
Our developers guide contains a large number of technical posts to help you understand the PDF file Format.
Do you need to solve any of these problems?
|Display PDF documents in a Web app|
|Use PDF Forms in a web browser|
|Convert PDF Documents to an image|
|Work with PDF Documents in Java|