JP2003263364A - Cache allocation system - Google Patents

Cache allocation system

Info

Publication number
JP2003263364A
JP2003263364A JP2002061587A JP2002061587A JP2003263364A JP 2003263364 A JP2003263364 A JP 2003263364A JP 2002061587 A JP2002061587 A JP 2002061587A JP 2002061587 A JP2002061587 A JP 2002061587A JP 2003263364 A JP2003263364 A JP 2003263364A
Authority
JP
Japan
Prior art keywords
cache
main memory
memory
setting
valid
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
Application number
JP2002061587A
Other languages
Japanese (ja)
Inventor
Akihiko Tani
昭彦 谷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP2002061587A priority Critical patent/JP2003263364A/en
Publication of JP2003263364A publication Critical patent/JP2003263364A/en
Pending legal-status Critical Current

Links

Landscapes

  • Memory System Of A Hierarchy Structure (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a cache allocation system having a main memory having a vast storage capacity and a cache memory having a smaller capacity and a high access speed, capable of shortening a program execution time without mounting a complicated cache algorithm on a CPU chip. <P>SOLUTION: A CPU core 3 has a normal mode for performing fixed cycle processing and a measuring mode for splitting the main memory 1 and setting cache effectiveness accessed through the cache memory 2 in each split unit and cache ineffectiveness accessed by bypassing the cache memory 2. The measuring mode sets the cache effectiveness and the cache ineffectiveness so that the execution time of a fixed cycle processing program by the CPU core 3 becomes minimum. <P>COPYRIGHT: (C)2003,JPO

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【発明の属する技術分野】この発明は、広大であるが比
較的アクセス速度が遅い主メモリと、それよりは遥かに
小さい容量であるがアクセス速度が速いキャッシュメモ
リを有し、主メモリにあるコード/データをアクセスし
ながら、固定動作周期(定周期)で処理を繰り返す装置
において、CPUチップ上に複雑なキャッシュアルゴリ
ズムを実装することなく、プログラムの実行時間を短縮
させることができるキャッシュ割り当て方式に関するも
のである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention has a vast main memory having a relatively slow access speed, and a cache memory having a much smaller capacity but a faster access speed, and a code in the main memory. / A cache allocation method capable of shortening program execution time in a device that repeats processing at a fixed operation cycle (fixed cycle) while accessing data without implementing a complicated cache algorithm on a CPU chip Is.

【0002】[0002]

【従来の技術】図6は、例えば特開平8−147218
号公報に示された従来のキャッシュ制御装置を示す構成
図である。図6において、101は計算機システムに備
えられた複数の処理手段、102は処理手段101によ
ってアクセスされる記憶装置、103はキャッシュメモ
リ、104は処理手段101の記憶装置102へのアク
セス要求に応じてキャッシュメモリ103を制御するキ
ャッシュ制御装置である。キャッシュメモリ103は、
複数の処理手段101にそれぞれ対応して設けられた複
数の占有領域111と、複数の処理手段101が共有す
る共有領域112を有している。
2. Description of the Related Art FIG. 6 shows, for example, Japanese Unexamined Patent Publication No. 8-147218.
It is a block diagram which shows the conventional cache control apparatus shown by the publication. In FIG. 6, 101 is a plurality of processing means provided in the computer system, 102 is a storage device accessed by the processing means 101, 103 is a cache memory, and 104 is in response to an access request from the processing means 101 to the storage device 102. It is a cache control device that controls the cache memory 103. The cache memory 103 is
It has a plurality of occupied areas 111 provided respectively corresponding to the plurality of processing means 101, and a shared area 112 shared by the plurality of processing means 101.

【0003】キャッシュ制御装置104は、複数の占有
領域111及び共有領域112に、キャッシュメモリ1
03の記憶領域を配分する配分手段113と、複数の処
理手段101のそれぞれから入力されるアクセス要求に
応じて、対応する占有領域111と共有領域112とに
対して該当するデータの検索処理を行う検査手段114
と、検索結果に応じて、該当する占有領域111と共有
領域112とからなる領域に格納されたデータの置き換
え優先順位を操作する第一の順位操作手段115と、該
当するデータが存在しない旨の検査結果の入力に応じ
て、該当する占有領域111と共有領域112からなる
連続した領域における置き換え優先順位に従ってデータ
の置き換え処理を行う置き換え手段116と、配分手段
113のローカル待ち行列を変更する変更手段121と
を有している。配分手段113は、複数の占有領域11
1に対応する複数のローカル待ち行列117と共有領域
に対応する共有待ち行列118を有している。
The cache control device 104 stores the cache memory 1 in a plurality of occupied areas 111 and shared areas 112.
No. 03 storage area is allocated, and the corresponding occupying area 111 and shared area 112 are searched for corresponding data in response to access requests input from each of the plurality of processing means 101. Inspection means 114
And a first order operation means 115 for operating the replacement priority order of the data stored in the area including the corresponding occupied area 111 and the shared area 112 according to the search result, and the fact that the corresponding data does not exist. In response to the input of the inspection result, the replacement unit 116 that performs the data replacement process according to the replacement priority in the continuous region including the corresponding occupied region 111 and the shared region 112, and the changing unit that changes the local queue of the distribution unit 113. 121 and 121. The allocating means 113 has a plurality of occupied areas 11
It has a plurality of local queues 117 corresponding to 1 and a shared queue 118 corresponding to a shared area.

【0004】次に、動作について説明する。配分手段1
13により、キャッシュメモリ103の記憶領域が、複
数の処理手段101にそれぞれ対応する占有領域111
と共有領域112とに配分されており、検索手段114
は、処理手段101からのアクセス要求に応じて、対応
する占有領域111及び共有領域112に対して検索処
理を行う構成となっている。この検索結果に応じて、第
1の順位操作手段115により、該当する占有領域11
1とともに共有領域112における置き換え優先順位が
操作され、この置き換え優先順位に基づいて、置き換え
手段116による置き換え処理が行われる。この場合
は、該当する占有領域111と共有領域112とは連続
した領域として扱われるから、置き換え処理に伴って、
占有領域111からはみ出したデータは、共有領域11
2に吸収される。従って、各処理手段101に占有領域
111とそれぞれ所定の記憶領域を割り当てると共に、
共有領域112を各処理手段101のアクセス頻度に応
じて配分することができるから、各処理手段101に最
低限度のヒット率を保証すると共に、アクセス頻度の高
い処理手段101のヒット率の向上を図ることが可能と
なる。
Next, the operation will be described. Distribution means 1
13, the storage area of the cache memory 103 becomes the occupied area 111 corresponding to each of the plurality of processing units 101.
And the shared area 112 and the search means 114.
Is configured to perform a search process for the corresponding occupied area 111 and shared area 112 in response to an access request from the processing unit 101. In accordance with this search result, the corresponding occupation area 11 is operated by the first order operation means 115.
The replacement priority order in the shared area 112 is manipulated together with 1, and the replacement process by the replacement means 116 is performed based on this replacement priority order. In this case, since the corresponding occupied area 111 and the shared area 112 are treated as a continuous area, the replacement processing
The data protruding from the occupied area 111 is the shared area 11
It is absorbed by 2. Therefore, in addition to allocating the occupied area 111 and a predetermined storage area to each processing means 101,
Since the shared area 112 can be distributed according to the access frequency of each processing means 101, the minimum hit rate is guaranteed for each processing means 101 and the hit rate of the processing means 101 with high access frequency is improved. It becomes possible.

【0005】[0005]

【発明が解決しようとする課題】従来のキャッシュ制御
装置は、以上のように構成され、動作するので、キャッ
シングに対して特殊なハードウェア回路の追加が必要で
あった。また、処理手段全体からみるとアクセス頻度が
少ない処理手順に対しても、予め各処理に占有領域を固
定的に割り当てるため、キャッシュメモリ内の占有領域
の使用に無駄が生じ、非効率であるという問題があっ
た。また、ある1つの処理手順に着目した場合でも、そ
の処理手順のアクセスするコード/データが大きく、通
常処理においてループするような処理で、ループの中で
は各コード/データが例えば1回ずつしかアクセスされ
ないような処理においては、ループの先頭の方でアクセ
スされたコード/データがキャッシュに格納されても、
ループの最後の方で新たにアクセスされたコード/デー
タで置き換えられてしまい、再度ループの先頭の方の処
理に到達した時点では、既にキャッシュに格納されてお
らず、常にキャッシュミスとなり、非効率であるという
問題があった。
Since the conventional cache control device is constructed and operates as described above, it is necessary to add a special hardware circuit to the caching. Further, even if a processing procedure that is rarely accessed from the viewpoint of the processing means as a whole, an occupied area is fixedly assigned to each process in advance, so that use of the occupied area in the cache memory is wasted, which is inefficient. There was a problem. Further, even when focusing on one processing procedure, the code / data to be accessed by that processing procedure is large, and each code / data is accessed only once, for example, in the loop processing in the normal processing. In the processing that is not performed, even if the code / data accessed at the top of the loop is stored in the cache,
It will be replaced by the newly accessed code / data at the end of the loop, and when it reaches the processing at the beginning of the loop again, it will not be stored in the cache and will always be a cache miss, resulting in inefficiency. There was a problem that was.

【0006】この発明は、上述のような問題点を解決す
るためになされたものであり、広大であるが比較的アク
セス速度が遅い主メモリと、それよりは遥かに小さい容
量であるがアクセス速度が速いキャッシュメモリを有
し、CPUチップ上に複雑なキャッシュアルゴリズムを
実装することなく、プログラムの実行時間を短縮させる
ようにしたキャッシュ割り当て方式を得ることを目的に
している。
The present invention has been made in order to solve the above-mentioned problems, and it is a vast main memory with a relatively slow access speed and an access speed with a much smaller capacity than that. The object of the present invention is to obtain a cache allocation method that has a fast cache memory and that shortens the program execution time without mounting a complicated cache algorithm on the CPU chip.

【0007】[0007]

【課題を解決するための手段】この発明に係わるキャッ
シュ割り当て方式においては、所定の記憶容量をもつ主
メモリ及びこの主メモリより少ない記憶容量をもち主メ
モリよりアクセス速度の速いキャッシュメモリを有し、
主メモリのアクセスを伴う定周期処理を繰り返す装置の
キャッシュ割り当て方式において、装置は、定周期処理
を行う通常モードと、主メモリを所定サイズで分割し、
分割された分割単位毎にキャッシュメモリを介してアク
セスされるキャッシュ有効またはキャッシュメモリを介
さずにアクセスされるキャッシュ無効を設定する測定モ
ードを有し、測定モードは、装置の定周期処理プログラ
ムの動作周期毎にキャッシュ有効及びキャッシュ無効の
組合せを順次切り替えて、定周期処理プログラムの実行
時間が最小になるように分割単位毎のキャッシュ有効ま
たはキャッシュ無効を設定するものである。
A cache allocation system according to the present invention has a main memory having a predetermined storage capacity and a cache memory having a storage capacity smaller than the main memory and having an access speed faster than that of the main memory.
In the cache allocation method of the apparatus that repeats the fixed cycle processing involving access to the main memory, the apparatus divides the main memory into a normal mode in which the fixed cycle processing is performed and the main memory with a predetermined size
It has a measurement mode for setting cache valid accessed via the cache memory or cache invalid accessed without the cache memory for each divided unit, and the measurement mode is the operation of the fixed-cycle processing program of the device. A combination of cache valid and cache invalid is sequentially switched for each cycle, and cache valid or cache invalid is set for each division unit so that the execution time of the fixed cycle processing program is minimized.

【0008】さらに、測定モードによるキャッシュ有効
またはキャッシュ無効の設定結果は、不揮発性メモリに
記憶されると共に、通常モードの実行時には、不揮発性
メモリに記憶された設定結果に応じてキャッシュ有効ま
たはキャッシュ無効の設定を行い、設定にしたがって主
メモリがアクセスされるものである。
Further, the cache valid or cache invalid setting result in the measurement mode is stored in the non-volatile memory, and when the normal mode is executed, the cache valid or cache invalid is set according to the setting result stored in the non-volatile memory. Is set, and the main memory is accessed according to the setting.

【0009】また、測定モードは、主メモリの分割単位
の所定サイズを変更しながら、キャッシュ有効またはキ
ャッシュ無効を設定するものである。また、測定モード
によるキャッシュ有効またはキャッシュ無効の設定は、
定周期処理プログラムの実行時間に影響を与える入力条
件を変化させながら行われるものである。
In the measurement mode, cache valid or cache invalid is set while changing the predetermined size of the main memory division unit. In addition, the cache enable or cache disable setting in the measurement mode is
This is performed while changing the input condition that affects the execution time of the fixed cycle processing program.

【0010】[0010]

【発明の実施の形態】実施の形態1.以下、この発明の
実施の形態1について説明する。図1は、この発明の実
施の形態1によるキャッシュ割り当て方式を使用した際
の主メモリのキャッシュ有効/無効割り当てを示す図で
ある。図1において、1はプログラムのコード/データ
を格納し、広大であるが比較的アクセス速度の遅い主メ
モリ、2は主メモリ1より小さい容量であるがアクセス
速度の速いキャッシュメモリ、3は実際のコードの実行
やデータの参照を行うCPUコアである。
BEST MODE FOR CARRYING OUT THE INVENTION Embodiment 1. The first embodiment of the present invention will be described below. FIG. 1 is a diagram showing cache valid / invalid allocation of a main memory when the cache allocation system according to the first embodiment of the present invention is used. In FIG. 1, 1 is a main memory that stores the code / data of a program and is large but has a relatively low access speed. 2 is a cache memory that has a smaller capacity than the main memory 1 but has a fast access speed. It is a CPU core that executes code and refers to data.

【0011】図1では、主メモリとして1MByte、
キャッシュメモリ32KByte、キャッシュ有効/無
効の設定サイズを4KByteとしている。主メモリ1
を、キャッシュ有効/無効設定サイズ4KByteによ
って256個の空間に分割し、各分割単位を、キャッシ
ュ設定ユニット♯1〜キャッシュ設定ユニット♯256
とする。図1では、キャッシュ設定ユニット♯1、♯
3、♯6・・・は、キャッシュ無効と設定されているた
め、CPUコア3からのアクセスは、キャッシュメモリ
2を介さずに直接アクセスされる。また、キャッシュ設
定ユニット♯2、♯4、♯5、・・・、♯256は、キ
ャッシュ有効と設定されているため、CPUコア3から
のアクセスはキャッシュメモリ2を介してアクセスされ
る。CPUコア3は、通常の定周期処理を行う通常モー
ドと、主メモリ1を分割して各分割単位であるキャッシ
ュ設定ユニット毎に、キャッシュ有効/無効を設定する
測定モードを有している。
In FIG. 1, 1 MByte as a main memory,
The cache memory has 32 KBytes, and the cache valid / invalid setting size is 4 KByte. Main memory 1
Is divided into 256 spaces by a cache valid / invalid setting size of 4 KBytes, and each division unit is divided into cache setting unit # 1 to cache setting unit # 256.
And In FIG. 1, cache setting units # 1 and #
.., # 6, ... Are set as cache invalid, and therefore the access from the CPU core 3 is made directly without going through the cache memory 2. Further, since the cache setting units # 2, # 4, # 5, ..., # 256 are set to be cache valid, the access from the CPU core 3 is accessed via the cache memory 2. The CPU core 3 has a normal mode in which normal fixed cycle processing is performed, and a measurement mode in which the main memory 1 is divided and cache valid / invalid is set for each cache setting unit which is each division unit.

【0012】次に、全体の処理フローについて説明す
る。図2は、この発明の実施の形態1によるキャッシュ
割り当て方式を示すフローチャートであり、CPUコア
3が定周期処理プログラムの動作周期に同期してキャッ
シュ有効/無効を順次切り替え、プログラムの実行時間
が一番短くなるキャッシュ有効/無効空間の組合せを自
動的に調べる一例を示している。まず、今回の動作モー
ドが、測定モードか通常モードかを調べ(ステップST
1−1)、通常モードの場合は、通常動作として定周期
処理を実行し続ける(ステップST1−2)。測定モー
ドの場合には、最小処理手段をクリア(実際には時間の
最大を表す“0xFFFFFFFF”等で初期化す
る。)(ステップST1−3)、最小パターンもクリア
し(ステップST1−4)、主メモリを固定サイズNで
分割する(ステップST1−5)。ここで分割された各
空間(分割単位)をそれぞれキャッシュ設定ユニット♯
1〜キャッシュ設定ユニット♯Mとする。
Next, the overall processing flow will be described. FIG. 2 is a flow chart showing the cache allocation method according to the first embodiment of the present invention, in which the CPU core 3 sequentially switches the cache valid / invalid in synchronization with the operation cycle of the fixed cycle processing program, and the program execution time is reduced. An example of automatically checking the combination of the cache valid / invalid space that becomes the shortest is shown. First, check whether the operation mode this time is the measurement mode or the normal mode (step ST
1-1), in the normal mode, the fixed cycle processing is continuously executed as a normal operation (step ST1-2). In the case of the measurement mode, the minimum processing means is cleared (actually, it is initialized by "0xFFFFFFFF" indicating the maximum time) (step ST1-3), and the minimum pattern is also cleared (step ST1-4). The main memory is divided into fixed sizes N (step ST1-5). Each space (division unit) divided here is set in the cache setting unit #
1 to cache setting unit #M.

【0013】次に、全キャッシュ設定ユニットに対し
て、キャッシュ有効/無効設定の組合せパターン分の処
理手段測定が全て終了したかを調べ(ステップST1−
6)、終了した場合は、全パターン中で実行時間を短縮
する対象とした定周期処理プログラムの実行時間が一番
最小となるキャッシュ有効/無効の組合せパターンを報
告(ステップST1−14)して、測定モードを終了す
る。
Next, it is checked whether or not the processing means measurement for the combination pattern of cache valid / invalid settings has been completed for all the cache setting units (step ST1-
6) When finished, report a cache valid / invalid combination pattern that minimizes the execution time of the fixed cycle processing program whose execution time is shortened in all patterns (step ST1-14). , Exit the measurement mode.

【0014】キャッシュ有効/無効の組合せパターン分
の処理時間測定が全て終了していない場合は、キャッシ
ュ設定ユニット♯1〜♯Mに対して、キャッシュ有効/
無効の設定を次のパターンに更新する(ステップST1
−7)。次に、処理時間測定開始を行い(ステップST
1−8)、処理時間短縮を行う対象である定周期処理プ
ログラムを実行し(ステップST1−9)、終了後に処
理時間測定を終了し(ステップST1−10)、今回の
キャッシュ有効/無効の組合せパターンでの処理時間が
最小処理時間よりさらに小さいかを調べ(ステップST
1−11)、小さい場合は、最小処理時間を今回測定の
処理時間で更新する(ステップST1−12)。この時
のキャッシュ有効/無効の組合せパターンを最小パター
ンとして記憶し(ステップST1−13)、ステップS
T1−6から繰り返す。ステップST1−11で、今回
のキャッシュ有効/無効の組合せパターンでの処理時間
が最小処理時間より小さくない場合は、最小処理時間、
最小パターンを更新せずにステップST1−6から繰り
返す。通常、この処理は、処理装置のオペレーションシ
ステムや、スケジューラにより実現されるが、処理時間
を短縮する対象であるアプリケーションプログラム等に
組み込んでも良い。
When the processing time measurement for the combination pattern of cache valid / invalid is not completed, the cache valid / invalid for the cache setting units # 1 to #M.
The invalid setting is updated to the next pattern (step ST1)
-7). Next, the processing time measurement is started (step ST
1-8), the fixed cycle processing program for which the processing time is to be shortened is executed (step ST1-9), the processing time measurement is ended after the end (step ST1-10), and the current cache valid / invalid combination is executed. Check whether the processing time in the pattern is shorter than the minimum processing time (step ST
1-11), if it is smaller, the minimum processing time is updated with the processing time of this measurement (step ST1-12). The cache valid / invalid combination pattern at this time is stored as a minimum pattern (step ST1-13), and step S
Repeat from T1-6. In step ST1-11, if the processing time in this cache valid / invalid combination pattern is not less than the minimum processing time, the minimum processing time,
The procedure is repeated from step ST1-6 without updating the minimum pattern. Normally, this processing is realized by the operating system of the processing device or the scheduler, but it may be incorporated in an application program or the like which is a target for reducing the processing time.

