SMPProgAdd - High Memory Support: Difference between revisions
Created page with "{{IBM-Reprint}} {{SMPProgAdd}} Category:WorkToDo The High Memory Support in OS/2 Warp Server for SMP removes the 512 MB virtual memory limit present in previous versions of OS/2, thus allowing 32-bit applications to allocate shared or private memory objects above the 512 MB boundary. == VIRTUALADDRESSLIMIT Parameter in CONFIG.SYS == A new **CONFIG.SYS** parameter, **VIRTUALADDRESSLIMIT**, has been added to specify the highest virtual memory address that may be acc..." |
No edit summary |
||
Line 28: | Line 28: | ||
Objects allocated above the 512 MB line will start on a 4 KB boundary, the size will be rounded up to a multiple of 4 KB, and the memory will ''not'' be tileable. 16-bit programs will not be able to address or access the object. | Objects allocated above the 512 MB line will start on a 4 KB boundary, the size will be rounded up to a multiple of 4 KB, and the memory will ''not'' be tileable. 16-bit programs will not be able to address or access the object. | ||
Memory should be allocated with the **OBJ_ANY** attribute wherever possible, since it provides the most efficient use of both the per-process address space as well as the system-wide virtual memory resources. It is intended that an application would make infrequent requests for large blocks of memory using [[DosAllocMem]] and then use [[DosSubSetMem]] along with DosSubAllocMem and DosSubFreeMem to manage the memory. If **OBJ_ANY** is not specified, the behavior of DosAllocMem and DosAllocSharedMem is the same as in OS/2 Warp. | Memory should be allocated with the **OBJ_ANY** attribute wherever possible, since it provides the most efficient use of both the per-process address space as well as the system-wide virtual memory resources. It is intended that an application would make infrequent requests for large blocks of memory using [[DosAllocMem]] and then use [[DosSubSetMem]] along with [[DosSubAllocMem]] and [[DosSubFreeMem]] to manage the memory. If **OBJ_ANY** is not specified, the behavior of [[DosAllocMem]] and [[DosAllocSharedMem]] is the same as in OS/2 Warp. | ||
== Implementation Details == | == Implementation Details == |
Revision as of 18:33, 18 May 2025
Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation
The High Memory Support in OS/2 Warp Server for SMP removes the 512 MB virtual memory limit present in previous versions of OS/2, thus allowing 32-bit applications to allocate shared or private memory objects above the 512 MB boundary.
VIRTUALADDRESSLIMIT Parameter in CONFIG.SYS
A new **CONFIG.SYS** parameter, **VIRTUALADDRESSLIMIT**, has been added to specify the highest virtual memory address that may be accessed. The default value for OS/2 Warp Server for SMP is 2 GB, which is specified in MB in the command:
VIRTUALADDRESSLIMIT=2048
The smallest value allowed is 512, which provides compatibility with previous versions of OS/2 which only allowed access to 512 MB. The largest value supported is 3072 (3 GB). The **VIRTUALADDRESSLIMIT** parameter may be specified as part of selective install.
Values in excess of 512 will reduce the number of processes that can concurrently run on the system. When memory has been exhausted, OS/2 control program functions will fail with **ERROR_NOT_ENOUGH_MEMORY** and PM functions will fail with **PMERR_INSUFFICIENT_MEMORY**. Future versions of OS/2 may allow larger values and, for any given value, support more concurrent processes.
Values outside the valid range (below 512 or over 3072) will result in an error message during **CONFIG.SYS** processing and the system will use the default value of 2048.
The highest virtual memory address and the maximum number of concurrent processes allowed can be determined from a program by using the DosQuerySysInfo function.
New OBJ_ANY Memory Attribute
A new allocation attribute of **OBJ_ANY** is available to 32-bit programs when allocating memory using DosAllocMem and DosAllocSharedMem. **OBJ_ANY** indicates that the memory may be allocated anywhere in the available virtual address space. An application must be able to handle pointer values above the 512 MB tiled memory compatibility region when using **OBJ_ANY**.
In OS/2 Warp Server for SMP, **OBJ_ANY** memory allocations will first be attempted in the high memory area, which is the area of the virtual address space above 512 MB. If there is insufficient memory to satisfy the request from the high memory area, the memory will be allocated in the first 512 MB of the address space. IBM reserves the right to change this allocation strategy in future releases of OS/2.
Memory objects allocated below the 512 MB line will start on a 64 KB boundary, the size will be rounded up to a multiple of 64 KB, and the memory will be tileable.
Objects allocated above the 512 MB line will start on a 4 KB boundary, the size will be rounded up to a multiple of 4 KB, and the memory will not be tileable. 16-bit programs will not be able to address or access the object.
Memory should be allocated with the **OBJ_ANY** attribute wherever possible, since it provides the most efficient use of both the per-process address space as well as the system-wide virtual memory resources. It is intended that an application would make infrequent requests for large blocks of memory using DosAllocMem and then use DosSubSetMem along with DosSubAllocMem and DosSubFreeMem to manage the memory. If **OBJ_ANY** is not specified, the behavior of DosAllocMem and DosAllocSharedMem is the same as in OS/2 Warp.
Implementation Details
Note: IBM reserves the right to change these implementation details in future releases of OS/2.
Any number specified in **VIRTUALADDRESSLIMIT** is rounded up to a 64 MB boundary.
The user's address space above the 512 MB line has the same properties as the user's address space below the 512 MB line, namely:
- A high private arena at the low end and a high shared arena at the high end.
- 1/8 of the user's address space is guaranteed to be in the high private arena.
- 1/8 of the user's address space is guaranteed to be in the high shared arena.
- The two arenas grow toward each other: the high private arena grows up and the high shared arena grows down.
No memory objects can span the 512 MB line. The current allocation strategy for **OBJ_ANY** allocations is: Allocate from the appropriate high memory arena. If there is not enough virtual memory in the specified arena to support the request, then the allocation will come from the appropriate low memory arena below the 512 MB line, if possible. Otherwise, the function will fail with a return code of **ERROR_NOT_ENOUGH_MEMORY**.
High Memory Support Functions
The following OS/2 functions have been tested with the High Memory Support:
- DosFlatToSel
- DosGetNamedSharedMem
- DosGetSharedMem
- DosGiveSharedMem
- DosSetMem
- DosFreeMem
- DosRead
- DosWrite
- DosQueryMem
- DosQueryState
- DosQueryPageUsage
- DosSubSetMem
- DosSubAllocMem
- DosSubFreeMem
- DosSubUnsetMem
- All 32-bit semaphore functions
- All 32-bit exception handling functions
The maximum amount of free space in the high memory area can be determined from a program by using the DosQuerySysInfo function. If a virtual address above the 512 MB line is passed to DosFlatToSel, a 0 is returned. The following functions have been enhanced for High Memory Support: