next up previous contents
Next: Swapping Pages In (Demand Up: Swapping and Discarding Pages Previous: Reducing the Size of

Swapping Out Shared Pages

Physical pages that have been shared between processes are swapped out separately from ordinary pages. When the swap daemon attempts to swap out shared pages, it uses shm_segs, a vector of pointers to shmid_ds  data structures to look through the shared pages for good candidates for swapping. For each shmid_ds  there is a list of vm_area_struct  structures which each describe how the virtual memory of a particular process is related to this shared memory area. Just like non-shared memory, the page table entries must be modified to show that the page is in the swap file. However, the page tables of all of the sharing processes must be modified before the page is written to the swap file and freed. The page table entries for each process are found by following the vm_mm  pointer in each vm_area_struct  structure. tex2html_wrap11639 points at the level 1 page table for the process.

David A. Rusling