【0015】このように、実施の形態1によれば、主メ
モリをある固定サイズのキャッシュ設定ユニットに分割
し、その単位でプログラムの動作周期に同期してキャッ
シュ有効/無効を順次切り替え、プログラムの実行時間
が一番短くなるキャッシュ有効/無効空間の組合せを自
動的に調べる手段を設けたため、処理時間短縮を目的と
するプログラムに対して実際に一番処理時間が短くなる
キャッシング設定を得ることが可能となる。また、キャ
ッシングに対して特殊なハードウェア回路の追加も必要
でない。
As described above, according to the first embodiment, the main memory is divided into certain fixed-size cache setting units, and the cache valid / invalid is sequentially switched in synchronization with the operation cycle of the program in each unit, so that the program Since a means for automatically checking the combination of cache valid / invalid space that provides the shortest execution time is provided, it is possible to obtain the caching setting that actually results in the shortest processing time for a program whose processing time is shortened. It will be possible. Also, no special hardware circuit is required for caching.

【0016】実施の形態2.次に、この発明の実施の形
態2について説明する。実施の形態2では、キャッシュ
有効/無効割り当てを示す構成は、実施の形態1での図
1と同様であり、実施の形態1とは処理フローが異なっ
ている。次に、動作について説明する。図3は、この発
明の実施の形態2によるキャッシュ割り当て方式を示す
フローチャートである。図3において、実施の形態1と
同等の処理ステップには、図2と同一のステップ番号を
付けて重複説明を省略し、図2と異なる部分についての
み説明する。動作モードが測定モードの場合、全キャッ
シュ設定ユニットに対してキャッシュ有効/無効設定の
組合せパターンを更新しながら実行時間を短縮する対象
とした定周期処理プログラムの実行時間が、一番最小と
なるキャッシュ有効/無効の組合せパターンを求め、求
めた最小パターンをフラッシュメモリ等の不揮発性メモ
リに格納(ステップST2−14)し、測定モードを終
了する。その後、動作モードを通常モードにした場合、
格納されていた最小パターンに従って、自動的に各キャ
ッシュ設定ユニットに対してキャッシュ有効/無効を設
定し(ステップST2−1)、通常動作として定周期処
理を実行し続ける(ステップST1−2)。
Embodiment 2. Next, a second embodiment of the present invention will be described. In the second embodiment, the configuration showing cache valid / invalid allocation is the same as that of the first embodiment shown in FIG. 1, and the processing flow is different from that of the first embodiment. Next, the operation will be described. FIG. 3 is a flowchart showing a cache allocation method according to the second embodiment of the present invention. In FIG. 3, the same process steps as those in the first embodiment are given the same step numbers as those in FIG. 2 and duplicate description is omitted, and only the parts different from FIG. 2 will be described. When the operation mode is the measurement mode, the cache that minimizes the execution time of the fixed-cycle processing program whose execution time is shortened while updating the combination pattern of cache valid / invalid settings for all cache setting units A valid / invalid combination pattern is obtained, the obtained minimum pattern is stored in a nonvolatile memory such as a flash memory (step ST2-14), and the measurement mode is ended. After that, if you set the operation mode to normal mode,
According to the stored minimum pattern, the cache valid / invalid is automatically set for each cache setting unit (step ST2-1), and the fixed cycle processing is continuously executed as a normal operation (step ST1-2).

