Docsity

Clock Page Replacement Algorithm (OS), Study notes of Operating Systems

Partial preview of the text

Download Clock Page Replacement Algorithm (OS) and more Study notes Operating Systems in PDF only on Docsity!

Clock (2 Chance } Page Replacement Algovithm Explaination: Second Chance Page. Replacement WOKS dike FIFO but tvies vot to vemnove pages that ave Still befiney usecl. FIFO just yemoves the oldest Page. 7 ENEN if it (s SLU meeded , which can cause problems. Cecond Chance Algo vith fixes this by using a gmail vefevence bit (Co ov 1). > when a page is used ,its vefevence bit ts set to L > When a page must be replaced ,the system checks page in order, ud) If a page hag bit O,ik fs yemoved . _ diy re a page hag bit bythe bit ts changed to O emd the page is moved to the end of the queve giving it another chance- (Theoretical Concept ). aad Because of thie ) Pages that ove used aq ain and again ove fess Likely te be yemroved by migtake. Example : Refevence String = 2,35)2,4)852,4 , 7 3,2, Number of Frames = 3 5 p>, > z \ S » 1} 2 4) 2 yo2 foal 2d 4, S 4s * 13] as] sa] zo 3 a 2 —? > 4 i ol 4 >0 4 F F A F F F 4 5 2 m ¢ 2 vil S |aL$ 3 {| 3 | 4) > | 4} 3 4} 2 1) 2 }soj a] >t) 2 o| 2 q) 2 4} a4] of TP of 4 iS) aps rr rn re Fage Faults: Number ef page faults = 8 Page fault ratio= 8 xKloo Tr = 66.47. Page. Hits: Numbey of page hits = 4 Page hit vatio= 4, X loo 2 = 33.3 “fe return mwaleed@mwaleed: ~/Desktop/Lab :-$ cd Desktop/ $ cd Lab/ mwa Leed@mwaleed: § gcc Assig3.c mwa Lee waLleed: § ./Assig3 memory frames: 3 Enter number of pages in reference string: 12 Enter reference string 232152453252 CK (Second Chance) [214] [ ] [ ] <- Page Fault [211] [311] [ ] <- Page Fault [211] [311] <- Hit [211] [314] <- Page [5|1] [316] Page [511] [2141 Page (5]1] [21] <- Page > [5] 1] [ <- Hit Page > [3]1] T <- Page Fault Page > [3]1] [ <- Hit Page > [3]1] [ <- Page Fault Page 2 -> [3]1] [ <- Hit Total Page Fault Total Page Hits mwaleed@mwaleed :