Real-time systems are mainly designed to satisfy the timing requirements from the real word application. A real-time system concerns not only the logic correctness of the computing results, but also the time when the results come out. The process must be completed before deadline, or the system will failed. Otherwise, in real-time system, priority inversion phenomenon may occur frequently under the condition of multiple tasks share resource, and it will lead to system failure. So task scheduling and resource management is the most important part.This paper useμC/OS-II as the reaserch object.μC/OS-II has a preemptive scheduling and free code kernel.μC/OS-II assigns each task for an unique priority, but it does not allow the kernel to have multiple tasks at the same priority. In practical application, it is not a good logical design. Aiming at this problem, by modifying the real time kernelμC/OS-II, this paper advanced round-robin scheduling to deal with the same priority tasks. By experiment verification, the modified kernel can support the tasks at the same priority, and it can remainμC/OS-II's preemptive property.For real-time kernel adopting preemptive priority policy, priority inversion phenomenon may occur frequently under the condition of multiple tasks share resource. Some unpredictable errors of real-time application system perhaps derive from this phenomenon. This paper expounds the cause of priority inversion problem and the effect for real-time system performance firstly, and then, three approaches named as scheduler lock , priority ceiling protocol and priority inheritance protocol are proposed to be used inμC/OS- II for reducing the priority inversion phenomenon. By experiment verification, the three methods reduce priority inversion effectively inμC/OS- II. Finally, the performance of the three methods had been compared and analyzed. |