RFR: 8257831: Suspend with handshakes [v4]

Robbin Ehn rehn at openjdk.java.net
Mon Apr 12 07:12:43 UTC 2021


On Fri, 9 Apr 2021 16:16:45 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> Robbin Ehn has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains six commits:
>> 
>>  - White space fixes
>>  - Merge branch 'master' into SuspendInHandshake
>>  - Review fixes
>>  - Merge branch 'master' into SuspendInHandshake
>>  - Merge branch 'master' into SuspendInHandshake
>>  - 8257831: Suspend with handshake (review baseline)
>
> I'm still really happy with this fix! Thumbs up!
> Reminder: don't forget to decide what to do about the obsolete options.
> @dholmes-ora can provide guidance on how to handle this type of removal.

Thanks Serguei,

Fixed nits.

> I wonder why ThreadSuspensionHandshake is not stack allocated as SuspendThreadHandshake below:

Simplified:
Suspender thread target another thread for suspension.
It first allocates the synchronous handshake on stack and tries to execute it.
When the target thread becomes blocked/native we install the asynchronous handshake (the trap).
The trap will stop the target thread from leaving blocked/native until we resume it.
Since the suspender now have successfully suspended the target (the trap is installed) it will return from this method call.
Thus it's stack is not usable for the asynchronous handshake.

The trap can even be executed after the suspender thread have terminated, therefore we need to but the trap on the heap.

Hope this answers your question!

Thanks, Robbin

> Thanks,
> Serguei

-------------

PR: https://git.openjdk.java.net/jdk/pull/3191


More information about the serviceability-dev mailing list