標題: 適用於嵌入式多工數位訊號處理應用之輕量型環境切換
Lightweight Context Switch for Embedded Multi-Task DSP Applications
作者: 王炳勛 
Bing-Shiun Wang
劉志尉
Chih-Wei Liu
電子研究所
關鍵字: 嵌入式;多工;環境切換;處理器;embedded;Multi-tasking;Context switch;processor
公開日期: 2007
摘要: 在進入系統單晶片(SoC)的紀元,數位訊號處理的應用越來越廣泛,另一方面,隨著積體電路製程不斷地進步,處理器已能提供足夠的運算能力,也因此整合多項工作,但為了應付多項工作的排程與動態資源管理,多數處理器上都會有作業系統或微核心(micro kernel)協助扮演著動態即時資源管理的角色。為了達到QoS以及即時性,滿足具有高優先權(priority)的工作對於反應時間(response time)有特定的要求,大部分的微核心會採取搶先式(preemptive)的實現方式。搶先式的微核心雖然可以提供高優先權的工作一個可預期且較快速的反應時間,但不可避免地,在切換工作的同時又必須把所有暫存器的狀態存入記憶體中,這樣的環境切換(context switch)代價勢必會因為系統暫存器的數目增加而變得沈重。本篇論文提出了一種輕量環境切換(lightweight context switch)的實現方式,作法是在程式當中適當地插入一些轉換點(switch point),在這些特殊的轉換點上做環境切換,在擁有64個暫存器的處理器中,我們所提之輕量型環境切換平均只需儲存2~10個暫存器,如此可大幅降低環境切換的代價。利用所提之輕量環境切換,藉由編譯器地支援,可以根據不同系統的反應時間要求,自動地在程式裡插入轉換點。另外,我們也設計出一套硬體來儲存轉換點上所特別指定的暫存器。在我們的模擬實驗裡,這樣的機制相對於搶先式的微核心最多可以降低約40%的工作切換代價。而我們所提出的機制當中,硬體面積花費的代價大約僅僅只佔現有的數位訊號處理器的不到1%而已。
As the progress of IC technology, processors have provided an adequate computing capability to support multiple tasks. To deal with the multi-task scheduling and run-time resource management, the operating system or the micro kernel plays an important role in most of processors. To meet QoS and requirements for certain high priority tasks, most of micro kernels adopt preemptive mechanism for implementation. Though preemptive kernels provide a deterministic and rapid response time for high priority tasks, they must dump all CPU states into memory when switching task. Therefore, the context switch overhead will become an encumbrance for DSP processor with large register file. In this thesis, we propose a lightweight context switch mechanism where compiler can support to automatically insert adequate switch points in the program according to the system responsiveness requirement. Context switch is only performed at these switch points. For a typical DSP processor with 64 general registers, there are only 2~10 context registers needed to be stored in average. Thus, the context switch overhead is drastically reduced. In addition, we also design a dedicated hardware to store the context registers on the switch point. In our experimental results, compared to preemptive kernel, it can save up to 40% task switching overhead. Moreover, the hardware cost of the proposed lightweight context switch mechanism only possesses no more than 1% gate count of a generic DSP processor.
URI: http://140.113.39.130/cdrfb3/record/nctu/#GT009411609
http://hdl.handle.net/11536/80521
Appears in Collections:Thesis