








Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Various aspects of virtual memory, including page fault algorithms, replacement policies, and performance considerations. Topics include the working set algorithm, page fault frequency algorithm, lru algorithm, optimal algorithm, and clock algorithm. Discussions cover page access, page fault generation, and page replacement strategies to minimize page faults and optimize system performance.
Typology: Slides
1 / 14
This page cannot be seen from the preview
Don't miss anything!









COMP755 Advanced OperatingCOMP755 Advanced OperatingSystemsSystems
Size of the PageFetch Policy Size of the Page Fetch Policy Placement PolicyCleaning policy Placement Policy Cleaning policy Resident Set ManagementReplacement Policy Resident Set Management Replacement Policy Multiprogramming Level Multiprogramming Level
Should all programs have an equalShould all programs have an equalnumber of pages? If there are N programsnumber of pages? If there are N programs running, should each program have 1/N ofrunning, should each program have 1/N ofthe total RAM?the total RAM? When a program gets a page fault andWhen a program gets a page fault andneeds another page, should the new pageneeds another page, should the new page replace only a page in that userreplace only a page in that user’or can it replace any page from anyor can it replace any page from any’s programs program program?program?
Fixed or variable number of pages perprocess. Fixed or variable number of pages perprocess. Pages replaced globally or within aprocess. Pages replaced globally or within aprocess. Working Set Algorithm looks at thenumber of pages recently accessed to Working Set Algorithm looks at thenumber of pages recently accessed to determine how many pages a programshould have.determine how many pages a programshould have.
advantageous to give more pages to aadvantageous to give more pages to aprogram.program. When few or no free pages are available,When few or no free pages are available,giving pages to one program means takinggiving pages to one program means taking pages from another.pages from another. Taking pages from another program willTaking pages from another program will likely increase that programlikely increase that program’rate.rate. ’s page faults page fault The goal is to reduce the total number ofThe goal is to reduce the total number ofpage faults in the system.page faults in the system.
If a program is generating more pageIf a program is generating more pagefaults than some limit, give the programfaults than some limit, give the program more pages in RAM.more pages in RAM. If the OS needs to take pages from aIf the OS needs to take pages from a program, remove them from a programprogram, remove them from a programthat is generating less than somethat is generating less than some minimum number of page faults.minimum number of page faults.
For each program, the OS keeps residentFor each program, the OS keeps residentall pages that have been accessed in theall pages that have been accessed in the lastlast Increasing the parameterIncreasing the parameter^ ∆∆^ time units.time units. ∆∆ (^) increases theincreases the number of pages.number of pages. Usually implemented so that at a pageUsually implemented so that at a page fault the system keeps those pages thatfault the system keeps those pages thathave been accesses inhave been accesses in (^) ∆∆ time units.time units.
spending so much of its resourcesmaintaining the virtual memory that littlespending so much of its resourcesmaintaining the virtual memory that little actual work gets accomplished.As the number of running programsactual work gets accomplished. As the number of running programs increases, each program gets fewer pagesin RAM.increases, each program gets fewer pagesin RAM. With fewer pages in RAM, each programcreates more page faults. With fewer pages in RAM, each programcreates more page faults.
What page should be overwritten?What page should be overwritten? OptimalOptimal - requires looking forward in time.-requires looking forward in time. Useful for evaluating other algorithms.Useful for evaluating other algorithms. LRULRU (^) - - works well.works well. FIFOFIFO ClockClock^ - denies the concept of locality- - - used by Mac OS.denies the concept of localityused by Mac OS. Page BufferingPage Buffering available and released pages.available and released pages. - - System keeps a list ofSystem keeps a list of
How many programs can runsimultaneously? How many programs can runsimultaneously? Swap out idle programs Swap out idle programs
55
55 44
55 44 77
55 44 77
55 44 77 66
(^55887766)
55 88 AA 66
55 88 AA 66
55 88 AA^77
(^5566) AA (^77)
55 66 FF^77
AA 66 FF (^77)
AA FF 55 44
AA FF 55 44 13 total page faults
The optimal algorithm looks forward inThe optimal algorithm looks forward intime and replaces the page that will not betime and replaces the page that will not be referenced again or will be referenced thereferenced again or will be referenced thefarthest in the future.farthest in the future. Cannot be implemented.Cannot be implemented. Provides a theoretical minimum number ofProvides a theoretical minimum number of page faultspage faults
(^55)
55 44
55 44 77
55 44 77
55 44 77 66
55 88 77 66
55 AA 77 66
55 AA^7766
55 AA 77 66
FF AA 55 66
FF AA 55 44
FF AA (^5544)
FF AA 55 44
FF AA (^5544) 9 Total Page Faults
Considers if a page has been referencedand if it has been modified. Considers if a page has been referencedand if it has been modified. Unmodified pages are replaced beforemodified pages to avoid having to write the Unmodified pages are replaced beforemodified pages to avoid having to write the old page back to disk.Pages are kept in a circular queue with aold page back to disk. Pages are kept in a circular queue with a pointer to the page after last replacedpage.pointer to the page after last replacedpage.
Scan 1Scan 1 –pages are scanned for one that has notpages are scanned for one that has not– Beginning with the pointer, theBeginning with the pointer, the been referenced or modified. The first pagebeen referenced or modified. The first pagefound is replaced.found is replaced. Scan 2Scan 2 –a page that has not been referenced buta page that has not been referenced but– Starting from the pointer, look forStarting from the pointer, look for has been modified. As the pages arehas been modified. As the pages arechecked, clear the referenced bit.checked, clear the referenced bit.
Scan 3 -pages are scanned for one that has not Scan 3pages are scanned for one that has not- Starting from the pointer, theStarting from the pointer, the been referenced or modified.Scan 4 -been referenced or modified. Scan 4- Starting from the pointer, look forStarting from the pointer, look for a page that has not been referenced buthas been modified.a page that has not been referenced buthas been modified.
The OS maintains a list of free pages.The OS maintains a list of free pages. Pages are taken from the free list wheneverPages are taken from the free list whenever a new page is needed.a new page is needed. When a page is replaced, it is put on the endWhen a page is replaced, it is put on the end of the free list if it has not been modified.of the free list if it has not been modified. If the page was modified, it is put on aIf the page was modified, it is put on a modified list.modified list.
Pages on the modified list are written todisk when the system is idle. Cleaned Pages on the modified list are written todisk when the system is idle. Cleaned pages are put on the free list.When a page fault occurs, the systempages are put on the free list. When a page fault occurs, the system checks these lists to see if the page is stillin RAM.checks these lists to see if the page is stillin RAM.