Организация памяти программ в POSIX-совместимых ОС: что почитать?
(Из ленты Непрофессиональный блог Алексея Петрова)
В продолжение ранее опубликованного списка литературы о низкоуровневой оптимизации исходного кода заглянем «под капот» ОС Linux и FreeBSD, чтобы ответить на вопрос, как работают жизненно важные функции *alloc()
/ free()
, ответственные за выделение и освобождение участков динамической памяти.
Введение
- Drepper, U. What Every Programmer Should Know About Memory (Nov. 2007). URL: http://people.redhat.com/drepper/cpumemory.pdf.
- Duarte, G. Anatomy of a Program in Memory (Jan. 2009). URL: http://duartes.org/gustavo/blog/post/anatomy-of-a-program-in-memory/.
- Duarte, G. How the Kernel Manages Your Memory (Feb. 2009). URL: http://duartes.org/gustavo/blog/post/how-the-kernel-manages-your-memory/.
- Duarte, G. Page Cache, the Affair Between Memory and Files (Feb. 2009). URL: http://duartes.org/gustavo/blog/post/page-cache-the-affair-between-memory-and-files/.
- Kaspersky, K. Code Optimization: Effective Memory Usage (A-LIST Publishing, 2003).
Основные источники
- Burelle, M. A Malloc Tutorial (Feb. 2009). URL: http://www.inf.udec.cl/~leo/Malloc_tutorial.pdf.
- Lea, D. A Memory Allocator (Apr. 2000). URL: http://g.oswego.edu/dl/html/malloc.html.
Примеры реализации
- Ghemawat, S., Menage, P. TCMalloc: Thread-Caching Malloc. URL: http://goog-perftools.sourceforge.net/doc/tcmalloc.html.
jemalloc
. URL: http://www.canonware.com/jemalloc/.- McKusick, M., Karels, M. Design of a General Purpose Memory Allocator for the 4.3BSD UNIX Kernel. Proceedings of the San Francisco USENIX Conference, pp. 295-303, June 1988. — Классическая работа, посвященная одному из наиболее знаменитых распределителей памяти, получившему свое сегодняшнее название по именам авторов («распределитель Маккьюсика – Карелса»).
Стандарт IEEE Std 1003.1
calloc
. The Open Group Base Specifications Issue 7. IEEE Std 1003.1, 2013 Edition. URL: http://pubs.opengroup.org/onlinepubs/9699919799/functions/calloc.html.free
. The Open Group Base Specifications Issue 7. IEEE Std 1003.1, 2013 Edition. URL: http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html.malloc
. The Open Group Base Specifications Issue 7. IEEE Std 1003.1, 2013 Edition. URL: http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html.posix_memalign
. The Open Group Base Specifications Issue 7. IEEE Std 1003.1, 2013 Edition. URL: http://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_memalign.html.realloc
. The Open Group Base Specifications Issue 7. IEEE Std 1003.1, 2013 Edition. URL: http://pubs.opengroup.org/onlinepubs/9699919799/functions/realloc.html.
Приятного чтения!
Источник: Организация памяти программ в POSIX-совместимых ОС: что почитать?