Java 10 Thread Local Handshakes

Posted By :Arun Singh |28th June 2018

It is the best way to behead callback on threads without performing a global VM safe point. Make it possible and cheap to stop individual threads and not just all threads or none.


  • The new structure does not allow for performance overheads larger than 1% in standard benchmarks.
  • The new structure does not increase the time required to reach a traditional global safe point.


The callback is beheading either by the thread itself or by the VM thread while keeping the thread in a blocked state. A Thread-Local action is a callback that is beheading for each Java Thread during that thread is in a safe point secure state. The biggest change between safe-pointing and handshakes is that the per-thread action will be performed on all threads ASAP. They will continue to execute as soon as it’s own action is completed. If a Java Thread is known to be running, then a Thread can be performed with that single Java Thread as well.


In the basic application, there will be a limitation of at most one Thread handshake action in flight at a given time. The action can involve any subset of all Java Threads. The VM thread will coordinate with the handshake operation through a VM operation. Which VM operation will stop global safe points reaction from occurring during the handshake operation. 


The modern safe-pointing programs are altered to perform an indirection through a per-thread pointer which will allow a one thread beheading to be affected to trap on the guard page. Actually, at all times there will be two polling pages: One which is always guarded, and one which is always unguarded. 


  1. This absorbs branch predictor state and is not as tight as just a load. An analysis in this area has shown that the achievements of conditional branches can be highly dependent on the specific microarchitecture of the target CPU. 
  2. Which signify sacrificing other registers, and then operating a load of the address the register holds to the register itself, assuming the value of the register is the address of its own handshake field.
  3. A disadvantage with this access is that if a destination thread is slow to respond then this can cause a signal storm for other Java threads since the polling page cannot be disarmed until the destination thread has responded.

About Author

Arun Singh

Arun is a MEAN stack developer. He has a fastest and efficient way of problem solving techniques. He is very good in JavaScript and also have a little bit knowledge of Java and Python.

Request For Proposal

[contact-form-7 404 "Not Found"]

Ready to innovate ? Let's get in touch

Chat With Us