【0017】このように、実施の形態2によれば、プロ
グラムの実行時間が一番短くなるキャッシュ有効/無効
の組合せを調べた結果を、フラッシュメモリ等の不揮発
性メモリに格納し、通常モード時はその格納された結果
で自動的にキャッシュを設定し、動作させるようにした
ため、報告されたキャッシング設定に従って人手でプロ
グラム中のキャッシング設定処理を変更することなく、
処理時間短縮を目的とするプログラムに対して、実際に
一番時間が短くなるキャッシング設定で動作させること
が可能となる。
As described above, according to the second embodiment, the result of checking the cache valid / invalid combination that minimizes the program execution time is stored in a non-volatile memory such as a flash memory, and is stored in the normal mode. Automatically configures and operates the cache with the stored result, so without manually changing the caching setting process in the program according to the reported caching settings,
For a program whose processing time is to be shortened, it is possible to operate the program with a caching setting that actually shortens the time.

【0018】実施の形態3.次に、この発明の実施の形
態3について説明する。実施の形態3では、キャッシュ
有効/無効割り当てを示す構成は、実施の形態1での図
1と同様であり、実施の形態1とは処理フローが異なっ
ている。次に、動作について説明する。図4は、この発
明の実施の形態3によるキャッシュ割り当て方式を示す
フローチャートである。図4において、実施の形態2と
同等の処理ステップには図3と同一のステップ番号を付
けて重複説明を省略し、図3と異なる部分についてのみ
説明する。図3が、ステップST1−5で、主メモリを
予め固定サイズNで分割しているのに対し、実施の形態
3では、この固定サイズNを変更するようにしている。
図3のステップST1−6及びステップST1−7で
は、予め固定サイズで分割された全キャッシュ設定ユニ
ットに対して、キャッシュ有効/無効設定の組合せパタ
ーンを更新しながら、実行時間を短縮する対象として定
周期処理プログラムの実行時間が一番最小となるキャッ
シュ有効/無効の組合せパターンを求めるのに対し、図
4では、各キャッシュ設定ユニットのキャッシュ有効/
無効設定を変更するだけでなく、主メモリの分割サイズ
も可変にして、切り替え(ステップST3−7)、全サ
イズ、組合せパターン分が全て終了したかを調べる(ス
テップST3−6)。
Embodiment 3. Next, a third embodiment of the invention will be described. In the third embodiment, the configuration showing cache valid / invalid allocation is the same as that of the first embodiment shown in FIG. 1, and the processing flow is different from that of the first embodiment. Next, the operation will be described. FIG. 4 is a flowchart showing a cache allocation method according to the third embodiment of the present invention. 4, the same processing steps as those in the second embodiment are given the same step numbers as those in FIG. 3 and duplicate explanations are omitted. Only the portions different from FIG. 3 will be explained. In FIG. 3, in step ST1-5, the main memory is divided into the fixed size N in advance, whereas in the third embodiment, the fixed size N is changed.
In steps ST1-6 and ST1-7 of FIG. 3, the cache valid / invalid setting combination pattern is updated for all cache setting units divided in advance with a fixed size, and the target is set as a target for reducing the execution time. In contrast to the cache valid / invalid combination pattern that minimizes the execution time of the periodic processing program, in FIG. 4, the cache valid / invalid of each cache setting unit is determined.
Not only the invalid setting is changed, but also the division size of the main memory is made variable, and switching (step ST3-7) is performed, and it is checked whether or not all sizes and combination patterns have been completed (step ST3-6).

