On Tue, 20 Dec 2022 05:21:21 GMT, David Holmes <dhol...@openjdk.org> wrote:

>> Chris Plummer has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Better comments.
>
> The JEP defines pinning as expected:
>> There are two scenarios in which a virtual thread cannot be unmounted during 
>> blocking operations because it is pinned to its carrier:
>>
>>  When it executes code inside a synchronized block or method, or
>>  When it executes a native method or a [foreign 
>> function](https://openjdk.java.net/jeps/424).
>>
>> Pinning does not make an application incorrect, but it might hinder its 
>> scalability. If a virtual thread performs a blocking operation such as I/O 
>> or BlockingQueue.take() while it is pinned, then its carrier and the 
>> underlying OS thread are blocked for the duration of the operation. Frequent 
>> pinning for long durations can harm the scalability of an application by 
>> capturing carriers.
> 
> But then also says:
>> The scheduler does not compensate for pinning by expanding its parallelism.
> 
> which contradicts what you quoted from Alan above - though I prefer that 
> behaviour as the JEP's behaviour seems a design flaw to me.

@dholmes-ora  I initially  took the approach of making sure each test that was 
ever running short of carrier threads explicitly requested the minimum it 
needed. It resulted in quite a few changes, and I still had one test that was 
occasionally failing. Possibly I just came up one short in the carrier thread 
calculation. I abandoned it for this PR because it's much simpler. Here's a PR 
I just created for those changes in case you want to have a look at what was 
involved: #11762.

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

PR: https://git.openjdk.org/jdk/pull/11735

Reply via email to