## 3 Proposed Algorithm for the Generalized Local \(I_{i}\)-Mutual Inclusion
Then, the leader designates a process within one hop (including the leader itself) to use the \"sidetrack\" to break the chain of cyclic blocking. Because the designated process \(P_{q}\) uses one extra CS exit/entry, the number of processes in the CSs is at least \((l_{q}+1)-1=l_{q}\) and at most \((k_{q}-1)+1=k_{q}\), and hence, LKCS does not deviate from the restriction of the \((l_{i},k_{i})\)-CS problem. The suspicion by the leader process \(P_{LDR}\) is not always correct, i.e., \(P_{LDR}\) may suspect that the system is in a deadlock when this is not true. However, incorrect suspicion does not violate the safety of the problem specification. ### Details of LKCS

We explain the technical details of LKCS below. Formal description of LKCS for each process \(P_{i}\) is presented in Algorithms 3-7. The execution model of this algorithm is the same as the previous section, except that the while statement is used in LKCS. By while (conditional expression) \(\{statement\}\), a process is blocked until the conditional expression is true. While a process is blocked by this statement, it executes only the statement between braces and message handlers. While a process is blocked by this statement and it receives a message, it invokes a corresponding message handler. That is, if the statement between braces is empty, this while statement is same as wait until statement. ```
\(\mathsf{enum}\) at \(\{\mathsf{MUTEX},\mathsf{MUTIN}\}\); \(state_{i}\in\{\mathsf{InCS},\mathsf{OutCS}\}\), initially\(state_{i}=\left\{ \begin{array}{ll}\mathsf{InCS}&(P_{i}\in\mathcal{CS}(C_{0}))\\ \mathsf{OutCS}&(P_{i}\
ot\in\mathcal{CS}(C_{0}))\end{array} \right.\) \(ts_{i}:\mathsf{integer}\), initially\(1\); \(nGrants_{i}[at]\): set of processID, initially\(\emptyset\); \(\mathsf{grantedTo}_{i}[at]\): set of (integer, processID), initially\(\{(1,P_{i}\in\mathcal{CS}_{i}(C_{0}))\}\); \(\mathsf{pendingReq}_{i}[at]\): set of (integer, processID), initially\(\emptyset\); \(\mathsf{preemptingNow}_{i}[at]\): (integer, processID), initially nil; Local Variable only for a leader\(P_{LDR}\): \(\mathsf{candidate}_{LDR}\): set of (integer, processID), initially\(\emptyset\); Macros: \(L_{i}\equiv\left\{ \begin{array}{ll}l_{i}&dist(P_{LDR},P_{i})>2\\ l_{i}+1&dist(P_{LDR},P_{i})\leq 2\\ k_{i}&dist(P_{LDR},P_{i})>2\\ k_{i}-1&dist(P_{LDR},P_{i})\leq 2\end{array} \right.\) \(\mathsf{Grant}_{LDR}\equiv\left\{P_{i}\mid(*,P_{i})\in\mathsf{grantedTo}_{ LDR}[\mathsf{MUTIN}]\wedge(*,P_{i})\in\mathsf{grantedTo}_{LDR}[\mathsf{MUTEX}]\right\}\) \(\mathsf{Waiting}_{LDR}\equiv\left|\mathsf{pendingReq}_{LDR}[\mathsf{MUTIN}] +\left|\mathsf{pendingReq}_{LDR}[\mathsf{MUTEX}]\right|+\left|\mathsf{Grant}_{ LDR}\right|\) \(\mathsf{Cond}_{i}\equiv(at=\mathsf{MUTEX}\wedge\left|\mathsf{grantedTo}_{i}[ \mathsf{MUTEX}]\right|<K_{i})\vee(at=\mathsf{MUTIN}\wedge\left|\mathsf{grantedTo}_{ i}[\mathsf{MUTIN}]\right|<|N_{i}|-L_{i}+1)\)
```

**Algorithm 3** Local variables and macros for process \(P_{i}\) in algorithm LKCSWhen the leader \(P_{LDR}\) suspects that the system is in a deadlock, it invokes the \(\mathit{TriggerNonmitation}()\) function and selects a process \(P_{q}\) within one hop (\(P_{LDR}\) itself or a neighbor of \(P_{LDR}\)) as a \"trigger\", and \(P_{LDR}\) sends a message (Trigger message type) to \(P_{q}\) so that \(P_{q}\) issues a special request. Then, \(P_{q}\) sends a special request message (RequestByTrigger message type) to each neighbor \(P_{r}\in N_{q}\). This message also cancels the current request of \(P_{q}\). After each \(P_{r}\) receives such special request from \(P_{q}\), then \(P_{r}\) cancels the request of \(P_{q}\) by deleting \((*,P_{q})\) from its pending list (_pendingReq_r) and its granted list (_grantedTo_r), inserts the special request \((0,P_{q})\) to its granted list and immediately grants by using the \"sidetrack\".