【0019】このように、実施の形態3によれば、主メ
モリを予め固定サイズでキャッシュ設定ユニットに分割
するのではなく、分割サイズをも順次切り替えて、プロ
グラムの実行時間が一番短くなる分割サイズ、キャッシ
ュ有効/無効の組合せを調べた結果を、フラッシュメモ
リ等の不揮発性メモリに格納し、通常モード時はその格
納された結果で自動的にキャッシュを設定し、動作する
手段を設けたため、処理時間短縮を目的とするプログラ
ムに対して実際に一番処理時間が短くなるキャッシング
設定で動作させることが可能となる。
As described above, according to the third embodiment, the main memory is not divided into cache setting units of a fixed size in advance, but the division sizes are also sequentially switched so that the program execution time becomes the shortest. The result of checking the combination of size and cache valid / invalid is stored in a non-volatile memory such as a flash memory, and in the normal mode, the cache is automatically set with the stored result, and means for operating is provided. It becomes possible to operate the program whose processing time is shortened by the caching setting that actually shortens the processing time.

【0020】実施の形態4.次に、この発明の実施の形
態4について説明する。実施の形態4では、キャッシュ
有効/無効割り当てを示す構成は、実施の形態1での図
1と同様であり、実施の形態1とは処理フローが異なっ
ている。次に、動作について説明する。図5は、この発
明の実施の形態4によるキャッシュ割り当て方式を示す
フローチャートである。図5において、実施の形態3と
同等の処理ステップには図4と同一のステップ番号を付
けて重複説明を省略し、図4と異なる部分についてのみ
説明する。主メモリを各キャッシュ設定ユニットに分割
するサイズ、各キャッシュ設定ユニットのキャッシュ有
効/無効組合せパターンを更新した後(ステップST3
−7)、今回の組合せパターンにおけるプログラムの実
行時間の最悪値を測定するために、今回最悪処理時間を
クリアし(ステップST4−1)、今回の組合せパター
ンでの全入力条件の入力終了かどうかを判断し(ステッ
プST4−2)、終了の場合は今回最悪処理時間が最小
処理時間よりさらに小さいかを調べ(ステップST4−
11)、小さい場合は最小処理時間を今回最悪処理時間
で更新する(ステップST1−12)。今回の組合せパ
ターンでの全入力条件の入力終了でない場合、処理時間
短縮を行う対象である定周期処理プログラムへの入力条
件を更新し(ステップST4−3)、処理時間測定開始
を行い(ステップST1−8)、処理時間短縮を行う対
象である定周期処理プログラムを実行し(ステップST
1−9)、終了時に処理時間測定を終了し(ステップS
T1−10)、今回の入力条件での処理時間が今回の最
悪処理時間より大きいかどうかを調べ(ステップST4
−4)、大きい場合は、今回最悪処理時間を更新し(ス
テップST4−5)、ステップST4−2から繰り返
す。大きくない場合は、今回最悪処理時間を更新せずに
ステップST4−2から繰り返す。
Fourth Embodiment Next, a fourth embodiment of the invention will be described. In the fourth embodiment, the configuration showing cache valid / invalid allocation is the same as that of FIG. 1 in the first embodiment, and the processing flow is different from that of the first embodiment. Next, the operation will be described. FIG. 5 is a flowchart showing a cache allocation method according to Embodiment 4 of the present invention. In FIG. 5, the same process steps as those in the third embodiment are given the same step numbers as those in FIG. 4 and duplicate explanations are omitted. Only parts different from FIG. 4 will be explained. After updating the size for dividing the main memory into each cache setting unit and the cache valid / invalid combination pattern of each cache setting unit (step ST3
-7), in order to measure the worst value of the execution time of the program in the present combination pattern, the present worst processing time is cleared (step ST4-1), and whether or not the input of all input conditions in the present combination pattern has been completed. Is determined (step ST4-2), and when the processing is finished, it is checked whether the worst processing time this time is shorter than the minimum processing time (step ST4-).
11) If it is smaller, the minimum processing time is updated with the worst processing time this time (step ST1-12). If the input of all the input conditions in this combination pattern has not been completed, the input conditions for the fixed cycle processing program for which the processing time is to be shortened are updated (step ST4-3), and the processing time measurement is started (step ST1). -8) Execute the fixed cycle processing program for which the processing time is shortened (step ST
1-9), and at the end, the processing time measurement ends (step S
(T1-10), it is checked whether the processing time under the current input condition is longer than the current worst processing time (step ST4).
-4), if it is larger, the worst processing time is updated this time (step ST4-5), and the process is repeated from step ST4-2. If it is not larger, the worst processing time is not updated this time and the process is repeated from step ST4-2.

