Katana VentraIP

Memory management

Memory management is a form of resource management applied to computer memory. The essential requirement of memory management is to provide ways to dynamically allocate portions of memory to programs at their request, and free it for reuse when no longer needed. This is critical to any advanced computer system where more than a single process might be underway at any time.[1]

"Memory allocation" redirects here. For memory allocation in the brain, see Neuronal memory allocation.

Several methods have been devised that increase the effectiveness of memory management. Virtual memory systems separate the memory addresses used by a process from actual physical addresses, allowing separation of processes and increasing the size of the virtual address space beyond the available amount of RAM using paging or swapping to secondary storage. The quality of the virtual memory manager can have an extensive effect on overall system performance. The system allows a computer to appear as if it may have more memory available than physically present, thereby allowing multiple processes to share it.


In some operating systems, e.g. OS/360 and successors,[2] memory is managed by the operating system.[note 1] In other operating systems, e.g. Unix-like operating systems, memory is managed at the application level.


Memory management within an address space is generally categorized as either manual memory management or automatic memory management.

Memory management in OS/360 and successors[edit]

IBM System/360 does not support virtual memory.[note 5] Memory isolation of jobs is optionally accomplished using protection keys, assigning storage for each job a different key, 0 for the supervisor or 1–15. Memory management in OS/360 is a supervisor function. Storage is requested using the GETMAIN macro and freed using the FREEMAIN macro, which result in a call to the supervisor (SVC) to perform the operation.


In OS/360 the details vary depending on how the system is generated, e.g., for PCP, MFT, MVT.


In OS/360 MVT, suballocation within a job's region or the shared System Queue Area (SQA) is based on subpools, areas a multiple of 2 KB in size—the size of an area protected by a protection key. Subpools are numbered 0–255.[10] Within a region subpools are assigned either the job's storage protection or the supervisor's key, key 0. Subpools 0–127 receive the job's key. Initially only subpool zero is created, and all user storage requests are satisfied from subpool 0, unless another is specified in the memory request. Subpools 250–255 are created by memory requests by the supervisor on behalf of the job. Most of these are assigned key 0, although a few get the key of the job. Subpool numbers are also relevant in MFT, although the details are much simpler.[11] MFT uses fixed partitions redefinable by the operator instead of dynamic regions and PCP has only a single partition.


Each subpool is mapped by a list of control blocks identifying allocated and free memory blocks within the subpool. Memory is allocated by finding a free area of sufficient size, or by allocating additional blocks in the subpool, up to the region size of the job. It is possible to free all or part of an allocated memory area.[12]


The details for OS/VS1 are similar[13] to those for MFT and for MVT; the details for OS/VS2 are similar to those for MVT, except that the page size is 4 KiB. For both OS/VS1 and OS/VS2 the shared System Queue Area (SQA) is nonpageable.


In MVS the address space includes an additional pageable shared area, the Common Storage Area (CSA), and an additional private area, the System Work area (SWA). Also, the storage keys 0-7 are all reserved for use by privileged code.

Dynamic array

Out of memory

. Fundamental Algorithms, Third Edition. Addison-Wesley, 1997. ISBN 0-201-89683-4. Section 2.5: Dynamic Storage Allocation, pp. 435–456.

Donald Knuth

Archived 5 March 2016 at the Wayback Machine (originally published on OSDEV Community)

Simple Memory Allocation Algorithms

Wilson, P. R.; Johnstone, M. S.; Neely, M.; Boles, D. (1995). "Dynamic storage allocation: A survey and critical review". Memory Management. Lecture Notes in Computer Science. Vol. 986. pp. 1–116.  10.1.1.47.275. doi:10.1007/3-540-60368-9_19. ISBN 978-3-540-60368-9.

CiteSeerX

Berger, E. D.; Zorn, B. G.; (June 2001). "Composing High-Performance Memory Allocators" (PDF). Proceedings of the ACM SIGPLAN 2001 conference on Programming language design and implementation. PLDI '01. pp. 114–124. CiteSeerX 10.1.1.1.2112. doi:10.1145/378795.378821. ISBN 1-58113-414-2. S2CID 7501376.

McKinley, K. S.

Berger, E. D.; Zorn, B. G.; (November 2002). "Reconsidering Custom Memory Allocation" (PDF). Proceedings of the 17th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications. OOPSLA '02. pp. 1–12. CiteSeerX 10.1.1.119.5298. doi:10.1145/582419.582421. ISBN 1-58113-471-1. S2CID 481812.

McKinley, K. S.

Wilson, Paul R.; Johnstone, Mark S.; Neely, Michael; Boles, David (September 28–29, 1995), (PDF), Austin, Texas: Department of Computer Sciences University of Texas, retrieved 2017-06-03

Dynamic Storage Allocation: A Survey and Critical Review

"Generic Memory Manager" C++ library

Sample bit-mapped arena memory allocator in C

TLSF: a constant time allocator for real-time systems

Slides on Dynamic memory allocation

Inside A Storage Allocator

The Memory Management Reference