Experimental Physics and
| |||||||||||||||
|
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.
| ||||||||||||||
ANJ, 02 Sep 2010 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |