Skip to content

Thread.getState() performance issue with yielding pinned VirtualThread #22322

@fengxue-IS

Description

@fengxue-IS

The need for suspending target thread in order to retrieve thread state causes significant performance bottle neck on virtual thread testing as many tests are written using:

while (vthread.getState() != targetState) {
    Thread.yield();
}

where the getState() call will prevent virtual thread's transition from completing due to repeated interruption.

#17251 tracks a similar perf bottleneck on platform thread.
Related tests: #22153

Work in progress solution: #21043

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions