JP2008015668A - Task management device - Google Patents
Task management device Download PDFInfo
- Publication number
- JP2008015668A JP2008015668A JP2006184412A JP2006184412A JP2008015668A JP 2008015668 A JP2008015668 A JP 2008015668A JP 2006184412 A JP2006184412 A JP 2006184412A JP 2006184412 A JP2006184412 A JP 2006184412A JP 2008015668 A JP2008015668 A JP 2008015668A
- Authority
- JP
- Japan
- Prior art keywords
- task
- task management
- executed
- instruction code
- main memory
- 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.)
- Pending
Links
- 230000015654 memory Effects 0.000 claims abstract description 133
- 238000007726 management method Methods 0.000 claims description 96
- 230000010365 information processing Effects 0.000 claims description 5
- 238000000034 method Methods 0.000 abstract description 24
- 230000008569 process Effects 0.000 description 7
- 238000010586 diagram Methods 0.000 description 4
- 230000004048 modification Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000000737 periodic effect Effects 0.000 description 2
- 230000004913 activation Effects 0.000 description 1
- 230000001934 delay Effects 0.000 description 1
- 230000007704 transition Effects 0.000 description 1
Images
Landscapes
- Memory System Of A Hierarchy Structure (AREA)
Abstract
【課題】キャッシュミスヒットを減らし、メモリアクセスを高速化することのできる技術を提供する。
【解決手段】タスク管理装置において、各タスクの実行開始時刻およびメインメモリ上における記憶位置(開始アドレスとサイズ)を記憶するタスク管理テーブルを用いて、タスクの実行制御を行う。そして、タスク管理テーブルに基づいて、タスクの実行開始までにタスクを構成する命令コードをプリフェッチするプリフェッチ部を備えることで、新たなタスクが実行状態になったときに、そのタスクの命令コードがキャッシュメモリ上に取り込まれていることになるため、キャッシュミスヒットを減らすことができる。
【選択図】図5A technique capable of reducing cache miss hits and speeding up memory access is provided.
In a task management device, task execution control is performed using a task management table that stores the execution start time of each task and the storage location (start address and size) on the main memory. Based on the task management table, a prefetch unit that prefetches the instruction code constituting the task before the start of the task execution is provided, so that when a new task enters the execution state, the instruction code of the task is cached. Since it is taken in the memory, cache miss hits can be reduced.
[Selection] Figure 5
Description
本発明は、タスク管理装置に関する。 The present invention relates to a task management device.
一般に、情報処理装置においては、RAMなどの主メモリに記憶された命令コードおよびデータを読み出して、CPU(中央演算処理装置)がその命令コードを解釈して読み込んだデータに対して処理を実行する。CPUから主メモリへのアクセスは、CPUの命令実行速度に比べて格段に遅い。したがって、CPUが毎回主メモリから命令コードとデータ(ここでは、両方を区別せずに単にデータという)を読み込むと、CPUはメモリアクセスの間待ち状態となってしまい処理速度が向上しない。そこで、CPUと主メモリの間に、キャッシュメモリを設けることが一般的である。キャッシュメモリには、主メモリよりも高速なアクセスが可能なメモリが使用される。頻繁に使用されるデータを高速アクセスが可能なキャッシュメモリに一時的に格納することで、CPUは低速な主メモリにアクセスすることなくキャッシュメモリからデータを読み込むことができるので処理速度の向上が図れる。 In general, in an information processing apparatus, an instruction code and data stored in a main memory such as a RAM are read, and a CPU (central processing unit) interprets the instruction code and executes processing on the read data. . Access from the CPU to the main memory is much slower than the instruction execution speed of the CPU. Therefore, when the CPU reads an instruction code and data (here, simply referred to as data without distinguishing both) from the main memory each time, the CPU enters a waiting state during memory access, and the processing speed does not improve. Therefore, it is common to provide a cache memory between the CPU and the main memory. As the cache memory, a memory that can be accessed at a higher speed than the main memory is used. By temporarily storing frequently used data in a cache memory that can be accessed at high speed, the CPU can read data from the cache memory without accessing the low-speed main memory, thereby improving the processing speed. .
逆に、キャッシュメモリに読み込まれていないデータにアクセスする場合、すなわちキャッシュミスヒットが発生した場合には、主メモリまでアクセスする必要があるため処理速度が遅くなってしまう。このようなキャッシュミスヒットを回避することで、メモリアクセスの高速化が図られ、処理速度が向上する。 Conversely, when accessing data that has not been read into the cache memory, that is, when a cache miss occurs, the processing speed is slowed down because the main memory must be accessed. By avoiding such a cache miss hit, the memory access speed is increased and the processing speed is improved.
CPUが次に必要とするデータがあらかじめ分かっている場合には、そのデータをキャッシュメモリに取り込んでおけば、キャッシュミスヒットを回避することができる。このように、あらかじめキャッシュメモリに必要なデータを取り込む処理をプリフェッチ(pre-fetch)という。 If the CPU knows in advance what data it needs next, it can avoid cache misses by fetching the data into the cache memory. In this manner, processing for fetching necessary data in the cache memory in advance is called pre-fetch.
プリフェッチによって高速なデータアクセスが可能となるが、一般に次に必要となるデータが確実には分からない。そこで、次に必要となる可能性が高いデータをとりあえずプリフェッチすることになる。しかしながら、キャッシュメモリとして使用される高速なアクセスが可能なメモリは高価であるため主メモリに比較して容量が小さい。したがって、無駄なプリフェッチを行ってしまうと、本当に必要なデータがキャッシュメモリから追い出されてしまう場合がある。つまり、キャッシュメモリを有効に活用するためには、次に必要となるデータを予測して、必要なだけのデータをプリフェッチすることが重要である。 Although prefetch enables high-speed data access, generally the next required data is not surely known. Therefore, data that is likely to be required next is prefetched for the time being. However, a high-speed accessible memory used as a cache memory is expensive and has a smaller capacity than the main memory. Therefore, if unnecessary prefetching is performed, there is a case where really necessary data is evicted from the cache memory. In other words, in order to effectively use the cache memory, it is important to predict the next necessary data and prefetch only the necessary data.
このような技術として、特許文献1には、実行待ち状態のタスクに対応するデータ(命令コードおよびデータ)を、このタスクが実行中状態に遷移する前に、主メモリからプリフェッチする技術が開示されている。また、特許文献2には、割り込み処理の中で、制御モードの切替までにキャッシュの入れ替えが終了することを保証するリアルタイム制御システムが開示されている。
本発明は、キャッシュミスヒットを減らし、メモリアクセスを高速化することのできる技術を提供することを目的とする。 An object of the present invention is to provide a technique capable of reducing cache miss hits and speeding up memory access.
上記目的を達成するために本発明では、以下の手段または処理によってタスクの管理および該タスクを構成する命令コードのプリフェッチを行う。 In order to achieve the above object, in the present invention, the following means or processing is used to manage tasks and prefetch instruction codes constituting the tasks.
本発明に係るタスク管理装置は、ハードウェアとして主メモリとキャッシュメモリとを有する。キャッシュメモリは、主メモリよりも高速なアクセスが可能なメモリである。主メモリに格納されている命令コードをキャッシュメモリに格納しておくことで、この命令コードに対しては高速なアクセスが可能となる。 The task management device according to the present invention has a main memory and a cache memory as hardware. The cache memory is a memory that can be accessed faster than the main memory. By storing the instruction code stored in the main memory in the cache memory, the instruction code can be accessed at high speed.
本発明に係るタスク管理装置は、さらに、タスク管理テーブルとタスク管理手段とプリフェッチ手段とを有する。 The task management apparatus according to the present invention further includes a task management table, task management means, and prefetch means.
タスク管理テーブルには、実行予定の複数のタスクについて、各タスクの実行開始時刻および各タスクを構成する命令コードの主メモリにおける記憶位置とが記憶される。なお、命令コードの記憶位置は、その記憶位置の開始アドレスおよびコードサイズ(容量)として、タスク管理テーブルに記憶されることが好適である。 The task management table stores the execution start time of each task and the storage location of the instruction code constituting each task in the main memory for a plurality of tasks scheduled to be executed. The storage location of the instruction code is preferably stored in the task management table as the start address and code size (capacity) of the storage location.
タスク管理手段は、タスク管理テーブルに記憶されたタスクの実行開始時刻にしたがって、タスクの実行を制御する。すなわち、あるタスクの実行開始時刻になると、タスク管理手段は、それまで実行されていたタスクの実行を中断し、新しいタスクを実行する。このように、タスク管理手段は、タスク管理テーブルに記憶されているスケジュールにしたがって、複数のタスクの実行を制御する。 The task management means controls task execution according to the task execution start time stored in the task management table. That is, when the execution start time of a certain task comes, the task management means interrupts the execution of the task that has been executed so far and executes a new task. Thus, the task management means controls the execution of a plurality of tasks according to the schedule stored in the task management table.
プリフェッチ手段は、実行が予定されているタスクについて、タスク管理テーブルに記憶されたタスクの命令コードの記憶位置に基づいて、命令コードを主メモリからキャッシュメモリにあらかじめ取り込む(プリフェッチする)。なお、プリフェッチ手段は、実行予定のタスクについて、そのタスクを構成する命令コードを全てプリフェッチすることが好適である。 The prefetch means fetches the instruction code from the main memory into the cache memory in advance (prefetch) based on the storage position of the instruction code of the task stored in the task management table for the task scheduled to be executed. It is preferable that the prefetch means prefetches all instruction codes constituting the task with respect to the task to be executed.
このように、本発明に係るタスク管理装置によれば、今後実行されるタスクについて、そのタスクの命令コードがキャッシュメモリにプリフェッチされることになるので、キャッシュミスヒットを減らすことができる。したがって、本発明に係るタスク管理装置によれば、メモリアクセスが高速化され、処理効率が向上することになる。 As described above, according to the task management device of the present invention, for a task to be executed in the future, the instruction code of the task is prefetched into the cache memory, so that cache misses can be reduced. Therefore, according to the task management device of the present invention, the memory access is speeded up and the processing efficiency is improved.
ここで、プリフェッチ手段は、実行するタスクをタスク管理手段が切り替える際に、新たに実行するタスクの命令コードをプリフェッチしても良い。 Here, the prefetch means may prefetch the instruction code of the task to be newly executed when the task management means switches the task to be executed.
また、プリフェッチ手段は、実行するタスクをタスク管理手段が切り替える際に、そのタスクより後に実行するタスクの命令コードをプリフェッチしても良い。 The prefetch means may prefetch the instruction code of a task to be executed after the task when the task management means switches the task to be executed.
また、プリフェッチ手段が一度にプリフェッチする命令コードは、1つのタスクの命令コードである必要はない。すなわち、プリフェッチ手段は、実行するタスクをタスク管理手段が切り替える際に、今後実行する複数のタスクの命令コードをまとめてプリフェッチしても良い。この場合、まとめてプリフェッチするタスクの数は、タスクを構成する命令コードサイズの合計と、キャッシュメモリの容量とに基づいて定められることが好適である。 Further, the instruction code that the prefetch means prefetches at a time need not be the instruction code of one task. That is, the prefetch means may prefetch the instruction codes of a plurality of tasks to be executed in the future when the task management means switches the tasks to be executed. In this case, it is preferable that the number of tasks to be prefetched collectively is determined based on the sum of the instruction code sizes constituting the tasks and the capacity of the cache memory.
また、本発明に係るタスク管理装置は、マルチプロセッサシステムまたはマルチコアシステムとして構成されても良い。この場合、1つのプロセッサまたはプロセッサコアがタ
スク管理手段およびプリフェッチ手段の実行に割り当てられ、他のプロセッサまたはプロセッサコアがタスクの実行に割り当てられることが好ましい。このように、マルチプロセッサシステムまたはマルチコアシステムでは、タスク管理手段およびプリフェッチ手段とタスクとが並列に動作可能なので、タスク管理手段およびプリフェッチ手段を常時実行しておくことができる。したがって、タスクの命令コードに関するキャッシュミスヒットを最小限にすることが可能となる。
The task management apparatus according to the present invention may be configured as a multiprocessor system or a multicore system. In this case, it is preferable that one processor or processor core is assigned to the execution of the task management means and the prefetch means, and another processor or processor core is assigned to the execution of the task. As described above, in the multiprocessor system or the multi-core system, the task management unit and the prefetch unit and the task can operate in parallel, so that the task management unit and the prefetch unit can be always executed. Therefore, it is possible to minimize the cache miss hit related to the instruction code of the task.
なお、本発明に係るタスク管理装置のキャッシュメモリは、多階層のキャッシュメモリとして構成することが可能である。この場合、命令コードをキャッシュメモリに取り込む(プリフェッチする)とは、多階層のキャッシュメモリのうちの少なくともいずれかのキャッシュメモリに、その命令コードを取り込むことをいう。 Note that the cache memory of the task management apparatus according to the present invention can be configured as a multi-level cache memory. In this case, fetching the instruction code into the cache memory (prefetching) means fetching the instruction code into at least one of the multi-level cache memories.
なお、本発明は、上記手段の少なくとも一部を有するタスク管理装置として捉えることができる。また、本発明は、上記処理の少なくとも一部を含むタスク管理方法、または、かかる方法を実現するためのプログラムとして捉えることもできる。上記手段および処理の各々は可能な限り互いに組み合わせて本発明を構成することができる。 The present invention can be understood as a task management device having at least a part of the above means. The present invention can also be understood as a task management method including at least a part of the above processing, or a program for realizing the method. Each of the above means and processes can be combined with each other as much as possible to constitute the present invention.
例えば、本発明の一態様としてのタスク管理方法は、主メモリとキャッシュメモリとを有する情報処理装置が行うタスク管理方法であって、実行予定の複数のタスクについて、各タスクの実行開始時刻および該タスクを構成する命令コードの前記主メモリにおける記憶位置をタスク管理テーブルに記憶するステップと、前記タスク管理テーブルに記憶されたタスクの実行開始時刻にしたがって、タスクの実行を制御するステップと、実行予定のタスクについて、前記タスク管理テーブルに記憶された該タスクの命令コードの記憶位置に基づいて、該命令コードを前記主メモリから前記キャッシュメモリにあらかじめ取り込むステップと、を含むことを特徴とする。 For example, a task management method as one aspect of the present invention is a task management method performed by an information processing apparatus having a main memory and a cache memory, and for a plurality of tasks scheduled to be executed, A step of storing a storage position of an instruction code constituting a task in the main memory in a task management table; a step of controlling execution of the task according to a task execution start time stored in the task management table; And fetching the instruction code from the main memory into the cache memory in advance based on the storage position of the instruction code of the task stored in the task management table.
また、本発明の一態様としてのタスク管理プログラムは、主メモリとキャッシュメモリとを有する情報処理装置に対して、実行予定の複数のタスクについて、各タスクの実行開始時刻および該タスクを構成する命令コードの前記主メモリにおける記憶位置をタスク管理テーブルに記憶するステップと、前記タスク管理テーブルに記憶されたタスクの実行開始時刻にしたがって、タスクの実行を制御するステップと、実行予定のタスクについて、前記タスク管理テーブルに記憶された該タスクの命令コードの記憶位置に基づいて、該命令コードを前記主メモリから前記キャッシュメモリにあらかじめ取り込むステップと、を実行させることを特徴とする。 In addition, the task management program as one aspect of the present invention is directed to an information processing apparatus having a main memory and a cache memory. The step of storing the storage location of the code in the main memory in a task management table, the step of controlling the execution of the task according to the execution start time of the task stored in the task management table, and the task scheduled to be executed, Based on the storage location of the instruction code of the task stored in the task management table, a step of prefetching the instruction code from the main memory into the cache memory is executed.
本発明によれば、キャッシュミスヒットを減らし、メモリアクセスを高速化することが可能となる。 According to the present invention, it is possible to reduce cache miss hits and increase memory access speed.
以下に図面を参照して、この発明の好適な実施の形態を例示的に詳しく説明する。 Exemplary embodiments of the present invention will be described in detail below with reference to the drawings.
<構成>
図1は、本実施形態に係るタスク管理装置のハードウェア構成を示す図である。タスク管理装置1は、CPU(中央演算処理装置)2、RAMなどのメインメモリ3、ハードディスク装置などの補助記憶装置4、キーボードやマウスなどの入力装置5、およびディスプレイなどの出力装置6を備える。これらの各装置は、バス7によって接続されている。
<Configuration>
FIG. 1 is a diagram illustrating a hardware configuration of a task management apparatus according to the present embodiment. The
図2は、CPU2のより詳しい構成を示す図である。CPU2は、命令コードを解釈して処理を実行するプロセッサコア21、およびキャッシュメモリ22を有する。
FIG. 2 is a diagram showing a more detailed configuration of the
キャッシュメモリ22およびメインメモリ3に対するアクセス速度は、キャッシュメモリ22に対するアクセス速度の方がメインメモリ3に対するアクセス速度よりも速い。逆に、メモリ容量は、メインメモリ3のメモリ容量の方がキャッシュメモリ22のメモリの容量よりも多い。
Regarding the access speed to the
CPU2は、メインメモリ3から命令コードを読み込むときには、キャッシュメモリ22内にその命令コードがすでに取り込まれているか判断し、すでに取り込まれている場合にはキャッシュメモリ22からその命令コードを読み込む。一方、キャッシュメモリ22内にその命令コードが取り込まれていない場合には、メインメモリ3からその命令コードを読み込むとともに、キャッシュメモリ22内に取り込む。このように、高速なキャッシュメモリを利用して、メインメモリ3に対するアクセスを減らして、メモリアクセスに要する処理時間を減らしている。
When reading the instruction code from the
次に、本実施形態に係るタスク管理装置1の機能部について説明する。図3は、本実施形態に係るタスク管理装置1の機能ブロックを示す図である。タスク管理装置1は、タスクスケジューラ101、タスク管理テーブル102、プリフェッチ部103、および複数のタスク104から構成される。タスクスケジューラ101は、タスク管理テーブル102にしたがって、CPU2がどのタスクを実行するのかを制御する。
Next, functional units of the
本実施形態に係るタスク管理装置1は、どのような具体的なスケジューリングアルゴリズムにしたがって、タスクのスケジューリングを行っても構わない。例えば、スケジューリングアルゴリズムとして、周期的なタスクにおいてタスクの起動からデッドラインまでの時間が短いタスクを優先的に実行するDM法(Deadline Monotonic)を用いることができる。また、スケジューリングアルゴリズムとして、周期的なタスクにおいてタスクの実行周期が短いタスクほど優先的に実行するRM法(Rate Monotonic)を用いることもできる。また、スケジューリングアルゴリズムとして、タスクのデッドラインが最も近いものから優先的に実行するEDF法(Earliest Deadline First)を用いることもできる。ま
た、その他どのようなスケジューリングアルゴリズムを用いても良い。いずれの場合も、タスクスケジューラ101は、タスク管理テーブル102にしたがってタスクの実行を制御する。
The
図4(a)は、タスク管理テーブル102のテーブル構造を示す図である。タスク管理テーブル102は、実行するタスクの、タスクID41、実行開始時刻42、そのタスクを構成する命令コードのメインメモリ3における記憶位置の開始アドレス43、およびそのタスクを構成する命令コードのコードサイズ44を格納する。すなわち、タスク管理テーブルには、各タスクについて、そのタスクをいつ実行するのかと、そのタスクを構成する命令コードのメインメモリ3における記憶位置が格納される。
FIG. 4A shows a table structure of the task management table 102. The task management table 102 includes a task ID 41, an execution start time 42 of the task to be executed, a start address 43 of a storage location of the instruction code constituting the task in the
図4(b)は、図4(a)のタスク管理テーブルにしたがったタスクのスケジューリングを説明する図である。図4(b)に示すように、図4(a)のタスク管理テーブルにしたがうと、時刻t1においてタスクAが実行され、時刻t2においてタスクBが、時刻t3においてタスクAが、時刻t4においてタスクCが、時刻t5においてタスクBが実行される。 FIG. 4B is a diagram illustrating task scheduling according to the task management table of FIG. As shown in FIG. 4B, according to the task management table of FIG. 4A, task A is executed at time t1, task B at time t2, task A at time t3, task A at time t4. C executes task B at time t5.
プリフェッチ部103は、プリフェッチ命令を実行して、メインメモリ3上に格納されている命令コードをキャッシュメモリ22上に取り込む処理を行う。プリフェッチ部103は、タスクスケジューラ101からの指示にしたがって、今後実行する予定のタスク104を構成する命令コードを、メインメモリ3からキャッシュメモリ22に取り込む処理を行う。具体的な処理については後述する。
The prefetch unit 103 executes a prefetch instruction and performs a process of fetching an instruction code stored in the
タスクスケジューラ101およびプリフェッチ部103は、補助記憶装置4に格納されたプログラムがメインメモリ3にロードされCPU2によって実行されることによって、その機能が実現される。また、タスク管理テーブル102はメインメモリ3上に構築(格納)されるものである。なお、タスク管理テーブル102はメインメモリ3上に格納されるデータであるため、キャッシュメモリ22上に取り込まれることもある。また、タスク104は、プログラムであって補助記憶装置4からメインメモリ3にロードされるものであり、それ自体CPU2によって実行されるものである。
The functions of the
<処理フロー>
図5に示す処理は、タスクスケジューラ101およびプリフェッチ部103が行う処理である。この処理ルーチンは所定の間隔で定期的に実行される。まず、タスクスケジューラ101が実行状態になると、タスク管理テーブル102に基づいて、実行するタスクの切替が発生したか否かを判定する(S10)。すなわち、タスク管理テーブル102に格納されている実行開始時刻42が到来したタスクが存在するか否かを判定する。タスクの切替が発生していない場合(S10−NO)は、この処理ルーチンを抜ける。タスクの切替が発生した場合(S10−YES)には、プリフェッチ部103がプリフェッチする対象とするタスクを決定する(S11)。
<Processing flow>
The process illustrated in FIG. 5 is a process performed by the
プリフェッチ部103がプリフェッチの対象とするタスクを決定する方法には、以下の方法が考えられる。 The following method can be considered as a method for the prefetch unit 103 to determine a task to be prefetched.
1.このルーチンにおいてタスクスケジューラが実行状態にするタスクをプリフェッチする。この方法によれば、次に実行状態になるタスクの命令コードがキャッシュメモリ22に格納されることにより、実行するタスクの命令コードをキャッシュメモリ22から取得することが可能となる。
1. In this routine, the task to be executed by the task scheduler is prefetched. According to this method, the instruction code of the task to be executed next is stored in the
2.このルーチンにおいてタスクスケジューラが実行状態にするタスクより後に実行状態にするタスクをプリフェッチする。この場合、今回実行状態にするタスクの次に実行状態にするタスクをプリフェッチの対象としても良く、所定回後に実行状態にするタスクをプリフェッチの対象としても良い。実行するタスクの順序はタスク管理テーブル102に格納されているので、プリフェッチ部103はタスク管理テーブル102を参照することで所定回後に実行状態にするタスクを判定することができる。 2. In this routine, a task to be executed is prefetched after a task to be executed by the task scheduler. In this case, a task to be executed next to a task to be executed this time may be a prefetch target, and a task to be executed after a predetermined number of times may be a prefetch target. Since the order of tasks to be executed is stored in the task management table 102, the prefetch unit 103 can determine a task to be executed after a predetermined number of times by referring to the task management table 102.
この方法によれば、命令コードのプリフェッチに時間がかかる場合であっても、実際にタスクが実行状態になる前からプリフェッチが行われているので、タスクが実行状態になったときにはそのタスクの命令コードがキャッシュメモリに格納されていることになる。 According to this method, even if it takes a long time to prefetch the instruction code, prefetching is performed before the task actually enters the execution state. Therefore, when the task enters the execution state, the instruction of the task The code is stored in the cache memory.
3.現在時刻より後の所定の時間帯の間に実行されるタスク、すなわち現在時刻からT1秒後より後であってT2秒後よりも前に実行が開始されるタスクをプリフェッチの対象とすることもできる。タスク管理テーブル102に各タスクの開始時刻が格納されているので、プリフェッチ部103はタスク管理テーブル102を参照することで、所定の時間帯に実行状態にするタスクを判定することができる。 3. A task executed during a predetermined time zone after the current time, that is, a task that starts after T1 seconds after the current time and starts before T2 seconds may be prefetched. it can. Since the start time of each task is stored in the task management table 102, the prefetch unit 103 can determine a task to be executed in a predetermined time zone by referring to the task management table 102.
この方法によっても上記2の方法と同様の効果が得られる。また、タスクが実行状態となる時間を基準としてプリフェッチの対象とするタスクを決定しているため、タスクの実行が開始されるまでにより確実にキャッシュメモリ22に取り込む制御が可能となる。
By this method, the same effect as the
4.今後実行状態にする複数のタスクをプリフェッチの対象としても良い。この場合、プリフェッチの対象となるタスクの数は、タスクを構成する命令コードの合計が所定の閾
値以内となるように選択する。所定の閾値は、キャッシュメモリ22のサイズ以内である必要がある。なお、キャッシュメモリ22に命令コードとデータの両方が取り込まれる場合には、全てを命令コードで満たすことは好ましくないので、キャッシュメモリ22の所定の割合の容量を閾値とすることが好ましい。
4). A plurality of tasks to be executed in the future may be prefetched. In this case, the number of tasks to be prefetched is selected so that the total number of instruction codes constituting the task is within a predetermined threshold. The predetermined threshold needs to be within the size of the
具体的には、今回のルーチンで実行状態にするタスクをT0、そのn回後に実行状態にするタスクをTn、タスクTiの命令コードのサイズをS(Ti)、上述の所定の閾値をSとすると、以下の数1を満たす最大のNを求め、T0〜TNをプリフェッチの対象とすることができる。
Specifically, the task to be executed in the current routine is T 0 , the task to be executed n times after that is T n , the instruction code size of task T i is S (T i ), Assuming that the threshold is S, the maximum N satisfying the
また、ここではT0以降のタスクをプリフェッチの対象としているが、kを所定の整数として、Tk〜TNをプリフェッチの対象としても良い(Nは上記と同様にして求める)。 In addition, although tasks after T 0 are prefetched here, k may be a predetermined integer and T k to T N may be prefetched (N is obtained in the same manner as described above).
この方法によっても確実にキャッシュメモリ22に今後実行する予定のタスクを構成する命令コードが取り込まれることになる。なお、この方法では多くの命令コードをキャッシュメモリ22にプリフェッチすることになるが、すでにキャッシュメモリ22上に取り込まれている命令コードに対してプリフェッチ命令を発行しても無視されるだけなので、処理が非効率となることはない。
Also by this method, the instruction code constituting the task scheduled to be executed in the future is surely taken into the
プリフェッチ部103は、上記のいずれかの方法によってプリフェッチの対象とするタスクを決定する。次に、プリフェッチ部103は、プリフェッチの対象としたタスクを構成する命令コードをキャッシュメモリ22に取り込むプリフェッチ命令を発行する(S12)。タスク管理テーブル102には、各タスクのメインメモリ3における記憶位置、すなわち開始アドレスとコードサイズが格納されているので、プリフェッチ部103はタスク管理テーブル102を参照することで、メインメモリ3のどのメモリ領域をプリフェッチすればよいのか判断することができる。
The prefetch unit 103 determines a task to be prefetched by any of the methods described above. Next, the prefetch unit 103 issues a prefetch instruction for fetching the instruction code constituting the task to be prefetched into the cache memory 22 (S12). Since the task management table 102 stores the storage location of each task in the
最後に、タスクスケジューラ101は、実行状態にするタスクの切替を行う(S13)。ここで、実行状態にするタスクの命令コードはプリフェッチ部103によって、すでにキャッシュメモリ22にプリフェッチされているので、CPUは切り替えるタスクの命令コードに対して高速にアクセスすることが可能である。
Finally, the
<実施形態の効果>
本実施形態に係るタスク管理装置によれば、タスクが実行状態になる前までに、そのタスクを構成する命令コードをキャッシュメモリにプリフェッチすることが可能となる。したがって、キャッシュミスヒットを回避することができ、タスク切替時のメモリアクセスによる実行遅延を減少させることができる。
<Effect of embodiment>
According to the task management device according to the present embodiment, it is possible to prefetch the instruction code constituting the task into the cache memory before the task enters the execution state. Therefore, cache miss hits can be avoided, and execution delays due to memory access during task switching can be reduced.
また、タスクの実行順序を管理するタスク管理テーブルに基づいてプリフェッチする命令コードを決定しているため、プリフェッチしたが実際にはCPUに読み込まれないという状況が発生せず、効率的なプリフェッチを行うことができる。 In addition, since the instruction code to be prefetched is determined based on the task management table that manages the task execution order, a situation in which prefetching is not actually read into the CPU does not occur, and efficient prefetching is performed. be able to.
また、タスクスケジューラ101とプリフェッチ部103が、どのタイミングでどの命令コードをプリフェッチするかを判断しているため、プログラム作成者が(タスクの)プ
ログラムの中に明示的にキャッシュ制御に関する処理コードを書く必要がなく、プログラム作成者の負担も軽減することができる。
In addition, since the
<変形例1>
本実施形態におけるCPU2は1階層のキャッシュメモリ22のみを有していたが、CPU1は複数階層のキャッシュメモリを有していても良い。この場合、プリフェッチ部103は、特定の階層のキャッシュメモリまで命令コードがプリフェッチされることを目的とする制御を行う。例えば、L1キャッシュとL2キャッシュの2階層のキャッシュ構成をとる場合、プリフェッチ部103は命令コードをL1キャッシュまでプリフェッチしても良く、L2キャッシュまでしかプリフェッチしなくても良い。3階層以上のキャッシュ構成の場合も同様である。
<
Although the
<変形例2>
本実施形態において、タスク管理装置1はCPU2を1つのみしか有しなかったが、複数個のCPUを有するマルチプロセッサシステムとして構成されても良い。この場合、CPUの外部に設置されたキャッシュメモリをこれら複数個のCPUが共用することが好ましい。具体的な構成を図6に示す。図6では、CPU201とCPU202とが、外部キャッシュ203を共用している。CPU201およびCPU202はその内部にキャッシュメモリを有するが、プリフェッチ部103は、外部キャッシュ203に命令コードをプリフェッチする命令を発行する。これによって、CPU201がプリフェッチした命令コードをCPU202でも利用することが可能である。なお、CPUの数は2つである必要はなく、3つ以上であっても構わない。
<
In the present embodiment, the
また、タスク管理装置1は、マルチコアシステムとして構成されても良い。すなわち、CPU2が複数のプロセッサコアを有するように構成されても良い。マルチコアシステムには様々な形態が考えられるが、その一例を図7に示す。図7に示すように、CPU2は1つのパッケージ内に、2つのプロセッサコア21a,21bを有し、それぞれがキャッシュメモリ22を共用している。なお、プロセッサコアの数は2つである必要はなく、3つ以上であっても構わない。
Further, the
なお、タスク管理装置1をマルチプロセッサシステムまたはマルチコアシステムとして構成した場合、あるプロセッサまたはプロセッサコアを、タスクスケジューラ101およびプリフェッチ部103を実行するために専用に割り当てることが好ましい。この構成によれば、タスクスケジューラ101とプリフェッチ部103を常時起動しておくことが可能となるため、命令コードのプリフェッチを遅滞なく行うことができ、命令コードに関するキャッシュミスヒットを最小限にすることが可能となる。
When the
<変形例3>
本実施形態においては、タスクスケジューラ101とプリフェッチ部103は、CPU2がプログラムを実行することによってその機能が実現されたが、タスクスケジューラ101とプリフェッチ部103は専用のチップとして構成されても構わない。この場合も、プリフェッチ部103は、タスクを実行するCPU2に接続されたキャッシュメモリ22に対してタスクを構成する命令コードをプリフェッチする。
<
In this embodiment, the functions of the
1 タスク管理装置
2 CPU
3 メインメモリ
4 補助記憶装置
5 入力装置
6 出力装置
7 バス
21 プロセッサコア
22 キャッシュメモリ
1
3
Claims (9)
実行予定の複数のタスクについて、各タスクの実行開始時刻および該タスクを構成する命令コードの前記主メモリにおける記憶位置を記憶するタスク管理テーブルと、
前記タスク管理テーブルに記憶されたタスクの実行開始時刻にしたがって、タスクの実行を制御するタスク管理手段と、
実行予定のタスクについて、前記タスク管理テーブルに記憶された該タスクの命令コードの記憶位置に基づいて、該命令コードを前記主メモリから前記キャッシュメモリにあらかじめ取り込むプリフェッチ手段と、
を有することを特徴とするタスク管理装置。 A task management device having a main memory and a cache memory,
For a plurality of tasks scheduled to be executed, a task management table that stores the execution start time of each task and the storage location of the instruction code constituting the task in the main memory;
Task management means for controlling task execution according to the task execution start time stored in the task management table;
Prefetch means for pre-fetching the instruction code from the main memory into the cache memory based on the storage position of the instruction code of the task stored in the task management table for the task to be executed;
A task management device comprising:
ことを特徴とする請求項1に記載のタスク管理装置。 The task management apparatus according to claim 1, wherein a storage location of the instruction code stored in the task management table in the main memory is stored as a start address and a size of the instruction code.
ことを特徴とする請求項1または2に記載のタスク管理装置。 3. The task according to claim 1, wherein the prefetch unit fetches an instruction code of a task to be newly executed from the main memory into the cache memory when the task management unit switches execution tasks. 4. Management device.
ことを特徴とする請求項1または2に記載のタスク管理装置。 The prefetch means fetches an instruction code of a task to be executed after a newly executed task from the main memory into the cache memory when the task management means switches execution tasks. 2. The task management device according to 2.
ことを特徴とする請求項1または2に記載のタスク管理装置。 The said prefetch means fetches the instruction codes of a plurality of tasks to be executed in the future from the main memory into the cache memory when the task management means switches execution tasks. Task management device.
前記タスク管理手段および前記プリフェッチ手段は、前記第1のプロセッサによって実行され、
タスクは、前記第2のプロセッサによって実行される
ことを特徴とする請求項1〜5のいずれかに記載のタスク管理装置。 The task management device has at least first and second processors,
The task management means and the prefetch means are executed by the first processor,
The task is executed by the second processor. The task management device according to claim 1, wherein the task is executed by the second processor.
前記タスク管理手段および前記プリフェッチ手段は、前記第1のプロセッサコアによって実行され、
タスクは、前記第2のプロセッサコアによって実行される
ことを特徴とする請求項1〜5のいずれかに記載のタスク管理装置。 The task management device has a processor including at least first and second processor cores,
The task management means and the prefetch means are executed by the first processor core,
The task is executed by the second processor core. The task management device according to claim 1, wherein the task is executed by the second processor core.
実行予定の複数のタスクについて、各タスクの実行開始時刻および該タスクを構成する命令コードの前記主メモリにおける記憶位置をタスク管理テーブルに記憶するステップと、
前記タスク管理テーブルに記憶されたタスクの実行開始時刻にしたがって、タスクの実行を制御するステップと、
実行予定のタスクについて、前記タスク管理テーブルに記憶された該タスクの命令コー
ドの記憶位置に基づいて、該命令コードを前記主メモリから前記キャッシュメモリにあらかじめ取り込むステップと、
を含むことを特徴とするタスク管理方法。 A task management method performed by an information processing apparatus having a main memory and a cache memory,
For a plurality of tasks scheduled to be executed, storing in the task management table the execution start time of each task and the storage location of the instruction code constituting the task in the main memory;
Controlling the execution of the task according to the execution start time of the task stored in the task management table;
Pre-fetching the instruction code from the main memory into the cache memory based on the storage position of the instruction code of the task stored in the task management table for the task to be executed;
A task management method comprising:
実行予定の複数のタスクについて、各タスクの実行開始時刻および該タスクを構成する命令コードの前記主メモリにおける記憶位置をタスク管理テーブルに記憶するステップと、
前記タスク管理テーブルに記憶されたタスクの実行開始時刻にしたがって、タスクの実行を制御するステップと、
実行予定のタスクについて、前記タスク管理テーブルに記憶された該タスクの命令コードの記憶位置に基づいて、該命令コードを前記主メモリから前記キャッシュメモリにあらかじめ取り込むステップと、
を実行させることを特徴とするタスク管理プログラム。 For an information processing apparatus having a main memory and a cache memory,
For a plurality of tasks scheduled to be executed, storing in the task management table the execution start time of each task and the storage location of the instruction code constituting the task in the main memory;
Controlling the execution of the task according to the execution start time of the task stored in the task management table;
Pre-fetching the instruction code from the main memory into the cache memory based on the storage position of the instruction code of the task stored in the task management table for the task to be executed;
A task management program characterized by causing
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2006184412A JP2008015668A (en) | 2006-07-04 | 2006-07-04 | Task management device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2006184412A JP2008015668A (en) | 2006-07-04 | 2006-07-04 | Task management device |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2008015668A true JP2008015668A (en) | 2008-01-24 |
Family
ID=39072636
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2006184412A Pending JP2008015668A (en) | 2006-07-04 | 2006-07-04 | Task management device |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2008015668A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2014225088A (en) * | 2013-05-15 | 2014-12-04 | オリンパス株式会社 | Arithmetic unit |
JP2016509320A (en) * | 2013-03-05 | 2016-03-24 | インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation | Computer system, computer program, and computer-implemented method for prefetching data |
JP2016513829A (en) * | 2013-03-05 | 2016-05-16 | インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation | Computer system, computer program, and computer-implemented method for prefetching data on a chip |
JP7590852B2 (en) | 2020-11-13 | 2024-11-27 | 株式会社日立製作所 | Storage control system and storage control method |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2002259209A (en) * | 2001-03-01 | 2002-09-13 | Oki Electric Ind Co Ltd | Arithmetic processing system |
JP2005100034A (en) * | 2003-09-24 | 2005-04-14 | Matsushita Electric Ind Co Ltd | Information processing control system |
WO2005106623A1 (en) * | 2004-04-28 | 2005-11-10 | Matsushita Electric Industrial Co., Ltd. | Cpu clock control device, cpu clock control method, cpu clock control program, recording medium, and transmission medium |
-
2006
- 2006-07-04 JP JP2006184412A patent/JP2008015668A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2002259209A (en) * | 2001-03-01 | 2002-09-13 | Oki Electric Ind Co Ltd | Arithmetic processing system |
JP2005100034A (en) * | 2003-09-24 | 2005-04-14 | Matsushita Electric Ind Co Ltd | Information processing control system |
WO2005106623A1 (en) * | 2004-04-28 | 2005-11-10 | Matsushita Electric Industrial Co., Ltd. | Cpu clock control device, cpu clock control method, cpu clock control program, recording medium, and transmission medium |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2016509320A (en) * | 2013-03-05 | 2016-03-24 | インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation | Computer system, computer program, and computer-implemented method for prefetching data |
JP2016513829A (en) * | 2013-03-05 | 2016-05-16 | インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation | Computer system, computer program, and computer-implemented method for prefetching data on a chip |
JP2014225088A (en) * | 2013-05-15 | 2014-12-04 | オリンパス株式会社 | Arithmetic unit |
JP7590852B2 (en) | 2020-11-13 | 2024-11-27 | 株式会社日立製作所 | Storage control system and storage control method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5089186B2 (en) | Data cache miss prediction and scheduling | |
US8140768B2 (en) | Jump starting prefetch streams across page boundaries | |
US7958316B2 (en) | Dynamic adjustment of prefetch stream priority | |
EP1421490B1 (en) | Methods and apparatus for improving throughput of cache-based embedded processors by switching tasks in response to a cache miss | |
US8255631B2 (en) | Priority-based prefetch requests scheduling and throttling | |
US8812822B2 (en) | Scheduling instructions in a cascaded delayed execution pipeline to minimize pipeline stalls caused by a cache miss | |
US6564313B1 (en) | System and method for efficient instruction prefetching based on loop periods | |
JP3739491B2 (en) | Harmonized software control of Harvard architecture cache memory using prefetch instructions | |
US7895399B2 (en) | Computer system and control method for controlling processor execution of a prefetech command | |
JP4064924B2 (en) | Method and apparatus for controlling memory access | |
JP5444889B2 (en) | Arithmetic processing device and control method of arithmetic processing device | |
US20080276079A1 (en) | Mechanism to minimize unscheduled d-cache miss pipeline stalls | |
US9201798B2 (en) | Processor instruction based data prefetching | |
CN105786448A (en) | Instruction scheduling method and device | |
JP5159258B2 (en) | Arithmetic processing unit | |
JP2008186233A (en) | Instruction cache pre-fetch control method and device thereof | |
US20050198439A1 (en) | Cache memory prefetcher | |
JP2008015668A (en) | Task management device | |
JP4030314B2 (en) | Arithmetic processing unit | |
JP5128382B2 (en) | Method and apparatus for executing multiple load instructions | |
JP2008015562A (en) | Cache mistake/hit prediction | |
JP4374956B2 (en) | Cache memory control device and cache memory control method | |
JP5170050B2 (en) | Hardware processor, hardware processor control method, and information processing apparatus | |
JP5116275B2 (en) | Arithmetic processing apparatus, information processing apparatus, and control method for arithmetic processing apparatus | |
CN116414463B (en) | Instruction scheduling method, instruction scheduling device, processor and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20090522 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20111018 |
|
A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20120228 |