- Memory management
Memory management is the act of managing computer memory. The essential requirement of memory management is to provide ways to dynamically allocate portions of memory to programs at their request, and freeing it for reuse when no longer needed. This is critical to the computer system.
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 effectively available amount of RAM using paging or swapping to secondary storage. The quality of the virtual memory manager can have a big impact on overall system performance.
Dynamic memory allocation
The task of fulfilling an allocation request consists of finding a block of unused memory of sufficient size. Even though this task seems simple, several issues make the implementation complex. One of such problems is internal and external fragmentation, which arises when there are a lot of small gaps between allocated memory blocks, which are insufficient to fulfill the request. Another is that allocator's metadata can inflate the size of (individually) small allocations; this effect can be reduced by Chunking.
Usually, memory is allocated from a large pool of unused memory area called the heap (also called the free store). Since the precise location of the allocation is not known in advance, the memory is accessed indirectly, usually via a pointer reference. The precise algorithm used to organize the memory area and allocate and deallocate chunks is hidden behind an abstract interface and may use any of the methods described below.
The dynamic memory allocation algorithm actually used can impact performance significantly and a study conducted in 1994 by Digital Equipment Corporation illustrates the overheads involved for a variety of allocators. The lowest average instruction path length required to allocate a single memory slot was 52 (as measured with an instruction level profiler on a variety of software).
Fixed-size-blocks allocation, also called memory pool allocation, uses a free list of fixed-size blocks of memory (often all of the same size). This works well for simple embedded systems where no large objects need to be allocated, but it suffers from fragmentation.
In this system, memory is allocated from several pools of memory instead of just one, where each pool represents blocks of memory of a certain power of two in size. If a smaller size is requested than is available, the smallest available size is selected and it is then broken in two. One of the resulting halves is selected, and the process repeats (checking the size again and splitting if needed) until the block is just large enough. All new blocks that are formed during these splits are added to their respective memory pools for later use.
All the blocks of a particular size are kept in a sorted linked list or tree. When a block is freed, it is compared to its buddy. If they are both free, they are combined and placed in the next-largest size buddy-block list (when a block is allocated, the allocator will start with the smallest sufficiently large block avoiding needlessly breaking blocks).
Systems with virtual memory
Virtual memory is a method of decoupling the memory organisation from the actual physical hardware. The applications operate memory via virtual adresses. Each time an attempt to access the actual data is made, virtual memory subsystem translates the virtual address to a physical address, which corresponds to the address of the data as seen by the hardware. The address translation process itself is managed by the operating system. In this way addition of virtual memory enables granular control over the main memory and ways to access it. This can be used to increase the effectiveness of memory management.
In virtual memory systems the operating system controls the ways a process can access the memory. This feature can be used to disallow a process to read or write to memory that is not allocated to the said process, essentially prevents malicious or malfunctioning code in one program from interfering with the operation of other running programs.
Even though the memory for different processes is normally protected from each other, different processes sometimes need to be able to share information. One way to provide this is to allow the processes to access the same part of memory. Shared memory is one of the fastest techniques for Inter-process communication.
Memory is usually divided into fast primary storage and slow secondary storage. Memory management in the operating system handles moving information between these two levels of memory.
- Heap (data structure)
- Automatic memory allocation
- Dynamic array
- Garbage collection
- Memory pool
- Region-based memory management
- Slab allocation
- Stack-based memory allocation
- Demand paging
- Memory management unit (MMU)
- Page table
- Virtual memory
- Donald Knuth. Fundamental Algorithms, Third Edition. Addison-Wesley, 1997. ISBN 0-201-89683-4. Section 2.5: Dynamic Storage Allocation, pp. 435–456.
- Simple Memory Allocation Algorithms[dead link] on OSDEV Community
- Wilson, P.R.; Johnstone, M.S.; Neely, M.; Boles, D. (1995). "Dynamic Storage Allocation: A Survey and Critical Review". Memory Management: International Workshop, Iwmm'95, Kinross, Uk, September 27-29, 1995: Proceedings (Springer). ISBN 9783540603689. http://books.google.com/?id=m0yZN2bA3TcC&pg=PA1&dq=paul+wilson. Retrieved 2008-01-06.
- Berger, E.D.; Zorn, B.G.; McKinley, K.S. (2001). "Composing high-performance memory allocators". ACM SIGPLAN Notices 36 (5): 114–124. doi:10.1145/381694. http://portal.acm.org/citation.cfm?id=381694.378821.
- Berger, E.D.; Zorn, B.G.; McKinley, K.S. (2002). "Reconsidering custom memory allocation". Proceedings of the 17th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications. ACM Press New York, NY, USA. pp. 1–12. http://portal.acm.org/citation.cfm?id=582419.582421.
- "Dynamic Storage Allocation: A Survey and Critical Review", Department of Computer Sciences University of Texas at Austin
- Sample bit-mapped arena memory allocator in C
- TLSF: a constant time allocator for real-time systems
- Slides for knowing about Dynamic memory allocation
- Inside A Storage Allocator
- The Memory Management Reference
- Linux Memory Management
- Memory Management For System Programmers
- "Generic Memory Manager" C++ library
Memory management Manual memory management Virtual memory Hardware Garbage collectionImplementationsBoehm garbage collector • Garbage-first collector Memory segmentation Memory safety Issues Other
Wikimedia Foundation. 2010.
См. также в других словарях:
Memory Management — Memory Management, Speicherverwaltung … Universal-Lexikon
memory management — The way in which the operating system handles the use of memory, usually as a combination of physical memory and virtual memory. When applications are loaded, they are assigned space in which to run and store data. As they are removed, the… … Dictionary of networking
memory management — Manages the function of user programs in a multiprogramming medium … IT glossary of terms, acronyms and abbreviations
Memory Management Unit — Устройство управления памятью программно аппаратные средства поддерживающие функционирование виртуальной памяти. Синонимы английские: MMU См. также: Системные программы Виртуальная память Финансовый словарь Финам … Финансовый словарь
Memory Management Unit — Memory Management Unit, MMU … Universal-Lexikon
Memory management unit — This 68451 MMU could be used with the Motorola 68010 A memory management unit (MMU), sometimes called paged memory management unit (PMMU), is a computer hardware component responsible for handling accesses to memory requested by the CPU. Its… … Wikipedia
Memory Management Controller — Multi Memory Controllers or Memory Management Controllers (MMC) are different kinds of special chips designed by various video game developers for use in Nintendo Entertainment System (NES) cartridges. These chips extended the capabilities of… … Wikipedia
Memory Management Unit — Die Begriffe Memory Management Unit (MMU) und Speicherverwaltungseinheit benennen eine Funktionseinheit von Mikroprozessoren, die zum Zugriff auf den Arbeitsspeicher oder sonstige Hardware das Übersetzen von virtuellen Adressen in physische… … Deutsch Wikipedia
Memory Management Unit — Unité de gestion mémoire Cette MMU MC68451 pouvait s utiliser avec le Motorola 68010 Une unité de gestion mémoire (MMU pour Memory Management Unit) est un composant informatique responsable de l accès à la mémoire demandée par le processeur. Sur… … Wikipédia en Français
Memory management unit — Unité de gestion mémoire Cette MMU MC68451 pouvait s utiliser avec le Motorola 68010 Une unité de gestion mémoire (MMU pour Memory Management Unit) est un composant informatique responsable de l accès à la mémoire demandée par le processeur. Sur… … Wikipédia en Français