The start-up processing is concerned firstly with setting up the Fixed Plant objects that the programme uses (q.v. the Fixed Plant pattern) and with restarting and programming the detector controllers. This processing is purely sequential.
The vast majority of stimuli are obey commands for DRAMA actions (see the notes on the DRAMA Facade for a discussion of the actions). Once started, each action runs to completion unless it fails or is cancelled by a DRAMA kick command. However, the actions are chosen to make a neat interface for the client software, not for ease of implementation in the server. This means that long-running actions (e.g. an action running a 30-second readout and and action saving the previous readout laboriously to disc) must overlap in time and must run in quasi-parallel on the uni-processor computer. This introduces multi-threading to the design, as discussed below.
Often, the timers in the telemetry-polling loops expire while an action
is active. Telemetry must be (moderately) timely, so the telemetry processing
also has to run in parallel with the actions.
Udas_camera uses Pthreads to separate the contexts. Each action causes one worker thread to be started, following the Casual Worker pattern (q.v.). The telemetry-polling loops run in other worker threads that belong to the Fixed Plant objects and follow the Tenured Worker pattern (q.v.). This allows each stimulus-action pair to run to completion, while sharing the single processor in the DAS computer.
Some action threads start a further layer of Casual Worker threads; the RUN, PROCESS and ARCHIVE actions do this. This allows these actions to firstly process in parallel with blocking I/O and secondly to make periodic telemetry reports to the facade on what they have acheived. In these cases, the second-generation Casual Workers must all finish and be "payed off" before the first-generation worker can finish.
The worker threads are scheduled by the Solaris kernel (they are system-scope
threads) using a timeslicing algorithm, and this gives an adequate response
to all soft-real-time operations. Where a hard-real-time response is needed,
the worker thread is scheduled, again by the Solaris kernel, in the RT
class, and this gives it priority over all the timesliced threads. The
dispatch latency in Solaris for this scheduling class is stated by SUN
to be bounded, but no bounding value has been quoted for modern SUN computers.
The worst-possible latency is believed to be around 0.2ms (the published
figures for an old SPARCstation 5 are better than this), and this has proven
fast enough for all udas_camera's needs. Udas_camera has
never been shown to fail in service due to over-running a time-window
for hard-real-time I/O.
Because of the threading, most of the