Real-time systems are mainly designed to satisfy the timing requirements from the real world application. A real-time system concerns not only the logic correctness of the computing results, but also the time when the results come out. Today, real-time systems have been widely used in military and civilian industry. RTOS is the core of real-time system. As the improvement of hardware performance, in order to meet the requirement of real-time application, RTOS needs not only better performance, but also to provide more functions or services, such as GUI, network etc. The commercial RTOS which exist today is either too simple in function or too expensive. There is no such a RTOS that is open enough, standard, widely supporting, efficient and also cheap, so many institutes begin to research on turning the non-real-time universal operating systems which are functional strong into RTOS. Linux is naturally a good candidate, because it is capable of providing many services, supporting varied hardware, open source, modularized development, compatible with many international and industry standard.Linux is originally designed as a time share operating system, it has many shortcomings in the real-time applications, and especially the scheduling algorithms of Linux are singular. In this dissertation, give the design thought and basic frame of two-steps scheduling algorithm and implement it in RTAI, design RM scheduler and EDF scheduler, so RTAI's real-time scheduler is extended and can support both RM and EDF scheduling algorithms. At last, validate the correctness of two steps scheduling algorithm with the tests. The main content of this dissertation is:(1) Researching the basic theory knowledge of Linux and RTOS's scheduling algorithms, analyzing the advantages and shortcomings of Linux in the real-time applications;(2) Researching the scheduling model of RTOS which can support multifarious scheduling algorithms and task types, giving an idea of two-steps scheduling algorithm and the framework;(3) After analyzing some popular real-time Linux projects, choosing RTAI as a platform to implement two steps scheduling algorithm, designing RM and EDF scheduler, making RTAI to support both RM and EDF scheduling algorithms;(4) Testing Linux and RTAI with interrupt latency time testing and context-switching time testing, and comparing the results, testing the two-steps scheduling algorithm, validating its correctness.To sum up, according to the singular of scheduling algorithms in Linux, this dissertation proposed a two-steps scheduling algorithm, the scheduling process include two steps in this scheduling algorithm, it divides the choosing of scheduler and the concrete scheduling, so more scheduling algorithm can be used, comparing to the proposal which can support only one scheduling algorithm, it can be used in more application situation. By means of theoretic analysis and testing, it can be clearly concluded that the strategy is correct and effective; the RTAI which are extended can correctly schedule the real time tasks in accordance with the chose algorithm. |