【0021】このように、実施の形態4によれば、主メ
モリを各キャッシュ設定ユニットに分割するサイズ、各
キャッシュ設定ユニットのキャッシュ有効/無効の組合
せパターンを順次切り替えるだけでなく、1つの分割サ
イズ、組合せパターンにおいて、プログラムへの入力条
件も順次切り替えて処理時間の最悪処理時間を測定する
手段を設けたため、あらゆる入力条件での最悪処理時間
が一番短くなるキャッシング設定で動作させることが可
能となる。
As described above, according to the fourth embodiment, not only the size for dividing the main memory into each cache setting unit and the cache valid / invalid combination pattern of each cache setting unit are sequentially switched, but also one division size is used. In the combination pattern, since the means for measuring the worst processing time of the processing time by sequentially switching the input conditions to the program is provided, it is possible to operate with the caching setting that minimizes the worst processing time under all input conditions. Become.

【0022】[0022]

【発明の効果】この発明は、以上説明したように構成さ
れているので、以下に示すような効果を奏する。所定の
記憶容量をもつ主メモリ及びこの主メモリより少ない記
憶容量をもち主メモリよりアクセス速度の速いキャッシ
ュメモリを有し、主メモリのアクセスを伴う定周期処理
を繰り返す装置のキャッシュ割り当て方式において、装
置は、定周期処理を行う通常モードと、主メモリを所定
サイズで分割し、分割された分割単位毎にキャッシュメ
モリを介してアクセスされるキャッシュ有効またはキャ
ッシュメモリを介さずにアクセスされるキャッシュ無効
を設定する測定モードを有し、測定モードは、装置の定
周期処理プログラムの動作周期毎にキャッシュ有効及び
キャッシュ無効の組合せを順次切り替えて、定周期処理
プログラムの実行時間が最小になるように分割単位毎の
キャッシュ有効またはキャッシュ無効を設定するので、
定周期処理プログラムの実行時間が最小になるようにキ
ャッシングの設定を行うことができる。
Since the present invention is constructed as described above, it has the following effects. A cache allocation method for a device having a main memory having a predetermined storage capacity and a cache memory having a storage capacity smaller than that of the main memory and having an access speed faster than that of the main memory, and repeating a fixed cycle process involving access to the main memory. Is a normal mode in which fixed-cycle processing is performed, and the main memory is divided into a predetermined size, and the cache valid accessed through the cache memory or the cache invalid accessed without the cache memory is divided into each divided unit. There is a measurement mode to be set, and the measurement mode sequentially switches the combination of cache valid and cache invalid for each operation cycle of the fixed-cycle processing program of the device, and the unit of division is set to minimize the execution time of the fixed-cycle processing program. Since each cache setting is enabled or disabled,
Caching can be set so that the execution time of the fixed cycle processing program is minimized.

