3 ms·
What is it like working with hard real time? As in, is there some tooling to determine how long a given function will take to run to meet a deadline? It star
by jmkr 2y ago
What is it like working with hard real time? As in, is there some tooling to determine
how long a given function will take to run to meet a deadline? It starts to sound like
an NP problem, but we have other kinds of correctness and proof testing.
I suppose it's hard to make guarantees with different environments and hardware, but
I realized when we (non-realtime people) ship software we don't really have guarantees
for when our functions run.
- duped 2y agoIt's just a very different programming model. You don't write potentially infinite loops, you allocate memory ahead of time, anything that might be potentially unbounded is handled asynchronously, etc. Things like I/O run on precise timers and so on. Keep in mind you don't use the same operating systems (or often even the same hardware) in hard real time applications. You'll use a real time operating system (FreeRTOS, VxWorks, etc) with a very different task scheduler than you're probably used to with processes or threads in Unix-like platforms. That said, while multitasking exists for RTOSes in practice you're not going to be running nearly as many tasks on a device as say a web server. You can get worst case performance of a section of code by guaranteeing that it has a fixed maximum number of operations (no infinite loops, basically). Of course the halting problem applies, but you're never concerned with solving it in the general case, just for critical sections. It gets tricky with OOO architectures but you can usually figure out a worst case performance.