Комментарии:
If you want a mathematically predictable (true hard real time) system, don't use C++. End of story. Hopefully you work in a very large conglomerate, because it's gonna be expensive. In my experience, it is absolutely possible to achieve real-time behavior that's not mathematically deterministic due to the complexity of the system using C++ and PREEMPT_RT. In addition to everything else Timur covered in this excellent talk, it's a matter of what else you're running and how tight your deadlines are. Many hard real-time systems aren't even running an OS, or the OS they are running is certified hard-real time and $$$$$$$.
ОтветитьWe can add std::span to the list of useful std real-time-safe classes
ОтветитьI learned a lot from this talk. Excellent presentation!
ОтветитьThis is a very interesting talk. I liked the pmr trick to avoid dynamic memory allocation.
Ответить@ real time safe dynamic memory: pre-configured and pre-allocatable data structures capacity like string, containers (vectors, ...) etc. can be used. As often in real time programming this shifts work from runtime to compile time, so memory use measurements with a profiler gives information for the system memory capacity configuration, which is good to be also on the safe side.
ОтветитьReally nice
ОтветитьI love the way Timur's lectures change with the years.
ОтветитьGreat public speaking!
ОтветитьThis is a fabulous presentation, thank you ever so much Timur.
ОтветитьThis is a great talk, and covering a subject which I didn't manage to find many good resources about. Can you recommend other resources that cover this topic? Or is the standard the only place to look into?
ОтветитьSo stick to C?
ОтветитьWhy on earth would I use the STL in real-time scenarios. It's completely unsuitable (algorithms excluded) and figuring out whether I can use a piece from it takes me more time than rewriting it for real-time audio needs.
ОтветитьI'm not sure why you'd want to enter a try block if you don't want to throw exceptions. Isn't the whole point of that structure to guard against exceptions?
ОтветитьI suggest an additional (optional) parameter to the attribute:
[[realtime_safe(n*m)]] void do_sth(int* array2d, int n, int m);
In general attributes for runtime might be useful, which would allow more complex code analysis:
[[average_time(n*std::log(n)), worst_time(n*n)]] void sort(...);
I guess compilers could bubble up this attribute through callers, such that tools can show the runtime behavior of any function.
by definition, real-time does not equal to low-latency, although most of time people tend to use interchangeably. Real-time is a deterministic characteristic.
ОтветитьSomething else I do is overload operator new and assert() it is never called once everything is set
up. Thoughts?
Why not just use std::vector and pre-allocate? Any reason why we should not do that?
ОтветитьMost important I think here is avoid using std containers ( or maybe with a custom preallocator ) , and anything else appart from atomic in multithreading . I did not know actually stdarray is allocated on the stack good info there .
ОтветитьThis guy has an unwarranted phobia of multi-threading. What guarantees are there that his beloved single thread won't be interrupted and re-scheduled by the OS? None. I'd rather make my app faster with multi-threading and thus more "realtime".
ОтветитьIn conclusion: Don't use C++.
ОтветитьThis was an excellent talk - this topic is very rarely covered at this depth - extremely useful for my interest in C++ audio DSP on ARM - thank you.
ОтветитьIt is a very good talk! Thank you.
Ответитьthanks Timur.
ОтветитьYou know it:s going to be a good presentation if Timur is presenting
ОтветитьThere were a lot of primitives from the thread support library getting tossed out. I wish there was a bit more time spent going over why. Having worked in an RTOS environment, posting semaphores or a msg to a queue seems like a common thing to do from a high priority thread.
ОтветитьGreat talk. This topic was definitely poorly covered in the past. Thank you.
ОтветитьFantastic talk! The audio quality is great. Your talk has a constant level of abstraction, this makes it easy to follow and absorb. You mention where there are rabbit holes and give a summary of your findings, that's so efficient. Your slideware greatly supports your narrative, is short and precise. The overall narrative visits topic after topic, giving an overview, some examples, some details, some outlook (like inpace_function, static_vector) and mentions the standard or papers where useful. One of the best talks of CppCon 2021! I have nothing to do with audio but I enjoyed it beginning to end.
ОтветитьExcellent talk! I would die to have a standard implementation of a lock free queue! It's time already!
ОтветитьGreat talk, thank you.
ОтветитьFascinating talk, thank you for this.
If applicable, and where the problem areas are 'small'/manageable, would writing those sections in assembly language give you your required predictive execution behaviour? Of course, it would help if kernel calls are not used, or if used, they don't re-introduce what you seek to prevent. We used to re-write specific (problematic) kernel routines in days gone by - mainly removing their general purpose nature for our specific use cases(and gaining significant speed and 100% behavioural predictability)...don't know how doable that is here/today. A damn shame if those days are gone. Today's abstraction is both good and bad (loss of control, predictability, etc)
the best true random number generator ive seen is a reverse polarity base emitter junction in a bjt with non connected collector connected to an ADC...
Ответитьtechnically you could do algorithms that are linear or worse in time complexity if you know that your input is within a given range for that the time complexity is within the deadline (or rather some percentage thereof)
ОтветитьI am a little confused where can I find the slides for 2021?
ОтветитьI find it sad that it's 2022 and Timur still has to dispel the "lambdas heap allocate" myth. Lambdas have been in the language for more than ten years at this point. How many CppCon talks pointing this out is it going to take before we can stop re-explaining all this?
Ответитьgreat lecture especially if your into ableton vst plug ins like izotope or virtual instruments steinberg etc
Ответить