2002 2003 2004 2005 2006 2007 2008 2009 <2010> 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 | Index | 2002 2003 2004 2005 2006 2007 2008 2009 <2010> 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: Dynamic Loading and Unloading of EPICS Device Support and Record. |
From: | Marty Kraimer <[email protected]> |
To: | Core-Talk <[email protected]> |
Date: | Wed, 08 Sep 2010 15:06:04 -0400 |
On 09/08/2010 01:44 PM, Dalesio, Leo wrote:
Let me explain briefly how the javaIOC handles dynamic creation and deletion of database records. Rather than lock sets each javaIOC record is locked. To handle links between records it is possible to lock one additional record besides the currently locked record. The implementation prevents deadlocks. In addition any code that accesses a record must register itself by supplying a callback method named "detach". Each record instance has a RecordProcess created for it. RecordProcess calls the top level Support which must exist. Each field can optionally also have a Support. RecordProccess and Support implement the following methods: initialize, start,process, stop, and uninitialize. When initialize is called the support can create anything it requires for processing but can not access anything outside the record. Start can connect to things outside the record, e.g. hardware, other records, channel access, etc. Process is called when a record is processed. Stop undoes start. Uninitialize undoes initialize. There are two databases involved with records that can be processed: master, and beingInstalled. The following is done to delete a record: The record is removed from the master database. The detach method of all registered code is called. After detach is called the code must no longer access the record. Then RecordProcess.stop() is called. This results in all Support.stop() methods being called, Then RecordProcess.uninitialize is called which again results in all the Support.uninitialize methods being called. After this the record is gone. To add a record, actually a set of records, the following is done: The records are added to the beingInstalled database. For each record the following is done: Look for all fields that have a request to replace the current PVField implementation. Ceates a RecordProcess for the the record and create the Support for all fields that have support. Then call RecordProcess.initialize and then RecordProcess.start,. If anything fails during this install quits. If all succeed then the beingInstalled records are moved to the master database. It is somewhat more complicated than this but not much. The really big problems with the v3 IOC are: 1) lock sets, which span records, and 2) There is no equivalent in record support or device support to stop and initialize, and 3) There is no equivalent to detach. For lock sets I think it means the entire database must be locked while a record is added or deleted so that lock sets can be recomputed. There is already a global lock for the database which gets locked if a new access security file is loaded into a running IOC. I think I am remembering this correctly. But it does mean the entire database must be locked which makes everything freeze. To support stop and unintialize all record/device code for any record to be added or deleted must be upgraded. In addition any code that accesses record instances must register and provide a detach method. Sounds like a really big job. As Bob says you could decide not to support record
deletion. That removes the need to support stop and uninitialize
and detach. That simplifies what must be done. But lock sets
still appear to be a problem. I would still go with the idea of a
beingInstalled database. One thing to remember, however, is that
code that accesses other records (dbliink calink) must look in
both master and beingInstalled when looking for local records.
|