EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: GTR: thread-safety issue with devGtr.c
From: Till Straumann <[email protected]>
To: EPICS Techtalk <[email protected]>, Eric Norum <[email protected]>, "[email protected]" <[email protected]>
Date: Tue, 29 Oct 2013 14:38:35 -0700
Looking at devGtr.c's waveform device-support I find the following:

1) Execution of the driver's 'readMemory()' and 'readRawMemory()' operators
   is delegated to a callback task which is kicked off by the ISR.

   These operators pull data from the card to a memory buffer.

2)a) If the waveform has FTVL set to SHORT or LONG then the waveform's BPTR
   is directly passed on to readMemory()/readRawMemory(), i.e., in the
   context of the callback task data are copied from the board directly
   into the waveform record.

 b) If FTVL is set to another data type then readMemory/readRawMemory
   deposit data into an intermediate buffer. During record processing
   (waveform's 'read' devsup entry point) samples are copied and converted
   from the intermediate buffer into the waveform record.

=> Scenario 1+2a is not thread-safe. The callback task does not
lock the waveform record while writing data into it. I.e., nothing prevents e.g., a CA client from reading a partially old and partially new waveform.


Solution:
  i) use an intermediate buffer also in case 2a
OR
ii) in case 2a call readMemory/readRawMemory() from the waveform's 'read' devsup entry
     point rather than from a callback.
OR
iii) Use classical asynchronous record processing to read data into the waveform
     record. Even 2b) could then be delegated to a worker thread.

Drawback: The current way to process the 'autoRestart' record which rearms the digitizer after all waveforms are read is no longer possible. A different
     method must be implemented.

Clearly, i) is easiest and least invasive but introduces some extra overhead.

- Till

Navigate by Date:
Prev: RE: Labview EPICS server and client data types. Vaughn, Brian
Next: Re: sequencer + streamdevice Christoph Burandt
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: merge multiple alarms Tito Körner
Next: EPICS support for USB TMC (Test & Measurement Class) devices -- Release 1.0 Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·