RFR: 8321242: Enable WorkerThreads to run tasks in caller thread [v2]

Stefan Karlsson stefank at openjdk.org
Wed Dec 6 08:56:38 UTC 2023


On Wed, 6 Dec 2023 08:43:28 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> Why should this be using Atomic::store? Concurrent accesses are guarded by the semaphores. That's what the comment tries to convene:
>> 
>> // No workers are allowed to read the state variables until they have been signaled.
>
> I would say it is a matter of hygiene. If we access things with Atomics, e.g. for CASes, then we should be doing atomic accesses everywhere else. In case some platforms do something specific for atomics to work. There is a CAS for `_not_finished` in `WorkerTaskDispatcher::worker_run_task`. I guess we want the same for `_started`.

The counter-argument is that when you see the Atomic::store you think that there must be some concurrent access happening, but there are none and the reader was just mislead by the Atomic::store.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16945#discussion_r1416939397


More information about the hotspot-gc-dev mailing list