2. 2
â« Introduction towindows os
â« Virtual memory
â« Virtual address translation
â« Page files / page faults
â« Working set
â« Physical memory
â« Conclusion
3. 3
â« Microsoft Windows is a series of graphical interface operating systems
developed, marketed, and sold by Microsoft.
â« Microsoft Windows came to dominate the world's personal computer
market.
â« Microsoft introduced an operating environment named /Windows/ on
November 20, 1985 as an add-on to MS-DOS in response to the growing
interest in graphical user interfaces.
â« The mostrecentversionof Windows is Windows 11.
4. â«Windows uses demand paging with Clustering.
â«Clustering handles page faults by bringing in not only the faulting
page but also the multiple pages surrounding the faulting page.
â«Windows uses clock algorithm.
4
Introduction to windows OS (Cont.)
5. â«CPU can address up to 3GB of memory, using its full 32 bits.
â«This is normally far more than the RAM of the machine.
â«The hardware provides for programs to operate in terms of as
much as they wish of this full 4GB space as Virtual Memory,
those parts of the program and data which are currently active
being loaded into Physical Random Access Memory (RAM).
5
6. 6
â«The first is to allow the use of programs that are too big to
physically fit in memory.
â«The other reason is to allow for multitasking â multiple programs
running at once.
7. 7
â« In Windows the processor manages the mapping in terms of pages of 4 Kilobytes
each a size that has implications for managing virtual memory by the system.
â« Only some parts of the program and data that are currently in active use need to
be held in physical RAM.
â« Otherparts are then held in a swap file(in as itâs called in Windows 95/98/ME:
Win386.swp )or page file(in Windows NT versions including Windows 2000 and
XP).
9. 9
â«Process space contains:
â« Theapplicationyou are running
(.EXE + .DLLs)
â« A user-modestack foreach thread
â« All staticstoragedefined by the
application
User
Accessible
Kernel-mode
accessible
00000000
Unique per
process
7FFFFFFF
80000000
System-
wide
FFFFFFFF
10. 10
â«System space contains:
â« Executive, Kernel
â« Statically-allocated system-
widedatacells
â« Page tables
â« Kernel-modedevicedrivers
â« Filesystem cache
â« A kernel-mode stack
forevery thread
in every
process
User
Accessible
Kernel-mode
accessible
00000000
Unique per
process
7FFFFFFF
80000000
System-
wide
FFFFFFFF
11. 11
Itemsof RAM can bedivided into two parts :
-Non paged area
âą Partsof system which arevery important . This cannot
be paged out.
-pagepool
âą Programcode, Data pages that had actual datawritten
to them.
12. 12
â« Two-level hierarchical memory map
â« Pagedirectory table
â« Pagedirectoryentries (PDEs) point to page table
â« One page directory table per process
â« Location in page directoryregister
â« Page table
â« Page table entries (PTEs) point topage frames
â« Page frame
â« Contains page of data
â« TLB (translation look aside buffer) acceleratesaddress translation
13. 13
â« Hardwareconvertseachvalid virtual address toa physical
address
Virtual page number Byte within page
Byte within page
Physical page number
Page
Tables
Translation
Lookaside
Buffer
Page
Directory
virtual address
physical address
Address translation
(hardware) If page
not valid
Page
fault
14. â«Page file
â« The page file is a hidden file called pagefile.sys.
â« It is regeneratedateach boot .
â« there is no need to include it in a backup
14
15. 15
â« TheVMM creates a file on the hard disk that holds theextra memory that
is needed by the O.S.
â« This file is called a paging file (also known as a swap file), and plays an
important role in virtual memory.
â« The paging file combined with the RAM accounts forall of the memory.
â« Whenever the O.S. needsa âblockâ of memory thatâs not in the real (RAM)
memory, the VMM takes a block from the real memory that hasnât been
used recently, writes it to the paging file.
â« Then it reads the block of memory that the O.S. needs from the paging
file.
16. 16
â« TheVMM then takes the block of memory from the paging file, and
moves it into the real memory â in place of theold block.
â« Thisprocess iscalled swapping (also known as paging),
â« The blocksof memory thatare swapped arecalled pages.
17. 17
â«When the program needs the page which is not in main
memory the page fault interruptwill be invoked.
â«If the this is availableon disk then itwill be swapped.
â«If it is not available due tosome hardware problems the
systemwill have âinvalid page faulterrorâ.
â«It may manifest itself as a âblue screenâ failurewith a STOP
code.
18. 18
â« A page faultoccurswhen there is a reference toa page that isnât
mapped toa physical page
â« Thesystem goes to theappropriate block in theassociated file to find
thecontentsof the page:
â« Physical page is allocated
â« Block is read intophysical page
â« Page tableentry is filled in
â« Exception is dismissed
â« Processorre-executes the instruction thatcaused the page fault
â« The page has now been âfaulted intoâ theprocess âworking setâ
â« Pagesareonly brought into memoryas a resultof page faults
19. 19
â« Virtual memorycan slowdown performance.
â« If the size of virtual memory is quite large in comparison to the real
memory, then moreswapping toand from the hard disk will occuras a
result.
â« Accessing the hard disk is farslowerthan using system memory.
â« Using too many programsatonce in a system with an insufficient
amountof RAM results in constantdisk swapping â also
called thrashing.
20. Working Set
â« All the physical pages âownedâ by a process
â« E.g. the pages the process can referencewithout incurring a page fault
â« A process always starts with an empty working set
â« It then incurs page faults when referencing a page that isnât in its
working set
â« Manypage faults may be resolved from memory
newerpages olderpages
21. â« Each process hasadefaultworking set minimumand maximum
â« Can changewith SetProcessWorkingSet
â« Working set minimumcontrols maximum numberof locked
pages (VirtualLock)
â« Minimum is also reserved from RAM asaguarantee to the
process
â« Working set maximum is ignored
â« If thereâsample memory, process working set representsall the
memory it has referenced (but not freed)
22. Working Set
â« When memory managerdecides the process is large enough, it
give up pages to make room for new pages
â« Local page replacement policy
â« Means thata single process cannot take overall of physical
memory unless otherprocesses arenâtusing it
â« Page replacement algorithm is least recentlyaccessed
(pages areaged when available memory is low)
Tostandby
or modified
page list
23. â« Consistsof 2 types of pages:
â« Shareable (of which some may be shared)
â« Private
â« Fourperformancecountersavailable:
â« Working Set Shareable
â« Working Set Shared (subsetof shareable thatare currentlyshared)
â« Working Set Private
â« Working Set Size (total of WS Shareable+Private)
â« Note: adding this up foreach process overcountsshared pages
24. â« System keeps unassigned physical pages on oneof several lists
â« Free page list
â« Modified page list
â« Standbypage lists (8 as of Vista & later)
â« Zeropage list
â« Bad page list - pages that failed memory testatsystem startup
â« Listsare implemented byentries in the âPFN databaseâ
â« Maintained as FIFO listsorqueues
25. â« Modified pages go to modified (dirty) list
â« Avoidswriting pages back todisk toosoon
â« Unmodified pages go tostandby (clean) lists
â« They form asystem-widecacheof âpages likely to be needed againâ
â« Pagescan be faulted back intoa process from thestandbyand
modified page list
â« Thesearecounted as page faults, but notpage reads
26. â« When modified list reachescertain size, modified pagewritersystem
thread is awoken towritepages out
â« Also triggered when memory isovercommitted (toofew free pages)
â« Does not flush entire modified page list
â« Pages move from the modified list to thestandby list
â« E.g. can still be soft faulted intoaworking set
27. â« Free Page List
â« Used forpage reads
â« Private modified pages go hereon process exit
â« Pages contain junk in them (e.g. not zeroed)
â« On most busy systems, this is empty
â« Zero Page List
â« Used tosatisfy demand zeropage faults
â« References to private pages that have not been created yet
â« When free page list has 8 or more pages, a priority zero thread is awoken
tozero them
â« On most busy systems, this is empty too
28. â« Superfetch proactivelyrepopulates RAM with the mostuseful data
â« Sets priorityof pages tooptimal value, based on the page historyand
otheranalysis that itperforms
â« Takes intoaccountfrequencyof page usage, usageof page in context
of otherpages in memory
â« Scenarios SuperFetch improves include
â« Resume from hibernateand suspend
â« Fastuserswitching
â« Performanceafter infrequentor low prioritytasks execute
â« Application launch