Hyperspace
Hyperspace is an extended storage object in z/OS that provides a large, contiguous block of virtual storage (up to 2GB) for an application's use. Unlike standard virtual storage, data within a hyperspace is not directly addressable by CPU instructions but is accessed through a "windowing" mechanism provided by Data Windowing Services. Its primary purpose is to manage and manipulate large amounts of data efficiently without consuming excessive real storage or requiring frequent I/O operations.
Key Characteristics
-
- Indirect Addressability: Data within a hyperspace cannot be directly referenced by standard CPU instructions. Instead, applications use Data Windowing Services (
HSPSERVmacro) to map a "window" (a contiguous block of up to 256KB) of the hyperspace into their standard addressable virtual storage. - Large Capacity: A single hyperspace can be up to 2 gigabytes (2GB) in size, allowing applications to manage very large datasets in virtual memory.
- Ephemeral Nature: Hyperspaces are typically owned by an address space and are released when the owning address space terminates, or explicitly freed by the application.
- Performance Optimization: By keeping large datasets in virtual storage and accessing them via windows, hyperspaces reduce the need for physical I/O to disk, improving application performance for data-intensive operations like sorting or buffering.
- Two Types:
- Standard Hyperspace: Owned by a single address space, private to that address space.
- Shared Hyperspace: Can be shared by multiple address spaces, providing a mechanism for inter-address space data sharing.
- Indirect Addressability: Data within a hyperspace cannot be directly referenced by standard CPU instructions. Instead, applications use Data Windowing Services (
Use Cases
-
- Large Data Buffering: Applications that process large sequential files or datasets can use hyperspaces as high-speed buffers to stage data, reducing physical I/O and improving throughput.
- Sorting Operations: Sorting utilities often use hyperspaces as work areas to hold intermediate sorted data, significantly speeding up the sorting process by keeping data in memory.
- Temporary Data Storage: Complex applications can use hyperspaces to store large amounts of temporary data that needs to be quickly accessible but doesn't require permanent storage.
- Inter-Address Space Communication (Shared Hyperspace): A shared hyperspace can be used to exchange large volumes of data between different address spaces, offering a high-performance alternative to traditional IPC mechanisms for specific scenarios.
Related Concepts
Hyperspaces are closely related to address spaces as they are owned by and exist within the context of an address space, or can be shared across multiple address spaces. They are a form of virtual storage, but distinct from the standard private area, existing typically above the 2GB bar. They are conceptually similar to data spaces in providing large virtual storage objects for data, but differ in their access method: data spaces are directly addressable, while hyperspaces require the Data Windowing Services (HSPSERV macro) for access, mapping "windows" into the addressable private area. This windowing mechanism is key to their design for sequential, high-volume data access.
- Efficient Window Management: Minimize the number of
HSPSERVcalls to create and delete windows. Reuse windows when possible, and efficiently move the window across the hyperspace to access different data segments. - Error Handling: Always check return codes from
HSPSERVmacro calls to properly handle conditions like insufficient storage or invalid parameters. - Resource Management: Explicitly free hyperspaces using
HSPSERV RELEASEwhen they are no longer needed to prevent virtual storage leaks