Demand Paging
Demand paging is a memory management technique used in z/OS where pages of a program or data are loaded into real storage only when they are actually referenced (demanded) by the CPU. This approach optimizes real storage utilization and enables the execution of applications that are larger than the available physical memory. Demand paging is a memory management technique in z/OS where pages of a program or data are loaded into real storage only when they are actually referenced or "demanded" by the CPU. This approach allows programs to execute even if their total size exceeds the available real memory, optimizing the use of real storage and improving system throughput.
Key Characteristics
-
- Virtual Storage Integration: It is a core component of the z/OS
virtual storagearchitecture, working in conjunction with address translation hardware. - Page Fault Mechanism: When a program attempts to access a virtual address whose corresponding page is not currently in real storage, a
page faultoccurs, triggering the operating system to load the required page. - Page-in/Page-out Operations: Involves
page-in(loading a page from auxiliary storage into real storage) andpage-out(writing a modified page from real storage back to auxiliary storage). - Auxiliary Storage Reliance: Utilizes
auxiliary storage(typically paging datasets on DASD) as a backing store for pages that are not currently resident in real memory. - Working Set Management: Aims to keep the
working set(the set of pages actively being used by a program) in real storage to minimize page faults and optimize performance. - Dynamic Allocation: Pages are allocated to real storage dynamically as needed, rather than pre-loading entire programs.
- Virtual Storage Integration: It is a core component of the z/OS
Use Cases
-
- Large Application Execution: Enables the execution of large COBOL batch jobs, CICS regions, or DB2 subsystems whose total virtual storage requirements exceed the available real storage.
- Multiprogramming and Multitasking: Facilitates efficient
multiprogrammingby allowing numerous address spaces to share limited real storage, with only their currently active pages present. - System Resource Optimization: Reduces the real storage footprint of inactive or less frequently accessed parts of programs and data, making more real storage available for active workloads.
- Virtual Storage Constraint Relief: A fundamental mechanism that provides
virtual storage constraint reliefby decoupling the size of an application from the physical memory limits.
Related Concepts
Demand paging is intrinsically linked to the z/OS virtual storage management system, which maps virtual addresses to real storage addresses. It heavily relies on paging datasets on DASD as the external repository for pages not currently in real storage. The Workload Manager (WLM) indirectly influences demand paging by managing system resources and dispatching priorities, which can affect an address space's access to real storage and its likelihood of experiencing page faults.
- Monitor Paging Rates: Regularly monitor system-wide and address space-specific
paging ratesusing tools like RMF or SMF data to identify excessive paging (thrashing). - Optimize Program Locality: Design and structure applications (e.g., COBOL programs) to exhibit good
locality of referenceto minimize the number of distinct pages accessed over short periods, thereby reducing page faults. - Configure Paging Datasets: Ensure sufficient, properly sized, and strategically placed
paging datasetson fast DASD to handle paging I/O efficiently and avoid I/O bottlenecks. - Allocate Sufficient Real Storage: Provide adequate
real storageto z/OS LPARs to reduce the overall system's reliance on paging, especially for critical workloads. - Tune WLM Policies: Adjust
WLM policiesto assign appropriate importance and resource goals to critical workloads, allowing WLM to prioritize their access to real storage and minimize their paging activity.