# Design and Analysis of an Efficient Energy Algorithm in Wireless Social Sensor Networks
## 2 Ad Hoc Network Structure and Hybrid Checkpointing Model
### Hybrid Checkpointing Model
\(P_{i,k,s}\), \(P_{i,a,v}\) and \(P_{i,j,t}\) are the processes executing in different terminals of cluster \(C_{i}\) respectively. While \(P_{m,s,c}\) is the process executing in terminal s of cluster \(C_{m}\). \(SC_{i,a,v}^{b}\) expresses the \(SC\) of \(P_{i,a,v}\) and \(b\) is the sequence number of checkpoint. \(DC_{i,k,s}^{m}\) is the \(DC\) of \(P_{i,k,s}\) and \(m\) is the id of cluster which the sender of message from different cluster stays. Combined with the Figure 2, the explanation for principles of hybrid checkpointing model can be expressed as follows:  
1. The initialized checkpoint. When each process initializes, it takes an initialization checkpoint (certain checkpoint). For example, \(SC_{i,a,v^{\prime}}^{b}\)\(SC_{i,j,t^{\prime}}^{y}\)\(SC_{i,k,s}^{d}\) and \(SC_{m,s,c}^{d}\) in Figure 2 are initialized checkpoints. 2. The taking of SC\({}_{\text{s}}\). When a process \(P\) receives a fixed number of messages from MH\({}_{\text{s}}\) in same cluster, it initializes a coordination procedure of checkpoints. \(P\) firstly takes an uncertain checkpoint, and then it sends checkpoint requests to the processes which have dependence relation with \(P\). When these processes receive the requests, they firstly take uncertain checkpoints and then reply to \(P\). By the time \(P\) receives all replies from processes which take part in the coordination procedure, it turns the uncertain checkpoint into a certain checkpoint. Otherwise, \(P\) eliminates its own uncertain checkpoint. Finally, \(P\) notices related processes to finish the turning or elimination operations of checkpoints together. Figure 2: The model of hybrid checkpointing. The taking of DC\({}_{\rm s}\). When a process receives a message from a MH in a different cluster, the DC is triggered. In order to assure that the receiving event of this message can be cancelled when the sending event of this message is cancelled, the process has to take the DC firstly and then receives the message. In Figure 2, \(P_{i,j,t}\) is the process which initializes the checkpointing. \(P_{i,a,v}\) and \(P_{i,k,s}\) are the participant processes of checkpointing because of messages \(M_{2}\) and \(M_{3}\). When the checkpointing starts, \(P_{i,j,t}\) firstly takes a uncertain checkpoint \(SC^{y+1}_{i,j,t}\) and then notices \(P_{i,a,v}\) and \(P_{i,k,s}\) to take uncertain checkpoints \(SC^{b+1}_{i,a,v}\) and \(SC^{d+1}_{i,k,s}\) respectively. By the time \(P_{i,a,v}\) and \(P_{i,k,s}\) finish each uncertain checkpoint \(SC^{b+1}_{i,a,v}\) and \(SC^{d+1}_{i,k,s}\), they send replies to \(P_{i,j,t}\). After \(P_{i,j,t}\) has received the replies from \(P_{i,a,v}\) and \(P_{i,k,s}\) (not marked in Figure 2), \(P_{i,j,t}\) turns \(SC^{y+1}_{i,j,t}\) to certain checkpoint. In addition, \(P_{i,j,t}\) notices \(P_{i,a,v}\) and \(P_{i,k,s}\) to turn \(SC^{b+1}_{i,a,v}\) and \(SC^{d+1}_{i,k,s}\) into certain checkpoints, but their Checkpoint Sequence Number (CSN) does not change. Otherwise, \(P_{i,j,t}\) eliminates its own uncertain checkpoint and notices \(P_{i,a,v}\) and \(P_{i,k,s}\). For example, when process \(P_{i,k,s}\) in cluster \(C_{i}\) receives a message \(M_{2}\) from process \(P_{m,s,c}\) in cluster \(C_{m}\) as Figure 2 shows, \(P_{i,k,s}\) firstly takes \(DC^{m}_{i,k,s}\) and then receives \(M_{2}\).