1 = Paging = 2 3 Within filesystem servers, a number of abstractions are combined to support 4 [[FilesystemAccess|access to filesystem content]] through paging: the delivery 5 of content to clients in mapped memory. 6 7 The general paging mechanism used to support paging is depicted below. 8 9 ######## A graph showing the general paging mechanism 10 11 {{{#!graphviz 12 #format svg 13 #transform notugly 14 digraph paging { 15 node [fontsize="12.0",fontname="sans-serif",shape=box]; 16 edge [fontsize="12.0",fontname="sans-serif"]; 17 rankdir=LR; 18 19 subgraph { 20 rank=same; 21 22 Pager_note [shape=note,style=filled,fillcolor=gold,label="Provides\nfilesystem\ncontent"]; 23 Pager; 24 25 Pager_note -> Pager [dir=none,style=dotted]; 26 } 27 28 subgraph { 29 rank=same; 30 31 PageMapper_note [shape=note,style=filled,fillcolor=gold,label="Provides\npopulated\nfile pages"]; 32 PageMapper; 33 34 PageMapper_note -> PageMapper [dir=none,style=dotted]; 35 } 36 37 subgraph { 38 rank=same; 39 40 Accessor_note [shape=note,style=filled,fillcolor=gold,label="Populates\nfile pages"]; 41 Accessor; 42 43 Accessor_note -> Accessor [dir=none,style=dotted]; 44 } 45 46 AccessMap [shape=record,label="<head> AccessMap | 47 { offset-0 |<fp0> flexpage-0 } | ... | 48 { offset-n |<fpn> flexpage-n } | ..."]; 49 50 subgraph { 51 rank=same; 52 53 Pages_note [shape=note,style=filled,fillcolor=gold,label="Provides\nmemory\npages"]; 54 Pages; 55 56 Pages_note -> Pages [dir=none,style=dotted]; 57 } 58 59 PageQueue [shape=record,label="<head> PageQueue | 60 { owner-0 |<fp0> flexpage-0 } | ... | 61 { owner-N |<fpN> flexpage-N } | <end> ..."]; 62 63 Flexpage_offset_n [shape=record,label="<head> Flexpage | 64 offset | size |<r> region"]; 65 66 subgraph { 67 rank=same; 68 69 Memory_note [shape=note,style=filled,fillcolor=gold,label="Allocates\nmemory\nregions"]; 70 Memory; 71 72 Memory_note -> Memory [dir=none,style=dotted]; 73 } 74 75 Region; 76 77 /* Relationships. */ 78 79 PageMapper -> Accessor; 80 PageMapper -> AccessMap:head; 81 Pager -> PageMapper -> Pages; 82 Pages -> Memory; 83 Pages -> PageQueue:head; 84 AccessMap:fpn -> Flexpage_offset_n:head; 85 PageQueue:fpN -> Flexpage_offset_n:head; 86 Flexpage_offset_n:r -> Region; 87 } 88 }}} 89 90 ######## 91 92 A [[FilesystemAccess#Pager|Pager]], being a resource that provides filesystem 93 content to clients for a particular file, requests pages from the PageMapper, 94 itself having the role of supplying populated pages of content from the given 95 file. The PageMapper relies on the AccessMap to discover existing pages for 96 any accessed region of a file, involving the Pages object (or page collection) 97 to obtain new memory pages where existing pages are not available or are no 98 longer valid, and requesting the population of such pages through use of the 99 associated Accessor for the file concerned. 100 101 The Pages object may either obtain new memory pages from a Memory object or 102 reclaim (or recycle) existing pages from a PageQueue, this recording all pages 103 that have been populated and supplied to clients. Since it may be desirable to 104 limit the number of pages employed to satisfy file access operations, the 105 PageQueue provides a kind of lending mechanism: pages are issued to clients 106 and then added to the end of the queue; where no new page can be supplied by a 107 Memory object, the issued page at the head of the queue is obtained for 108 recycling; ultimately, an issued page will remain valid for its user (the 109 client accessing its contents) until all pages in front of it in the queue are 110 themselves recycled and it is then removed from the queue for recycling.