问题
I want to make an RTOS for 8051 and very confused as what minimum requirements should be followed to make an OS in 8051 as 8051 has very limitted resources in case of RAM and ROM. It is just and assignment type problem but i am really confused as we make softwares for 8051 are they not an OS? which features differenciate a normal regular coding of micro controller from RTOS? please help thanks
回答1:
An typical RTOS provides at least the following:
- Deterministic task scheduling
- Task synchronisation mechanisms
- Inter-process communication mechanisms
- Timer services
An RTOS scheduler is typically priority-based and pre-emptive - the highest priority task that is ready to run will run, regardless of the state of lower priority tasks.
There is a presentation by Jack Ganssle on RTOS Fundamentals on TechOnline that may be of use to you. It is sponsored by Micrium and uses uC/OS-II as a case study, but it generally applicable for the most part.
The 8051 in particular is capable of particularly efficient task context switching due to its multiple register banks, switchable with a single instruction.
回答2:
The functionality of an RTOS are largely guided by its ability to execute a particular work-load in a deterministic and timely manner. These usually include threading, synchronisation operations and a scheduler with a specialised algorithm designed to execute threads in a deterministic fashion.
Implementing this in a 8051 is going to be a tall-order (and perhaps even impossible due to the hardware architecture of the processor). A more common approach on uCs of this class is to use a Cyclic Executive and the priority nesting of interrupt handlers to enforce the priority of execution. You could consider this approach to be an RTOS of sorts.
来源:https://stackoverflow.com/questions/14632355/basic-requirements-to-be-called-rtos-for-8051