On Thu, Apr 29, 2021 at 2:26 PM Øyvind Teig <oyvind.t...@teigfam.net> wrote:

> Your suggestion would in fact do pri select in the special case 1. below:
>
> Poll highPri first (take it if it's ready), if highPri not ready then take 
> lowPri (provided highPri has not become ready since the first poll)
> However, if highPri has become ready between the first and the second, then 
> it would be taken (provided lowPri is not also ready)
> If both have become ready when the second select is entered they would be 
> taken 50% of the time on the average

My analysis is different. There are four cases on entry of the outer
select statement:

1. high is ready and low is ready -> high handled, correct.
2. high is ready and low is not ready -> high handled, correct.
3. high is not ready and low is ready -> low handled, correct.

The "interesting" case is

4. high not ready and low not ready.

We enter the default clause of the outer select statement and enter
the inner select statement. Now there are three subcases when
eventually something gets ready:

4a. high gets ready before low gets ready -> high handled, correct.
4b. low gets ready before high gets ready -> low handled, correct.
4c. both high and low get ready at the same time -> one of them is
randomly chosen, correct.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAA40n-X3Mp_Zf2%3DopzuvGSSFSVMr1w_T7rOyGPHeTrVDMm5MAQ%40mail.gmail.com.

Reply via email to