Couldn't you write a really simple kernel[1] or bootstrapping program, and effectively run your program without an OS?
Does an architecture (ARM / AVR / x86) limit the possibility of writing real-time code if the code is the OS, and just runs on the bare metal?
Your program would run in ring 0, be the only "process" and have full access to RAM. You decide whether you want to handle interrupts or not. (I assume there's a way to select what interrupts you want to handle.)
There's no such thing as bare metal any more. https://en.wikipedia.org/wiki/System_Management_Mode - the CPU itself may at times spend some time doing "other things" such as changing the spin speed of the cooling fans, or interpreting the signals from the USB keyboard. The OS (running in ring 0) has no control over this - the CPU effectively just pauses for a little bit every now and again.
TrustZone. It is "one level deeper" just like any other hypervisor or monitor. As far as I know, it is quite common in Android phones for HSM and DRM purposes. Yay? =\
Does an architecture (ARM / AVR / x86) limit the possibility of writing real-time code if the code is the OS, and just runs on the bare metal?
Your program would run in ring 0, be the only "process" and have full access to RAM. You decide whether you want to handle interrupts or not. (I assume there's a way to select what interrupts you want to handle.)
[1] For e.g., this tutorial explains how to write a basic x86 kernel: http://www.jamesmolloy.co.uk/tutorial_html/