Midas DAQ System
Not logged in
01 Jan 2009, Konstantin Olchanski, Info, odb "hot link" magic explored
14 Jan 2009, Stefan Ritt, Info, odb "hot link" magic explored
14 Jan 2009
In reply to:
odb "hot link" magic explored
note 1: I do not completely understand the ss_suspend_xxx() stuff. The best I can tell is it creates a number of udp sockets bound to the local host and at least one udp rpc receive socket ultimately connected to the cm_dispatch_rpc() function.
The ss_suspend_xxx() stuff is indeed the most complicated thing in midas an I have to remind myself always
on how this works. So let me try again:
The basic idea is that for a high performance system, you cannot do the inter-process communication via
polling. That would waste CPU time. Inter-process communication is necessary for for buffer manager
(producer notifies consumer when new events are there), for the RPC mechanism (odbedit tells mlogger to
start a run) or for ODB hot-links. To avoid polling, the inter-process communication works with sockets (UDP
and TCP). This allows to use the select() call, which suspends the calling process until some socket
receives data or a pre-defined time-out expires. This is the only portable method I found which works under
windows (signals are only poorly supported under windows).
So after creating all sockets, ss_suspend() does a select() on these sockets:
Server side for any new RPC connection (each client is also a RPC server which gets contacted directly during run transitions for example
Receive socket (TCP) for any active RPC connection
Receive socket (TCP) for bare events (bypassing RPC layer for performance reasons)
TCP connection to mserver. Used for example for hot-link notifications from mserver
UDP socket for inter-process notification
For each socket there is a dispatch function, which gets called if that socket receives some data. Hope this sheds some light on the guts of that.