# Design and Analysis of an Efficient Energy Algorithm in Wireless Social Sensor Networks
## 4 Checkpoint Triggering Occasions  
In the distributed system, the checkpoint always adopts the way to be triggered at a fixed time or by a fixed number of messages. For the ad hoc network, the time interval for triggering checkpoints periodically is hard to decide because of the dynamism and uncertainty of this network on the one hand, and on the other hand, a timing trigger may usually wake up some MHs staying dormant state and then cause unnecessary battery consumption. Therefore, the \(\mathrm{SC_{s}}\) and \(\mathrm{DC_{s}}\) in the hybrid checkpointing model all adopt the active trigger mechanism based on messages. Besides, the \(\mathrm{SC_{s}}\) use the reactive trigger mechanism to reduce the number of \(\mathrm{SC_{s}}\), which cannot be eliminated. There are two different SC triggers: Active Trigger based on Message and Reactive Trigger:  
1. Active Trigger based on Message: The active trigger means that a process initializes a checkpointing procedure actively when it receives \(K\) (\(K\) is the threshold, \(K\geq 1\)) messages from \(\mathrm{MH_{s}}\) in same cluster. The value of \(K\) is directly proportional to the continued communication time without failure and storage space of the MH, but inversely proportion to the disconnection and failure probability of the MH. What is more, the choice of \(K\) should consider the kinds of overhead of the ad hoc network. This part will be further discussed and verified in the experiments. 2. Reactive Trigger: It can be seen from Criterion 5, that if one SC depends on any DC directly or indirectly then it cannot be cleared away, so there will be a lot of \(\mathrm{SC_{s}}\) which could not be eliminated. As Figure 5 shows, all \(\mathrm{SC_{s}}\) of \(P_{i,k,l}\) and \(P_{i,j,e}\) depends on \(\mathit{DC_{i,j,e}^{m}}\) directly or indirectly, so they could not be cleared away before \(\mathit{DC_{i,j,e}^{m}}\) is eliminated. If the checkpoint frequency of cluster \(C_{i}\) is higher than the one of \(C_{m}\), then there may be a lot of \(\mathrm{SC_{s}}\) of \(C_{i}\) which cannot be cleaned up. Figure 5: An example of the coexistence of multiple same cluster checkpoints. The key to solve this problem is to clean up the DC\({}_{\rm s}\) on which the SC\({}_{\rm s}\) depend. According to the Criteria 6 and 7, the premises to eliminate DC include two conditions. One is that the process has finished new checkpoint (namely this DC is not the new checkpoint of the process). The other is that the checkpoints of processes in other clusters on which the process depends have been eliminated. Let \(C_{i}\) and \(C_{j}\) to be two different clusters. If the processes in \(C_{i}\) which contains all DC\({}_{\rm s}\) (created by the receiving of messages from MH\({}_{\rm s}\) in \(C_{j}\)) related to \(C_{j}\) have finished the certain checkpoints (namely meet the first premise), then \(C_{i}\) notices \(C_{j}\) to initialize a new checkpoint (only the new checkpoint is done, the former SC\({}_{\rm s}\) can be cleaned up and this meets the last premise). If some checkpoint dependent on the DC\({}_{\rm s}\) in \(C_{i}\) can be cleared away after the related processes in \(C_{j}\) has finished new \(SC\), then the elimination probability of the DC\({}_{\rm s}\) increases heavily. Then the SC\({}_{\rm s}\) in \(C_{i}\) which depend on the DC\({}_{\rm s}\) could be cleaned up further. The detailed elimination rules of checkpoints will be discussed in Section 5. Different from the active trigger, this checkpointing procedure is initialized by the CH and the related processes in cluster just act as the participants, so it is called a reactive trigger. The DC uses the message trigger mechanism also, namely the DC is triggered when it receives messages from MH\({}_{\rm s}\) in different clusters. However, if a process takes a DC when it receives a message from the same different cluster each time, it will increase the checkpoints and so augment the storage overhead heavily.