Class DD_garbage_d: class that encapsulates the DD garbage demon process.
Class DD_garbage_d: class that encapsulates the DD garbage demon process.The DD_garbage_d process fulfills the following functions:
- Collects all the volatile buffers and removes them. Note that in order to do that, the volatile buffers have to be created with the proper uid.
- Checks whether there are still DD masters attached to the system. If there are no masters left, he removes the DD system and exits.
- Looks for processes that seem to be dead. If they are found and their fifo is unprotected, then he removes the fifo and the process from the DD system.
- Keeps track of the process semaphores: every process that attaches to the DD system has a semaphore (one for master, one for slave). When the process exists the system removes the semaphore. This allows the garbage demon to check whether the process has properly detached from the DD system. If not, the garbage demon cleans it up.
- Keeping track of the event flow within the DD system: The garbage demon constantly calculates the rates in the various fifos for the various processes and writes this information into the DD dcom area, where other processes can read it.
The garbage demon is a process with his own fifo. It is started by the process which creates the DD system by calling the static member function DD_garbage_d::start_garbage_d. In the main part of the garbage_d program (in file dd_garbage_main.cc) we construct one instance of the DD_garbage_d class, which then does all the work.
For the most part of his life the garbage demon sleeps on the semaphore for the GARBAGE fifo where he receives a volatile buffer. As soon as one or many arrive he deletes them.
Internally the garbage demon has also a timer (class Timer - see package otools for details) which calls periodically the static function check_eodd from where the periodic functions are done as outlined above.The garbage demon has also responses to the signal DD_SHUTDOWN_SIGNAL (currently SIGHUP, see header file dd_signal_def.h). Upon arrival of this signal, the garbage demon informes all the processes about an imminent shutdown (by calling lDD::prepare_shutdown), waits a moment and then removes the DD system.
The garbage demon writes all the log information into a logfile. By default this logfile is put into the directory
HOST.PID. If the directory is not found, the logfile is put into /tmp. If the garbage demon fails before opening the logfile, he will put an error message into the UNIX utility SYSLOG.
Modifications:
Alphabetic index HTML hierarchy of classes or Java