4 ms·
Been awhile since I dealt with microcontrollers, but my recollection is that some non-trivial amount of things have to be done by a RTOS. For example if your t
by dmoy 9y ago
Been awhile since I dealt with microcontrollers, but my recollection is that some non-trivial amount of things have to be done by a RTOS.
For example if your thing is attached to a sensor that spits out 47 bytes of sensor data every N clock cycles, and has a buffer that is 94 bytes, then you damn well better be reading that thing every N*2 clock cycles with a hard guarantee that your routine is finished copying all 94 bytes of data by the time it finishes (including time for interrupts).
This gets complicated when you have specific requirements about when data is available or other things too (e.g. if reading data requires pulling pin X low, waiting at least Y clock cycles, and then reading all data in no more than Z clock cycles before returning pin X back to high, then good luck doing that in a normal OS where you have no hard time guarantees).
- HankB99 9y agoTwo models are common in embedded systems: "main loop" or RTOS. In the main loop model, once initialization is complete, the program loops indefinitely, servicing various functions. Since the developer is responsible for a larger portion of the code, it is easier to meet timing deadlines. An RTOS provides a convenience to allow various threads to block and thus simplify programming. I would choose an RTOS where there are a greater number of independent tasks which need to be performed. Both are alternatives to a conventional OS which makes hitting deadlines difficult or impossible.
- nitrogen 9y agoAn additional advantage of some kind of RTOS, or at least using interrupts: infinite looping uses more power than sleeping and waiting for interrupts.
- ianhowson 9y agoIt's worth noting that very few devices using an RTOS actually have real-time constraints. In practice, "RTOS" just means "operating system for an embedded device".
- amelius 9y agoDoes an RTOS have a built-in theorem prover to accomplish that?