C++ Custom Memory Allocation & C Threadpool Library

Library of classes for self-managed memory allocation and Multiplatform implementation of a threadpool using pthread

Custom Memory Allocators

C++ classes which allow for custom memory allocation. Precisely:

  • Linear Allocator
  • Stack
  • Double-Ended Stack
  • Pool
  • It was extremely interesting to learn a way to overcome the performance implications of memory allocation. This further expanded my knowledge of both the C++ language syntax and of the architecture of modern PCs.

    Developed in my spare time with the help of Steven Tovey, SMTS at AMD. The picture I used is also from Steven's article on this topic, which can be found on his blog.

    Threadpool

    Threadpool developed in my spare time in order to consolidate my knowledge of multithreaded programming. I extensively read about concurrency before starting the project, which allowed me to develop it quickly.

    Features:

  • Coded in C
  • Portability: works on Windows and Linux
  • Use of pthreads, both on Windows and Linux
  • Use of synchronisation utilities of pthread
  • Ability to create worker threads as needed
  • Use of CMake
  • The outcome was to learn how to write concurrent code and be aware of the advantages and pitfalls which come with it.
    Initially I wanted to write lock-free data structures in order to support the threadpool, but opted for a simpler approach using mutexes. While I am aware of atomics and how they can be used to write lock-free data structures, this decision allowed me to have something working really quickly, on which I can iterate in the future if I decide to code the lock-free data structures. For this project I was mentored by Steven Tovey, SMTS at AMD. Thank you so much Ste!

    Many, many thanks to my dear friend Stefano Musumeci for his awesomeness and support.

    Picture source: http://3.bp.blogspot.com/-Xm6R_soRSlc/UZu6tNyJqdI/AAAAAAAAAMY/eMDJatqXyzY/s400/ThreadPool.png

    Info & Curiosity

    Alberto Taiuti: developer of the whole project

    Technology: C++, pthread


    Documents:
  • Memalloc source code |  view
  • Threadpool source code |  view