【正文】
分類號______________ 密級_______________U D C_______________碩士學位論文周期性互換的實時多任務(wù)調(diào)度方法研究 研 究 生 姓 名 王 聰 指導(dǎo)教師姓名、職稱 王 彬(副教授) 學 科 專 業(yè) 控制工程 研 究 方 向 實時系統(tǒng)多任務(wù)調(diào)度算法 論 文 工 作 起 止 日 期 2012年3月至2013年3月 論 文 提 交 日 期 2013年3月26日 Error! No text of specified style in document.昆明理工大學學位論文原創(chuàng)性聲明本人鄭重聲明:所呈交的學位論文,是本人在導(dǎo)師的指導(dǎo)下或我個人……進行研究工作所取得的成果。除文中已經(jīng)注明引用的內(nèi)容外,本論文不含任何其他個人或集體已經(jīng)發(fā)表或撰寫過的研究成果。對本文的研究做出重要貢獻的個人和集體,均已在論文中作了明確的說明并表示了謝意。本聲明的法律結(jié)果由本人承擔。 學位論文作者簽名: 日 期: 年 月 日……………………………………………………………………………關(guān)于論文使用授權(quán)的說明本人完全了解昆明理工大學有關(guān)保留、使用學位論文的規(guī)定,即:學校有權(quán)保留、送交論文的復(fù)印件,允許論文被查閱,學??梢怨颊撐牡娜炕虿糠謨?nèi)容,可以采用影印或其他復(fù)制手段保存論文。(保密論文在解密后應(yīng)遵守)導(dǎo) 師 簽 名: 論文作者簽名: 日 期: 年 月 日57周期性互換的實時多任務(wù)調(diào)度方法研究摘要近年來,隨著數(shù)字化和智能化程度的提高,微處理器被引進到電子領(lǐng)域的各個行業(yè)。一般來講,凡是帶有微處理器的電子系統(tǒng),都可以統(tǒng)稱為嵌入式系統(tǒng)。由于一個系統(tǒng)中集成的功能越來越多,因而需要微處理器處理的任務(wù)也隨之增加。這就引進了單個微處理器對多任務(wù)的調(diào)度問題。多任務(wù)調(diào)度問題不僅在嵌入式行業(yè),在通用處理平臺上也存在,并且更早。多任務(wù)調(diào)度從實時性上劃分,分為實時調(diào)度和非實時調(diào)度;從調(diào)度算法上劃分為動態(tài)調(diào)度和靜態(tài)調(diào)度。實時調(diào)度一般是基于搶占式優(yōu)先級來調(diào)度任務(wù),不同的任務(wù)分配不同的優(yōu)先級,從而實現(xiàn)高優(yōu)先級任務(wù)優(yōu)先執(zhí)行。非實時調(diào)度一般是按照時間片輪轉(zhuǎn)法進行多任務(wù)調(diào)度,每個任務(wù)的執(zhí)行幾率是相同的。動態(tài)調(diào)度算法是通過預(yù)先設(shè)定的某一指標對所有就緒任務(wù)進行衡量,滿足條件的任務(wù)優(yōu)先執(zhí)行。由于該指標所依賴的參數(shù)是不斷變化的,所以滿足條件的任務(wù)也是不斷變更的。這樣就實現(xiàn)了對任務(wù)的動態(tài)調(diào)度。靜態(tài)調(diào)度算法也是通過預(yù)先設(shè)定的某一指標對當前所有就緒任務(wù)進行衡量,滿足條件的任務(wù)優(yōu)先執(zhí)行。但是和動態(tài)調(diào)度算法不同的是該指標所依賴的參數(shù)是固定的或者人為的設(shè)定的,不會在任務(wù)執(zhí)行過程中發(fā)生變化,所以是靜態(tài)調(diào)度。本文研究實時系統(tǒng)多任務(wù)調(diào)度中低優(yōu)先級任務(wù)的延遲問題。由于低優(yōu)先級任務(wù)總是要等到高優(yōu)先級任務(wù)的執(zhí)行間隙才能得到執(zhí)行,所以研究低優(yōu)先級任務(wù)的延遲問題很有必要。這關(guān)系到底優(yōu)先級任務(wù)的實時性。通過研究,本文的重點放在實時系統(tǒng)采用靜態(tài)調(diào)度算法進行多任務(wù)調(diào)度時的低優(yōu)先級任務(wù)的實時性研究。本文提出了一種優(yōu)先級周期性互換的任務(wù)調(diào)度算法,來解決低優(yōu)先級任務(wù)的實時性問題。通過Ptolemy II仿真軟件對優(yōu)先級周期性互換任務(wù)調(diào)度算法進行仿真,得出仿真結(jié)果并進行分析。最后,以實際控制系統(tǒng)的響應(yīng)曲線圖來驗證優(yōu)先級周期性互換算法對低優(yōu)先級任務(wù)的實時性的提高有很大的改進。關(guān)鍵字:多任務(wù)調(diào)度;優(yōu)先級周期性互換;實時系統(tǒng);Ptolemy IIAbstractIn recent years, with the improvement in the level of digital and intelligent, microprocessor was introduced to various industries in the field of electronics. In general, any electronic system with a microprocessor, can be collectively referred to as embedded systems. As more and more integrated in a system increases, thus the need for a microprocessor to handle the task. This is the introduction of a single microprocessor to multitask scheduling problem.Multitask scheduling problem, not only in the embedded industry, there are also general purpose processing platform and earlier. Multitask scheduling from the realtime performance on a divided, divided into realtime scheduling and nonrealtime scheduling。 scheduling algorithm is divided into dynamic scheduling and static scheduling. The realtime scheduling preemptive prioritybased scheduling tasks, different tasks assigned different priority, in order to achieve a highpriority task execution priority. The nonrealtime scheduling rotation method according to the time slice of the multitask scheduling, the probability of each execution of the task is the same. The dynamic scheduling algorithm is all ready tasks through a preset indicators to measure to meet the conditions of the task execution priority. Since the indicator depends on the parameters are constantly changing, so that satisfy the condition task is constantly changed. This dynamic scheduling of tasks. Static scheduling algorithm is also through a preset indicators to measure the current all ready tasks to meet the conditions of task execution priority. And dynamic scheduling algorithm is different indicators dependent parameters are fixed or artificially set, will not change in the task execution process, and so is static scheduling.In this paper, realtime multitask scheduling low priority task latency issues. As a lowpriority task is always to wait until the implementation of highpriority task execution gap to get, so study the lowpriority task latency issues is necessary. This relationship in the end the realtime nature of the priority tasks. Through research, the article focuses on realtime systems using static scheduling algorithm for multitask scheduling, realtime lowpriority task. This paper proposes a priority periodic swap task scheduling algorithm, to solve realtime problems of lowpriority tasks. The theoretical analysis of the algorithm and demonstration priority periodic exchange of task scheduling algorithm, and by Ptolemy II simulation software simulation, simulation results derived algorithm. A great improvement verify priority cyclical interchangeable algorithm response curves of the actual control system to improve realtime lowpriority task.Keyword目錄摘要 IABSTRACT II第一章緒論 11引言 1 1 5 7 7第二章嵌入式實時系統(tǒng)任務(wù)調(diào)度機制 9 9 9 11 12 13 13 14 15 15 18 18第三章 基于角色的PTOLEMY II實時仿真平臺研究 21 Ptolemy II域的研究分析 21 22 23 24 25(actor)分析介紹 28 Ptolemy II使用簡介 31第四章優(yōu)先級周期性互換調(diào)度算法的驗證 37 37 37 II軟件仿真 38 優(yōu)先級周期性互換任務(wù)調(diào)度算法應(yīng)用級仿真 41 44第五章總結(jié)與展望 47 總結(jié) 47 進一步的研究 48致謝 51參考文獻 53附錄A(攻讀碩士期間發(fā)表的論文) 57第一章 緒論1引言隨著信息時代發(fā)展和進步,特別是進入二十世紀以來,大量的電子產(chǎn)品紛紛涌現(xiàn)出來,充斥在每個人生活的方方面面。目前這些電子產(chǎn)品與過去有個明顯的區(qū)別就是有內(nèi)嵌微處理器,也就是常說的嵌入式系統(tǒng)。嵌入式系統(tǒng)給人們生活帶來了很大的方便,小到手機、智能電視、機頂盒等,大到汽車、飛機、火車、導(dǎo)彈、火箭等等,都嵌入了微處理器來實現(xiàn)智能控制或者調(diào)節(jié)。在以上列舉出來的系統(tǒng)中像手機、智能電視、機頂盒之類的嵌入式系統(tǒng),它們在使用過程中,對于任務(wù)觸發(fā)的響應(yīng)沒有嚴格的時限要求,因而它們們屬于嵌入式非實時系統(tǒng);而對于導(dǎo)彈、火箭之類的嵌入式系統(tǒng)就對于任務(wù)觸發(fā)的響應(yīng)有嚴格的時限要求,它們則屬于嵌入式實時系統(tǒng)。例如在汽車的安全氣囊防護系統(tǒng)[1] (Supplemental Inflatable Restraint System,簡稱SRS)。當車速50公里/時進行正面撞車時,其發(fā)生時間只有十分之一秒左右。由于作用時間太短,它對嵌入式實時系統(tǒng)的實時性要求就更為明顯。據(jù)計算,,,此刻之后,駕車者才會撞上氣囊。由此例可見,“”就是嵌入式實時系統(tǒng)對任務(wù)觸發(fā)時的響應(yīng)時間;“”就是該任務(wù)的執(zhí)行時間。這兩個任務(wù)的時限特別重要,一旦時限錯失將會帶來災(zāi)難性后果。實時系統(tǒng)更注重“實時”概念,實質(zhì)上就是將提交到系統(tǒng)內(nèi)部的信息及時進行處理并迅速輸出結(jié)果[25]。至于“及時”如何界定,這就取決于外部任務(wù)對系統(tǒng)的要求,是實時系統(tǒng)中一項最重要的衡量系統(tǒng)實時性的指標。目前對實時系統(tǒng)的定義可以描述為:系統(tǒng)在響應(yīng)任務(wù)請求后,其結(jié)果的正確取決于如下兩個方面:第一、一般概念下處理任務(wù)邏輯的正確;第二、產(chǎn)生任務(wù)結(jié)果的時效[610]。實時系統(tǒng)的特點要求也適用于嵌入式實時系統(tǒng)。實時概念自提出以來,實時技術(shù)隨著嵌入式實時系統(tǒng)向安防系統(tǒng)、工業(yè)控制系統(tǒng)、機器人控制系統(tǒng)等方向的發(fā)展,其自身的研究和應(yīng)用取得很大的突破和發(fā)展。主要是體現(xiàn)在實時系統(tǒng)的核心問題上:多任務(wù)調(diào)度算法。許多專家和學者都在探索多任務(wù)調(diào)度算法方面研究出了一批經(jīng)典算法,提出了很多行之有效的調(diào)度方法[1117]。嵌入式實時系統(tǒng)并非局限的就認為是一個嵌入式實時操作系統(tǒng)的內(nèi)核,當然嵌入式實時操作系統(tǒng)在實時系統(tǒng)中占據(jù)著極其重要的地位。作為一個具有完整功能的系統(tǒng)來看,一般分為軟件和硬件兩部分()。軟件部分的核心是實時操作系統(tǒng)(主要是內(nèi)核)和服務(wù)于實時任務(wù)的應(yīng)用程序;硬件包括微處理器、存儲器及I/O端口和外設(shè)器件等。高速運行的外圍設(shè)備是信號采集和傳輸?shù)闹匾U?;實時操作系統(tǒng)則是在多