4 ms·
True, but one mans 'realtime' is very different than another. Most microcontrollers today don't even have cycle-accurate memory access guarantees, so it's impo
by londons_explore 7y ago
True, but one mans 'realtime' is very different than another.
Most microcontrollers today don't even have cycle-accurate memory access guarantees, so it's impossible to do timing more accurate than tens of nanoseconds.
Things requiring low latency and accurate timing always end up hardware assisted (USB controllers, PWM hardware, UART serializers, and a million more examples).
- learc83 7y agoFor the vast majority of realtime tasks accuracy of a few tens of nanoseconds is fine, but random 50ms delays for GC aren't.
- pjmlp 7y agoThat is why Java variants for embedded soft real time deployments have completely different kind of GC implementations like something as OpenJDK or IBM J9, and expose regions and access to unamaged memory. Likewise .NET's support for value types and low level programming also means not everything needs to be GC-allocated.
- learc83 7y agoThat's all true. But at some point if you really need to avoid GC, you end up writing in a subset of C# that is so limited, it's really just C. Most people don't have those kinds of performance considerations. I use C# for soft realtime all the time, but in the instances when I have done actual realtime embedded work, I just used C.
- blackguardx 7y agoDo you have a source for that? Are you talking about accessing internal SRAM, internal Flash, or external memory?
- londons_explore 7y agoAny architecture with a CPU cache is generally not cycle accurate (since at the time you compile your code you can't fully predict if your data will be in the cache or not). Many pipelined architectures do not define in datasheets exactly what can cause a pipeline stall - usually they provide rough guidance, but not information about corner cases. Branch prediction likewise is rarely fully defined in the datasheets. Some architectures have some operations which are data dependant - for example, "division takes 6-8 cycles". The software developer can't be sure it will be 6, 7, or 8, and if they were to measure performance, they'd be relying on undefined performance behaviour, since a new revision of the same model of chip could change performance. Also, most architectures with DMA aren't cycle accurate because the SRAM is single-ported, so you get a CPU stall if you happen to read memory in the same cycle as a hardware device needs more data.