【0023】さらに、測定モードによるキャッシュ有効
またはキャッシュ無効の設定結果は、不揮発性メモリに
記憶されると共に、通常モードの実行時には、不揮発性
メモリに記憶された設定結果に応じてキャッシュ有効ま
たはキャッシュ無効の設定を行い、設定にしたがって主
メモリがアクセスされるので、定周期処理プログラムの
実行時間が最小のキャッシング設定で通常モードを動作
させることができる。
Further, the cache valid or cache invalid setting result in the measurement mode is stored in the non-volatile memory, and at the time of executing the normal mode, the cache valid or cache invalid is set according to the setting result stored in the non-volatile memory. Is set and the main memory is accessed according to the setting, so that the normal mode can be operated with the caching setting in which the execution time of the fixed cycle processing program is minimum.

【0024】また、測定モードは、主メモリの分割単位
の所定サイズを変更しながら、キャッシュ有効またはキ
ャッシュ無効を設定するので、分割の所定サイズを変え
ながら最小の定周期処理プログラムの実行時間になるよ
うにキャッシング設定を行うことができる。
Further, in the measurement mode, the cache valid or the cache is set while changing the predetermined size of the main memory division unit, so that the minimum fixed cycle processing program execution time is obtained while changing the predetermined division size. You can configure the caching settings as follows.

