| OCR Text |
Show 5.4.1 Methods to Record the History In general, approaches to record the history use a forward method or a backward method. The history is recorded in the form of history elements. Each history element consists of an address and the associated value. When a location in the process state is modified, a forward method will record the new value of the location. A backward method will save the old value of the location. For example, if the value of a location i is changed from 3 to 5, a forward method will save the pair (i,5) to the history and a backward method will save the pair (i,3) to the history (see Table 5.2). A forward method is easier to implement, since the new values can be obtained from the process state. It is less suited for reverse execution, since it requires a search through the history. To reverse the last statement, i = 9, in the example in Table 5.2, the history must be searched to find the previous change to location i. The history is logically an array of stacks, each stack representing the history of one location. When the entire state of the process must be recreated, the search process must be repeated for each location. To improve efficiency, forward methods usually work at the granularity of one page instead of single locations. The search can be sped up by sophisticated data structures [24, 91]. 134 Table 5.2. Forward and Backward History Recording Program Text Forward Recording Backward Recording /* i has value 3 * / /* j has value 7 * / i = 5; j = 6; i = 9; add (i,5) to history add (j,6) to history add (i,9) to history add (i,3) to history add (j,7) to history add (i,5) to history |