About factors in the operating system that account for memory usage
- Last Updated: October 15, 2024
- 3 minute read
- OpenEdge
- Version 12.8
- Documentation
Memory management in modern computing systems is sophisticated and complex. This topic provides a high-level view of how memory is organized in a modern OS.
Shared memory
Any process can reserve the memory
used for sharing with multiple processes. A process that reserves 1
GiB (gibibyte) of memory for shared use reduces the total amount of
memory available to the rest of the system, including the OS, by 1
GiB. For example, if a machine has 16 GiB and the
process reserves 1 GiB for shared memory, then the machine must
manage all its operations with the remaining 15 GiB.
The memory is used by any process that is accessing the database using the shared memory, if the database server is running on the same machine.
All the OS processes that wish to access the shared memory must first attach to the shared
memory segments and then co-ordinate access with each other using an agreed upon
locking mechanism. On Unix OS, this shared memory appears as SHR in
the top report.
- The memory is shared among multiple processes.
- The amount of shared memory is established by the process reserving the memory and not by the PAS for OpenEdge agent.
Swap
The OS manages memory in chunks called pages, which are typically
4k or 8k in size.
When the total amount of memory in use by all the processes running on the machine approaches the limit of the physical memory available on the machine, the OS identifies the least-recently used pages of memory and writes their contents to swap. This action frees up the physical memory of the swapped pages for use by another process or even the same process.
A page fault is raised when the original owner of the swapped page references
the memory in that page, which is then restored with the swapped pages. The OS uses
a combination of dedicated swap RAM and disk to manage the swap needs of the
machine.
- The machine, including all the processes, is using more physical memory than is physically available.
- The PAS for OpenEdge agent process has memory allocated to it, which has not been used in a while, thus appearing as a candidate for swap.
- Increase the physical memory on your machine.
- Decrease the amount of memory in use by the application.
- Take other actions like Using operating system commands (explained in the next section) and Memory leak. You can also read Memory fragmentation and heap to understand how the OS allocates memory to a process in all sizes.
Unix operating system commands
OS-COMMAND, INPUT-THROUGH,
or OUTPUT-THROUGH statements trigger the fork ()
and exec (). This trigger creates a new child process, bearing a
memory footprint copy of the current PAS for OpenEdge agent process; often, these
are small processes, but they end up having a large footprint. This new child
process puts memory pressure on the machine as long it is active. Wherever possible,
it is recommended to eliminate, consolidate, and minimize the use of
OS-COMMAND, INPUT-THROUGH, and
OUTPUT-THROUGH statements in the PAS for OpenEdge
application.OS-COMMAND in Microsoft
Windows does not consume the memory in the same way it is consumed in Unix
OS.