【0025】また、測定モードによるキャッシュ有効ま
たはキャッシュ無効の設定は、定周期処理プログラムの
実行時間に影響を与える入力条件を変化させながら行わ
れるので、実行時間に影響を与える入力条件を含めて最
小の定周期処理プログラムの実行時間になるようにキャ
ッシング設定を得ることができる。
Further, the setting of the cache valid or the cache invalid in the measurement mode is performed while changing the input condition affecting the execution time of the fixed cycle processing program, so that the minimum including the input condition affecting the execution time is set. It is possible to obtain the caching setting so that the execution time of the fixed cycle processing program is.

【図面の簡単な説明】[Brief description of drawings]

【図1】 この発明の実施の形態1によるキャッシュ割
り当て方式を使用した際の主メモリのキャッシュ有効/
無効割り当てを示す図である。
FIG. 1 is a schematic diagram showing a cache allocation method of a main memory when a cache allocation method according to a first embodiment of the present invention is used;
It is a figure which shows invalid allocation.

【図2】 この発明の実施の形態1によるキャッシュ割
り当て方式を示すフローチャートである。
FIG. 2 is a flowchart showing a cache allocation method according to the first embodiment of the present invention.

【図3】 この発明の実施の形態2によるキャッシュ割
り当て方式を示すフローチャートである。
FIG. 3 is a flowchart showing a cache allocation method according to Embodiment 2 of the present invention.

【図4】 この発明の実施の形態3によるキャッシュ割
り当て方式を示すフローチャートである。
FIG. 4 is a flowchart showing a cache allocation method according to Embodiment 3 of the present invention.

【図5】 この発明の実施の形態4によるキャッシュ割
り当て方式を示すフローチャートである。
FIG. 5 is a flowchart showing a cache allocation method according to Embodiment 4 of the present invention.

【図6】 従来のキャッシュ制御装置を示す構成図であ
る。
FIG. 6 is a configuration diagram showing a conventional cache control device.

【符号の説明】[Explanation of symbols]

1 主メモリ、2 キャッシュメモリ、3 CPUコ
ア。
1 main memory, 2 cache memory, 3 CPU core.

Claims (4)

