节点文献

Linux系统的实时性研究

The Research of the Real-time of the Linux

【作者】 姜南

【导师】 赵宏伟;

【作者基本信息】 吉林大学 , 计算机应用技术, 2010, 硕士

【摘要】 凭借着源代码公开、适用范围广泛、可移植性强、软件资源丰富等优势,Linux系统被越来越多的人所认知与认同。但是,在某些应用环境下,特别是某些嵌入式的环境下,Linux的实时性能并不令人满意。本文便是为了提高Linux操作系统的实时性能而进行的研究。首先学习Linux的相关理论知识,然后针对Linux实时性不强的原因进行了分析并制定了改进的方案。针对Linux系统调度算法的不足,用动态优先级的调度方法对其进行改进,并且利用反馈和设定阙值的方法解决了由于采用最小裕度优先算法而导致的进程频繁切换的问题。针对系统定时器粒度过大的问题,采用单次触发模式对系统的时钟中断发生时机进行了改进,实现了定时器粒度的细化。最后,通过改写中断服务程序完成了与中断延迟相关的实验,并利用管道完成了系统任务切换时间的测试实验,通过这两个实验验证了通过改进,系统的实时性能得到了提高。

【Abstract】 Nowadays, with the fast development of embedded system product, the claim toembedded system is more and more rigorous. However, there is not a mature orcomprehensively applied product in China. As the mature software, Linux bring the firstlight of morning for our country with its open source, high stability, low cost and someother characteristics. In the beginning, Linux is designed on the basis of fundamentals thatthe average response time is as possible as short and the throughput is as possible as high,which is for a operation system. Some characteristics like coarse time granularity,frequently interrupt disable for protecting data’s safety and consistency and the use ofvirtual memory,which lead to real time deficiency when Linux is used in some real timeclaim environment .So improving on real-time support of Linux system is becoming a hottopicoftheresearch.With more and more company. research communityand amateur participating in Linuxreal time performance research, a lot of achievements come out .Although goals are same,improving real time performance, the solutions are different and worth reference, whichhave different starting point, like decreasing use of interrupt or closing interrupt, realizingpreempted kernel, using double kernel, refine time granularity, threaded interrupts and soon. These solutions are successful for improving system real time ability in some aspects,someofwhicharepracticallyappliedanddeveloprelativeproducts.This paper is based upon studying relative theory of Linux. The solutions of improvingreal time ability of Linux system are analyzed by modifying process schedule and timegranularityofkernel.The fit task Process will be selected by scheduling algorithm to handle among manyprocesses and fix on process runtime, which directly influence system real-timeperformance. Although Linux adopt advanced O(1) algorithm, it doesn’t take into accountsystem dynamic operation, which will lead to low system real-time ability by adoptingstatic priority algorithm to schedule system process. This paper adopt lowest slackpriorityalgorithm to improve former algorithm, which consider the factor with relationshiptotime.Basedonthenewalgorithm,systemscheduleisnotonlyrelatedtoprocesspriority,but also related to process pressing degree—the slack。When the system schedule system process, it determines a certain process to run, which is most compatible to least slack firstalgorithm and to process priority.Because of considering the slack, the system may frequently switch some processeswhich have the same priority and similar slack. It will bring on extra burden and influencesystem performance. To solve this problem, this paper adopt feedback and threshold valueto decrease probability of problem occurring, which will improve system performance.Time interrupt play an important role in the system. When time interrupts occur,system will inspect process running state, providing an opportunity to schedule, which isimportant for improving system real time performance.This hope of the paper firstly is to improve on system performance by increasing timeclock frequency, but it failed. Later based upon KURT advanced theory , This paper adoptenhancing time granularity to improve system real time ability by means of one-shottriggering。The core of one-shot triggering time interrupt is that: the system need not have torespond to any change every time, but only make response when having to respond.Optimization scheme is carried out with PIT8254, time stamp counter-TSC and soft timer.At first, using TSC to time accurately, and using 8254 to bring out time interrupt. Whentime interrupt occur, system examine whether there are mature timers or not at the next timecycle. If there are mature timers, system calculate parameters which are based on maturetime. The parameters are used to modify 8254 control registers,which will bring out aninterrupt and make relative operation when system is at specific time. By this way, it isequivalent to enhancing system time frequency and refine time granularity. But it doesn’tincrease the system burden like only enhancing system time frequency.To estimate whether Linux performance is enhanced by the two modificationsmentioned above, the paper performs a relative test. First of all, the modified source code togenerate a new kernel file, by modifying the startup files, the system is running successfully.In order to test the system interrupt latency, I modify the clock interrupt service routine,firstly, through the TSC interrupt service routine to read the start-up time, and then removezero channel count of the PIT8254 and to carry out the two units conversion, and finally getout in microseconds as the unit of interrupt latency.In order to prove the higher performance of the context switch time, we create a fatherprocess and a son process, and two half- duplex pipes to pass message between the fatherand the son process. Because of the message ,the processes will be blocked. When theprocess switches, we record the right time with rdtsc() and calculate the value between the times. Through the two experiments, we can see that the performance of de systembecomes better in some degree.With the increasing popularity of Linux, it is used in more and more fields. But it isrestricted in many areas because of the deficiency of real time performance. I modify thekernel by modifying scheduling algorithm and refining time granularity. It is proved thatsystem real time performance is improved at a certain extent.

  • 【网络出版投稿人】 吉林大学
  • 【网络出版年期】2010年 09期
  • 【分类号】TP316.81
  • 【被引频次】1
  • 【下载频次】164
节点文献中: 

本文链接的文献网络图示:

本文的引文网络