JPH0782444B2 - Task schedule method - Google Patents
Task schedule methodInfo
- Publication number
- JPH0782444B2 JPH0782444B2 JP25821086A JP25821086A JPH0782444B2 JP H0782444 B2 JPH0782444 B2 JP H0782444B2 JP 25821086 A JP25821086 A JP 25821086A JP 25821086 A JP25821086 A JP 25821086A JP H0782444 B2 JPH0782444 B2 JP H0782444B2
- Authority
- JP
- Japan
- Prior art keywords
- task
- resource
- overhead
- ratio
- processor
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
Description
【発明の詳細な説明】 〔産業上の利用分野〕 本発明はメモリを共用するマルチプロセッサシステムに
おけるタスクのスケジューリング方式に関するものであ
る。TECHNICAL FIELD The present invention relates to a task scheduling method in a multiprocessor system sharing a memory.
タスクスケジューリング方式において、従来は先入れ先
出し方式、プライオリティによる方式、プロセッサ使用
時間の長いタスクよりI/Oの多いタスクを優先する方
式、処理時間の目標値を守るように処理順序を変える方
式等があった。これら方式では、タスクのリソース使用
状況および要求状況は考慮されていなかった。また、特
願昭61−133641号に示すようにタスク切り換えオーバー
ヘッドが十分小の場合はプライオリティを無視してリソ
ースを使用するタスクをいずれかのプロセッサで必ず処
理していることにより将来のリソースネックを防止して
スループットを向上させることができる。Conventional task scheduling methods include first-in first-out method, priority method, method that prioritizes tasks with more I / O than tasks that use a long processor time, and method that changes the processing order to keep the target value of processing time. . These methods did not consider task resource usage and request status. Also, as shown in Japanese Patent Application No. 61-133641, when the task switching overhead is sufficiently small, priority is ignored and tasks that use resources are always processed by one of the processors, so that a future resource bottleneck will occur. It can be prevented to improve the throughput.
従来の方式においては、タスクがリソースを解放する都
度タスクの再スケジュールを行っていた。この方式では
タスク切り換えのオーバーヘッドが小さい場合は最大の
スループットを実現できるが、オーバーヘッドの大きい
場合処理能力が低下してしまう。In the conventional method, the task is rescheduled every time the task releases the resource. With this method, the maximum throughput can be realized when the overhead of task switching is small, but the processing capacity decreases when the overhead is large.
本発明は上記の目的のため、従来のタスクキューの他に
リソース待ちキューを追加する。リソース競合時は、リ
ソース待ちキューにタスクを入れる。タスクスケジュー
ル時に、リソースが使用中かどうかを調べ、リソース未
使用ならリソース待ちキュー中のタスクをまずスケジュ
ールする。また、タスクがリソースを解放した場合、他
にリソース待ちをしているタスクがあればタスク切り換
えを行うべきかをあらかじめ設定したフラグによって決
定する。このフラグをタスク切り換えオーバーヘッドと
タスクのリソース占有解放の一周期のオーバーヘッドの
比較によって設定する手段を持つ。For the above purpose, the present invention adds a resource waiting queue in addition to the conventional task queue. When resources compete, put the task in the resource waiting queue. When a task is scheduled, it is checked whether the resource is in use. If the resource is not used, the task in the resource waiting queue is scheduled first. Further, when a task releases a resource, whether or not there is another task waiting for the resource is determined by a preset flag. It has a means for setting this flag by comparing the task switching overhead with the overhead of one cycle of resource occupation release of the task.
本発明の作用は、メモリを共用するプロセッサ上のタス
クスケジューラにおいてタスクが複数の排他リソースを
高い割合で使用する場合、これらリソースを待っている
タスクがある時に、タスクがリソースを解放した場合に
リソース待ちをしているタスクに切り換えるかどうか
を、タスク切り換えオーバーヘッドを考慮して決めるこ
とにより、将来発生し得るプロセッサのアイドルを防止
しつつ、タスク切り換えオーバーヘッドによる性能の低
下を防止する。The effect of the present invention is that when a task uses a plurality of exclusive resources at a high ratio in a task scheduler on a processor that shares memory, when there are tasks waiting for these resources, the resources are released when the task releases the resources. By deciding whether or not to switch to the waiting task in consideration of the task switching overhead, it is possible to prevent the processor from being idle in the future and to prevent the performance from being deteriorated due to the task switching overhead.
以下、本発明の一実施例を説明する。第1図は、本発明
のタスクスケジューラの概要図である。タスクスケジュ
ーラ1.は、各タスクの終了時リソースの占有解放時ある
いは入出力要求時などに、次に処理するタスクを選択し
起動するために起動される。本実施例ではリソースとし
て以下の条件を満足するものを想定する。リソースの要
求はプロセッサを割り当てられているタスクからのみ行
う。タスクの入出力要求時などタスクがプロセッサを割
り当て可能でない状態になる時は必ずリソースを解放す
ることにより、リソースは現在プロセッサを割り当てら
れている、あるいは割り当て可能で中断されているタス
クのみが占有している。An embodiment of the present invention will be described below. FIG. 1 is a schematic diagram of a task scheduler of the present invention. The task scheduler 1. is activated to select and activate the next task to be processed when each task ends, when the resource is released and when an input / output is requested. In this embodiment, it is assumed that resources satisfy the following conditions. Request resources only from tasks that have processors assigned to them. Whenever a task goes into a state where the processor cannot be assigned, such as when a task I / O is requested, the resource is released so that the task is occupied only by the task that is currently assigned the processor or is available and suspended. ing.
タスクの状態遷移は第2図に示すように行われる。タス
クは生成されるとレディ状態10.に入り、リソース非占
有実行状態11.で終了する(この処理は図示せず)。レ
ディ状態10.のタスクはタスクスケジューラによりリソ
ース非占有実行状態11.に入る。リソース非占有実行状
態11.のタスクがリソースを使用する時、リソース占有
処理が成功した場合はリソース占有実行状態12.に、失
敗した場合はリソース待ち状態13.に入る。リソース占
有実行状態12.でリソース解放時は、リソース解放処理
により他にリソース待ちタスクで使用可能なものがある
場合でディパッチフラグ20.がオンならレディ状態10.
に、そうでなければリソース非占有実行状態11.に入
る。リソース待ち状態13.のタスクはタスクスケジュー
ラにより選択された場合にリソース占有実行状態12.と
なる。リソース非占有実行状態11.、およびリソース占
有実行状態12.でタスク中断が発生した場合、中断処理
によりそれぞれレディ状態10.、およびリソース占有中
断状態14.に入る。リソース占有中断状態14.のタスクは
タスクスケジューラに選択された場合、リソース占有実
行状態12.に戻る。なお、第1図ではリソース占有中断
状態のタスクはリソース待ちキューの先頭に置かれる。The task state transition is performed as shown in FIG. When a task is created, it enters the ready state 10. and ends in the resource unoccupied execution state 11. (this process is not shown). The task in the ready state 10. enters the resource non-occupancy execution state 11. by the task scheduler. When a task in resource non-occupied execution state 11. uses a resource, it enters resource occupation execution state 12 if resource occupation processing succeeds, and enters resource wait state 13. if resource occupation processing fails. When the resources are released in the resource occupation execution state 12. and there is another resource waiting task that can be used by the resource release process, and the dispatch flag 20 is on, the ready state 10.
Otherwise, enter resource unoccupied execution state 11. A task in resource wait state 13. becomes resource exclusive execution state 12 when selected by the task scheduler. When a task is interrupted in the resource non-occupancy execution state 11. and the resource occupation execution state 12., the ready state 10. and the resource occupation interruption state 14. are entered by the interruption processing, respectively. When the task in resource occupation suspended state 14. is selected in the task scheduler, it returns to resource occupation execution state 12. In FIG. 1, the task in the resource occupancy suspended state is placed at the head of the resource waiting queue.
第3図に処理の流れを示すように、タスクスケジューラ
1.は、まず、リソース使用中フラグ2.を見て他のプロセ
ッサが当該リソースを使用中でなければリソース待ちキ
ュー3.の先頭のタスクを取り出しスケジュールする。ス
ケジュールすべきタスクがなければ、レディキュー4.よ
りタスクをスケジュールする。As shown in the processing flow in Fig. 3, the task scheduler
In 1., first, seeing the resource in-use flag 2. If another processor is not using the resource, the task at the head of the resource wait queue 3. is fetched and scheduled. If there is no task to schedule, schedule the task from Ready Queue 4.
タスクからリソースの占有解放を行う場合次のようにす
る。第4図に示すように占有要求時、リソース使用中フ
ラグがONならリソース待ちキュー3.へ入る。そしてタス
クスケジューラへ行く。When releasing the exclusive use of the resource from the task: As shown in FIG. 4, when the resource in-use flag is ON at the time of occupation request, the resource wait queue 3 is entered. Then go to the task scheduler.
解放時は第5図に示すように、ディスパッチフラグ20.
がONで他のリソース待ちキュー中のタスクがあるならば
自タスクを中断し、そのタスクを起動するためタスクス
ケジューラへ行く。When released, the dispatch flag 20.
If is on and there is another task in the resource waiting queue, the current task is interrupted and the task scheduler is started to activate the task.
タスク中断処理は第6図に示すように、タスクがリソー
スを使用中であればリソース待ちキューの先頭に、そう
でなければレディキューに入れる。As shown in FIG. 6, the task suspension processing puts the task at the head of the resource waiting queue if the task is using the resource, or puts it in the ready queue otherwise.
第7図はディスパッチフラグ20.の設定処理を示す。あ
らかじめ与えられたディスパッチ一回当たりのダイナミ
ックステップ数と、タスクの一回当たりのリソース占有
処理ステップ数+リソース非占有処理ステップ数の比
が、あらかじめ定められた比例定数よりも大きければデ
ィパッチフラグをオフに設定し、小さければオンに設定
する。FIG. 7 shows the setting process of the dispatch flag 20. If the ratio of the number of dynamic steps per dispatch given in advance and the number of resource occupation processing steps per task + resource non-occupancy processing steps is larger than a predetermined proportional constant, the dispatch flag is set. Set it to OFF, and if it is smaller, set it to ON.
本発明によれば、ディスパッチオーバーヘッドの小さい
時、リソースの競合による性能の低下を防止し、ディス
パッチオーバーヘッドの大きな時、逆にディスパッチを
防止することにより、システムのタスク処理能力を最大
にすることを可能にした。According to the present invention, when the dispatch overhead is small, it is possible to prevent the performance from deteriorating due to contention of resources, and when the dispatch overhead is large, on the contrary, to prevent the dispatch, thereby maximizing the task processing capacity of the system. I chose
第1図は本発明の一実施例によるタスクスケジューラの
処理概要図、第2図はタスクの状態遷移図、第3図はタ
スクスケジューラの処理の流れ図、第4図はリソース占
有時の処理の流れ図、第5図はリソース解放時の処理の
流れ図、第6図はタスク中断処理の流れ図、第7図はデ
ィスパッチフラッグ設定の処理の流れ図である。 〔符号の説明〕 1.タスクスケジューラ、2.リソース使用中フラグ、3.リ
ソース待ちキュー、4.レディキュー、5.リソーステーブ
ル、10.レディ状態、11.リソース非占有実行状態、12.
リソース占有実行状態、13.リソース待ち状態、14.リソ
ース占有中断状態、20.ディスパッチフラグ。FIG. 1 is a schematic diagram of a task scheduler process according to an embodiment of the present invention, FIG. 2 is a task state transition diagram, FIG. 3 is a task scheduler process flow diagram, and FIG. 4 is a process flow diagram when a resource is occupied. 5, FIG. 5 is a flow chart of processing when releasing resources, FIG. 6 is a flow chart of task interruption processing, and FIG. 7 is a flow chart of processing of dispatch flag setting. [Explanation of reference symbols] 1. Task scheduler, 2. Resource in-use flag, 3. Resource waiting queue, 4. Ready queue, 5. Resource table, 10. Ready state, 11. Unoccupied resource execution state, 12.
Resource occupancy execution status, 13. Resource wait status, 14. Resource occupancy suspended status, 20. Dispatch flag.
Claims (2)
するマルチプロセッサシステム上で、共通のリソースを
交互に排他使用する複数のタスクをスケジュールするた
めのタスクスケジュール方法において、プロセッサ上で
実行中のタスクが前記リソースの使用を終了したことに
応じて、タスク切り替えのオーバヘッドとタスクのリソ
ース占有、開放の一周期の処理のオーバヘッドとの比が
予め与えられた値を越えるか否か判定し、該判定の結
果、前記オーバヘッドの比が前記予め与えられた比より
も大きい場合に、前記リソースを開放したタスクを継続
して前記プロセッサ上で実行させ、前記オーバヘッドの
比が前記予め与えられた比よりも小さい場合に、前記タ
スクの実行を中断し、他のタスクを実行させることを特
徴とするタスクスケジュール方式。1. A task scheduling method for scheduling a plurality of tasks alternately using a common resource on a multiprocessor system having a plurality of processors sharing a main memory, the tasks being executed on the processor. Determines that the ratio of the overhead of task switching to the resource occupation of the task and the overhead of processing of one cycle of release exceeds a predetermined value in response to the termination of the use of the resource, and the determination is made. As a result, when the ratio of the overhead is larger than the predetermined ratio, the task releasing the resource is continuously executed on the processor, and the ratio of the overhead is larger than the predetermined ratio. If it is small, the task schedule is characterized in that the execution of the task is interrupted and another task is executed. Yuru system.
クが存在する場合、前記他のタスクとして、前記リソー
ス待ちのタスクを優先的に割り当てることを特徴とする
特許請求の範囲第1項記載のタスクスケジュール方式。2. The task according to claim 1, wherein when there is a task in the resource waiting state, the task waiting for the resource is preferentially assigned as the other task. Task scheduling method.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP25821086A JPH0782444B2 (en) | 1986-10-31 | 1986-10-31 | Task schedule method |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP25821086A JPH0782444B2 (en) | 1986-10-31 | 1986-10-31 | Task schedule method |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPS63113738A JPS63113738A (en) | 1988-05-18 |
| JPH0782444B2 true JPH0782444B2 (en) | 1995-09-06 |
Family
ID=17317044
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP25821086A Expired - Fee Related JPH0782444B2 (en) | 1986-10-31 | 1986-10-31 | Task schedule method |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH0782444B2 (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US12487849B2 (en) | 2022-05-17 | 2025-12-02 | Toyota Jidosha Kabushiki Kaisha | Resource management device, method, and computer program for resource management |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN121411409B (en) * | 2025-12-26 | 2026-03-13 | 大连致胜科技有限公司 | Intelligent test equipment cooperative control system for vehicle-mounted domain control |
-
1986
- 1986-10-31 JP JP25821086A patent/JPH0782444B2/en not_active Expired - Fee Related
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US12487849B2 (en) | 2022-05-17 | 2025-12-02 | Toyota Jidosha Kabushiki Kaisha | Resource management device, method, and computer program for resource management |
Also Published As
| Publication number | Publication date |
|---|---|
| JPS63113738A (en) | 1988-05-18 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US6779182B1 (en) | Real time thread dispatcher for multiprocessor applications | |
| JP2002063148A (en) | Multiple processor system | |
| JP2005508550A (en) | Method and apparatus for scheduling requests to a dynamic random access memory device | |
| JPH0782444B2 (en) | Task schedule method | |
| JP2667575B2 (en) | Task scheduling method | |
| JPH0644234B2 (en) | Task management device | |
| JPS636655A (en) | Task scheduling system | |
| JPS62290958A (en) | Task scheduling method | |
| JPH0640315B2 (en) | Central processing unit allocation control method | |
| JPH1074150A (en) | Process scheduling method, process scheduling apparatus and program storage medium therefor | |
| JPS63300326A (en) | Transaction execution schedule system | |
| JPS6316775B2 (en) | ||
| JPH0612394A (en) | Process schedule method | |
| JPH02204838A (en) | Task priority managing system | |
| JPH11249917A (en) | Parallel computers, their batch processing method, and storage medium | |
| JPH04162155A (en) | File transfer control system | |
| JPH0586574B2 (en) | ||
| WO1992003783A1 (en) | Method of implementing kernel functions | |
| JPH03182937A (en) | Task management mechanism of multitasking system | |
| JPS63301332A (en) | Job executing system | |
| JPH09282185A (en) | Real-time system and resource managing method for the same | |
| JPS62271147A (en) | Task control method | |
| JPS5924349A (en) | Task scheduling method for multitasking computer system | |
| JPH0128418B2 (en) | ||
| JPS6079461A (en) | Load dispersing system |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| LAPS | Cancellation because of no payment of annual fees |