| OCR Text |
Show A Read operation reads a value from the external environment. It is the only operation whose results cannot be predicted from the executor's state alone. If a process is in an infinite loop, then the sequence of states between Ai and Aj will be repeated indefinitely or until the process is halted under external influence. The period is j - i. For each state Ak, k > z, it holds that A& = Ak+(j~i). The process itself cannot detect if it is in an infinite loop. We can construct a director that detects if the executor A enters an infinite loop. The director must detect two equal states Ai and Aj. Assuming that i < j , the following equation is valid: Ai = Aj = Ai A i A i+i • • • A j_ i. (2.24) The algorithm for an infinite loop detection is equivalent to the detection of a sequence of deltas that has no effect on the executor's state. The director chooses a target state of the executor in which the algorithm starts. By using A and A -1 from the execution stream, the director incrementally calculates the difference between the executor's target state and the executor's current state. If this difference becomes an empty set, an infinite loop is detected. If a Read operation is detected, the target state is reset to the current state. A small detail remains how to chose the target state. The director does not know when to start detecting an infinite loop and how long the loop is. The detection algorithm can be started too early with a target state that is not in an infinite loop. In that case, the loop will never be detected. If the target state is changed after a period of monitoring that is shorter than the length of a loop, the infinite loop will be missed. One solution is to change the target state to the current state after an exponentially increasing number of steps. Using this method, the algorithm is guaranteed to detect an arbitrarily long infinite loop. A director for infinite loop detection is presented in Figure 2.1. Variable delta denotes A, variable delta_l denotes A -1 , and variable delta_total denotes the 28 |