Hi Andrew,
Regarding the problem you mentioned (database locks) before:
What if the "recordGenerator" record creates a new "dbbase" which is a
copy of the original "dbbase"?
That is, to maintain two "dbbase" in parallel: say "dbbase" and
"dbbaseCopy". The creation (with dbAllocBase()) of "dbbaseCopy" is done
at record init. Whenever the record-process routine gets called, it
first copies content of "dbbase" to "dbbaseCopy" and from this point on
it works on this copy (to generate a new record instance). When this
activity is finished then we exchange these two pointers just before
returning from process.
What problems do you see with this approach? (memory usage? etc.??)
Regards,
Babak
> -----Original Message-----
> From: Andrew Johnson [mailto:[email protected]]
> Sent: Freitag, 24. Oktober 2008 18:10
>
> Unfortunately there are major problems with doing this in a running
IOC:
> we
> don't have locks in all the database structures that need to be
modified
> when
> a new record instance is created, which makes this a precarious
activity.
> The current dbStaticLib design assumes that all record creation
happens
> while
> the IOC is running single-threaded before initialization of any scan
or
> server threads. For example, the pdbbase->ppvd structure which is a
hash
> table of all the record instances has no locks, so one or more server
> threads
> could be searching for PV names in the hash bucket linked list that
your
> new
> record instance gets added to.
>
> Looking at the code in base/src/dbStatic/dbPvdLib.c I can see several
ways
> that simultaneous calls to dbPvdFind() and dbPvdAdd() in different
threads
> could cause a segfault, because this code has not been written with
that
> possibility in mind.
>
> Note that remediation of this by adding locks to the pdbbase->ppvd
> structure
> is not as easy as it might seem because we have to check for deadlocks
> with
> other parts of the system which already have locks in place, and also
> because
> of the effect such locks could have on PV search performance (which
IOCs
> do a
> lot of and which dbPvdFind() is currently optimized for).
>
- Replies:
- Re: recordGenerator record Andrew Johnson
- Navigate by Date:
- Prev:
RE: Very slow reconnection to medm after IOC reboot Mark Rivers
- Next:
wrong timestamps in monitors 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
- Navigate by Thread:
- Prev:
Re: RTEMS soft reboot Till Straumann
- Next:
Re: recordGenerator record Andrew Johnson
- 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
|