Experimental Physics and Industrial Control System
On 2/25/2010 7:43 AM, Benjamin Franksen wrote:
It remains to draw practical conclusions for how to avoid such race
conditions in SNL code. Should we generally be wary of pvPut and monitor to
the same state variable? Could the compiler warn us about that? Or is this
too restrictive?
Great analysis. Thanks for that.
Wrong take-home message, though. If you had written this in C,
your first thoughts would probably have been something like this:
"Hmmm... two tasks; shared resource; better implement a mutex"
and your life would have been less eventful. (Sorry for the pun.
Here's another: this is a very old tale with a context switch.)
I've stabbed myself with exactly this blade more times than I can
count, in every programming language I've ever used.
I think the take-home messages are simply that SNL is not magic,
and that multitasking event-driven software is hard to get right.
Compilers can't really help with stuff like this, because you
could have the same problem by writing to X and monitoring some
other PV, Y, that gets changed as a result of the write to X.
What's really pernicious is the case in which X modifies Y
via a CA link, or via the reply to a serial device. In these
cases, the race condition is moved out in time so you almost
never can find it in testing.
--
Tim Mooney ([email protected]) (630)252-5417
Beamline Controls & Data Acquisition Group
Advanced Photon Source, Argonne National Lab.
- Replies:
- Re: Fwd: Sequencer bug? Benjamin Franksen
- References:
- Re: Sequencer bug? Benjamin Franksen
- Re: Fwd: Sequencer bug? Benjamin Franksen
- Navigate by Date:
- Prev:
RE: Fwd: Sequencer bug? Mark Rivers
- Next:
Re: Fwd: Sequencer bug? Benjamin Franksen
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
<2010>
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
- Navigate by Thread:
- Prev:
Re: Fwd: Sequencer bug? Benjamin Franksen
- Next:
Re: Fwd: Sequencer bug? Benjamin Franksen
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
<2010>
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025