JP2014002787A - Multi-core processor system, cache coherency control method, and cache coherency control program - Google Patents
Multi-core processor system, cache coherency control method, and cache coherency control program Download PDFInfo
- Publication number
- JP2014002787A JP2014002787A JP2013184347A JP2013184347A JP2014002787A JP 2014002787 A JP2014002787 A JP 2014002787A JP 2013184347 A JP2013184347 A JP 2013184347A JP 2013184347 A JP2013184347 A JP 2013184347A JP 2014002787 A JP2014002787 A JP 2014002787A
- Authority
- JP
- Japan
- Prior art keywords
- thread
- cache
- cpu
- snoop
- coherency
- 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
Abstract
Description
本発明は、キャッシュコヒーレンシ機構を制御するマルチコアプロセッサシステム、キャッシュコヒーレンシ制御方法、およびキャッシュコヒーレンシ制御プログラムに関する。 The present invention relates to a multi-core processor system that controls a cache coherency mechanism, a cache coherency control method, and a cache coherency control program.
近年、マルチコアプロセッサシステムでは、コアごとに独立したキャッシュメモリを搭載しており、キャッシュコヒーレンシ機構によりキャッシュメモリの一貫性を維持する、といった形態がとられている。キャッシュコヒーレンシ機構を利用したマルチコアプロセッサシステムでは、キャッシュメモリに格納された共有データの一貫性の維持をハードウェアで行うために、マルチコアプロセッサ向けの並列ソフトウェアを容易に作成することができる。 In recent years, multi-core processor systems are equipped with an independent cache memory for each core, and the cache coherency mechanism is used to maintain the consistency of the cache memory. In a multi-core processor system using a cache coherency mechanism, parallel software for a multi-core processor can be easily created in order to maintain the consistency of shared data stored in a cache memory with hardware.
キャッシュコヒーレンシ機構は、キャッシュメモリの動作を監視するために、キャッシュメモリアクセス時の遅延が発生する。遅延を防止する技術として、SMP(Symmetric Multi Processing)かASMP(ASymmetric Multi Processing)に基づいて、キャッシュコヒーレンシ機構を制御する技術が開示されている(たとえば、下記特許文献1を参照。)。特許文献1では、複数のコアが複数のプロセスを実行する場合をSMPとし、複数のコアが単一のプロセスを実行する場合をASMPとしている。プロセスとはプログラムの実行単位であり、一つのプロセスには、一つ以上のスレッドが属している。同じプロセスに属するスレッドは、同じメモリ空間にアクセスする。
Since the cache coherency mechanism monitors the operation of the cache memory, a delay occurs when the cache memory is accessed. As a technique for preventing a delay, a technique for controlling a cache coherency mechanism based on SMP (Symmetric Multi Processing) or ASMP (Asymmetric Multi Processing) is disclosed (for example, see
また、別の技術として、複数のコアが、同一のプロセスに属するスレッドを実行する場合にコヒーレンシを実行し、異なるプロセスに属するスレッドを実行する場合にはコヒーレンシを実行しないという技術が開示されている(たとえば、下記特許文献2を参照。)。
As another technique, a technique is disclosed in which a plurality of cores execute coherency when executing threads belonging to the same process, and do not execute coherency when executing threads belonging to different processes. (For example, see
また、スレッド間の依存関係を解析する技術として、各スレッドを1ステートメントごとに実行することにより、共有データへのアクセスを表す情報を作成し、スレッドのステートメントごとの依存関係を解析する技術が開示されている(たとえば、下記特許文献3を参照。)。
In addition, as a technology for analyzing the dependency relationship between threads, a technology is disclosed in which information representing access to shared data is created by executing each thread for each statement, and the dependency relationship for each statement of the thread is analyzed. (For example, refer to
上述した従来技術において、特許文献1、2にかかる技術では、プロセスの単位にてコヒーレンシを実行するか否かを判断している。また、組み込み機器など、多くの機能を同時に使用しない場合は、単一のプロセスにて実行されることが多い。したがって、組み込み機器に特許文献1、2にかかる技術を適用しても、コヒーレンシを常に実行することになり、キャッシュコヒーレンシ機構の動作が増加し、キャッシュメモリへの遅延発生や、消費電力の増大を招くという問題があった。
In the prior art described above, the techniques according to
また、特許文献3にかかる技術を用いると、ステートメントごとに共有データのアクセス情報を解析するため、ステートメントごとにキャッシュコヒーレンシ機構を制御することになり、制御の回数が非常に増大してしまうという問題があった。
Further, when the technique according to
本発明は、上述した従来技術による問題点を解消するため、キャッシュコヒーレンシ機構の動作を削減できるマルチコアプロセッサシステム、キャッシュコヒーレンシ制御方法、およびキャッシュコヒーレンシ制御プログラムを提供することを目的とする。 An object of the present invention is to provide a multi-core processor system, a cache coherency control method, and a cache coherency control program capable of reducing the operation of a cache coherency mechanism in order to solve the above-described problems caused by the prior art.
上述した課題を解決し、目的を達成するため、開示のマルチコアプロセッサシステムは、複数のコアのそれぞれがアクセスする複数のキャッシュメモリを有するマルチコアプロセッサシステムであって、複数のコアのいずれか一つは、複数のコアのうち第1のコアによって実行された第1のスレッドを検出した場合に、複数のコアのうち第1のコア以外の第2のコアにより実行中の第2のスレッドを検出し、第1のスレッドおよび第2のスレッドの実行時に共通してアクセスする共有データが無い場合には、複数のキャッシュメモリのうち第1のコアに対応する第1のキャッシュメモリと第2のコアに対応する第2のキャッシュメモリとのコヒーレンシ処理を停止させる。 In order to solve the above-described problems and achieve the object, a disclosed multi-core processor system is a multi-core processor system having a plurality of cache memories accessed by each of a plurality of cores, and any one of the plurality of cores is When a first thread executed by the first core among the plurality of cores is detected, a second thread being executed by the second core other than the first core among the plurality of cores is detected. If there is no shared data that is commonly accessed during execution of the first thread and the second thread, the first cache memory corresponding to the first core and the second core among the plurality of cache memories The coherency process with the corresponding second cache memory is stopped.
本マルチコアプロセッサシステム、キャッシュコヒーレンシ制御方法、およびキャッシュコヒーレンシ制御プログラムによれば、キャッシュコヒーレンシ機構内の動作を削減し、消費電力の削減や、遅延の防止を図ることができるという効果を奏する。 According to the multi-core processor system, the cache coherency control method, and the cache coherency control program, operations in the cache coherency mechanism can be reduced, and power consumption can be reduced and delay can be prevented.
以下に添付図面を参照して、本発明にかかるマルチコアプロセッサシステム、キャッシュコヒーレンシ制御方法、およびキャッシュコヒーレンシ制御プログラムの好適な実施の形態を詳細に説明する。 Exemplary embodiments of a multi-core processor system, a cache coherency control method, and a cache coherency control program according to the present invention will be described below in detail with reference to the accompanying drawings.
(マルチコアプロセッサシステム100のハードウェア)
図1は、実施の形態にかかるマルチコアプロセッサシステム100のハードウェアを示すブロック図である。図1において、マルチコアプロセッサシステム100は、CPUを複数搭載するCPUs101と、ROM(Read‐Only Memory)102と、RAM(Random Access Memory)103と、を備えている。また、マルチコアプロセッサシステム100は、フラッシュROM104と、フラッシュROMコントローラ105と、フラッシュROM106と、を備えている。また、マルチコアプロセッサシステム100は、ユーザやその他の機器との入出力装置として、ディスプレイ107と、I/F(Interface)108と、キーボード109と、を備えている。また、各部はバス110によってそれぞれ接続されている。
(Hardware of the multi-core processor system 100)
FIG. 1 is a block diagram illustrating hardware of a
ここで、CPUs101は、マルチコアプロセッサシステム100の全体の制御を司る。CPUs101は、シングルコアのプロセッサを並列して接続したすべてのCPUを指している。CPUs101の詳細は、図2にて後述する。また、マルチコアプロセッサシステムとは、コアが複数搭載されたプロセッサを含むコンピュータのシステムである。なお、本実施の形態では、説明を単純化するため、シングルコアのプロセッサが並列されているプロセッサ群を例に挙げて説明する。
Here, the
ROM102は、ブートプログラムなどのプログラムを記憶している。RAM103は、CPUs101のワークエリアとして使用される。フラッシュROM104は、OS(Operating System)などのシステムソフトウェアやアプリケーションソフトウェアなどを記憶している。たとえば、OSを更新する場合、マルチコアプロセッサシステム100は、I/F108によって新しいOSを受信し、フラッシュROM104に格納されている古いOSを、受信した新しいOSに更新する。
The
フラッシュROMコントローラ105は、CPUs101の制御に従ってフラッシュROM106に対するデータのリード/ライトを制御する。フラッシュROM106は、フラッシュROMコントローラ105の制御で書き込まれたデータを記憶する。データの具体例としては、マルチコアプロセッサシステム100を使用するユーザがI/F108を通して取得した画像データ、映像データなどである。フラッシュROM106は、たとえば、メモリカード、SDカードなどを採用することができる。
The
ディスプレイ107は、カーソル、アイコンあるいはツールボックスをはじめ、文書、画像、機能情報などのデータを表示する。このディスプレイ107は、たとえば、TFT液晶ディスプレイなどを採用することができる。
A
I/F108は、通信回線を通じてLAN(Local Area Network)、WAN(Wide Area Network)、インターネットなどのネットワーク111に接続され、ネットワーク111を介して他の装置に接続される。そして、I/F108は、ネットワーク111と内部のインターフェースを司り、外部装置からのデータの入出力を制御する。I/F108には、たとえばモデムやLANアダプタなどを採用することができる。キーボード109は、数字、各種指示などの入力のためのキーを備え、データの入力を行う。また、キーボード109は、タッチパネル式の入力パッドやテンキーなどであってもよい。
The I /
図2は、マルチコアプロセッサシステム100のハードウェアの一部とソフトウェアを示すブロック図である。図2で示されるハードウェアは、キャッシュコヒーレンシ機構201と、共有メモリ202と、CPUs101に含まれるCPU#0〜CPU#3とである。共有メモリ202と、CPU#0〜CPU#3はキャッシュコヒーレンシ機構201によって接続されている。また、CPU#0〜CPU#3は、共有メモリ202のデータに高速にアクセス可能とするため、共有メモリ202のデータをコピーしたキャッシュメモリを保持する。本実施の形態におけるCPU#0〜CPU#3のキャッシュメモリは、キャッシュコヒーレンシ機構201の内部に存在する。
FIG. 2 is a block diagram showing a part of hardware and software of the
キャッシュコヒーレンシ機構201は、CPU#0〜CPU#3がアクセスするキャッシュメモリの整合性をとる装置である。キャッシュコヒーレンシ機構の方式としては、大別してスヌープ方式とディレクトリ方式とがある。
The
スヌープ方式とは、キャッシュメモリが自身のキャッシュメモリや他CPUのキャッシュメモリの更新状態を管理し、他のキャッシュメモリと更新状態の情報を交換する方式である。更新状態の情報を交換することで、スヌープ方式をとるキャッシュコヒーレンシ機構は、どのキャッシュメモリに最新のデータが存在するかを判断する。また、各キャッシュメモリが最新のデータを取得できるように、スヌープ方式をとるキャッシュコヒーレンシ機構は、自身のキャッシュメモリの状態を変更したりキャッシュメモリの無効化を行う。 The snoop method is a method in which the cache memory manages the update state of its own cache memory and the cache memory of another CPU and exchanges update state information with other cache memories. By exchanging information on the update state, the cache coherency mechanism adopting the snoop method determines in which cache memory the latest data exists. In addition, the cache coherency mechanism using the snoop method changes the state of its own cache memory or invalidates the cache memory so that each cache memory can acquire the latest data.
ディレクトリ方式とは、キャッシュメモリの一貫性をディレクトリと呼ぶ専用領域にて一元管理する方式である。ディレクトリ方式をとるキャッシュコヒーレンシ機構では、キャッシュメモリからディレクトリへデータを送り、すべてのキャッシュメモリがデータを共有する。 The directory system is a system in which the consistency of cache memory is centrally managed in a dedicated area called a directory. In a cache coherency mechanism using a directory system, data is sent from a cache memory to a directory, and all the cache memories share the data.
いずれの方式においても、キャッシュコヒーレンシ機構201は、各CPUのキャッシュメモリが主記憶となる共有メモリ202と一致するかを判断する。不一致が発生した場合、キャッシュコヒーレンシ機構201は、一致をとるためキャッシュメモリのコピー、更新、無効化などを行うことで、不一致を解消する。本実施の形態におけるキャッシュコヒーレンシ機構201は、スヌープ方式にて説明を行うが、ディレクトリ方式であっても本実施の形態を適用することができる。
In any method, the
また、キャッシュコヒーレンシ機構201の内部としては、スヌープ対応キャッシュ#0〜スヌープ対応キャッシュ#3とスヌープ対応したバス110が存在する。CPU#0〜CPU#3は、対応するスヌープ対応キャッシュ#0〜スヌープ対応キャッシュ#3にそれぞれアクセスする。たとえば、CPU#0は、スヌープ対応キャッシュ#0にアクセスする。スヌープ対応キャッシュの詳細については、図3にて後述する。
In the
スヌープ対応したバス110は、従来のバスの機能に加えて、スヌープに対応するために機能追加されたバスである。スヌープ対応したバス110の詳細は、図4にて後述する。また、スヌープ対応キャッシュ#0は、マスタI/F#0とスレーブI/F#0とで、スヌープ対応したバス110と接続される。同様にスヌープ対応キャッシュ#1〜スヌープ対応キャッシュ#3も、それぞれのマスタI/FとスレーブI/Fとで、スヌープ対応したバス110と接続される。
The snoop
共有メモリ202は、CPU#0〜CPU#3からアクセス可能な記憶領域である。記憶領域とは、具体的には、たとえば、ROM102、RAM103、フラッシュROM104である。
The shared
図2で示されるソフトウェアは、OS203と、スレッド#0〜スレッド#3と、である。OS203は、マルチコアプロセッサシステム100を制御するプログラムである。具体的にOS203は、CPU#0〜CPU#3が実行するソフトウェアのスケジューリング処理を行う。スレッド#0〜スレッド#3は、OS203によってCPU#0〜CPU#3に割り当てられたスレッドである。スレッド#0〜スレッド#3は、同一のプロセスに属する場合も、異なるプロセスに属する場合も存在する。
The software shown in FIG. 2 is the
図3は、スヌープ対応キャッシュ#0の内部を示すブロック図である。図3では、スヌープ対応キャッシュ#0〜スヌープ対応キャッシュ#3のうち、スヌープ対応キャッシュ#0を用いて内部を説明する。
FIG. 3 is a block diagram showing the inside of the snoop-
スヌープ対応キャッシュ#0は、キャッシュライン記憶部#0とキャッシュライン制御部#0とを内部に含む。キャッシュライン記憶部#0は、データフィールドと、アドレスフィールドと、ステートフィールドを含む。データフィールドは、数十バイト程度のラインと呼ばれる連続したデータの単位で、データを記憶している。アドレスフィールドは、データフィールドが記憶するラインが共有メモリ202上で対応するアドレスを格納する。ステートフィールドは、データフィールドの状態を格納する。また、アドレスフィールドとステートフィールドとをあわせてタグ領域とする。
Snoop-
また、ステートフィールドのとりうる状態は、スヌープ方式を実現するプロトコルによって異なるが、代表的な状態としては、M状態、E状態、S状態、I状態、という4つの状態である。 The states that the state field can take vary depending on the protocol that implements the snoop method, but there are four typical states: M state, E state, S state, and I state.
M状態は、対応するラインが該当のキャッシュメモリだけに存在し、主記憶から変更されている状態を示す。E状態は、対応するラインが該当のキャッシュメモリだけに存在し、主記憶から変更されていない状態を示す。S状態は、対応するラインが複数のキャッシュメモリに存在し、主記憶から変更されていない状態を示す。I状態は、対応するラインが無効である状態を示す。さらに、前述の4つの状態と異なるO状態として、対応するラインが複数のキャッシュメモリに存在し、該当のラインが更新されており、主記憶へ書き戻す責任を持った状態を使用するプロトコルも存在する。 The M state indicates a state in which the corresponding line exists only in the corresponding cache memory and is changed from the main memory. The E state indicates a state in which the corresponding line exists only in the corresponding cache memory and has not been changed from the main memory. The S state indicates a state where corresponding lines exist in a plurality of cache memories and are not changed from the main memory. The I state indicates a state where the corresponding line is invalid. In addition, as an O state different from the above four states, there is a protocol that uses a state in which the corresponding line exists in a plurality of cache memories, the corresponding line is updated, and is responsible for writing back to the main memory. To do.
スヌープ方式を実現するプロトコルには、大別して、無効型プロトコルと更新型プロトコルが存在する。無効型プロトコルは、複数のキャッシュメモリから参照があるアドレスに対し、あるキャッシュメモリが更新を行う場合、そのアドレスはダーティであるとして参照中の全キャッシュの該当のラインを無効化するプロトコルである。更新型プロトコルは、複数のキャッシュメモリが参照しているアドレスに対してデータ更新を行うときは、主記憶と他のキャッシュメモリに対して更新データを通知するプロトコルである。 Protocols for realizing the snoop method are roughly classified into an invalid protocol and an update protocol. The invalid protocol is a protocol for invalidating a corresponding line of all the caches being referred to as an address being dirty when a certain cache memory updates a reference address from a plurality of cache memories. The update-type protocol is a protocol for notifying update data to the main memory and other cache memories when data is updated with respect to addresses referenced by a plurality of cache memories.
無効型プロトコルの例としては、M状態、E状態、S状態、I状態という4つの状態をとるMESI(Illinois)プロトコル、または、M状態、O状態、S状態、I状態という4つ状態をとるMOSI(Berkeley)プロトコルなどが存在する。更新型プロトコルの例としては、M状態、E状態、I状態という3つの状態をとるMEI(Firefly)プロトコル、または、M状態、O状態、E状態、S状態という4つの状態をとるMOES(DRAGON)プロトコルなどが存在する。 As an example of the invalid protocol, MESI (Illinois) protocol that takes four states of M state, E state, S state, and I state, or four states of M state, O state, S state, and I state There is a MOSI (Berkeley) protocol and the like. As an example of the update type protocol, MEI (Firefly) protocol that takes three states of M state, E state, and I state, or MOES (DRAGON) that takes four states of M state, O state, E state, and S state ) Protocols exist.
本実施の形態では、無効型プロトコルの一つであるMESIプロトコルを例にして説明を行うが、他の無効型プロトコルや、また、更新型プロトコルであっても本実施の形態を適用することができる。 In the present embodiment, the MESI protocol, which is one of the invalid protocols, will be described as an example. However, the present embodiment can be applied to other invalid protocols and update protocols. it can.
キャッシュライン制御部#0は、キャッシュメモリの機能を実現するために要求される、データ格納構造決定処理、ライン入れ替え処理、データ更新処理、等といった様々な機能を有する。また、キャッシュライン制御部#0は、対応するCPU#0とはCPUI/Fで接続され、バス110とは、マスタI/F#0とスレーブI/F#0とで接続されている。
The cache line
また、キャッシュライン制御部#0は、スヌープに対応するためスヌープ制御部#0を含む。スヌープ制御部#0は、スヌープ方式を実現するプロトコルに従って、キャッシュライン記憶部#0を制御する機能を有する。本実施の形態におけるスヌープ制御部#0は、MESIプロトコルに従ってキャッシュライン記憶部#0を制御する。スヌープ制御部#0は、新たにキャッシュラインをフェッチする処理と、キャッシュラインへの書き込み処理を行う。前述の2つの処理については、図10、図11にて後述する。
Further, the cache line
スヌープ対応キャッシュは、CPU#0〜CPU#3各々の分存在するため、スヌープ対応キャッシュの内部構造となるキャッシュライン記憶部、キャッシュライン制御部もそれぞれのCPU分存在する。たとえば、キャッシュライン記憶部#1は、スヌープ対応キャッシュ#1のキャッシュライン記憶部を示している。キャッシュライン記憶部#2、キャッシュライン記憶部#3も、それぞれスヌープ対応キャッシュ#2、スヌープ対応キャッシュ#3に対応する。キャッシュライン制御部、スヌープ制御部も同様である。
Since snoop-compatible caches exist for each of
図4は、スヌープ対応したバス110の詳細を示す説明図である。図4中の線は物理的な一本の信号線であり、黒丸は信号線同士の接続を表す。バス110は、マスタI/F#0〜マスタI/F#3とスレーブI/F#0〜スレーブI/F#3から信号を受ける。マスタI/Fは、アドレス情報と、リードかライトかといったコマンド情報を送出する。コントローラ401は、アドレス情報とあらかじめコントローラ401に登録されたマッピング情報に基づいて、対応するスレーブI/Fにセレクト信号を出力する。セレクト信号を受け取ったスレーブI/Fはアドレス情報とコマンド情報を受け取り、コマンド情報に応じてデータのやりとりを行う。
FIG. 4 is an explanatory diagram showing details of the
図4の例にて、マスタI/F#0によって送出された信号は、コントローラ401が受信する。コントローラ401は、たとえば、スレーブI/F#1〜スレーブI/F#3に対してセレクト信号を出力する。セレクト信号を受け取ったスレーブIF#1〜スレーブI/F#3は、アドレス情報とコマンド情報を受け取り、コマンド情報に応じてデータのやりとりを行う。
In the example of FIG. 4, the
さらにスヌープに対応したバス110は、ブロードキャスト、ブロック、インバリデートといった3つの機能が追加される。ブロードキャストとは、マスタI/Fから、コマンド情報とデータ情報の組み合わせの要求を、あらかじめブロードキャスト先として設定されたすべてのスレーブI/Fに送出する機能である。ブロックとは、現在のバス接続を強制的に解除する機能である。インバリデートとは、キャッシュメモリに対してアドレスに対応するラインを無効化させる機能である。これらの機能を使用することで、バス110は、キャッシュコヒーレンシ機構として要求される機能を満たす。
Furthermore, the
(マルチコアプロセッサシステム100の機能)
次に、マルチコアプロセッサシステム100の機能について説明する。図5は、マルチコアプロセッサシステム100の機能を示すブロック図である。マルチコアプロセッサシステム100は、実行部503と、検出部504と、特定部505と、判断部506と、制御部507と、を含む。この制御部となる機能(検出部504〜制御部507)は、記憶装置に記憶されたプログラムをたとえばCPU#0が実行することにより、その機能を実現する。記憶装置とは、具体的には、たとえば、図1に示したROM102、RAM103、フラッシュROM104などである。また、実行部503はキャッシュコヒーレンシ機構201が実行することにより、その機能を実現する。
(Functions of the multi-core processor system 100)
Next, functions of the
また、マルチコアプロセッサシステム100は、任意のスレッドに対して、同じ共有データにアクセスしないスレッドの一覧と、任意のスレッドがアクセスしないプロセス間通信の領域と、を格納した依存情報501にアクセス可能である。依存情報501の詳細は、図9にて後述する。
In addition, the
また、検出部504〜制御部507は、スケジューラ502に内部の機能として存在してもよいし、または、スケジューラ502の外部にあり、スケジューラ502の処理結果を通知可能な状態で存在してもよい。スケジューラ502は、OS203に含まれるソフトウェアであり、CPUに割り当てるプロセスを決定する機能を有する。また、図5では、検出部504〜制御部507は、CPU#0の内部に存在しているが、CPU#1〜CPU#3のいずれかに存在していてもよいし、CPU#0〜CPU#3のすべてに存在してもよい。
The detection unit 504 to the
たとえば、スケジューラ502は、スレッドに設定されている優先度等に基づいて、次にCPUに割り当てるスレッドを決定する。定められた時刻になった場合、スケジューラ502はディスパッチャが決定されたスレッドをCPUに割り当てる。スケジューラの機能の1つとしてディスパッチャを含む形態も存在する。本実施の形態では、スケジューラ502内にディスパッチャの機能が存在する。
For example, the
実行部503は、複数のコアの各々によってアクセスされるキャッシュメモリに格納された共有データの値のコヒーレンシを実行する機能を有する。たとえば、実行部503となるキャッシュコヒーレンシ機構201は、CPU#0がアクセスするスヌープ対応キャッシュ#0と、CPU#1がアクセスするスヌープ対応キャッシュ#1の共有データの値のコヒーレンシを実行する。
The
検出部504は、複数のコアのうち第1のコアによって実行された第1のスレッドを検出する機能を有する。たとえば、検出部504は、第1のコアとなるCPU#0によって実行されたスレッドA−1を検出する。具体的にスレッドA−1が検出されるタイミングとしては、スケジューラ502によってスレッドの再スケジューリング要求が行われる時である。なお、検出されたスレッドの情報は、CPU#0のレジスタ、ローカルメモリなどに格納される。
The detection unit 504 has a function of detecting a first thread executed by the first core among the plurality of cores. For example, the detection unit 504 detects the thread A-1 executed by the
特定部505は、検出部504によって第1のスレッドが検出された場合、複数のコアから第1のコア以外の第2のコアによって実行中の第2のスレッドを特定する機能を有する。たとえば、特定部505は、スレッドA−1が検出された場合、CPU#0〜CPU#3からCPU#0以外、たとえばCPU#1によって実行中のスレッドA−2を特定する。なお、特定されたスレッドの情報は、CPU#0のレジスタ、ローカルメモリなどに格納される。
When the detecting unit 504 detects the first thread, the specifying
判断部506は、第1のスレッドおよび特定部505によって特定された第2のスレッドによって共通してアクセスされる共有データが存在するか否かを判断する機能を有する。また、判断部506は、さらに、第1および第2のスレッドが同一のプロセスに属するか否かを判断してもよい。また、判断部506は、第1および第2のスレッドが異なるプロセスに属し、かつ、第1および第2のスレッドによって共通して使用されるプロセス間通信の領域が存在するか否かを判断してもよい。プロセス間通信の領域の詳細については、図8にて後述する。
The determination unit 506 has a function of determining whether there is shared data that is commonly accessed by the first thread and the second thread specified by the specifying
また、判断部506は、第1および第2のスレッドが属するプロセス同士が使用されるプロセス間通信の領域が存在するか否かを判断してもよい。また、判断部506は、共通して使用されるプロセス間通信の領域が存在するか否かを判断する場合、初めに、第1および第2のスレッドの少なくとも一方がプロセス間通信の領域を使用していない状態を判断してもよい。第1および第2のスレッドが共にプロセス間通信の領域を使用している場合に、判断部506は、第1および第2のスレッドによって共通して使用されるプロセス間通信の領域が存在するか否かを判断してもよい。 The determination unit 506 may determine whether there is an interprocess communication area in which the processes to which the first and second threads belong are used. In addition, when the determination unit 506 determines whether or not there is an interprocess communication area that is used in common, first, at least one of the first and second threads uses the interprocess communication area. You may judge the state which is not. When both the first and second threads use the interprocess communication area, the determination unit 506 determines whether there is an interprocess communication area commonly used by the first and second threads. It may be determined whether or not.
たとえば、判断部506は、依存情報501にアクセスし、第1のスレッドの同じ共有データにアクセスしないスレッドの一覧に、第2のスレッドが含まれるか否かで、スレッドによって共通してアクセスされる共有データが存在するか否かを判断する。また、判断部506は、依存情報501にアクセスし、第1および第2のスレッドがアクセスしないプロセス間領域から、共通して使用されるプロセス間通信の領域が存在するか否かを判断してもよい。なお、判断結果は、CPU#0のレジスタ、ローカルメモリなどに格納される。
For example, the determination unit 506 accesses the
制御部507は、判断部506によって共通してアクセスされる共有データが存在しないと判断された場合、実行部503により第1および第2のコアそれぞれに対応する第1および第2のキャッシュメモリとのコヒーレンシの実行を停止させる機能を有する。また、制御部507は、第1および第2のスレッドが同一のプロセスであると判断され、かつ、共通してアクセスされる共有データが存在しないと判断された場合、第1および第2のキャッシュメモリとのコヒーレンシの実行を停止させてもよい。また、制御部507は、第1および第2のスレッドが異なるプロセスに属し、かつ、共通して使用されるプロセス間通信の領域が存在しないと判断された場合、第1および第2のキャッシュメモリとのコヒーレンシの実行を停止させてもよい。
When the determination unit 506 determines that there is no shared data accessed in common by the determination unit 506, the
また、制御部507は、第1および第2のキャッシュメモリとのコヒーレンシの実行を停止させた場合、第1のキャッシュメモリに格納された共有データを第1のキャッシュメモリから消去させてもよい。
In addition, when the execution of coherency with the first and second cache memories is stopped, the
たとえば、判断部506がスレッドA−1とスレッドA−2に共通してアクセスされる共有データが存在しないと判断した場合を想定する。この時、制御部507は、キャッシュコヒーレンシ機構201によりスヌープ対応キャッシュ#0とスヌープ対応キャッシュ#1のコヒーレンシの実行を停止させる。また、制御部507は、スヌープ対応キャッシュ#0に格納された共有データをフラッシュすることで、共有データをスヌープ対応キャッシュ#0から消去させる。具体的なフラッシュ操作は、図12にて後述する。
For example, it is assumed that the determination unit 506 determines that there is no shared data that is commonly accessed by the thread A-1 and the thread A-2. At this time, the
図6は、キャッシュコヒーレンシの実行状態と停止状態を示す説明図である。符号601で示すブロック図は、マルチコアプロセッサシステム100で動作するプロセスAが保有するスレッドと、各スレッドがアクセスするメモリについて示している。プロセスAは、スレッドA−1、スレッドA−2、スレッドA−3を保有する。また、スレッドA−1は、共有メモリ202のプロセスA用データ領域のうち、データAにアクセスする。スレッドA−2は、データBにアクセスする。スレッドA−3は、データAとデータBにアクセスする。
FIG. 6 is an explanatory diagram showing an execution state and a stop state of cache coherency. A block diagram denoted by
符号601で示す前提のもと、符号602で示すマルチコアプロセッサシステム100では、CPU#0にスレッドA−1が割り当てられ、CPU#1にスレッドA−3が割り当てられる。符号602の状態では、キャッシュコヒーレンシ機構201は、キャッシュコヒーレンシを実行することで、CPU#0とCPU#1はデータAを整合性のとれた状態で共有することができる。
Under the premise indicated by
次に、符号603で示すマルチコアプロセッサシステム100では、符号602の状態から、CPU#1に割り当てられたスレッドが、スレッドA−3からスレッドA−2に切り替わった状態を示している。符号603の状態では、CPU#0とCPU#1には共有してアクセスするデータが存在しないため、キャッシュコヒーレンシ機構201は、キャッシュコヒーレンシの実行を停止してもよい。キャッシュコヒーレンシを無効にするには、たとえば、図4にて前述したスヌープに対応したバス110にて、ブロードキャスト送信を行う際に、ブロードキャスト先から除外することで、キャッシュコヒーレンシの実行停止を実現する。
Next, in the
具体的に無効にする方法としては、バス110にて、スヌープ対応キャッシュ#0とスヌープ対応キャッシュ#1のブロードキャストを停止するといった方法がある。たとえば、キャッシュコヒーレンシ機構201は、スヌープ対応キャッシュ#0のマスタI/F#0から無効化通知等をブロードキャスト送信する際に、スレーブI/F#1には送信せず、スレーブI/F#2とスレーブI/F#3に送信する。このように、キャッシュコヒーレンシ機構201において、特定のCPU間のキャッシュコヒーレンシの実行を停止すると、送信先が減少するために、バス110のトラフィック量や処理量が減少し、消費電力を削減し、また遅延を防止することができる。
As a specific invalidation method, there is a method of stopping broadcasting of the snoop-
図7は、マルチコアプロセッサシステム100の動作概要である。図7では、図6で提示したようなスレッドがアクセスする共有データに基づいてキャッシュコヒーレンシ機構201の実行と停止を切り替えることを実現するための処理群として、処理701〜処理710を示している。処理701と処理702は、マルチコアプロセッサシステム100の設計時に実行され、処理703〜処理710は、マルチコアプロセッサシステム100の動作中に実行される。
FIG. 7 is an outline of the operation of the
処理701では、スレッド間の依存関係を、ESL(Electronic System Level)シミュレータなどによって、対象プロセスに属するスレッド間の依存関係を解析する。具体的な解析の例は、図8にて後述する。解析後、処理702ではコンパイラによって、対象プロセスの元となるプログラムが書き換えられる。具体的には、コンパイラは、特定のスレッドの先頭等に、特定のスレッドと依存関係があるスレッドの情報をプログラム内に追加する。
In the
処理703にて、対象プロセスを実行するCPUは、新規にスレッドを生成する。生成後、処理704にて、前述のCPUは、コンパイラによって追加された依存関係の情報を、OS203内の依存情報501に追加する。依存情報501の詳細は、図9にて後述する。追加後、対象プロセスは、OS203に対してスレッドの割り当て要求を行い、処理705にて、OS203内のスケジューラ502によって割り当てが決定されたCPUによって、生成されたスレッドを実行する。
In
OS203のスケジューラ502は、処理706にて、対象のCPUに割り当てるスレッドを決定する。決定対象となるスレッドは、処理703にて生成されたスレッドや実行可能状態となっているスレッドから決定される。スレッドを決定後、スケジューラ502は、処理707にて、他のCPUで実行中のスレッドを取得する。
In process 706, the
実行中のスレッドを取得後、スケジューラ502は、処理708にて、登録された依存情報501から、コヒーレンシの実行、または停止を決定する。決定後、スケジューラ502は、処理709にて、決定内容に従ってキャッシュコヒーレンシ機構201を制御する。制御後、スケジューラ502は、処理710にて、対象のCPUに決定されたスレッドを割り当てる。処理706〜処理710の詳細については、図12、図13にて後述する。
After acquiring the executing thread, the
図8は、依存情報501の登録方法を示す説明図である。図8では、符号601で示したプロセスAについて、依存情報501の登録方法を示している。マルチコアプロセッサシステム100の設計時に、ESLシミュレータは、スレッド並列処理を行うプロセスA内のスレッドに対して、それぞれのスレッドが利用するデータ領域を調査する。
FIG. 8 is an explanatory diagram showing a method for registering the
調査方法には、ソースコードを解析することで使用するデータ領域を得る静的手法や、実際にスレッドを実行してメモリアクセスの記録からスレッドが使用するデータ領域を得る動的手法などが存在する。スレッドのデータ領域の完全な解析が困難である場合には、調査によって明らかにデータ領域を共有していないことが判明したスレッドの組み合わせを記録してもよい。 There are static methods to obtain the data area to be used by analyzing the source code, and dynamic methods to obtain the data area to be used by the thread from the memory access record by actually executing the thread. . If complete analysis of the data area of the thread is difficult, a combination of threads that are clearly found not to share the data area may be recorded.
データ領域の共有の調査に加えて、調査対象のスレッドが、OS203が提供するプロセス間通信の領域のうち、明らかに利用しない領域があれば、その領域も記録する。プロセス間通信の領域とは、複数のプロセス間で通信を行うための領域であり、OS203がAPI(Application Programming Interface)等で提供する。一般的に、プロセス間でメモリ空間は独立しており、互いのメモリ空間を直接アクセスすることはできない。したがって、プロセス間で情報を送受信する場合、プロセスは、プロセス間通信の領域を利用して情報を送受信する。たとえば、OS203はメモリ空間の塊となるチャンクを確保し、確保したチャンクをプロセス間通信の領域として、プロセスに提供する。
In addition to the data area sharing investigation, if the investigation target thread has an area that is obviously not used in the inter-process communication area provided by the
符号801は、プロセスAの元となるプログラムである。ESLシミュレータは、調査の結果となる、データを共有しないスレッドの情報や利用しないプロセス間通信領域の情報を、プロセスAの実行中にスレッドを起動する際に依存情報501に情報を登録するようにプログラムを変更する。コンパイラは、変更されたプログラムをコンパイルし、実行コードを生成する。具体的に図8では、スレッドA−1と、スレッドA−2には、共通してアクセスされる共有データが存在しないため、ESLシミュレータは、プロセスAのプログラムに、スレッドA−1とスレッドA−2が依存の無いことを追記する。
Reference numeral 801 denotes a program that is a source of the process A. The ESL simulator registers the information of the thread that does not share data and the information of the inter-process communication area that is not used as a result of the investigation into the
OS203は、データを共有しないスレッドの情報を依存情報501に登録する。図8に示すプロセスAのスレッド間の依存関係802では、スレッドA−1とスレッドA−2に“依存無し”が登録されることになる。OS203は、データを共有しないスレッドの情報と利用しないプロセス間通信領域とを管理する依存情報501として、スレッドデータ構造を拡張する。拡張されたスレッドデータ構造については、図9にて後述する。
The
図9は、拡張されたスレッドデータ構造901のメンバー一覧と記憶内容の一例を示す説明図である。図9では、拡張されたスレッドデータ構造901と、スレッドデータ構造901の記憶内容の一例として、表902、スレッドIDリスト903、スレッドIDリスト904、プロセス間通信領域リスト905、プロセス間通信領域リスト906を示している。
FIG. 9 is an explanatory diagram showing an example of a member list and stored contents of the extended
スレッドデータ構造901のスレッドIDフィールドには、スレッドごとに採番された値が設定される。スレッド関数フィールドは、スレッドの関数名が設定される。その他、スレッドデータ構造901のフィールドとして、従来のスレッドデータ構造に存在するフィールドが存在する。また、依存情報501の実体となる、データを共有しないスレッドIDリストフィールドと、利用しないプロセス間通信領域リストフィールドは、本実施の形態にて拡張されたフィールドである。
In the thread ID field of the
データを共有しないスレッドIDリストフィールドは、対象のスレッドとデータを共有しないスレッドIDリストへのポインタが設定されている。たとえば、表902において、スレッドIDが“1”であるBrowser_Mainスレッドは、データを共有しないスレッドIDリストフィールドにスレッドIDリスト903が設定されている。スレッドIDリスト903には、スレッドID“2”とスレッドID“3”のスレッドが登録されている。これにより、Browser_Mainスレッドは、スレッドIDが“2”であるBrowser_Downloadスレッドと、スレッドIDが“3”であるBrowser_Uploadスレッドとに対してデータの共有がない、ということを示している。 In the thread ID list field that does not share data, a pointer to a thread ID list that does not share data with the target thread is set. For example, in Table 902, for the Browser_Main thread whose thread ID is “1”, the thread ID list 903 is set in the thread ID list field that does not share data. In the thread ID list 903, threads having a thread ID “2” and a thread ID “3” are registered. As a result, the Browser_Main thread indicates that there is no data sharing between the Browser_Download thread whose thread ID is “2” and the Browser_Upload thread whose thread ID is “3”.
同様に、Browser_Downloadスレッドのデータを共有しないスレッドIDリストフィールドには、スレッドIDリスト904が設定されている。スレッドIDリスト904の内容により、Browser_Downloadスレッドは、Browser_Mainスレッドに対してデータの共有がないことを示している。 Similarly, a thread ID list 904 is set in the thread ID list field that does not share data of the Browser_Download thread. The content of the thread ID list 904 indicates that the Browser_Download thread does not share data with the Browser_Main thread.
利用しないプロセス間通信領域リストフィールドは、スレッドが利用しないプロセス間通信領域リストへのポインタが設定されている。たとえば、Browser_Mainスレッドは、利用しないプロセス間通信領域リストフィールドにプロセス間通信領域リスト905が設定されている。プロセス間通信領域リスト905には、チャンク3とチャンク4が登録されている。
In the unused inter-process communication area list field, a pointer to an inter-process communication area list that is not used by a thread is set. For example, in the Browser_Main thread, the inter-process
また、Browser_Mainスレッドと異なるプロセスとして実行される、スレッドIDが“4”のFTP_Downloadスレッドは、利用しないプロセス間通信領域リストフィールドにプロセス間通信領域リスト906が設定されている。プロセス間通信領域リスト906には、チャンク1とチャンク2が登録されている。OS203が確保したチャンクがチャンク1〜チャンク4である場合、プロセス間通信領域リスト905とプロセス間通信領域リスト906では、共通して利用されるプロセス間通信領域が存在しないことになる。
Further, the FTP_Download thread with the thread ID “4” executed as a process different from the Browser_Main thread has the inter-process
図9で説明したように、OS203は、スレッドデータ構造901によってスレッドを管理するが、同様に、スレッドの集合であるプロセスを管理してもよい。さらに、OS203は、プロセスごとに利用しないプロセス間通信領域リストを生成してもよい。
As described with reference to FIG. 9, the
図10は、スヌープ制御部#0によるラインフェッチ処理を示すフローチャートである。図10では、スヌープ対応キャッシュ#0が、CPU#0からキャッシュへの読み込み要求を受信し、CPU#0が要求したキャッシュがキャッシュライン記憶部#0に存在しなく、スヌープ制御部#0によるラインフェッチ処理が発生した場合を想定している。スヌープ制御部#0以外のスヌープ制御部#1〜スヌープ制御部#3も、対応するCPUからの読み込み要求により、ラインフェッチ処理が行われる。
FIG. 10 is a flowchart showing line fetch processing by the snoop
スヌープ制御部#0は、新規ラインフェッチを決定する(ステップS1001)。決定後、スヌープ制御部#0は、バス110に1ライン分のリード要求をマスタI/F#0からブロードキャストとして送出する(ステップS1002)。
The snoop
リード要求を受信したスヌープ制御部#1〜スヌープ制御部#3は、ラインフェッチ処理の応答を開始する。なお、スヌープ制御部#1〜スヌープ制御部#3はすべて等しい処理を行うため、以下の記述では、説明の簡略化のため、スヌープ制御部#1にて説明を行う。スヌープ制御部#1は、キャッシュライン記憶部#1のタグ領域から、要求されたアドレスと一致するアドレスを持つラインが存在するかを検索する(ステップS1003)。なお、一致するアドレスを持つラインを検索する際には、無効状態であるI状態以外のラインから検索される。
The snoop
検索後、スヌープ制御部#1は、一致するアドレスを持つラインが存在するかを判断する(ステップS1004)。一致するアドレスを持つラインが存在しない場合(ステップS1004:No)、スヌープ制御部#1は、ラインフェッチ処理の応答を終了する。一致するアドレスを持つラインが存在する場合(ステップS1004:Yes)、スヌープ制御部#1は、リード要求の送信元、図10の例ではスヌープ制御部#0に、ブロック命令を発行する(ステップS1005)。
After the search, the snoop
発行後、スヌープ制御部#1は、一致したラインの状態がM状態であるかを判断する(ステップS1006)。一致したラインの状態がM状態である場合(ステップS1006:Yes)、スヌープ制御部#1は、一致したラインのデータを共有メモリ202に書き込む(ステップS1007)。書き込み終了後、または、検索されたラインの状態がM状態以外の場合(ステップS1006:No)、スヌープ制御部#1は、ラインをS状態に変更し(ステップS1008)、ラインフェッチ処理の応答を終了する。
After the issuance, the snoop
スヌープ制御部#0は、スヌープ制御部#1〜スヌープ制御部#3のいずれかからブロック命令によりブロックされたかを判断する(ステップS1009)。ブロックされなかった場合(ステップS1009:No)、スヌープ制御部#0は、リードしたラインをE状態でキャッシュライン記憶部#0に格納し(ステップS1010)、ラインフェッチ処理を終了する。ブロックされた場合(ステップS1009:Yes)、スヌープ制御部#0は、バス110に1ライン分のリード要求を再送する(ステップS1011)。再送後、スヌープ制御部#0は、リードしたラインをS状態でキャッシュライン記憶部#0に格納し(ステップS1012)、ラインフェッチ処理を終了する。
The snoop
図11は、スヌープ制御部#0によるラインへの書き込み処理を示すフローチャートである。図11では、スヌープ対応キャッシュ#0が、CPU#0からキャッシュへの書き込み要求を受信した場合を想定している。スヌープ制御部#0以外のスヌープ制御部#1〜スヌープ制御部#3も、対応するCPUからの書き込み要求により、書き込み処理が行われる。
FIG. 11 is a flowchart showing a write process to a line by the snoop
スヌープ制御部#0は、ラインへの書き込みを決定する(ステップS1101)。決定後、スヌープ制御部#0は、書き込み予定のラインがS状態であるかを判断する(ステップS1102)。S状態である場合(ステップS1102:Yes)、スヌープ制御部#0は、無効化要求をスヌープ制御部#1〜スヌープ制御部#3にブロードキャストにて発行する(ステップS1103)。無効化要求を送信後、またはS状態でない場合(ステップS1102:No)、スヌープ制御部#0は、書き込み予定のラインをM状態に変更する(ステップS1104)。変更後、スヌープ制御部#0は、書き込み予定のラインへデータを書き込み(ステップS1105)、ラインへの書き込み処理を終了する。
The snoop
ステップS1103の処理にて無効化要求を受信したスヌープ制御部#1〜スヌープ制御部#3は、ラインへの書き込み処理の応答を開始する。なお、スヌープ制御部#1〜スヌープ制御部#3はすべて等しい処理を行うため、以下の記述では、説明の簡略化のため、スヌープ制御部#1にて説明を行う。
The snoop
スヌープ制御部#1は、キャッシュライン記憶部#1のタグ領域から、要求されたアドレスと一致するアドレスを持つラインが存在するかを検索する(ステップS1106)。なお、一致するアドレスを持つラインを検索する際には、無効状態であるI状態以外のラインから検索される。検索後、スヌープ制御部#1は、一致するアドレスを持つラインが存在するかを判断する(ステップS1107)。一致するアドレスを持つラインが存在する場合(ステップS1107:Yes)、スヌープ制御部#1は、ラインをI状態にすることで無効化する(ステップS1108)。ラインの無効化後、または、一致するアドレスを持つラインが存在しない場合(ステップS1107:No)、スヌープ制御部#1は、ラインへの書き込み処理の応答を終了する。
The snoop
図12は、コヒーレンシ制御処理を示すフローチャートである。コヒーレンシ制御処理は、CPU#0〜CPU#3のうち、どのCPUでも実行される。図12では、CPU#0にてコヒーレンシ制御処理が実行される場合にて説明を行う。
FIG. 12 is a flowchart showing the coherency control process. The coherency control process is executed by any of the
CPU#0は、再スケジュール要求の受け付けを検出する(ステップS1201)。コヒーレンシ制御処理は、スレッドの再スケジュールを行うたびに実行される。したがって、コヒーレンシ制御処理は、スケジューラ502の内部にあってもよいし、スケジューラ502の外部にあり、通知可能な状態であってもよい。CPU#0は、再スケジュールの対象CPUに割り付けるスレッドを決定する(ステップS1202)。再スケジュール対象CPUは、CPU#0であってもよいし、スケジューラ502が他のCPUのスケジュール処理も行っている場合は、再スケジュール要求の受け付けの対象となった他のCPUであってもよい。
決定後、CPU#0は、割り付け禁止フラグが設定されているかを判断する(ステップS1203)。割り付け禁止フラグが設定されている場合(ステップS1203:Yes)、CPU#0は、一定時間後、再度ステップS1203を実行する。割り付け禁止フラグが設定されていない場合(ステップS1203:No)、CPU#0は、対象CPU以外の他のCPUへ割り付け禁止フラグを設定する(ステップS1204)。
After the determination,
割り付け禁止フラグの設定後、CPU#0は、コヒーレンシ対象CPU決定処理を実行する(ステップS1205)。コヒーレンシ対象CPU決定処理の詳細は、図13にて後述する。実行後、CPU#0は、コヒーレンシ対象CPU決定処理によって、コヒーレンシを実行していた状態から停止へ変化したCPUが存在するかを判断する(ステップS1206)。停止へ変化したCPUがある場合(ステップS1206:Yes)、CPU#0は、対象CPUのキャッシュをフラッシュする(ステップS1207)。フラッシュとは、たとえばスヌープ制御部が、M状態など、データが更新されているラインを共有メモリ202に書き込み、M状態を含むすべてのラインをI状態に設定する操作である。
After setting the allocation prohibition flag, the
フラッシュ後、または、停止に変化したCPUがない場合(ステップS1206:No)、CPU#0は、キャッシュコヒーレンシ機構201を制御する(ステップS1208)。具体的な制御内容として、ステップS1205の処理にて、対象CPUがCPU#0であり、CPU#0とCPU#1とのコヒーレンシの実行を停止すると決定した場合を想定する。
If there is no CPU changed to stop after the flush (step S1206: No), the
この場合、CPU#0は、スヌープ対応キャッシュ#0に対し、スヌープ対応キャッシュ#1をブロードキャスト先から除くように指示をする。具体的に、CPU#0は、スヌープ対応キャッシュ#0の設定レジスタを変更することで、スヌープ対応キャッシュ#1をブロードキャスト先から除くようにする。
In this case, the
同様に、CPU#0は、スヌープ対応キャッシュ#1に対しても、スヌープ対応キャッシュ#0をブロードキャスト先から除くように指示をする。ブロードキャスト先から除くことで、ステップS1002、ステップS1103の処理で行ったブロードキャストの送信量が減少し、バス110内のトラフィック量を減少することができる。また、ブロードキャスト先から除かれたスヌープ対応キャッシュも、それぞれの応答処理を行わなくて済むため、処理量を減少させることができる。
Similarly, the
制御後、CPU#0は、他CPUの割り付け禁止フラグを解除し(ステップS1209)、決定されたスレッドを対象CPUに割り付ける(ステップS1210)。割り付け後、CPU#0は、コヒーレンシ制御処理を終了する。
After control,
図13は、コヒーレンシ対象CPU決定処理を示すフローチャートである。コヒーレンシ対象CPU決定処理も、コヒーレンシ制御処理と同じくCPU#0〜CPU#3のうち、どのCPUでも実行される。図13では、図12と同様に、CPU#0にてコヒーレンシ対象CPU決定処理が実行される場合にて説明を行う。また、コヒーレンシ対象CPU決定処理は、コヒーレンシ制御処理から対象CPUと割り付け予定のスレッドである対象スレッドを引数として取得する。
FIG. 13 is a flowchart showing a coherency target CPU determination process. The coherency target CPU determination process is also executed by any of the
CPU#0は、対象CPU以外の他のCPUから、未選択のCPUを選択する(ステップS1301)。選択後、CPU#0は、対象スレッドが属するプロセスと選択されたCPUで実行中のスレッドが属するプロセスが同一かを判断する(ステップS1302)。
同一である場合(ステップS1302:Yes)、CPU#0は、対象スレッドのデータを共有しないスレッドIDリストフィールドに、選択されたCPUで実行中のスレッドが含まれているかを判断する(ステップS1303)。含まれる場合(ステップS1303:Yes)、CPU#0は、対象CPUと選択されたCPUとのコヒーレンシの停止を決定する(ステップS1304)。含まれない場合(ステップS1303:No)、CPU#0は、対象CPUと選択されたCPUとのコヒーレンシの実行を決定する(ステップS1305)。
If they are the same (step S1302: Yes), the
対象スレッドが属するプロセスと選択されたCPUで実行中のスレッドが属するプロセスが同一でない場合(ステップS1302:No)、CPU#0は、プロセス同士が同一のプロセス間通信領域を利用するかを判断する(ステップS1306)。同一のプロセス間通信領域を利用する場合(ステップS1306:Yes)、CPU#0は、対象スレッドと選択されたCPUで実行中のスレッドが同一のプロセス間通信領域を利用するかを判断する(ステップS1307)。
If the process to which the target thread belongs and the process to which the thread being executed by the selected CPU belongs are not the same (step S1302: No), the
同一のプロセス間通信領域を利用する場合(ステップS1307:Yes)、CPU#0は、対象CPUと選択されたCPUとのコヒーレンシの実行を決定する(ステップS1308)。同一のプロセス間通信領域を利用しない場合(ステップS1306:No、ステップS1307:No)、CPU#0は、対象CPUと選択されたCPUとのコヒーレンシの停止を決定する(ステップS1309)。
When using the same inter-process communication area (step S1307: Yes), the
ステップS1304、ステップS1305、ステップS1308、ステップS1309のいずれかの処理後、CPU#0は、対象CPU以外の他のCPUから未選択のCPUが存在するかを判断する(ステップS1310)。未選択のCPUがある場合(ステップS1310:Yes)、CPU#0は、ステップS1301の処理に移行する。未選択のCPUがない場合(ステップS1310:No)、CPU#0はコヒーレンシ対象CPU決定処理を終了する。
After any of steps S1304, S1305, S1308, and S1309,
以上説明したように、マルチコアプロセッサシステム、キャッシュコヒーレンシ制御方法、およびキャッシュコヒーレンシ制御プログラムによれば、第1および第2のコアで実行中の第1および第2のスレッドでアクセスされる領域が異なることを判断する。領域が異なると判断された場合、マルチコアプロセッサシステムは、第1のコアに対応する第1のキャッシュメモリと第2のコアに対応する第2のキャッシュメモリとのコヒーレンシを停止させる。アクセスされる領域が異なるため、コヒーレンシを停止させても共有データの不整合が発生しない。よって、マルチコアプロセッサシステムは、キャッシュコヒーレンシ機構のトラフィック量が減少することで、消費電力を削減し、また、トラフィック量の増大による遅延を防止することができる。 As described above, according to the multi-core processor system, the cache coherency control method, and the cache coherency control program, the areas accessed by the first and second threads being executed in the first and second cores are different. Judging. When it is determined that the areas are different, the multi-core processor system stops coherency between the first cache memory corresponding to the first core and the second cache memory corresponding to the second core. Since the accessed areas are different, shared data inconsistency does not occur even if coherency is stopped. Therefore, the multi-core processor system can reduce power consumption by reducing the traffic amount of the cache coherency mechanism, and can prevent a delay due to an increase in the traffic amount.
また、マルチコアプロセッサシステムは、第1および第2のスレッドが同一のプロセスに属し、かつ共通してアクセスされる共有データが存在しないと判断された場合に、コヒーレンシを停止させてもよい。これにより、マルチコアプロセッサシステムは、2つのコアが同一プロセスのスレッドを実行していても、キャッシュコヒーレンシ機構のトラフィック量を減少することができ、消費電力を削減することができる。携帯電話に代表される組み込み機器では、複数のプロセスを同時に起動するケースは少なく、同一のプロセスに属する複数のスレッドを実行する機会が多いため、本実施の形態は、特に有効である。 The multi-core processor system may stop coherency when it is determined that the first and second threads belong to the same process and there is no shared data to be accessed in common. Thereby, even if two cores are executing the thread of the same process, the multi-core processor system can reduce the traffic amount of the cache coherency mechanism, and can reduce power consumption. In an embedded device typified by a mobile phone, there are few cases where a plurality of processes are activated simultaneously, and there are many opportunities to execute a plurality of threads belonging to the same process. Therefore, this embodiment is particularly effective.
さらに、組み込み機器に搭載される組み込みOSには、プロセスの概念がなく、すべてのスレッド(タスク)が同一のメモリ空間にアクセスするOSも存在する。たとえば、下記参考文献1で説明されているμITRONである。
(参考文献1:組み込みOS適材適所 《Windows(登録商標) Embedded CE編》(1) ―― まず、μITRONとWindows(登録商標) Embedded CEの違いを理解する|Tech Village / CQ出版株式会社:[online]、[平成22年05月13日検索]、インターネット<URL:http://www.kumikomi.net/archives/2009/09/itronwindows_embedded_ceoswindows_embedded_ce1.php?page=2>)
Furthermore, an embedded OS installed in an embedded device has no concept of a process, and there is an OS in which all threads (tasks) access the same memory space. For example, μITRON described in
(Reference 1: Suitable place for embedded OS << Windows (registered trademark) Embedded CE Edition (1)}-First, understand the difference between μITRON and Windows (registered trademark) Embedded CE | Tech Village / CQ Publishing Co., Ltd .: [ online], [searched on May 13, 2010], Internet <URL: http: // www.
前述のようなOSでは、すべてのスレッドが全メモリ空間にアクセス可能であるため、従来手法を適用しても、常にコヒーレンシを実行する状態となる。しかし、本実施の形態におけるマルチコアプロセッサシステム100では、共通してアクセスされる共有データが存在しないと判断された場合に、キャッシュコヒーレンシ機構のトラフィック量や処理量を削減することができ、特に効果がある。
In the OS as described above, since all threads can access the entire memory space, even if the conventional method is applied, the state is always in a state where coherency is executed. However, the
また、マルチコアプロセッサシステムは、第1および第2のスレッドが異なるプロセスに属し、かつ、第1および第2のスレッドによって共通して使用されるプロセス間通信の領域が存在しない場合に、コヒーレンシを停止してもよい。これにより、マルチコアプロセッサシステムは、異なるプロセスであってもコヒーレンシを実行すべき場合を除いてコヒーレンシを停止させることでトラフィック量や処理量が減少し、消費電力を削減し、また、トラフィック量の増大による遅延を防止することができる。 In addition, the multi-core processor system stops coherency when the first and second threads belong to different processes and there is no interprocess communication area commonly used by the first and second threads. May be. As a result, the multi-core processor system reduces the traffic volume and processing volume by stopping the coherency except when the coherency should be executed even in different processes, thereby reducing the power consumption and increasing the traffic volume. Can prevent delay.
また、マルチコアプロセッサシステムは、第1および第2のスレッドが属するプロセス同士が使用されるプロセス間通信の領域が存在するか否かを判断してもよい。また、第1および第2のスレッドによって共通して使用されるプロセス間通信の領域が存在するかを判断する場合、マルチコアプロセッサシステムは、初めに、第1および第2のスレッドの少なくとも一方がプロセス間通信の領域を使用していない状態を判断してもよい。 The multi-core processor system may determine whether there is an interprocess communication area in which the processes to which the first and second threads belong are used. When determining whether there is an area of interprocess communication that is commonly used by the first and second threads, the multi-core processor system starts with at least one of the first and second threads being a process. A state where the inter-communication area is not used may be determined.
プロセス間通信の領域を使用しているか否かの判断は、共通して使用されるプロセス間通信の領域が存在するか否かの判断よりも処理量が小さい。したがって、第1および第2のスレッドがプロセス間通信の領域を使用しているか否かを先に判断し、共に領域を使用している場合、共通して使用される領域が存在するかを判断する、という処理順序によって、全体の処理量を減少させることができる。 The determination of whether or not the interprocess communication area is used has a smaller processing amount than the determination of whether or not the interprocess communication area used in common exists. Therefore, it is determined first whether or not the first and second threads are using the interprocess communication area. If both areas are used, it is determined whether there is an area that is commonly used. The total processing amount can be reduced by the processing order of “Yes”.
また、マルチコアプロセッサシステムは、第1のキャッシュメモリと第2のキャッシュメモリとのコヒーレンシの実行を停止させた場合、第1のキャッシュメモリに格納された共有データを第1のキャッシュメモリから消去してもよい。これにより、マルチコアプロセッサシステムは、コヒーレンシの実行を停止させても、共有メモリの整合性をとることができる。 In addition, when the multi-core processor system stops coherency execution between the first cache memory and the second cache memory, the multi-core processor system erases the shared data stored in the first cache memory from the first cache memory. Also good. As a result, the multi-core processor system can maintain the consistency of the shared memory even if the execution of coherency is stopped.
なお、本実施の形態で説明したキャッシュコヒーレンシ制御方法は、あらかじめ用意されたプログラムをパーソナル・コンピュータやワークステーション等のコンピュータで実行することにより実現することができる。本キャッシュコヒーレンシ制御プログラムは、ハードディスク、フレキシブルディスク、CD−ROM、MO、DVD等のコンピュータで読み取り可能な記録媒体に記録され、コンピュータによって記録媒体から読み出されることによって実行される。また本キャッシュコヒーレンシ制御プログラムは、インターネット等のネットワークを介して配布してもよい。 Note that the cache coherency control method described in the present embodiment can be realized by executing a program prepared in advance on a computer such as a personal computer or a workstation. The cache coherency control program is recorded on a computer-readable recording medium such as a hard disk, a flexible disk, a CD-ROM, an MO, and a DVD, and is executed by being read from the recording medium by the computer. The cache coherency control program may be distributed via a network such as the Internet.
#0、#1 CPU、スヌープ対応キャッシュ
A−1、A−2 スレッド
100 マルチコアプロセッサシステム
110 バス
501 依存情報
502 スケジューラ
503 実行部
504 検出部
505 特定部
506 判断部
507 制御部
# 0, # 1 CPU, Snoop-compatible cache A-1,
Claims (3)
前記複数のコアのそれぞれがアクセスする複数のキャッシュメモリを有するマルチコアプロセッサシステムであって、前記複数のコアのいずれか一つは、
前記複数のコアのうち第1のコアによって実行された第1のスレッドを検出した場合に、前記複数のコアのうち前記第1のコア以外の第2のコアにより実行中の第2のスレッドを検出し、前記第1のスレッドおよび前記第2のスレッドの実行時に共通してアクセスする共有データが無い場合には、前記複数のキャッシュメモリのうち前記第1のコアに対応する第1のキャッシュメモリと前記第2のコアに対応する第2のキャッシュメモリとのコヒーレンシ処理を停止させる、
ことを特徴とするマルチコアプロセッサシステム。 With multiple cores,
A multi-core processor system having a plurality of cache memories accessed by each of the plurality of cores, wherein any one of the plurality of cores is:
When a first thread executed by a first core among the plurality of cores is detected, a second thread being executed by a second core other than the first core among the plurality of cores is detected. A first cache memory corresponding to the first core among the plurality of cache memories when there is no shared data to be detected and accessed in common during execution of the first thread and the second thread And coherency processing with the second cache memory corresponding to the second core,
A multi-core processor system characterized by that.
前記複数のコアのうち第1のコアによって実行された第1のスレッドを検出した場合に、前記複数のコアのうち前記第1のコア以外の第2のコアにより実行中の第2のスレッドを検出し、前記第1のスレッドおよび前記第2のスレッドの実行時に共通してアクセスする共有データが無い場合には、前記複数のキャッシュメモリのうち前記第1のコアに対応する第1のキャッシュメモリと前記第2のコアに対応する第2のキャッシュメモリとのコヒーレンシ処理を停止させる、
処理を実行することを特徴とするキャッシュコヒーレンシ制御方法。 A cache coherency control method for a multi-core processor system having a plurality of cache memories accessed by each of a plurality of cores, wherein any one of the plurality of cores includes:
When a first thread executed by a first core among the plurality of cores is detected, a second thread being executed by a second core other than the first core among the plurality of cores is detected. A first cache memory corresponding to the first core among the plurality of cache memories when there is no shared data to be detected and accessed in common during execution of the first thread and the second thread And coherency processing with the second cache memory corresponding to the second core,
A cache coherency control method characterized by executing processing.
前記複数のコアのうち第1のコアによって実行された第1のスレッドを検出した場合に、前記複数のコアのうち前記第1のコア以外の第2のコアにより実行中の第2のスレッドを検出し、前記第1のスレッドおよび前記第2のスレッドの実行時に共通してアクセスする共有データが無い場合には、前記複数のキャッシュメモリのうち前記第1のコアに対応する第1のキャッシュメモリと前記第2のコアに対応する第2のキャッシュメモリとのコヒーレンシ処理を停止させる、
処理を実行させることを特徴とするキャッシュコヒーレンシ制御プログラム。 A cache coherency control program for a multi-core processor system having a plurality of cache memories accessed by each of a plurality of cores, wherein any one of the plurality of cores includes:
When a first thread executed by a first core among the plurality of cores is detected, a second thread being executed by a second core other than the first core among the plurality of cores is detected. A first cache memory corresponding to the first core among the plurality of cache memories when there is no shared data to be detected and accessed in common during execution of the first thread and the second thread And coherency processing with the second cache memory corresponding to the second core,
A cache coherency control program characterized by causing processing to be executed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2013184347A JP5614483B2 (en) | 2013-09-05 | 2013-09-05 | Multi-core processor system, cache coherency control method, and cache coherency control program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2013184347A JP5614483B2 (en) | 2013-09-05 | 2013-09-05 | Multi-core processor system, cache coherency control method, and cache coherency control program |
Related Parent Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2012520182A Division JP5360299B2 (en) | 2010-06-14 | 2010-06-14 | Multi-core processor system, cache coherency control method, and cache coherency control program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2014002787A true JP2014002787A (en) | 2014-01-09 |
JP5614483B2 JP5614483B2 (en) | 2014-10-29 |
Family
ID=50035819
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2013184347A Expired - Fee Related JP5614483B2 (en) | 2013-09-05 | 2013-09-05 | Multi-core processor system, cache coherency control method, and cache coherency control program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP5614483B2 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113986778A (en) * | 2021-11-17 | 2022-01-28 | 海光信息技术股份有限公司 | Data processing method, shared cache, chip system and electronic equipment |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2005044342A (en) * | 2003-07-22 | 2005-02-17 | Samsung Electronics Co Ltd | Multiprocessor system and method for maintaining cache consistency of thereof |
JP2007004802A (en) * | 2005-06-24 | 2007-01-11 | Arm Ltd | Snoop operation management in data processor |
JP2008026944A (en) * | 2006-07-18 | 2008-02-07 | Renesas Technology Corp | Bus coupling type multiprocessor |
JP2009032264A (en) * | 2007-07-26 | 2009-02-12 | Hewlett-Packard Development Co Lp | Mask usable for snoop request |
US20090083493A1 (en) * | 2007-09-21 | 2009-03-26 | Mips Technologies, Inc. | Support for multiple coherence domains |
-
2013
- 2013-09-05 JP JP2013184347A patent/JP5614483B2/en not_active Expired - Fee Related
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2005044342A (en) * | 2003-07-22 | 2005-02-17 | Samsung Electronics Co Ltd | Multiprocessor system and method for maintaining cache consistency of thereof |
JP2007004802A (en) * | 2005-06-24 | 2007-01-11 | Arm Ltd | Snoop operation management in data processor |
JP2008026944A (en) * | 2006-07-18 | 2008-02-07 | Renesas Technology Corp | Bus coupling type multiprocessor |
JP2009032264A (en) * | 2007-07-26 | 2009-02-12 | Hewlett-Packard Development Co Lp | Mask usable for snoop request |
US20090083493A1 (en) * | 2007-09-21 | 2009-03-26 | Mips Technologies, Inc. | Support for multiple coherence domains |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113986778A (en) * | 2021-11-17 | 2022-01-28 | 海光信息技术股份有限公司 | Data processing method, shared cache, chip system and electronic equipment |
Also Published As
Publication number | Publication date |
---|---|
JP5614483B2 (en) | 2014-10-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5360299B2 (en) | Multi-core processor system, cache coherency control method, and cache coherency control program | |
JP5505501B2 (en) | Multi-core processor system, control program, and control method | |
US9916247B2 (en) | Cache management directory where hardware manages cache write requests and software manages cache read requests | |
US8453121B2 (en) | Managing the tracing of the execution of a computer program | |
US7395407B2 (en) | Mechanisms and methods for using data access patterns | |
KR101639672B1 (en) | Unbounded transactional memory system and method for operating thereof | |
CN110865968B (en) | Multi-core processing device and data transmission method between cores thereof | |
JP5488697B2 (en) | Multi-core processor system, synchronization control method, and synchronization control program | |
JP5481308B2 (en) | Data control apparatus and program | |
JP5085180B2 (en) | Information processing apparatus and access control method | |
US20150206277A1 (en) | Unified memory systems and methods | |
CN101593161A (en) | Guarantee the conforming apparatus and method of memory cache hierarchical data of microprocessor | |
WO2012127589A1 (en) | Multi-core processor system, and branch prediction method | |
KR101355105B1 (en) | Shared virtual memory management apparatus for securing cache-coherent | |
WO2011155027A1 (en) | Memory access control device, multi-core processor system, memory access control method, and memory access control program | |
CN104714899A (en) | Load-Through Fault Mechanism | |
JP5614483B2 (en) | Multi-core processor system, cache coherency control method, and cache coherency control program | |
US20160217076A1 (en) | Speculative cache reading using shared buffer | |
JP5776810B2 (en) | Multiprocessor system, control program, and control method | |
JP4974638B2 (en) | Simulation apparatus and simulation method | |
JP5811211B2 (en) | Multi-core processor system, multi-core processor system control method, and multi-core processor system control program | |
CN115061953A (en) | Processor and method for specified target to perform intra-core to extra-core cache content migration | |
Lüdtke et al. | Cache-Related Performance Analysis Using Rogue Wave Software’s ThreadSpotter | |
JP2018120297A (en) | Information processing device, control method of information processing device, and control program of the information processing device | |
JP2012008774A (en) | Cache device and information processing device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20131007 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20140428 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20140513 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20140714 |
|
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: 20140812 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20140825 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 5614483 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
LAPS | Cancellation because of no payment of annual fees |