Along with the dynamic memory manager, I also had to implement a thread system on that embedded project. We weren’t using any library and we didn’t know yet about the amazing FreeRTOS, so in order to have threads we had to implement them.
You can find here an explanation of how I did this.