I was thnking with myself today and i remembered an old software architecture for embedded systems division:
- Round-robin
- Round-robin with interrupts
- Function-queue-scheduling
- Real-time Operating Syste
IHMO the first one is just a subset of the second so i will just ignore it.
I was thinking on what kind of architecture i usually use on my projects (that usually range beween a PIC16F/MSP430 to a ARM CM4/ TI C2000) and i concluded that i probably use something between 2 and 3. Teh architecture that i use is basically inspired on a mechanism used on the Fnet stack. It poll a list of tasks continuously. What i did is to create several different handlers that can carry different tasks and use a void pointer as an argument. So in general i got a handler for timed tasks and a handler for async tasks. And i keep registering and unregistering services on both handlers. I must follow some rules to do not get a bad code, like never use an unpredictable while, or lock my code with nops, but that works most of the cases and is very portable. In order to improve the portability, most of the system is described by structures, and all the hardware dependent functions are separeted and abstractared by theses structures. So in general all the logic is reusable and all i must change is the hardware specific code, that is not that much.
However today using RTOS is a real trend and i could hear of good implementations of Function-queue-scheduling (however i got no example). Could you guys describe your experience with the software architecture you use? Comments on the benefits/drawbacks of each one? In special related to performance, scalability and reliability?
Thank you!