JP2004192403A - Information processing system and method for managing data in cache memory - Google Patents
Information processing system and method for managing data in cache memory Download PDFInfo
- Publication number
- JP2004192403A JP2004192403A JP2002360470A JP2002360470A JP2004192403A JP 2004192403 A JP2004192403 A JP 2004192403A JP 2002360470 A JP2002360470 A JP 2002360470A JP 2002360470 A JP2002360470 A JP 2002360470A JP 2004192403 A JP2004192403 A JP 2004192403A
- Authority
- JP
- Japan
- Prior art keywords
- history
- data
- address
- cache memory
- function
- 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.)
- Granted
Links
Images
Landscapes
- Memory System Of A Hierarchy Structure (AREA)
- Executing Machine-Instructions (AREA)
Abstract
Description
【0001】
【発明の属する技術分野】
本発明は、キャッシュメモリのデータ管理方法及び情報処理装置に係わり、特に、演算処理を行う演算装置に内蔵されたキャッシュメモリへのデータの格納を管理するためのキャッシュメモリのデータ管理方法、及びキャッシュメモリが内蔵された演算装置を備えた情報処理装置に関する。
【0002】
【従来の技術】
CPUでは、外部メモリから必要なデータを呼び出して演算処理を行うが、一般に、外部メモリとして用いられるDRAM(Dynamic RAM)などの記憶装置は、大容量化が容易だが応答速度が遅いという特徴があり、外部メモリへのアクセス時間のためにCPUの処理能力(パフォーマンス)が低下してしまう。このため、図8に示すように、CPU200には、CPUコア(本体)202から高速アクセス可能なSRAM(Static RAM)などがキャッシュメモリ204として備えられている。例えば、関数(プログラム)の呼出しを例に説明すると、CPU200では、CPUコア202により外部メモリ206から必要な関数208を呼び出した際に、キャッシュメモリ204にも当該関数208を格納しておく(矢印▲1▼参照)。次回、同一の関数208を読み込む必要がある場合には、外部メモリ206の代わりにキャッシュメモリ204からCPUコア202に当該関数208が供給されるようになっている(矢印▲2▼参照)。
【0003】
ここで、キャッシュメモリに必要とされるデータを全て格納できれば、格納後は外部メモリへのアクセスは不要となる。しかしながら、キャッシュメモリの大容量化は技術的に難しく、格納可能なデータ量には限界があり、外部メモリへのアクセスを不要にすることは不可能である。このため、従来より、命令アドレスの実行履歴を保持しておき、過去に必要とされたデータがキャッシュメモリに格納されていなかった(キャッシュミス)ときの命令アドレスの実行アドレスが近づいた際に、キャッシュミス時にキャッシュメモリに格納すべきデータを前もって外部メモリよりもアクセス時間の短い場所に設けたバッファに格納しておき、キャッシュミス時の不利を最小限に抑える技術が提案されている。
【0004】
【特許文献1】
特開2001−134439号公報
【0005】
【発明が解決しようとする課題】
しかしながら、従来技術では、バッファを介在させることで、外部メモリにアクセスするよりもキャッシュミスの1回当たりのアクセス時間を短縮することはできるが、キャッシュミスの発生頻度は変わらないため、キャッシュミス回数が多いほどバッファへのアクセス回数が増えて、CPUのパフォーマンスが低下してしまうという問題があった。
【0006】
本発明は上記問題点を解消するためになされたもので、キャッシュメモリを内蔵した演算装置の外部メモリへのアクセス回数を低減することができるキャッシュメモリのデータ管理方法及び情報処理装置を提供することを目的とする。
【0007】
【課題を解決するための手段】
上記目的を達成するために、請求項1に記載の発明は、演算装置に内蔵されたキャッシュメモリへのデータの格納を管理するためのキャッシュメモリのデータ管理方法であって、前記演算装置で所定のプログラムを実行した際に、当該実行中にアクセスしたデータのアドレスの履歴を取得して記憶しておき、前記所定のプログラムを実行する際に、前記履歴に含まれるアドレスを選択し、選択したアドレスに対応するデータを前記キャッシュメモリに常駐させる、ことを特徴としている。
【0008】
請求項1に記載の発明によれば、キャッシュメモリを内蔵した演算装置において、過去にプログラムを実行したときにアクセスしたアドレスの履歴を取得して記憶しておき、当該プログラムが再び実行されるときには、この履歴に含まれるアドレスの中から選択したアドレスのデータがキャッシュメモリに常駐される。したがって、演算装置では、当該プログラムの2回目以降の実行中に、選択したアドレスにアクセスする必要が生じた際には、外部のメモリからではなく、キャッシュメモリから当該アドレスに対応するデータの供給を受けることができる。これにより、外部メモリへのアクセス回数を低減することができる。
【0009】
なお、取得するアドレスは、所定の実行単位のアドレスでもよいし、所定の参照単位のアドレスでもよい。すなわち、キャッシュメモリへは、所定のプログラムの実行時に呼び出されるサブのプログラムである関数やその一部を常駐させてもよいし、所定のプログラムの実行時に参照されるデータを常駐させることもできる。
【0010】
上記のキャッシュメモリのデータ管理方法においては、請求項2に記載されているように、前記履歴中の高頻度のアドレスを選択するようにすることが好ましい。
【0011】
上記のキャッシュメモリのデータ管理方法は、以下の情報処理装置により実現可能である。すなわち、この情報処理装置は、請求項3に記載されているように、キャッシュメモリが内蔵された演算装置と、前記演算装置で所定のプログラムを実行した際に、アクセスしたデータのアドレスの履歴を取得する履歴取得手段と、前記履歴取得手段により取得された前記履歴を記憶する記憶手段と、前記記憶手段に記憶されている前記履歴に含まれるアドレスを選択する選択手段と、前記選択手段により選択されたアドレスに対応するデータが前記キャッシュメモリに常駐されるように制御する制御手段と、を備えたことを特徴とする。
【0012】
なお、上記の情報処理装置において、履歴を取得するアドレスは、請求項4に記載されているように、所定の実行単位のアドレスでもよいし、請求項5に記載されているように、所定の参照単位のアドレスでもよい。また、情報処理装置において、請求項6に記載されているように、前記選択手段が、前記履歴中で高頻度のアドレスを選択するとよい。
【0013】
また、請求項7に記載されているように、前記取得手段が、前記プログラム毎に前記履歴を取得して管理するとよい。
【0014】
また、請求項8に記載されているように、前記取得手段による前記履歴の取得を中止する中止手段を更に有するとよい。この場合の中止手段は、請求項9に記載されているように、2回目以降の前記プログラムの実行時に、前記取得手段による履歴の取得を中止するようにしてもよいし、請求項10に記載されているように、前記取得手段によって取得した前記履歴において、前記アドレスの頻度順位の変動が無かった場合に、以降の前記プログラムの実行時における前記取得手段による履歴の取得を中止するようにしてもよい。
【0015】
【発明の実施の形態】
次に、図面を参照して本発明に係る実施形態の1例を詳細に説明する。
【0016】
図1に本発明が適用された情報処理装置を示す。図1に示す情報処理装置10は、演算装置としてのCPU12と、外部メモリとしてのROM14及びRAM16と、不揮発メモリ18とを備え、CPU12、ROM14、RAM16、及び不揮発メモリ18はバス20により相互に接続されている。
【0017】
CPU12は、アプリケーションプログラム22に従って演算処理を行うCPUコア24と、CPUコア24で演算処理する関数を表すプログラムデータ(以下、「関数」と称す)26を格納するためのキャッシュメモリ(ICache)28と、CPUコア24での演算処理時に参照される参照データ(以下、「データ」と称す)30を格納するためのキャッシュメモリ(DCache)32と、キャッシュメモリ28、32への関数26及びデータ30の格納を制御するキャッシュ制御部34とが相互に接続されて構成されている。
【0018】
ROM14には、複数の(1つでもよい)アプリケーションプログラム22が格納されている。アプリケーションプログラム22は、当該アプリケーションプログラム22が目的とする本来の処理を行うための本体プログラム22A、及び該本体プログラム22Aの処理全体に係わる処理時間を短縮するための付加プログラム22Bを含んで構成されている。本体プログラム22Aには、当該アプリケーションプログラム22の本来目的としている処理を行うために、関数の呼出しや関数間での引数の引渡しなど全体の処理を制御するためのメインのプログラムと共に、サブのプログラムである各種の関数26が含まれている。一般に、この本体プログラム22Aがアプリケーションプログラムと称される。すなわち、本実施形態においては、一般的なアプリケーションプログラムに付加プログラム22Bが付加されてパッケージ化されている。
【0019】
前述のCPU12のキャッシュメモリ28には、アプリケーションプログラム22の実行時に、当該アプリケーションプログラムの本体プログラム22Aの中から必要な関数26が適宜呼び出されて格納される。
【0020】
RAM16は、アプリケーションプログラム22に従った演算処理の処理対象データ、処理結果データ、パラメータ設定値といった各種のデータ30を格納するために用いられ、前述のキャッシュメモリ32には、アプリケーションプログラム22の実行時に、このRAM16から必要なデータ30が適宜呼び出されて格納される。
【0021】
不揮発メモリ18には、例えばEEPROM、Flashメモリ、ハードディスクなどを用いることができる。不揮発メモリ18は、各アプリケーションプログラム22毎に後述する履歴データ36を格納するために用いられる。すなわち不揮発メモリ18が、記憶手段に対応する。
【0022】
ここで、本実施形態に係る情報処理装置10では、CPU12によりROM14に格納されているアプリケーションプログラム22を実行した場合、当該情報処理装置10のハードウェア資源を利用して、図2に示す機能が構築されるようになっている。
【0023】
すなわち、アプリケーションプログラム22の実行により、情報処理装置10には、プログラム実行部50と、プログラム実行部50でアクセスしたアドレスを管理するアドレス履歴管理部52と、アドレス選択部54とが構築される。
【0024】
プログラム実行部50は、本体プログラム22Aにより構築される機能であり、本体プログラム22Aに基づく処理、すなわちアプリケーションプログラム22が目的とする本来の処理を行う。
【0025】
アドレス履歴管理部52は、付加プログラム22Bにより構築される機能であり、プログラム実行部50の動作中、すなわち本体プログラム22Aの実行中にアクセスした所定の実行単位のアドレス履歴、すなわち実行した関数26の履歴を取得する。また、本体プログラム22Aの実行中にアクセスした所定の参照単位のアドレス履歴、すなわちデータ30のアドレスについても同様に履歴を取得する。すなわち、アドレス履歴管理部52が、履歴取得手段としての役目を担っている。
【0026】
また、アドレス履歴管理部52は、本体プログラム22Aの実行中は、取得した関数26やデータ30のアドレスの履歴56をRAM16に蓄積していき、本体プログラム22Aの処理が終了したら、その結果を履歴データ36として不揮発メモリ18に記憶し、電源がOFFされても保持可能にしておく。なお、履歴データ36は、アプリケーションプログラム22毎に管理される。
【0027】
なお、具体的には、本実施形態では、各関数26や各データ30の先頭アドレスへのアクセスした履歴56を取得するようになっている。また、本実施形態では、履歴データ36として取得した履歴56そのものを用いるが、履歴56から各関数26及び各データ30のアクセス回数を求めて、各々の求めたアクセス回数を履歴データ36として用いてもよく、何れにしろ履歴データ36により、各関数26の実行頻度及び各データ30の使用頻度が把握可能である。
【0028】
アドレス選択部54は、付加プログラム22Bにより構築される機能であり、特定のアドレスを選択して、キャッシュ制御部34に通知する。詳しくは、不揮発メモリ18の履歴データ36を参照して、実行頻度の高い関数26や、使用頻度の高いデータ30を特定して、当該関数26やデータ30の実行単位のアドレスを通知する。すなわち、アドレス選択部54が、選択手段としての役目を担っている。
【0029】
キャッシュ制御部34は、通知されたアドレスに基づいて、対応する関数26やデータ30をROM14やRAM16から呼び出して、キャッシュメモリ28、32内に常駐させるようになっている。すなわち、キャッシュ制御部34が、制御手段としての機能を担っている。
【0030】
詳しくは、キャッシュ制御部34では、キャッシュメモリ28、32における常駐指示された特定の関数26やデータ30の記憶領域については、他の関数26やデータ30を新たに呼び出した際にも書き換えが行われないようにロックしておく。特定の関数26やデータ30の記憶領域以外のキャッシュメモリ28、32の記憶領域については、新たに呼び出された他の関数26やデータ30の内容に随時更新する。
【0031】
したがって、アドレス選択部54では、キャッシュ制御部34へアドレス通知することにより、当該アドレスが示す特定の関数26及びデータ30をキャッシュメモリ28、32内に常駐させることができる。
【0032】
次に、本実施形態の作用を説明する。本実施形態に係る情報処理装置10では、アプリケーションプログラム22の実行により、図3に示す処理が開始される。
【0033】
すなわち、アプリケーションプログラム22が実行されると、図3に示すように、まず、ステップ100において、アドレス履歴管理部52の機能により、不揮発メモリ18に履歴データ36が有るか否かが判断される。当該アプリケーションプログラム22の初回の実行時には、履歴が取得されたことがないため、不揮発メモリ18内には履歴データ36は存在せず、ステップ100では否定判定されて、ステップ106に進む。
【0034】
ステップ106では、プログラム実行部50の機能により、アプリケーションプログラム22が目的とする本来の処理、すなわち本体プログラム22Aが実行されると共に、ステップ108で、アドレス履歴管理部52の機能により、この本体プログラム22Aの実行中にアクセスした関数26及びデータ30のアドレス履歴がそれぞれ取得される。そして、最後にステップ110で、アドレス履歴管理部52の機能により、履歴取得結果を履歴データ36として不揮発メモリ18に更新記録して、図3の処理は終了される。なお、この場合は、初めて取得された履歴であるため、履歴データ36は不揮発メモリ18に新規登録されることになる。
【0035】
ここで、具体的に、関数26の履歴取得について説明する。関数26の履歴を取得するためには、例えば、C言語であれば、図4に示すプログラム70を各関数26の先頭に記述することで、当該関数26が実行された履歴を履歴データ36に記録することが可能となる。なお、この場合、このプログラム70は、付加プログラム22Bの一部を構成するものとみなすことができる。
【0036】
具体的に、アプリケーションプログラム22の本体プログラム22Aがfunc1、func2、及びfunk3という名称の3つの関数26A、26B、26Cを備えており(図6参照)、アプリケーションプログラム22(より詳しくは本体プログラム22A)を実行するとfunk1の関数26Aが10回、funk2の関数26Bが100回、funk3の関数26Cが5回実行されるとする。
【0037】
この場合、各関数26の先頭に図4に示したプログラム70を記述することで、アプリケーションプログラム22を実行した際に、履歴データの格納先へのポインタである「record」には、各関数26が実行されるたびに、当該関数26の先頭アドレスである関数名が履歴56として追加記述されていく。すなわち、実行された順番に、各関数26のアドレスとして関数名が羅列された履歴56が取得される。そして、最終的には、図5に示すように、funk1のアドレスが10個、funk2のアドレスが100個、funk3のアドレスが5個記述された履歴データ36が不揮発メモリ18に格納される。このように、簡単なプログラムの記述だけで、アクセスした関数26のアドレス履歴を取得可能である。なお、例示は省略するが、アクセスしたデータ30の履歴についても同様に簡単なプログラムで取得可能である。
【0038】
一方、アプリケーションプログラム22の2回目以降の実行時には、上記のようにして不揮発メモリ18内に履歴データ36が記憶されているので、図3のステップ100で肯定されてステップ102に進む。ステップ102では、アドレス選択部54の機能により、当該アプリケーションプログラム22の履歴データ36を参照して、最も頻度の高いアドレス、すなわち最も実行頻度の関数26及び最も使用頻度の高いデータ30が選択される。そして、次のステップ104で、キャッシュ制御部34に対して、当該アドレスに対応する関数26及びデータ30をキャッシュメモリ28、32にロック(常駐)させた後、ステップ106に移行するようになっている。これにより、当該アプリケーションプログラム22の2回目以降の実行時には、キャッシュ制御部34により、以前にアプリケーションプログラム30を実行した際に実行頻度が高かった関数26及び使用頻度が高かったデータ30が予めキャッシュメモリ28、32内にロック(常駐)された状態で、アプリケーションプログラム22が目的とする本来の処理が行われることになる。
【0039】
例えば、前述の例では、図5に示した履歴データ36からfunk2の関数26Bが最も実行頻度が高いことが分かるため、図6(A)に示すように、funk2の関数26Bが外部メモリとしてのROM14から読み出されてキャッシュメモリ28にロックされる。funk2の関数26を格納した後のキャッシュメモリ28の残存容量では、関数26A又は関数26Cの何れか一方しか格納できないとすると、例えばfunk1の関数26Bが必要となりROM14から呼び出された際には、図6(B)に示すように、当該funk1の関数26Bがキャッシュメモリ28の残りの領域に格納される。
【0040】
その後、funk3の関数26Cが必要となりROM14から呼び出されると、図6(C)に示すように、funk1の関数26Aの代えて、funk3の関数26Cがキャッシュメモリ28の残りの領域に格納(上書き)される。再び、funk1の関数26Aが必要となった際には、図6(D)に示すように、funk3の関数26Cに代えて、funk1の関数26Aがキャッシュメモリ28の残りの領域に格納される。この間、funk2の関数26Bについてはキャッシュメモリ28に格納されたままであるので、funk2の関数26Bが必要な場合には、ROM14にアクセスせずとも、常時キャッシュメモリ28から当該関数26BがCPUコア24に供給される。
【0041】
また、2回目以降の実行時においても、図3のステップ108で、アプリケーションプログラムが目的とする本来の処理中、すなわち本体プログラム22Aの実行中にアクセスした各関数26及び各データ30のアドレス履歴が取得されて、ステップ110では、その結果を履歴データ36に加算して、累計データとなるように不揮発メモリ18内の履歴データ36が更新される。すなわち、この履歴データ36の更新により、2回目以降の実行時は、当該アプリケーションプログラム22の前回の実行までで、最も実行頻度の高かった関数26及び使用頻度の高かったデータ30をキャッシュメモリ28、32にロック(常駐)させて、アプリケーションプログラム22が目的とする本来の処理が実行されることになる。
【0042】
このように、本実施形態によれば、アプリケーションプログラム22を実行した際のアドレス履歴を取得することで、実行頻度の高い関数26及び使用頻度の高いデータ30を学習して、次回の当該アプリケーションプログラム22の実行時には、当該実行頻度の最も高い関数26及び使用頻度の最も高いデータ30をキャッシュメモリ28、32にロック(常駐)させるようになっている。これにより、実行頻度の高い関数26及び使用頻度の高いデータ30については、ROM14やRAM16といった外部メモリからではなく、キャッシュメモリ28、32から供給を受けることができ、ROM14やRAM16といった外部メモリへのアクセス回数を低減することができる。すなわち、外部メモリへのアクセスによるCPUのパフォーマンス低下を抑えることができ、当該アプリケーションプログラム22全体の処理に要する時間を短縮することができる。
【0043】
なお、上記では、アプリケーションプログラム22が実行されるたびに、毎回、アドレス履歴を取得して、実行頻度の高い関数26及び使用頻度の高いデータ30を学習する場合を例に説明したが、本発明はこれに限定されるものではない。例えば、図2に点線で示すように、アプリケーションプログラム22を実行した際に、付加プログラム22Bにより、情報処理装置10内に、中止手段として、アドレス履歴管理部52の動作を制御する履歴取得制御部80が更に構築されるようにし、当該アプリケーションプログラム22の実行により、例えば図7に示す処理が開始されるようにしてもよい。なお、図7では、図3と同一の処理ステップについては同一のステップ番号を付与しており、詳細な説明は省略する。
【0044】
すなわち、図7に示す処理では、ステップ106のアプリケーションプログラム22本来の処理の開始前に、ステップ120において、履歴取得制御部80の機能により、履歴の取得が必要か否かが判断されるようになっている。
【0045】
なお、このときの判断基準は、アプリケーションプログラム22が目的とする本来の処理、すなわち本体プログラム22Aにより実行される処理により定めればよい。例えば、本体プログラム22Aが毎回同じ処理を実行するためのものである場合は、関数26の実行頻度及びデータ30の使用頻度の順位に変動はないので、不揮発メモリ18に履歴データ36が無い場合にのみ、履歴の取得が必要であると判断し、不揮発メモリ18に履歴データ36が格納されている、すなわち過去に1回でも履歴が取得されている場合には、履歴の取得は不要であると判断すればよい。本体プログラム22Aが毎回同じ処理を実行するものではない場合は、関数26の実行頻度及びデータ30の使用頻度の順位に大きな変動がなくなる(収束する)までは、履歴の取得が必要であると判断し、大きな順位変動が無くなったら、履歴の取得は不要であると判断すればよい。
【0046】
ステップ120で履歴の取得が必要と判断した場合には、図3と同様にステップ106で、アプリケーションプログラム22が目的とする本来の処理を行いながら、ステップ108で関数26及びデータ30のアドレス履歴を取得して、ステップ110で履歴データ36を更新し、処理を終了する。一方、履歴の取得が不要と判断された場合には、履歴取得制御部80によりアドレス管理部52の動作が中止され、ステップ120からステップ122に進み、アプリケーションプログラム22が目的とする本来の処理を行ったら、アドレス履歴の取得及び履歴データ36の更新は行わずに、そのまま処理を終了する。
【0047】
このように、履歴取得の要否を判断し、必要が無い場合、すなわち関数26の実行頻度やデータ30の使用頻度の順位に変動が無く、ロックするための関数26やデータ30の選択に変更が無いと見込まれる場合には、無駄な履歴の取得を中止させることで、さらに処理時間の短縮が可能である。
【0048】
なお、上記では、最も実行頻度の高い関数26及び使用頻度の高いデータ30をキャッシュメモリ28、30にロックする場合を例に説明したが、本発明はこれに限定されるものではない。実行回数及び使用回数が複数回以上の関数26及びデータ30をキャッシュメモリにロックさせれば、当該関数26及びデータ39の2回目以降のアクセス時間を短縮でき、外部メモリへのアクセスによるCPUのパフォーマンス低下を防止することができる。ただし、より高いパフォーマンス低下防止効果を得るためには、実行頻度及び使用頻度が高いものをロックすることが好ましい。
【0049】
また、本発明は、キャッシュメモリにロックする関数26やデータ30の個数を特に限定されるものではなく、例えば、実行頻度及び使用頻度の高い順に、複数の関数26やデータ30をキャッシュメモリにロックさせてもよい。ロックさせる関数26やデータ30の個数は、キャッシュメモリの容量と関数及びデータのデータサイズに応じて適宜定めればよい。また、特に関数26については、関数26単位でキャッシュメモリ28にロックするのではなく、関数26の一部分のみをロックさせてもよい。言い替えると、履歴を取得する実行単位のアドレスは、各関数の先頭のアドレスではなく、各関数(プログラム)中の任意のアドレスとすることもできる。
【0050】
また、上記では、アプリケーションプログラム22毎に、アクセスしたアドレスの履歴を取得して、履歴データ36を管理する場合を例に説明したが、本発明はこれに限定されるものではなく、アプリケーションプログラム22を区別せずに、アクセスしたアドレスの履歴をまとめて1つの履歴データ36としてもよい。ただし、アプリケーションプログラム22によって、実行する関数26や参照するデータ30は異なるため、アプリケーションプログラム22毎に最適な関数26やデータ30を選択してキャッシュメモリ28、32に常駐させるためには、上記のように、アプリケーションプログラム22毎に履歴データ36を取得して管理することが好ましい。
【0051】
【発明の効果】
上記に示したように、本発明は、キャッシュメモリを内蔵した演算装置の外部メモリへのアクセス回数を低減することができるという優れた効果を有する。
【図面の簡単な説明】
【図1】本実施形態に係る情報処理装置の構成を示すブロック図である。
【図2】本実施形態に係る情報処理装置の機能構成図である。
【図3】本実施形態に係わる情報処理装置におけるアプリケーションプログラムの実行時の処理を示すフローチャートである。
【図4】履歴取得のためのプログラムの一例である。
【図5】図4のプログラムにより取得された履歴の一例である。
【図6】(A)〜(D)は、本実施の形態に係わる情報処理装置におけるキャッシュメモリへの関数の格納動作を説明するための概念図である。
【図7】別の実施形態に係わる情報処理装置におけるアプリケーションプログラムの実行時の処理を示すフローチャートである。
【図8】従来のキャッシュメモリへの関数の格納動作を説明するための概念図である。
【符号の説明】
10 情報処理装置
12 CPU
14 ROM
16 RAM
18 不揮発メモリ
22 アプリケーションプログラム
22A 本体プログラム
22B 付加プログラム
24 CPUコア
26、26A、26B、26C 関数
28、32 キャッシュメモリ
30 データ
34 キャッシュ制御部
36 履歴データ
50 プログラム実行部
52 アドレス履歴管理部
54 アドレス選択部
80 履歴取得制御部[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a data management method for a cache memory and an information processing apparatus, and more particularly, to a data management method for a cache memory for managing storage of data in a cache memory built in an arithmetic device that performs arithmetic processing, and a cache. The present invention relates to an information processing device including an arithmetic device having a built-in memory.
[0002]
[Prior art]
In a CPU, necessary data is called from an external memory to perform arithmetic processing. Generally, a storage device such as a DRAM (Dynamic RAM) used as an external memory has a feature that the capacity can be easily increased but the response speed is slow. However, the processing time (performance) of the CPU is reduced due to the access time to the external memory. For this reason, as shown in FIG. 8, the
[0003]
Here, if all necessary data can be stored in the cache memory, access to the external memory becomes unnecessary after the storage. However, it is technically difficult to increase the capacity of the cache memory, and the amount of data that can be stored is limited, and it is impossible to eliminate the need to access an external memory. For this reason, conventionally, the execution history of the instruction address is held, and when the execution address of the instruction address when data required in the past is not stored in the cache memory (cache miss) approaches, A technique has been proposed in which data to be stored in a cache memory at the time of a cache miss is stored in advance in a buffer provided at a location where the access time is shorter than that of the external memory, and the disadvantage at the time of a cache miss is minimized.
[0004]
[Patent Document 1]
JP 2001-134439 A
[0005]
[Problems to be solved by the invention]
However, in the related art, the access time per cache miss can be reduced by interposing a buffer as compared with accessing the external memory. However, since the frequency of occurrence of the cache miss does not change, the number of cache misses can be reduced. The number of accesses to the buffer increases as the number increases, and there is a problem that the performance of the CPU decreases.
[0006]
SUMMARY OF THE INVENTION The present invention has been made to solve the above problems, and provides a data management method and an information processing apparatus for a cache memory, which can reduce the number of accesses to an external memory by an arithmetic unit having a built-in cache memory. With the goal.
[0007]
[Means for Solving the Problems]
In order to achieve the above object, an invention according to claim 1 is a data management method for a cache memory for managing storage of data in a cache memory built in an arithmetic device, wherein the method includes the steps of: When the program is executed, a history of addresses of data accessed during the execution is acquired and stored, and when the predetermined program is executed, an address included in the history is selected and selected. Data corresponding to an address is resident in the cache memory.
[0008]
According to the first aspect of the present invention, in an arithmetic unit having a built-in cache memory, a history of addresses accessed when a program was executed in the past is acquired and stored, and when the program is executed again, The data of the address selected from the addresses included in the history is resident in the cache memory. Therefore, when it becomes necessary to access the selected address during the second and subsequent executions of the program, the arithmetic unit supplies the data corresponding to the address from the cache memory instead of the external memory. Can receive. As a result, the number of accesses to the external memory can be reduced.
[0009]
Note that the address to be obtained may be an address of a predetermined execution unit or an address of a predetermined reference unit. That is, a function that is a subprogram called at the time of execution of a predetermined program or a part thereof may be resident in the cache memory, or data referred to at the time of execution of the predetermined program may be resident.
[0010]
In the above-described cache memory data management method, it is preferable that a high-frequency address in the history be selected.
[0011]
The above data management method for the cache memory can be realized by the following information processing device. That is, this information processing apparatus stores an arithmetic device having a cache memory therein and an address history of data accessed when the arithmetic device executes a predetermined program. History acquisition means for acquiring, storage means for storing the history acquired by the history acquisition means, selection means for selecting an address included in the history stored in the storage means, selection by the selection means And control means for controlling data corresponding to the designated address to be resident in the cache memory.
[0012]
In the above information processing apparatus, the address at which the history is acquired may be an address of a predetermined execution unit as described in claim 4, or may be a predetermined execution unit as described in claim 5. The address may be a reference unit. In the information processing apparatus, the selection unit may select a high-frequency address in the history.
[0013]
Further, as described in claim 7, the acquisition means may acquire and manage the history for each program.
[0014]
Further, as described in claim 8, it is preferable that the information processing apparatus further includes a stop unit that stops the acquisition of the history by the acquisition unit. The stopping means in this case may stop the acquisition of the history by the acquiring means at the time of executing the program for the second time or later, as described in claim 9. As described above, in the history acquired by the acquisition unit, if there is no change in the frequency order of the address, acquisition of the history by the acquisition unit at the time of executing the program thereafter is stopped. Is also good.
[0015]
BEST MODE FOR CARRYING OUT THE INVENTION
Next, an example of an embodiment according to the present invention will be described in detail with reference to the drawings.
[0016]
FIG. 1 shows an information processing apparatus to which the present invention is applied. The information processing apparatus 10 illustrated in FIG. 1 includes a
[0017]
The
[0018]
The
[0019]
When the
[0020]
The
[0021]
As the
[0022]
Here, in the information processing apparatus 10 according to the present embodiment, when the
[0023]
That is, by executing the
[0024]
The
[0025]
The address
[0026]
During execution of the main program 22A, the address
[0027]
Note that, specifically, in the present embodiment, a
[0028]
The
[0029]
The
[0030]
More specifically, the
[0031]
Therefore, by notifying the
[0032]
Next, the operation of the present embodiment will be described. In the information processing apparatus 10 according to the present embodiment, the processing shown in FIG.
[0033]
That is, when the
[0034]
In
[0035]
Here, the acquisition of the history of the
[0036]
Specifically, the main program 22A of the
[0037]
In this case, by describing the
[0038]
On the other hand, when the
[0039]
For example, in the above-described example, since the
[0040]
Thereafter, when the
[0041]
Also, at the time of the second or subsequent execution, the address history of each
[0042]
As described above, according to the present embodiment, by acquiring the address history when the
[0043]
In the above description, an example has been described in which the address history is acquired and the frequently executed
[0044]
That is, in the process shown in FIG. 7, before the start of the original process of the
[0045]
Note that the determination criterion at this time may be determined by the original processing intended by the
[0046]
If it is determined in
[0047]
In this way, it is determined whether or not the history acquisition is necessary. If it is not necessary, that is, the execution frequency of the
[0048]
In the above, the case where the most frequently executed
[0049]
Further, the present invention does not particularly limit the number of the
[0050]
Further, in the above, the case where the history of the accessed address is acquired for each
[0051]
【The invention's effect】
As described above, the present invention has an excellent effect that the number of times of access to an external memory of an arithmetic unit having a built-in cache memory can be reduced.
[Brief description of the drawings]
FIG. 1 is a block diagram illustrating a configuration of an information processing apparatus according to an embodiment.
FIG. 2 is a functional configuration diagram of the information processing apparatus according to the embodiment.
FIG. 3 is a flowchart illustrating processing when an application program is executed in the information processing apparatus according to the embodiment.
FIG. 4 is an example of a program for acquiring history.
FIG. 5 is an example of a history acquired by the program of FIG. 4;
FIGS. 6A to 6D are conceptual diagrams for describing an operation of storing a function in a cache memory in the information processing apparatus according to the present embodiment.
FIG. 7 is a flowchart illustrating processing when an application program is executed in an information processing apparatus according to another embodiment.
FIG. 8 is a conceptual diagram for explaining a conventional operation of storing a function in a cache memory.
[Explanation of symbols]
10 Information processing device
12 CPU
14 ROM
16 RAM
18 Non-volatile memory
22 Application programs
22A body program
22B Additional program
24 CPU core
26, 26A, 26B, 26C functions
28, 32 cache memory
30 data
34 Cache control unit
36 History data
50 Program execution unit
52 Address History Management Unit
54 Address Selector
80 History acquisition control unit
Claims (10)
前記演算装置で所定のプログラムを実行した際に、当該実行中にアクセスしたデータのアドレスの履歴を取得して記憶しておき、
前記所定のプログラムを実行する際に、前記履歴に含まれるアドレスを選択し、
選択したアドレスに対応するデータを前記キャッシュメモリに常駐させる、
ことを特徴とするキャッシュメモリのデータ管理方法。A data management method of a cache memory for managing storage of data in a cache memory built in an arithmetic device,
When a predetermined program is executed by the arithmetic unit, a history of addresses of data accessed during the execution is acquired and stored,
When executing the predetermined program, select an address included in the history,
Causing data corresponding to the selected address to reside in the cache memory;
A data management method for a cache memory, characterized in that:
ことを特徴とする請求項1に記載のキャッシュメモリのデータ管理方法。Selecting a high frequency address in the history,
2. The data management method for a cache memory according to claim 1, wherein:
前記演算装置で所定のプログラムを実行した際に、アクセスしたデータのアドレスの履歴を取得する履歴取得手段と、
前記履歴取得手段により取得された前記履歴を記憶する記憶手段と、
前記記憶手段に記憶されている前記履歴に含まれるアドレスを選択する選択手段と、
前記選択手段により選択されたアドレスに対応するデータが前記キャッシュメモリに常駐されるように制御する制御手段と、
を備えた情報処理装置。An arithmetic unit with a built-in cache memory;
When a predetermined program is executed by the arithmetic unit, a history acquisition unit that acquires a history of addresses of accessed data,
Storage means for storing the history acquired by the history acquisition means,
Selection means for selecting an address included in the history stored in the storage means,
Control means for controlling data corresponding to the address selected by the selection means to be resident in the cache memory;
Information processing device provided with.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002360470A JP4304974B2 (en) | 2002-12-12 | 2002-12-12 | Data management method for cache memory and information processing apparatus |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002360470A JP4304974B2 (en) | 2002-12-12 | 2002-12-12 | Data management method for cache memory and information processing apparatus |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2004192403A true JP2004192403A (en) | 2004-07-08 |
JP4304974B2 JP4304974B2 (en) | 2009-07-29 |
Family
ID=32759535
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2002360470A Expired - Fee Related JP4304974B2 (en) | 2002-12-12 | 2002-12-12 | Data management method for cache memory and information processing apparatus |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP4304974B2 (en) |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2011234049A (en) * | 2010-04-26 | 2011-11-17 | Nec Corp | Portable terminal device, method for starting application of portable terminal device, and computer program |
JP2012181863A (en) * | 2004-10-21 | 2012-09-20 | Microsoft Corp | Using external memory devices to improve system performance |
US9361183B2 (en) | 2008-09-19 | 2016-06-07 | Microsoft Technology Licensing, Llc | Aggregation of write traffic to a data store |
US9529716B2 (en) | 2005-12-16 | 2016-12-27 | Microsoft Technology Licensing, Llc | Optimizing write and wear performance for a memory |
CN106547619A (en) * | 2016-10-20 | 2017-03-29 | 深圳市云海麒麟计算机系统有限公司 | Multi-user's memory management method and system |
US10216637B2 (en) | 2004-05-03 | 2019-02-26 | Microsoft Technology Licensing, Llc | Non-volatile memory cache performance improvement |
KR20190058316A (en) * | 2017-11-20 | 2019-05-29 | 삼성전자주식회사 | Systems and methods for efficient cache line handling based on predictions |
JP2019114013A (en) * | 2017-12-22 | 2019-07-11 | 株式会社富士通アドバンストエンジニアリング | Arithmetic processing apparatus and control method of arithmetic processing apparatus |
US10387313B2 (en) | 2008-09-15 | 2019-08-20 | Microsoft Technology Licensing, Llc | Method and system for ensuring reliability of cache data and metadata subsequent to a reboot |
JP6929474B1 (en) * | 2020-05-01 | 2021-09-01 | 三菱電機株式会社 | Program execution device, program execution method and computer program |
WO2023013649A1 (en) * | 2021-08-06 | 2023-02-09 | 株式会社エヌエスアイテクス | Data cache device and program |
-
2002
- 2002-12-12 JP JP2002360470A patent/JP4304974B2/en not_active Expired - Fee Related
Cited By (21)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10216637B2 (en) | 2004-05-03 | 2019-02-26 | Microsoft Technology Licensing, Llc | Non-volatile memory cache performance improvement |
JP2012181863A (en) * | 2004-10-21 | 2012-09-20 | Microsoft Corp | Using external memory devices to improve system performance |
US9317209B2 (en) | 2004-10-21 | 2016-04-19 | Microsoft Technology Licensing, Llc | Using external memory devices to improve system performance |
US9690496B2 (en) | 2004-10-21 | 2017-06-27 | Microsoft Technology Licensing, Llc | Using external memory devices to improve system performance |
US9529716B2 (en) | 2005-12-16 | 2016-12-27 | Microsoft Technology Licensing, Llc | Optimizing write and wear performance for a memory |
US11334484B2 (en) | 2005-12-16 | 2022-05-17 | Microsoft Technology Licensing, Llc | Optimizing write and wear performance for a memory |
US10387313B2 (en) | 2008-09-15 | 2019-08-20 | Microsoft Technology Licensing, Llc | Method and system for ensuring reliability of cache data and metadata subsequent to a reboot |
US9361183B2 (en) | 2008-09-19 | 2016-06-07 | Microsoft Technology Licensing, Llc | Aggregation of write traffic to a data store |
US9448890B2 (en) | 2008-09-19 | 2016-09-20 | Microsoft Technology Licensing, Llc | Aggregation of write traffic to a data store |
US10509730B2 (en) | 2008-09-19 | 2019-12-17 | Microsoft Technology Licensing, Llc | Aggregation of write traffic to a data store |
JP2011234049A (en) * | 2010-04-26 | 2011-11-17 | Nec Corp | Portable terminal device, method for starting application of portable terminal device, and computer program |
CN106547619A (en) * | 2016-10-20 | 2017-03-29 | 深圳市云海麒麟计算机系统有限公司 | Multi-user's memory management method and system |
CN106547619B (en) * | 2016-10-20 | 2023-05-05 | 深圳市云海麒麟计算机系统有限公司 | Multi-user storage management method and system |
US11138121B2 (en) | 2017-11-20 | 2021-10-05 | Samsung Electronics Co., Ltd. | Systems and methods for efficient cacheline handling based on predictions |
KR102193689B1 (en) | 2017-11-20 | 2020-12-21 | 삼성전자주식회사 | Systems and methods for efficient cache line handling based on predictions |
KR20190058316A (en) * | 2017-11-20 | 2019-05-29 | 삼성전자주식회사 | Systems and methods for efficient cache line handling based on predictions |
JP2019114013A (en) * | 2017-12-22 | 2019-07-11 | 株式会社富士通アドバンストエンジニアリング | Arithmetic processing apparatus and control method of arithmetic processing apparatus |
JP7144670B2 (en) | 2017-12-22 | 2022-09-30 | 富士通株式会社 | Arithmetic processing device and method of controlling arithmetic processing device |
JP6929474B1 (en) * | 2020-05-01 | 2021-09-01 | 三菱電機株式会社 | Program execution device, program execution method and computer program |
WO2021220516A1 (en) * | 2020-05-01 | 2021-11-04 | 三菱電機株式会社 | Program execution device, program execution method, and computer program |
WO2023013649A1 (en) * | 2021-08-06 | 2023-02-09 | 株式会社エヌエスアイテクス | Data cache device and program |
Also Published As
Publication number | Publication date |
---|---|
JP4304974B2 (en) | 2009-07-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7093258B1 (en) | Method and system for managing distribution of computer-executable program threads between central processing units in a multi-central processing unit computer system | |
US6073232A (en) | Method for minimizing a computer's initial program load time after a system reset or a power-on using non-volatile storage | |
EP0747816B1 (en) | Method and system for high performance multithread operation in a data processing system | |
US8250332B2 (en) | Partitioned replacement for cache memory | |
JP3986950B2 (en) | CPU, information processing apparatus having the same, and control method of CPU | |
JP3739491B2 (en) | Harmonized software control of Harvard architecture cache memory using prefetch instructions | |
US20050086435A1 (en) | Cache memory controlling apparatus, information processing apparatus and method for control of cache memory | |
US7395397B2 (en) | Electronic apparatus with page table management of program, data processing method and computer program | |
WO2018096316A1 (en) | Data processing | |
JP2001109661A (en) | Assigning method for cache memory, operating system and computer system having the operating system | |
JPH06348595A (en) | Cache device | |
JP2009211153A (en) | Memory device, information processing apparatus, and electric power controlling method | |
TW200428210A (en) | Memory management | |
US8954969B2 (en) | File system object node management | |
JP2004192403A (en) | Information processing system and method for managing data in cache memory | |
JP2001290706A (en) | Prefetch for tlb cache | |
JPWO2011096163A1 (en) | Information processing system, exclusive control method, and exclusive control program | |
KR101392062B1 (en) | Fast speed computer system power-on & power-off method | |
US6256714B1 (en) | Computer system with efficient memory usage for managing multiple application programs | |
KR100985239B1 (en) | Reducing cache trashing of certain pieces | |
US6862675B1 (en) | Microprocessor and device including memory units with different physical addresses | |
US20090320036A1 (en) | File System Object Node Management | |
WO2010116405A1 (en) | Calculation system provided with nonvolatile main memory | |
JP4792065B2 (en) | Data storage method | |
JP2001229053A (en) | Computer with dump acquiring mechanism |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20051121 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20081209 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20081216 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20090209 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20090407 |
|
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20090420 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120515 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120515 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130515 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20140515 Year of fee payment: 5 |
|
LAPS | Cancellation because of no payment of annual fees |