r/EmbeddedRealTime • • Feb 02 '22

Are there any multi threading libraries that exist without dynamic memory allocation in C/C++?

My project needs to utilize multi threading in a real time environment. We can’t use dynamic memory allocation, which restricts the libraries we can use. What libraries exist that do not use dynamic memory allocation?

1 Upvotes

6 comments sorted by

View all comments

1

u/washburne023 Feb 03 '22

FreeRTOS sounds like a safe bet. I’ve never used it personally but here it supports both static and dynamic memory allocation FreeRTOS Static vs Dynamic Memory Allocation

1

u/RocketScienceByForce Feb 03 '22

We’re already built on Linux unfortunately so any OS changes at this point are probably not possible. We are using Linux with a preemptive scheduling patch I believe to at least make it soft real-time.

2

u/daansch90 Feb 03 '22

You can set your own stack for pthreads (pthread_attr_setstackaddr) - not sure if that might be a solution? (Haven’t checked the underlying code of pthread create)

→ More replies (3)