I am writing a user space audio application which runs over Linux (Kernel 3.0) , and it need real time behavior. Should I go for glibc or uClibC ? How uClibC and glibc are compared with respect to realtime behavior?
(edit: mine is an embedded system with nand flash. it uses buildroot with external gcc toolchain with glibc. i can also use buildroot internal toolchain with uClibc if required)
Realistically, I don't think anyone can say for sure one way or the other. The reason being that your code may well use the C library in a way that is greatly better/worse in one variant than the other.
The only reasonable way is to run the code with glibc, then under the same conditioins with uclibc. Compare the time it takes to do the work. Which is better in your case? - and if this is going into some sort of embedded system, make sure you measure on the processor you want it to run on, not some PC processor that has completely different instruction set, different cache-sized, different memory speed, etc, etc.
You say you use a lot of malloc - maybe if you think that is a limiting factor for your speed, you should consider an approach where you don't use malloc quite so much. In particular, it's not a good idea to call malloc in your "hot-path", unless you absolutely HAVE TO.
Note also that Linux is not a realtime OS. You can only expect semi-realtime behaviour with Linux, and if your application really relies on being able to process it's audio within a certain amount of time, and with certain conditions for how long it can be "not running" etc, you will need to add extensions to the kernel - I'm not quite familiar with WHICH ones are good for which version(s) of kernel, types of workloads, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With