Explanation of the Thread-Local Handshakes
Asked Answered
B

1

33

As part of the putative JDK 10 this JEP 312: Thread-Local Handshakes was proposed.

I've tried to grasp its description, but I am still not confident that I got the idea properly.

Is it essentially an attempt to reanimate something similar to the deprecated Thread.destroy()?

How could this interface theoretically look like?

Brena answered 10/11, 2017 at 12:29 Comment(1)
Can we get the answer back? The current state of this question being in meta instead of here is an undesirable situation. If the answer can't be revived? Can it be reposted? Nobody seems to know why this was deleted in the first place.Horme
U
12

After researching JEP: 312 Thread-Local-Handshakes and reading the excellent comments to this question, here is a quick summary.

  • It is a performance enhancement which cannot be used directly by developers:

    A handshake mechanism is proposed as an optimisation of the Hotspot safepoints mechanism.

    The former allows threads in a safepoint to continue executing immediately after performing a regulatory operation (the handshake callback).

    The latter forces all threads to block on a safepoint in order for critical operations to take place (such as YoungGen GC or the STW parts of a Full GC). The threads are released only after the critical operation has completed its execution.

  • This JEP is not related to thread termination APIs such as Thread.destroy(). Since this subject has been raised, I'll add a few articles on thread termination in the references below.

OP Commentators:

JimmyB , Andy Turner , skomisa , Alexander Bollaert

References:

Uzzia answered 10/11, 2017 at 12:29 Comment(1)
@RannLifshitz Mixing your own content with what you have drawn from comments by others is fine, as long as the attribution of the parts you have taken from elsewhere is clear. Whether to make the answer community wiki is a separate matter: it is appropriate to do so if most of your answer is drawn from posts by others. See also: Why would you mark an answer as Community Wiki? (Meta).Downwash

© 2022 - 2024 — McMap. All rights reserved.