<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Archie and Kim,</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
Thank you for your patience, I tried to get back to this as soon as possible.</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Trying to swap this in again, looking at the code it would seem like lockInterruptibly() by external threads can indeed get interleaved with signaled waiters in the Condition's wait list.<br>
<br>
It is worth noting, however, that you could have any number of different Conditions operating within the same lock, so the question would be what the relative priority should be between the different waiters within the different Conditions, esp. in the face
 of competition from "the outside".</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Before we do anything at all, does there exist a reproducer which would illustrate that the current behavior causes problems?</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature" style="color: inherit;">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Cheers,<br>
√</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<b><br>
</b></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<b>Viktor Klang</b></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Software Architect, Java Platform Group<br>
Oracle</div>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Archie Cobbs <archie.cobbs@gmail.com><br>
<b>Sent:</b> Friday, 20 September 2024 16:32<br>
<b>To:</b> 김민주 <miiiinju00@gmail.com><br>
<b>Cc:</b> Viktor Klang <viktor.klang@oracle.com>; Daniel FUCHS <daniel.fuchs@oracle.com>; core-libs-dev@openjdk.org <core-libs-dev@openjdk.org><br>
<b>Subject:</b> Re: [External] : Re: [POTENTIAL BUG] Potential FIFO violation in BlockingQueue under high contention and suggestion for fair mode in ArrayBlockingQueue and LinkedBlockingQueue</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>Hi Kim,</div>
<div><br>
</div>
<div>Here is a quick summary of my thoughts...</div>
<div><br>
</div>
<div>Before diving into coding solutions, we need to make sure we're all on the same page.</div>
<div><br>
</div>
<div>First: (Viktor) Do we all agree that "Interpretation B" accurately describes how things are actually working today?<br>
</div>
<div><br>
</div>
<div>If "No" then we need to stop and understand the disagreement.</div>
<div><br>
</div>
<div>If "Yes" then the next step is to collectively decide what, if anything, we might want to change. Here are some options:<br>
</div>
<div>
<ol>
<li>Do nothing</li><li>Do nothing but document the behavior more clearly in the Javadoc</li><li>Change the behavior from B → A and update the Javadoc accordingly</li><li>Something else?</li></ol>
<div>Deciding among 1-4 will likely need to involve more core-libs-dev people, especially of the java.util.concurrent ilk.</div>
<div><br>
</div>
<div>-Archie<br>
</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">On Fri, Sep 20, 2024 at 1:58 AM 김민주 <<a href="mailto:miiiinju00@gmail.com">miiiinju00@gmail.com</a>> wrote:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div>
<p>Hi Viktor, Archie, and Daniel,</p>
<p>I hope everything is going well on your end. I really appreciate the thoughtful feedback you've provided so far, and I wanted to follow up on our previous discussion about the potential fairness issue in <code>ArrayBlockingQueue</code> when using <code>ReentrantLock</code> with <code>Condition.await()</code>.</p>
</div>
</blockquote>
</div>
<br>
<span class="x_gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="x_gmail_signature">Archie L. Cobbs<br>
</div>
</div>
</div>
</body>
</html>