3 ms·
This post is a plug of my own research. The multithreaded treatment in the article is naive: grab a lock, do the operation, release the lock. You won't get muc
by scott_s 18y ago
This post is a plug of my own research.
The multithreaded treatment in the article is naive: grab a lock, do the operation, release the lock. You won't get much concurrency that way in mutlithreaded applications with many concurrent memory operations. A prior research project of mine was a lock-free memory allocator: http://www.cs.vt.edu/~scschnei/streamflow http://www.cs.vt.edu/~scschnei/streamflow
That link has source code and a published paper.
Research that is not my own: TCMalloc, which is a part of Google's perftools library, is an excellent multithreaded allocator. Despite using locks, it was actually the best competitor in terms of speed. TCMalloc description: http://goog-perftools.sourceforge.net/doc/tcmalloc.html http://goog-perftools.sourceforge.net/doc/tcmalloc.html
The Hoard memory allocator was one of the first in the literature to address the mutlithreaded case: http://www.hoard.org/ http://www.hoard.org/
Writing your own allocator is a great exercise; I've recommend it as a means to learn systems programming in C. But if implementing your own is often not worth the effort in a real application. If memory allocation is an issue in your application, there's probably an existing allocator that solves the problem better than you can.
- biohacker42 18y agoWriting your own allocator is a great exercise; I've recommend it as a means to learn systems programming in C. But if implementing your own is often not worth the effort in a real application. If memory allocation is an issue in your application, there's probably an existing allocator that solves the problem better than you can. Thank you!