private void scanHot ( ) { // As mentioned above, what triggers the movement of handHot is that a cold page is found to // have been accessed in its test period and thus turns into a hot page, which maybe accordingly // turns the hot page with the largest recency into a cold page. If the reference bit of the hot // page pointed to by handHot is unset, we can simply change its status and then move the hand // forward. However, if the bit is set, which indicates the page has been re-accessed, we // spare this page, reset its reference bit and keep it as a hot page. This is because the // actual access time of the hot page could be earlier than the cold page. Then we move the hand // forward and do the same on the hot pages with their bits set until the hand encounters a hot // page with a reference bit of zero. Then the hot page turns into a cold page. Note that moving // handHot forward is equivalent to leaving the page it moves by at the list head. Whenever // the hand encounters a cold page, it will terminate the page’s test period. The hand will also // remove the cold page from the clock if it is non-resident (the most probable case). It // actually does the work on the cold page on behalf of hand handTest. Finally the hand stops at // a hot page. if ( handHot == handTest ) { scanTest ( ) ; } if ( handHot . status == Status . HOT ) { if ( handHot . marked ) { handHot . marked = false ; } else { handHot . status = Status . COLD ; sizeCold ++ ; sizeHot -- ; } } // Move the hand forward handHot = handHot . next ; }
Moves the hot hand forward .