On Wed, May 5, 2021 at 9:56 AM Øyvind Teig <oyvind.t...@teigfam.net> wrote:
>
> Here is my cognitive test case. It is not 100% realistic, but it's just to 
> convey my point:
> hiPri is a disconnect message of a smoke detetector. loPri is a fire alarm. 
> If the disconnect hiPri is activated before (1 sec to 1 ns) or simulatenously 
> (same polling of "hw pins") as the alarm loPri there should be no alarm being 
> sent to the fire department. No emergency fire trucks. Not ever. There should 
> not be any case of some low probability where this may happen. However, if 
> the hiPri disconnect message was activated after the alarm, then it was too 
> late, and the alarm will go off. (Disconnect was because we knew that there 
> was going to be an alarm since we were doing something, and we explicitly did 
> not want the fire trucks to come)

This description assumes that there is some notion of absolute time
that permits you to determine whether event A occurs 1ns before event
B.  In a concurrent programming language like Go, with a program
running on a multi-core processor like more modern processors, there
is no absolute time.  While it may be possible in principle for
someone outside the system to say that event A happened first, within
the system there is no way to determine which event happened first.
Events that occur close in time on different cores are effectively
simultaneous.

So I would say that the problem with your cognitive test is that it
misunderstands the nature of concurrent languages on multicore
systems.  Unless there is an explicit synchronization event, it's
often impossible to say which event happened first.

Ian

-- 
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/CAOyqgcWaQP_eSJHeMTjzje_OkOQUxRsNyZVE50SyjSQhpMy_3A%40mail.gmail.com.

Reply via email to