智能与分布计算实验室
  嵌入式Linux实时性分析与改造研究
姓名 董俊
论文答辩日期 2002.05.10
论文提交日期 2004.08.17
论文级别 硕士
中文题名 嵌入式Linux实时性分析与改造研究
英文题名 Analysis and Alteration of the Embedded Linux’s Real-Time Capabilities
导师1 卢正鼎
导师2
中文关键词 Linux;嵌入式操作系统;实时性;进程调度
英文关键词 Linux;embedded OS;real-time;process scheduling
中文文摘 随着以计算机技术、通讯技术为主的信息技术的快速发展和互联网的广泛应用,计算机的发展已显示出微型化和专业化的趋势,嵌入式系统将在这一时期大显身手,而利用Linux搭建嵌入式操作系统则是近年来出现的最令人振奋的方案。 实时性是嵌入式操作系统的基本要求。Linux作为一种通用的操作系统,在某些方面还不适合作为嵌入式操作系统的需要。在详细分析Linux内核源代码的基础上,对其采用的进程调度机制进行了研究,指出该调度机制在实时处理上存在一定的缺陷,主要表现为:在调度算法中,采用了对可运行队列进行线性搜索的方法来选择下一调度进程,造成了调度时间上的不确定性;在调度方式上,不允许在内核空间中对进程进行抢占式调度,造成了一定的调度延迟。 针对这些不足,提出并实现了一种基于优先级的抢占式调度机制。首先,该机制采用了一种基于优先级排序的进程调度器PO-Scheduler,该调度器在保持了Linux现有调度器一切优良特性的基础之上,还具有以下一些优点:使用了复杂度为O(1)的调度算法,保证了调度时间的确定性;强调了紧迫任务对响应时间的要求,使系统具有更好的响应能力;使用了更合理的数据结构,在实现上更加简洁。其次,该调度机制采用了抢占式的调度方式,利用在内核中插入可抢占点的方法,将Linux改造成内核可抢占的;并对SMP版本中的spinlock机制进行改进,从而方便地对可抢占点进行设置。新的调度方式允许系统在内核状态下对进程进行抢占调度,从而减少了调度延迟的产生。通过上述这种调度机制,使得Linux具有一定程度的软实时特性,从而满足其作为嵌入式操作系统的需要。 基于优先级的抢占式调度机制已成功应用于同深圳泛友科技有限公司合作开发的Jinux嵌入式操作系统之中,该系统已通过国家有关部门鉴定,具有良好的市场前景。
英文文摘 With the development of the computer & communication technology, also the broad use of Internet, computer tends to micromation and specialization. The embedded system will strut its stuff this period, and using Linux to build embedded operating system is the most inspiring thing. Real-time capabilities is the base requirement of an embedded OS, but Linux has some shortcomings in being an embedded operating system as a general purpose OS. After analyzing thoroughly the kernel source code, especially the process scheduling mechanism, the paper points out this mechanism has some deficiency when handling real-time tasks: one is it adopts a linear searching algorithm when scheduling, which will make scheduling time unpredictable; the other is it does not permit preemptive scheduling in kernel mode, which will result in scheduling latency. Aiming at these problems, the paper brings forward a preemptive scheduling mechanism based on priority. Firstly, it uses a priority ordered scheduler PO-Scheduler. This scheduler keeps all the good things of the current scheduling mechanism, and also has some extra characteristics: using an O(1) complexity algorithm to schedule tasks which keeps the scheduling time constant; emphasizing the time requirement of urgent tasks which provides system a better response capability; making use of a better data structure which leads to a concise realization. Secondly, it adopts a preemptive scheduling manner, which makes Linux kernel preemptive by the way of inserting preemptive point. It also modifies the spinlock mechanism of SMP version to setup the preemptive points conveniently, thus reduces the occurrence of scheduling latency. By adopting the scheduling mechanism mentioned above, Linux can have a soft real-time capability and meet the demands of being an embedded operating system. The new scheduling mechanism has been successfully used in the Jinux system which is developed by the ShenZhen FanYou technology Co. Ltd. Jinux has passed the authentication and has a nicer market foreground.