【特許請求の範囲】[Claims] 【請求項1】 所定の記憶容量をもつ主メモリ及びこの
主メモリより少ない記憶容量をもち上記主メモリよりア
クセス速度の速いキャッシュメモリを有し、上記主メモ
リのアクセスを伴う定周期処理を繰り返す装置のキャッ
シュ割り当て方式において、上記装置は、上記定周期処
理を行う通常モードと、上記主メモリを所定サイズで分
割し、上記分割された分割単位毎にキャッシュメモリを
介してアクセスされるキャッシュ有効またはキャッシュ
メモリを介さずにアクセスされるキャッシュ無効を設定
する測定モードを有し、上記測定モードは、上記装置の
定周期処理プログラムの動作周期毎にキャッシュ有効及
びキャッシュ無効の組合せを順次切り替えて、上記定周
期処理プログラムの実行時間が最小になるように上記分
割単位毎の上記キャッシュ有効またはキャッシュ無効を
設定することを特徴とするキャッシュ割り当て方式。
1. An apparatus having a main memory having a predetermined storage capacity and a cache memory having a storage capacity smaller than that of the main memory and having an access speed faster than that of the main memory, and repeating a periodic process accompanied by access to the main memory. In the cache allocation method, the apparatus divides the main memory into a normal mode in which the fixed cycle processing is performed, and the main memory is divided into a predetermined size, and cache effective or cache that is accessed through the cache memory for each divided division unit. There is a measurement mode for setting cache invalidity that is accessed without going through a memory, and the measurement mode is such that the combination of cache valid and cache invalidity is sequentially switched for each operation cycle of the fixed cycle processing program of the device, and the fixed mode is set. To minimize the execution time of the cyclic processing program, Cache allocation method characterized by setting cache enable or cache disable.
【請求項2】 測定モードによるキャッシュ有効または
キャッシュ無効の設定結果は、不揮発性メモリに記憶さ
れると共に、通常モードの実行時には、上記不揮発性メ
モリに記憶された設定結果に応じてキャッシュ有効また
はキャッシュ無効の設定を行い、上記設定にしたがって
主メモリがアクセスされることを特徴とする請求項1記
載のキャッシュ割り当て方式。
2. The cache valid or cache invalid setting result in the measurement mode is stored in the non-volatile memory, and when the normal mode is executed, the cache valid or cache is set according to the setting result stored in the non-volatile memory. 2. The cache allocation method according to claim 1, wherein invalid setting is performed and the main memory is accessed according to the setting.
【請求項3】 測定モードは、主メモリの分割単位の所
定サイズを変更しながら、キャッシュ有効またはキャッ
シュ無効を設定することを特徴とする請求項1または請
求項2記載のキャッシュ割り当て方式。
3. The cache allocation method according to claim 1, wherein in the measurement mode, cache valid or cache invalid is set while changing a predetermined size of a main memory division unit.
【請求項4】 測定モードによるキャッシュ有効または
キャッシュ無効の設定は、定周期処理プログラムの実行
時間に影響を与える入力条件を変化させながら行われる
ことを特徴とする請求項1〜請求項3のいずれか一項記
載のキャッシュ割り当て方式。
4. The cache valid or cache invalid setting in the measurement mode is performed while changing an input condition that affects the execution time of the fixed cycle processing program. The cache allocation method described in paragraph 1.
JP2002061587A 2002-03-07 2002-03-07 Cache allocation system Pending JP2003263364A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002061587A JP2003263364A (en) 2002-03-07 2002-03-07 Cache allocation system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002061587A JP2003263364A (en) 2002-03-07 2002-03-07 Cache allocation system

Publications (1)

Publication Number Publication Date
JP2003263364A true JP2003263364A (en) 2003-09-19

Family

ID=29195807

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002061587A Pending JP2003263364A (en) 2002-03-07 2002-03-07 Cache allocation system

Country Status (1)

Country Link
JP (1) JP2003263364A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100833178B1 (en) 2005-08-26 2008-05-28 삼성전자주식회사 System capable of controlling the number of block in a cache memory and method thereof
KR101692055B1 (en) * 2016-02-24 2017-01-18 주식회사 티맥스데이터 Method, apparatus, and computer program stored in computer readable storage medium for managing shared memory in database server
CN109784647A (en) * 2018-12-14 2019-05-21 兰州空间技术物理研究所 A kind of method for scheduling task of the active potential control system for space station

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100833178B1 (en) 2005-08-26 2008-05-28 삼성전자주식회사 System capable of controlling the number of block in a cache memory and method thereof
KR101692055B1 (en) * 2016-02-24 2017-01-18 주식회사 티맥스데이터 Method, apparatus, and computer program stored in computer readable storage medium for managing shared memory in database server
US9652393B1 (en) 2016-02-24 2017-05-16 TmaxData Co., Ltd. Managing shared memory in database server
CN109784647A (en) * 2018-12-14 2019-05-21 兰州空间技术物理研究所 A kind of method for scheduling task of the active potential control system for space station

Similar Documents

Publication Publication Date Title
US7330935B2 (en) Set associative cache system and control method for cache memories
US8250332B2 (en) Partitioned replacement for cache memory
US8868835B2 (en) Cache control apparatus, and cache control method
JP4006436B2 (en) Multi-level cache with overlapping sets of associative sets at different cache levels
JP2001109661A (en) Assigning method for cache memory, operating system and computer system having the operating system
US20090307434A1 (en) Method for memory interleave support with a ceiling mask
JPH0219945A (en) Main memory controller
JP5040050B2 (en) Multi-channel DMA controller and processor system
JP2003263364A (en) Cache allocation system
JP2020106918A (en) Semiconductor device, temperature control device, and method
US7302524B2 (en) Adaptive thread ID cache mechanism for autonomic performance tuning
JP2002099465A (en) Cache control method
JP2001290704A (en) Device and method for controlling multiprocess
JPS5827253A (en) Data processing device
US20030221067A1 (en) Staggering call stack offsets for multiple duplicate control threads
KR100841130B1 (en) Method and apparatus for efficient ordered stores over an interconnection network
JP2000099399A (en) Way predictive cache memory and access method therefor
JPH11143774A (en) Cache control mechanism
JP2010218350A (en) Information processor
KR101951309B1 (en) Data processing apparatus and data processing method
US11994993B2 (en) Adaptive prefetcher for shared system cache
JPH11250025A (en) Processor, loop program controller and multiprocessor system
US10817413B2 (en) Hardware-based memory management for system-on-chip (SoC) integrated circuits that identify blocks of continuous available tokens needed to store data
JP2002278774A (en) Method and device for generating instruction word in controlling function unit in processor
CN112214421A (en) STM32 low-power intelligent cache prefetch