Personal tools
You are here: Home Software CAMP slow controls rt95 rt95_paper_www node5.html

node5.html

by admin last modified Mar 02, 2016 05:32 PM



next up previous
Next: Future Up: The CAMP Slow Control Previous: Tcl Instrument Drivers

Multithreaded Server

Most of the instrumentation in use with CAMP at TRIUMF limit access to no more than 2 Hz. The use of synchronous I/O by the server process, which performs all I/O, caused the server to often be slow to respond to RPC requests. The instrument drivers were becoming sufficiently complicated (i.e., many I/Os performed per request) that this delay was becoming noticeable to users. In the worst case, instruments powered off while CAMP was polling could effectively cause CAMP to temporarily ``hang". Most importantly, the I-SR data acquisition required fast response from CAMP for setting and retrieving data. CAMP could potentially cause unnecessary loss of data if it were performing more than just the functionality necessary for data acquisition.

The DECthreads facility was investigated as a means of asynchronously processing RPC requests and polling requests. [9] The simultaneous processing of multiple RPC requests would not be trivial using ONC RPC methodology. It was possible, however, to implement the processing of multiple polling requests and one RPC request simultaneously. The CAMP server thus contains a thread handling RPC requests, a thread checking polling requests and dynamically created threads to process each polling request (see Fig. gif). This improved response sufficiently for client applications. The same functionality could have been implemented using asynchronous I/O, but the DECthreads facility provides convenient means for locking access to data (using mutexes), and is portable to several operating systems of prospective interest (OpenVMS/AXP, OSF/1). The DECthreads retrofit was reasonably simple to implement. All additions were made with conditional compilation to assure the possibility of reversion to the single-threaded version.

  
Figure: CAMP Server - Multithreaded

The use of multiple threads made several changes necessary to CAMP. Firstly, C code had been compiled using VAX C, but DECthreads requires a reentrant run-time library. The DEC C compiler, with reentrant run-time library, is now used. Also, the modification of the Tcl instrument drivers was necessary with asynchronous I/O in mind. The drivers used many global Tcl variables that would be used by other instances of the same instrument type, or even other instrument types with Tcl variables of the same name. These variables had to be made unique to the instance of the instrument.

This version of CAMP (v1.3) will be used in Summer 1995.



next up previous
Next: Future Up: The CAMP Slow Control Previous: Tcl Instrument Drivers



Data Acq. Group
Sun Oct 15 01:58:10 PDT 1995
Document Actions