JP3925854B2 - Programs in multiprocessor systems - Google Patents

Programs in multiprocessor systems Download PDF

Info

Publication number
JP3925854B2
JP3925854B2 JP2002298685A JP2002298685A JP3925854B2 JP 3925854 B2 JP3925854 B2 JP 3925854B2 JP 2002298685 A JP2002298685 A JP 2002298685A JP 2002298685 A JP2002298685 A JP 2002298685A JP 3925854 B2 JP3925854 B2 JP 3925854B2
Authority
JP
Japan
Prior art keywords
processor
data
program
cache coherency
executed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2002298685A
Other languages
Japanese (ja)
Other versions
JP2004133753A (en
Inventor
眞 上田
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.)
International Business Machines Corp
Original Assignee
International Business Machines 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 International Business Machines Corp filed Critical International Business Machines Corp
Priority to JP2002298685A priority Critical patent/JP3925854B2/en
Publication of JP2004133753A publication Critical patent/JP2004133753A/en
Application granted granted Critical
Publication of JP3925854B2 publication Critical patent/JP3925854B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Memory System Of A Hierarchy Structure (AREA)

Description

【0001】
【発明の属する技術分野】
本発明は、マルチ・プロセッサ・システムで複数のプロセス(またはプログラムと言う)のスレッドをディスパッチするためのプログラムに関する。
【0002】
【従来の技術】
従来、マルチ・スレッド・プログラムの実行環境として、マルチ・プロセッサ・システムはWEBサーバの応用で特に成功を収めている。この場合、システムで実行されるプロセスは、プロキシやファイアーウォールなどのサーバ・プログラムである。分散処理をおこなう場合、1つのシステムで1つのサーバ・プログラムが実行されることもしばしばである。
【0003】
WEBサーバのマルチ・スレッド・プログラムは、非同期な複数のクライアントからのリクエストに応じて、ジョブの生成・消滅を繰り返す。これに対してCPU(central processing unit)サーバあるいはCPU Farmと呼ばれるサーバ用途では、性質の異なる複数のプログラム、例えば計算やCAD(computer aided design)などが実行される。
【0004】
マルチ・スレッド・プログラムを含むプロセスを1つ実行する場合、割り当て可能なプロセッサにプロセスのスレッドを全て割り当てることが最もプロセスの実行速度を高める。しかし、複数のプロセスが存在する場合、システムのスループットを最適化する方法でスレッドの割り当てをおこなう必要がある。
【0005】
例えば、8個のプロセスを同時に処理できるマルチ・プロセッサ・システムで、独立な8個のプロセスを実行する場合、1個のプロセスを処理するシングル・プロセッサ8台で実行したときと比較してスループットが著しく劣ることがある。これは、ユーザ空間の共有の結果生じた競合が効率を落とす原因と考えられている。
【0006】
マルチ・スレッド・プログラムは、スレッドの切り替えがプログラムの切り替えと比較して高速である。さらに異なるスレッド間で同じユーザ空間を共有しているため、スレッド間でのデータの受け渡しがポインタ渡しにできる。したがって、スレッド間のデータの受け渡しはコピー操作の必要なプログラム間のデータの受け渡しに比べて高速である。マルチ・スレッド・プログラムをマルチ・プロセッサ・システムで実行する場合、システムはキャッシュ・コヒーレントな共有メモリを有することが望ましい。なぜなら、異なるプロセッサで実行中のスレッド同士でデータの受け渡しをポインタ渡しでおこなうとき、ハードウェア・レベルでコピー操作が発生しないからである。
【0007】
マルチ・プロセッサ・システムは、マルチ・スレッド・プログラムの実行に最適化された結果、ハードウェア・レベルでのキャッシュ・コヒーレンシなサポートを加えられている。キャッシュ・コヒーレンシをハードウェアでサポートすることは、頻繁に起きるスレッド間のデータの受け渡し、すなわちスレッド間の通信に適している。
【0008】
しかし、スレッド間通信の頻度の低い独立したプログラム間でのデータの受け渡しに備えて、常にキャッシュ・コヒーレンシ・プロトコルを用いたデータ・アクセスを用いると、速度面で不要な処理が多くなる。CC−NUMA(cache coherence-non uniform memory access)型マルチ・プロセッサ・システムの例では、L2(レベル2)キャッシュ・ミスをした場合、ソフトウェアの介在なしに、データの所属するメモリを管理するホーム・ノードに属するタグ・メモリがアクセスされ、最新のデータを保持しているオーナ・ノードが自動的に照会される。また、スヌープ・キャッシュを用いた場合、常にアドレスを全キャッシュにブロードキャストする必要があるため、アドレスバスが1セットしかないと、スヌープを必要とするメモリ・アクセスを同時に複数発生させることができない。なお、タグ・メモリは、データをキャッシュしている状態を管理するメモリである。スヌープ・キャッシュは、コヒーレンシをハードウェアで自動管理するために使用するメモリである。L2キャッシュ・ミスは、キャッシュ・メモリが2層構造であり、1層に次いで2層でもキャッシュ・ミスをすることを言う。
【0009】
したがって、キャッシュ・コヒーレンシのハードウェアでのサポートは、マルチ・スレッド・プログラムを効率よくサポートするために適しているが、独立した複数のプログラムを実行する場合には却って不要なサポートである。
【0010】
【発明が解決しようとする課題】
本発明の目的は、マルチ・プロセッサ・システムで複数のプログラムを実行する場合、システムのスループットを最大化するように制御するプログラムを提供することにある。
【0011】
【課題を解決するための手段】
本発明のプログラムの要旨は、複数のプロセッサを含むマルチ・プロセッサ・システムで実行されるプロセスのスレッドをディスパッチするプログラムであって、前記マルチ・プロセッサ・システムを、前記複数のプロセッサにそれぞれプロセスのスレッドを割り当てるときの該プロセスの処理効率を判定するために、前記プロセスの実行時間の内のプロセッサでの処理時間とI/O待ちの時間との長さを比較する手段と、前記プロセッサでの処理時間またはI/O待ちの時間のいずれが長いかによって、前記プロセスを1つのプロセッサまたは複数のプロセッサで実行させることを選択する手段、として機能させるためのプログラムである。
【0012】
複数のプロセッサを含むマルチ・プロセッサ・システムで実行されるプロセスのスレッドをディスパッチする方法、前記複数のプロセッサにそれぞれプロセスのスレッドを割り当てたときの該プロセスの処理効率を判定するステップと、前記プロセスを1つのプロセッサまたは複数のプロセッサで実行させるかを選択するステップと、を含む。
【0013】
【発明の実施の形態】
本発明のプログラムの実施の形態について図面を用いて説明する。なお、本明細書、図面1、2および4において、符号38は、符号38a,38b,P1,P2,P3を総括的に示す。
【0014】
本発明のプログラムは、図1に示すスレッドのディスパッチをおこなうプログラムである。言い換えると、本発明は、マルチ・プロセッサ・システムにおけるオペレーティング・システムのスケジューラの発明である。先ず、システムのスループットを最大化するための方法を説明する。
【0015】
図2は、オペレーティング・システム32とプロセス38を表したものである。T0からT4はプロセス38のスレッドを示し、これらのスレッドT0,T1,T2,T3,T4の位置がマルチ・プロセッサ・システム40における実行ポイントを示す。図2の例では、スレッドT0はスレッドT1,T2,T3,T4と同時実行可能なユーザ空間36のスレッドである。スレッドT1はシステム・コールによってスレッドT2,T3へとサービスを受けた後、スレッドT4にリターンする。
【0016】
なお、本明細書において、例えば図2のスレッドT0,T2,T3を異なるプロセッサに割り当てれば、最大3の並行度が得られるプロセス38であっても、1つのプロセッサ(シングル・プロセッサ)に割り当てることを、シングル・プロセッサ実行状態にすると言う。
【0017】
従来、例えばスレッドT0,T2,T3を異なるプロセッサにて並列実行する場合、データが共有されるため、キャッシュ・コヒーレンシ・プロトコルが必要である。スレッドT0からT4をシングル・プロセッサ実行する場合は、キャッシュ・コヒーレンシ・プロトコルは不要である。そこで、ユーザ空間36のデータは、対応するページテーブルにてコヒーレンシ不要とマークする。なお、ページテーブルは、メモリの記憶域をページ単位で管理するための表であり、仮想アドレスと物理アドレスの対応関係が格納される。この表を用いてキャッシュ制御、キャッシュ・コヒーレンシ制御を管理することができる。また、ページは、プログラムを等しい長さに分割した場合の分割された各部分である。
【0018】
キャッシュ・コヒーレンシ不要とマークする場合、例えば、図3のページテーブル42では、WIMビット・フィールドにて指定する。マルチ・プロセッサ・システム40に含まれるMMU(memory management unit)の機能が働いて、このユーザ空間36へのデータ・アクセスに関してハードウェア30はキャッシュ・コヒーレンシ・プロトコルを発生しない。
【0019】
ただし、このままでは他のプロセッサで実行されたプログラムとのデータ受け渡しの時に、キャッシュ・コヒーレンシが保たれない可能性がある。例えば、図2のスレッドT5が、図4のプロセッサuP2にて実行されている場合に、スレッドT5がキャッシュ・コヒーレンシ不要としたプロセスを有するユーザ空間36aを参照した場合、キャッシュ・コヒーレンシが保たれなくなる。
【0020】
上記の場合に、プロセッサへのディスパッチを変更して、スレッドT5も加えてシングル・プロセッサ実行状態にして、キャッシュ・コヒーレンシを保つ。ディスパッチを変更するイベントを発生するために、MMUのアシストを利用する。ページテーブル42において、このユーザ空間36を実行中の唯一のプロセッサからのみ読み書き可能とし、他のプロセッサからは読み書き不可能とする。スレッドT5に対しキャッシュ・コヒーレンシを破るデータの参照をおこなう前に割り込が発生し、スレッドT0,T1,T2,T3,T4と同じプロセッサへディスパッチさせる。
【0021】
ページに対する読み書きの属性は、図3のページテーブル42の例では、PPビット・フィールドで指定することによって、キャッシュ・コヒーレンシ・プロトコルを省略することが可能となる。
【0022】
ページテーブル42に記録された読み書きの属性の内容が、プロセッサによって異なって見えるが、これは、DSM(distributed shared memory)にてソフトウェア・キャッシュを実装する場合にも用いられる技術である。DSMのソフトウェア・キャッシュでは、ページ・フォルトを起こしたページをノード間で移動させることによってキャッシュ効果を得るのに対して、本発明では、ページ・フォルトを起こしたスレッドをノード間で移動させる点が異なる。なお、ページ・フォルトは、メモリに存在しないページに対するアクセスが起こったときに発生する割り込みである。
【0023】
全てのプロセス38をシングル・プロセッサ実行状態にしてしまうと、マルチ・プロセッサ・システム40の意味が失われる。そこで、本発明のプログラムは、下記のような構成にし、シングル・プロセッサ実行状態にすべきプロセス38を選択する。
【0024】
図1に示す本発明のプログラム10は、マルチ・プロセッサ・システム40を、複数のプロセッサ(マルチ・プロセッサ)28にそれぞれプロセス38a,38bのスレッドを割り当てたときのプロセス38a,38bの処理効率を判定する判定手段12、判定手段12の結果に基づいて、プロセス38a,38bをシングル・プロセッサ26またはマルチ・プロセッサ28で実行させるかを選択する選択手段14、として機能させるためのプログラムである。
【0025】
判定手段12は、プロセス38a,38bの実行状態を観測する観測部16と、プロセス38a,38bの処理効率を判定する判定部18とを含む。観測部16は、プロセス38a,38bの実行時間をプロセッサ26,28での処理の時間およびI/O(input/output)待ちの時間とに分割する分割手段(図示せず)と、処理の時間とI/O待ちの時間とを比較する比較手段(図示せず)と、を含む。比較手段の比較結果を用いて、判定部18がプロセス38a,38bの処理効率を判定する。
【0026】
選択手段14は、メモリ管理部20とタスク・ディスパッチャ22とを含む。メモリ管理部20は、メモリ24にあるプロセス38a,38bに対して、キャッシュ・コヒーレンシをオンにするかオフにするかをおこなう。タスク・ディスパッチャ22は、マルチ・プロセッサ実行かシングル・プロセッサ実行を選択する。
【0027】
本発明は、判定手段12と選択手段14によって、シングル・プロセッサ26で実行されているプロセス38aが処理するデータに他のプロセッサからのアクセスするとき、そのアクセスを中止し、そのアクセスを上記シングル・プロセッサ26に変更する。すなわち、他のプロセッサからのアクセスに対して割り込みを発生させ、シングル・プロセッサ26にそのアクセスを変更する。
【0028】
本発明は、判定手段12と選択手段14によって、シングル・プロセッサ26で実行されているプロセス38aが処理するデータに対して、シングル・プロセッサ26がデータの読み書きをおこない、他のプロセッサに対してデータの読み書きを禁止する。
【0029】
次に、上記のプログラム10によるディスパッチ方法について説明する。プログラム10は、マルチ・プロセッサ28にそれぞれプロセス38a,38bのスレッドを割り当てたときの処理効率を判定し、シングル・プロセッサ実行またはマルチ・プロセッサ実行を選択する。
【0030】
判定をおこなうとき、▲1▼I/Oバウンドが発生する処理の場合、CPUで消費されるわずかな時間でプロセスを並列処理したとしても、その効果は限られている。そこで、プロセス38a,38bの実行時間をプロセッサ28での処理時間とI/O待ちの時間とに分割し、処理時間とI/O待ちの時間とを比較する。比較の結果、I/O待ちの時間の方が長い場合、シングル・プロセッサ実行する。図1ではプロセス38aがシングル・プロセッサ実行となっている。I/Oバウンドは、データの処理おいてハードディスク上の仮想記憶領域を使用すること、すなわちスワップファイルを生成することをいう。
【0031】
▲2▼プログラム10を含むオペレーティング・システム42上で動作するアプリケーション・プログラムがシングル・スレッド・プログラムである場合もシングル・プロセッサ実行の候補となる。この場合は、オペレーティング・システム32がマルチ・スレッド・プログラムであれば、アプリケーション・プログラムはマルチ・スレッド・プログラムのように振る舞う。しかし、I/Oバウンドの発生が予想されるため、オペレーティング・システム32は、アプリケーション・プログラムがプロセス処理の並行性を持たない場合は、シングル・プロセッサ実行の候補とする。すなわち、本発明のプログラムは、上記の場合に、選択手段14がシングル・プロセッサ実行を選択する。
【0032】
▲3▼単独で実行されるときにマルチ・プロセッサ実行に適しているプロセス38でも、複数のプロセス38が実行される場合には処理効率が悪いという場合がある。この様な処理もシングル・プロセッサ実行の候補とする。すなわち、本発明のプログラム10は、判定手段12が個々のプロセス38a,38bにおけるマルチ・プロセッサ実行の処理効率を判定し、判定の結果が上記のような場合に、選択手段14がシングル・プロセッサ実行を選択する。例えば、図1でプロセス38aがマルチ・プロセッサ実行に適していても、選択手段14によってシングル・プロセッサ実行となる。
【0033】
本発明のプログラム10を有するマルチ・プロセッサ・システム40において、マルチ・プロセッサ実行に適したマルチ・スレッド・プログラムを持つプロセス38は、ハードウェア・レベルでのキャッシュ・コヒーレンシ・サポートを与えられたマルチ・プロセッサ28にて並行処理する。
【0034】
図4において、プロセスP3は2つのプロセッサuP3,uP4で処理される。プロセッサuP3,uP4で発生するデータ・アクセスは、キャッシュ・コヒーレンシ・プロトコルを発生する。
【0035】
マルチ・プロセッサ実行に適さないプロセス38は、シングル・プロセッサ実行され、他のプロセッサとのキャッシュ・コヒーレンシは、MMUのアシストなどを使ったソフトウェア制御方法のみ保たれる。図4のプロセスP1,P2をそれぞれ実行するプロセッサuP1,uP2の発生するユーザ空間36a,36bに対するデータ・アクセスはキャッシュ・コヒーレンシ・プロトコルを発生しない。この結果、キャッシュ・コヒーレンシ・プロトコルのバンド幅は緩和され、システム40のスループットは向上する。
【0036】
キャッシュ・コヒーレンシ・プロトコルを発生しないため、プロセスP1に対して、プロセッサuP2からのアクセスをおこなうとき、上記の割り込み手段がそのアクセスに対して割り込みを発生させる。そして、割り込みの発生後、プロセッサuP2からプロセッサuP1にスレッドを割り当てて、アクセスをおこなう。
【0037】
また、MMUによって、あるプロセッサで実行されているプロセス38が処理するデータに対して、そのプロセッサがデータの読み書きをおこない、他のプロセッサに対してデータの読み書きを禁止するようにシステム40を制御する。
【0038】
以上、本発明の実施の形態を説明したが、本発明は上記の形態に限定されることはない。上記の説明はキャッシュをL1(レベル1)キャッシュを前提に説明をおこなっており、シングル・プロセッサ実行状態とは、シングル・プロセッサでスレッドを実行することであった。同じアイデアをL2キャッシュに応用することができる。この場合、シングル・プロセッサ・ノード実行状態にする。シングル・プロセッサ・ノード実行状態とは、同じノードに属する複数のプロセッサが1つのプロセスに属する複数のタスクを処理する状態を言う。
【0039】
キャッシュ・コヒーレンシ・プロトコルを省略する空間を、実装が容易で、効果の高いユーザ空間としたが、システム空間の一部に応用することは可能である。すなわち、システム空間の用途を分類し、分類された中でキャッシュ・コヒーレンシ・プロトコルを省略できる部分に適用する。
【0040】
その他、本発明は、主旨を逸脱しない範囲で当業者の知識に基づき種々の改良、修正、変更を加えた態様で実施できるものである。
【0041】
【発明の効果】
本発明によると、マルチ・プロセッサ・システムにおいて、プロセスのディスパッチを最適におこなうため、システムのスループットを下げることなく、全てのプロセスを処理することができる。
【図面の簡単な説明】
【図1】本発明のプログラムの構成およびディスパッチの様子を示す図である。
【図2】プロセスのスレッドの実行状態を示す図である。
【図3】キャッシュ・コヒーレンシを保つためのページテーブルの例を示す図である。
【図4】マルチ・プロセッサ・システムの例を示す図である。
【符号の説明】
10:プログラム
12:判定手段
14:選択手段
16:観測部
18:判定部
20:メモリ管理部
22:タスク・ディスパッチャ
24:メモリ
26:シングル・プロセッサ
28:マルチ・プロセッサ
30:ハードウェア
32:オペレーティング・システム
34,34a,34b,34c:システム空間
36,36a,36b,36c:ユーザ空間
38:プロセス
40:マルチ・プロセッサ・システム
42:ページテーブル
[0001]
BACKGROUND OF THE INVENTION
The present invention, concerning a thread of a plurality of processes (or referred to as a program) to the program for dispatching a multi-processor system.
[0002]
[Prior art]
Conventionally, as an execution environment for a multi-thread program, a multi-processor system has been particularly successful in the application of a WEB server. In this case, the process executed in the system is a server program such as a proxy or a firewall. When performing distributed processing, one server program is often executed in one system.
[0003]
The multi-thread program of the WEB server repeatedly generates and deletes jobs in response to requests from a plurality of asynchronous clients. On the other hand, in a server application called a CPU (central processing unit) server or CPU Farm, a plurality of programs having different properties, for example, calculation and CAD (computer aided design) are executed.
[0004]
When one process including a multi-thread program is executed, assigning all the process threads to an assignable processor increases the execution speed of the process most. However, when there are a plurality of processes, it is necessary to assign threads by a method that optimizes the throughput of the system.
[0005]
For example, in a multi-processor system that can process eight processes simultaneously, when eight independent processes are executed, the throughput is higher than when executed by eight single processors that process one process. May be significantly inferior. This is considered to be the cause of the inefficiency caused by the competition resulting from the sharing of the user space.
[0006]
In a multi-thread program, thread switching is faster than program switching. Furthermore, since the same user space is shared between different threads, data can be passed between threads using pointers. Therefore, data transfer between threads is faster than data transfer between programs that require a copy operation. When executing a multi-thread program on a multi-processor system, the system preferably has a cache coherent shared memory. This is because, when data is transferred between threads running on different processors by pointer passing, no copy operation occurs at the hardware level.
[0007]
Multi-processor systems have been added to support hardware-level cache coherency as a result of being optimized for the execution of multi-threaded programs. Supporting cache coherency with hardware is suitable for data passing between threads that occurs frequently, that is, communication between threads.
[0008]
However, if data access using a cache coherency protocol is always used in preparation for data transfer between independent programs with low frequency of communication between threads, unnecessary processing increases in speed. In an example of a CC-NUMA (cache coherence-non uniform memory access) type multi-processor system, when an L2 (level 2) cache miss occurs, the home memory that manages the memory to which the data belongs without intervention of software The tag memory belonging to the node is accessed and the owner node holding the latest data is automatically queried. In addition, when a snoop cache is used, it is necessary to always broadcast addresses to all caches. Therefore, if there is only one address bus, a plurality of memory accesses requiring snoop cannot be generated simultaneously. The tag memory is a memory that manages a state in which data is cached. The snoop cache is a memory used for automatically managing coherency by hardware. The L2 cache miss means that the cache memory has a two-layer structure, and a cache miss is made in two layers after the first layer.
[0009]
Therefore, the hardware support for cache coherency is suitable for efficiently supporting a multi-thread program, but is an unnecessary support when a plurality of independent programs are executed.
[0010]
[Problems to be solved by the invention]
An object of the present invention, when executing a plurality of programs in a multi-processor system is to provide Hisage a program to control to maximize the throughput of the system.
[0011]
[Means for Solving the Problems]
The gist of the program of the present invention is a program for dispatching a thread of a process executed in a multi-processor system including a plurality of processors, wherein the multi-processor system is sent to each of the plurality of processors as a process thread. Means for comparing the length of processing time in the processor and the time waiting for I / O within the execution time of the process, and processing in the processor A program for causing a process to be executed by one processor or a plurality of processors depending on whether the time or I / O waiting time is long .
[0012]
How to dispatch threads of a process executed by the multi-processor system containing multiple processors, determining the processing efficiency of the process when assigning the threads of the process to the plurality of processors, said process Selecting whether to execute on one processor or a plurality of processors.
[0013]
DETAILED DESCRIPTION OF THE INVENTION
It will be described with reference to the drawings programming implementation in the form of a ram of the present invention. In this specification and FIGS. 1, 2 and 4, reference numeral 38 generally indicates reference numerals 38a, 38b, P1, P2, and P3.
[0014]
The program of the present invention is a program for dispatching threads shown in FIG. In other words, the present invention is an invention of an operating system scheduler in a multi-processor system. First, a method for maximizing system throughput will be described.
[0015]
FIG. 2 represents the operating system 32 and the process 38. T0 to T4 indicate the threads of the process 38, and the positions of these threads T0, T1, T2, T3, and T4 indicate execution points in the multiprocessor system 40. In the example of FIG. 2, the thread T0 is a thread in the user space 36 that can be executed simultaneously with the threads T1, T2, T3, and T4. The thread T1 receives services from the system call to the threads T2 and T3, and then returns to the thread T4.
[0016]
In this specification, for example, if the threads T0, T2, and T3 in FIG. 2 are assigned to different processors, even the process 38 that can obtain a maximum of 3 parallelisms is assigned to one processor (single processor). This is called a single processor execution state.
[0017]
Conventionally, for example, when threads T0, T2, and T3 are executed in parallel by different processors, data is shared, and thus a cache coherency protocol is required. When the threads T0 to T4 are executed by a single processor, no cache coherency protocol is required. Therefore, the data in the user space 36 is marked as not requiring coherency in the corresponding page table. The page table is a table for managing the memory storage area in units of pages, and stores the correspondence between virtual addresses and physical addresses. This table can be used to manage cache control and cache coherency control. A page is each divided part when the program is divided into equal lengths.
[0018]
When marking that cache coherency is unnecessary, for example, in the page table 42 of FIG. 3, it is specified in the WIM bit field. With the function of an MMU (memory management unit) included in the multiprocessor system 40, the hardware 30 does not generate a cache coherency protocol for data access to this user space 36.
[0019]
However, there is a possibility that cache coherency may not be maintained when data is exchanged with a program executed by another processor. For example, when the thread T5 of FIG. 2 is executed by the processor uP2 of FIG. 4, when the user T36 having a process that does not require cache coherency is referred to, the thread coherency cannot be maintained. .
[0020]
In the above case, the dispatch to the processor is changed, and the thread T5 is added to the single processor execution state to maintain cache coherency. Use MMU assistance to generate events that change dispatches. In the page table 42, the user space 36 can be read / written only from the only processor that is executing, and cannot be read / written from other processors. An interrupt occurs before the thread T5 is referred to data that breaks cache coherency, and is dispatched to the same processor as the threads T0, T1, T2, T3, and T4.
[0021]
In the example of the page table 42 of FIG. 3, the read / write attribute for the page can be omitted by specifying the PP bit field in the cache coherency protocol.
[0022]
The contents of the read / write attribute recorded in the page table 42 look different depending on the processor. This is a technique that is also used when a software cache is implemented by DSM (distributed shared memory). In the DSM software cache, the page faulted page is moved between the nodes to obtain the cache effect, whereas in the present invention, the page faulted thread is moved between the nodes. Different. A page fault is an interrupt that occurs when a page that does not exist in memory is accessed.
[0023]
If all processes 38 are in a single processor execution state, the meaning of the multi-processor system 40 is lost. Therefore, the program of the present invention has the following configuration, and selects a process 38 to be in a single processor execution state.
[0024]
The program 10 of the present invention shown in FIG. 1 determines the processing efficiency of the processes 38a and 38b when the multiprocessor system 40 assigns threads of the processes 38a and 38b to a plurality of processors (multiprocessors) 28, respectively. This is a program for causing the determination means 12 and the selection means 14 to select whether the processes 38a and 38b are executed by the single processor 26 or the multi processor 28 based on the result of the determination means 12.
[0025]
The determination unit 12 includes an observation unit 16 that observes the execution states of the processes 38a and 38b, and a determination unit 18 that determines the processing efficiency of the processes 38a and 38b. The observation unit 16 includes a dividing unit (not shown) that divides the execution time of the processes 38a and 38b into processing time in the processors 26 and 28 and waiting time for I / O (input / output), and processing time. And a comparison means (not shown) for comparing the I / O waiting time. The determination unit 18 determines the processing efficiency of the processes 38a and 38b using the comparison result of the comparison unit.
[0026]
The selection unit 14 includes a memory management unit 20 and a task dispatcher 22. The memory management unit 20 turns on or off cache coherency for the processes 38 a and 38 b in the memory 24. The task dispatcher 22 selects multiprocessor execution or single processor execution.
[0027]
In the present invention, when the data processed by the process 38a executed by the single processor 26 is accessed from another processor by the determination unit 12 and the selection unit 14, the access is stopped and the access is stopped. Change to processor 26. That is, an interrupt is generated for an access from another processor, and the access is changed to the single processor 26.
[0028]
In the present invention, the single processor 26 reads / writes data for the data processed by the process 38a executed by the single processor 26 by the determination means 12 and the selection means 14, and the data is sent to other processors. Prohibits reading and writing.
[0029]
Next, a dispatch method by the program 10 will be described. The program 10 determines the processing efficiency when the threads of the processes 38a and 38b are assigned to the multiprocessor 28, respectively, and selects single processor execution or multiprocessor execution.
[0030]
When making a determination, (1) in the case of processing in which I / O bound occurs, even if the processes are processed in parallel in a short time consumed by the CPU, the effect is limited. Therefore, the execution time of the processes 38a and 38b is divided into the processing time in the processor 28 and the I / O waiting time, and the processing time and the I / O waiting time are compared. As a result of the comparison, if the I / O wait time is longer, a single processor is executed. In FIG. 1, the process 38a is executed by a single processor. I / O bound refers to using a virtual storage area on a hard disk in processing data, that is, generating a swap file.
[0031]
(2) A single processor execution candidate is also a case where an application program that runs on the operating system 42 including the program 10 is a single thread program. In this case, if the operating system 32 is a multi-thread program, the application program behaves like a multi-thread program. However, since an I / O bound is expected to occur, the operating system 32 is a candidate for single processor execution if the application program does not have concurrency of process processing. That is, in the program of the present invention, the selection means 14 selects the single processor execution in the above case.
[0032]
(3) Even if the process 38 is suitable for multiprocessor execution when executed alone, the processing efficiency may be poor when a plurality of processes 38 are executed. Such processing is also a candidate for single processor execution. That is, in the program 10 of the present invention, the determination unit 12 determines the processing efficiency of multiprocessor execution in the individual processes 38a and 38b, and when the determination result is as described above, the selection unit 14 executes the single processor execution. Select. For example, even if the process 38a in FIG. 1 is suitable for multiprocessor execution, the selection means 14 performs single processor execution.
[0033]
In a multi-processor system 40 having the program 10 of the present invention, a process 38 having a multi-thread program suitable for multi-processor execution is a multi-processor provided with hardware level cache coherency support. The processor 28 performs parallel processing.
[0034]
In FIG. 4, the process P3 is processed by two processors uP3 and uP4. Data accesses occurring in the processors uP3 and uP4 generate a cache coherency protocol.
[0035]
The process 38 that is not suitable for multiprocessor execution is executed by a single processor, and cache coherency with other processors is maintained only by a software control method using the assistance of the MMU. Data access to the user spaces 36a and 36b generated by the processors uP1 and uP2 respectively executing the processes P1 and P2 in FIG. 4 does not generate a cache coherency protocol. As a result, the bandwidth of the cache coherency protocol is relaxed and the throughput of the system 40 is improved.
[0036]
Since no cache coherency protocol is generated, when the process P1 is accessed from the processor uP2, the interrupt means generates an interrupt for the access. Then, after the occurrence of the interrupt, a thread is assigned from the processor uP2 to the processor uP1 to perform access.
[0037]
Further, the MMU controls the system 40 so that the processor reads / writes data processed by a process 38 executed by a processor and prohibits other processors from reading / writing data. .
[0038]
As mentioned above, although embodiment of this invention was described, this invention is not limited to said form. The above description is based on the assumption that the cache is an L1 (level 1) cache, and the single processor execution state is that a thread is executed by a single processor. The same idea can be applied to L2 cache. In this case, a single processor node execution state is set. The single processor node execution state refers to a state in which a plurality of processors belonging to the same node process a plurality of tasks belonging to one process.
[0039]
The space that omits the cache coherency protocol is a user space that is easy to implement and highly effective, but can be applied to a part of the system space. That is, the usage of the system space is classified and applied to a portion in which the cache coherency protocol can be omitted.
[0040]
In addition, the present invention can be implemented in a mode in which various improvements, modifications, and changes are made based on the knowledge of those skilled in the art without departing from the spirit of the present invention.
[0041]
【The invention's effect】
According to the present invention, in a multiprocessor system, process dispatching is optimally performed, so that all processes can be processed without reducing the system throughput.
[Brief description of the drawings]
FIG. 1 is a diagram showing a configuration of a program according to the present invention and a state of dispatch.
FIG. 2 is a diagram showing an execution state of a thread of a process.
FIG. 3 is a diagram illustrating an example of a page table for maintaining cache coherency.
FIG. 4 illustrates an example of a multi-processor system.
[Explanation of symbols]
10: Program 12: Determination unit 14: Selection unit 16: Observation unit 18: Determination unit 20: Memory management unit 22: Task dispatcher 24: Memory 26: Single processor 28: Multiprocessor 30: Hardware 32: Operating System 34, 34a, 34b, 34c: System space 36, 36a, 36b, 36c: User space 38: Process 40: Multiprocessor system 42: Page table

Claims (3)

複数のプロセッサを含むマルチ・プロセッサ・システムで実行されるプロセスのスレッドをディスパッチするプログラムであって、
前記マルチ・プロセッサ・システムを、
前記複数のプロセッサにそれぞれプロセスのスレッドを割り当てるときの該プロセスの処理効率を判定するために、前記プロセスの実行時間の内のプロセッサでの処理時間とI/O待ちの時間との長さを比較する手段、
前記プロセッサでの処理時間またはI/O待ちの時間のいずれが長いかによって、前記プロセスを1つのプロセッサまたは複数のプロセッサで実行させることを選択する手段、
前記1つのプロセッサで実行されるプロセスで処理されるデータに対してキャッシュ・コヒーレンシの不要をマークするページテーブル、
前記ページテーブルにおいてキャッシュ・コヒーレンシが不要とマークされているデータが、前記1つのプロセッサで実行されているプロセスで処理されており、該データに他のプロセッサからアクセスするとき、該アクセスに対して割り込みを発生させる手段、
前記割り込みの後、前記他のプロセッサから前記プロセスを実行している1つのプロセッサにプロセスのスレッドを割り当てる手段、
前記1つのプロセッサで実行されているプロセスが処理するデータに対して、該1つのプロセッサが該データの読み書きをおこない、前記他のプロセッサに対して該データの読み書きを禁止し、且つ前記キャッシュ・コヒーレンシの不要のマークによってキャッシュ・コヒーレンシ・プロトコルを発生しないようにするMMU( memory management unit )、
として機能させるためのプログラム。
A program for dispatching threads of a process executing on a multi-processor system including a plurality of processors,
Said multi-processor system,
In order to determine the processing efficiency of each process when assigning process threads to each of the plurality of processors, the length of the processing time in the processor and the time waiting for I / O within the execution time of the process are compared. Means to
Means for selecting the process to be executed by one processor or a plurality of processors depending on whether processing time in the processor or I / O waiting time is long;
A page table for marking cache coherency unnecessary for data processed by a process executed by the one processor;
Data that is marked as not requiring cache coherency in the page table is being processed by a process running on the one processor, and the access is interrupted when the data is accessed from another processor Means for generating,
Means for assigning a process thread to the one processor executing the process from the other processor after the interrupt;
The one processor reads / writes the data to / from data processed by a process executed by the one processor, prohibits the other processor from reading / writing the data, and the cache coherency. MMU ( memory management unit ) to prevent cache coherency protocol from being generated due to unnecessary marks
Program to function as.
前記選択する手段が、前記I/O待ちの時間が長い場合に1つのプロセッサでのプロセスの実行を選択する請求項1に記載のプログラム。  The program according to claim 1, wherein the selecting unit selects execution of a process in one processor when the I / O waiting time is long. 前記プロセスがシングル・スレッド・プロセスである場合、前記選択する手段が1つのプロセッサでのプロセスの実行を選択する請求項1または2に記載のプログラム。  The program according to claim 1 or 2, wherein, when the process is a single thread process, the means for selecting selects execution of the process on one processor.
JP2002298685A 2002-10-11 2002-10-11 Programs in multiprocessor systems Expired - Fee Related JP3925854B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002298685A JP3925854B2 (en) 2002-10-11 2002-10-11 Programs in multiprocessor systems

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002298685A JP3925854B2 (en) 2002-10-11 2002-10-11 Programs in multiprocessor systems

Publications (2)

Publication Number Publication Date
JP2004133753A JP2004133753A (en) 2004-04-30
JP3925854B2 true JP3925854B2 (en) 2007-06-06

Family

ID=32288016

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002298685A Expired - Fee Related JP3925854B2 (en) 2002-10-11 2002-10-11 Programs in multiprocessor systems

Country Status (1)

Country Link
JP (1) JP3925854B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5035299B2 (en) * 2009-06-15 2012-09-26 株式会社日立製作所 Multi-core processor control method, computer system thereof, and management computer program
JP5360299B2 (en) 2010-06-14 2013-12-04 富士通株式会社 Multi-core processor system, cache coherency control method, and cache coherency control program

Also Published As

Publication number Publication date
JP2004133753A (en) 2004-04-30

Similar Documents

Publication Publication Date Title
US6871219B2 (en) Dynamic memory placement policies for NUMA architecture
JP4085389B2 (en) Multiprocessor system, consistency control device and consistency control method in multiprocessor system
US7143412B2 (en) Method and apparatus for optimizing performance in a multi-processing system
JP4082612B2 (en) Multiprocessor computer system with multiple coherency regions and software process migration between coherency regions without cache purge
US6816947B1 (en) System and method for memory arbitration
US5787480A (en) Lock-up free data sharing
US20060206635A1 (en) DMA engine for protocol processing
US10169087B2 (en) Technique for preserving memory affinity in a non-uniform memory access data processing system
US20040093467A1 (en) Adaptive cache coherence protocols
JPH10143483A (en) Multiprocess system constituted so as to detect and efficiently provide migratory data access pattern
JPH03217963A (en) Multi-processor system and method of controlling private cache of the same
JP2001236221A (en) Pipe line parallel processor using multi-thread
US20060294319A1 (en) Managing snoop operations in a data processing apparatus
Kaushik et al. Designing predictable cache coherence protocols for multi-core real-time systems
JP2009529740A (en) Method, system, apparatus, and program for performing cache line polling by cross-referencing with related applications using store and reserve instructions
US6457107B1 (en) Method and apparatus for reducing false sharing in a distributed computing environment
CN115981833A (en) Task processing method and device
US20090083496A1 (en) Method for Improved Performance With New Buffers on NUMA Systems
JP2024500779A (en) Address mapping aware task processing mechanism
JP3925854B2 (en) Programs in multiprocessor systems
JPWO2008114415A1 (en) Multi-processing system
Mallya et al. Simulation based performance study of cache coherence protocols
JP2002202960A (en) Data processing method and device
García-Guirado et al. Energy-efficient cache coherence protocols in chip-multiprocessors for server consolidation
Unrau Scalable memory management through hierarchical symmetric multiprocessing.

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20060118

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20060221

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20060419

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20061107

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20061211

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: 20070213

RD14 Notification of resignation of power of sub attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7434

Effective date: 20070215

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20070223

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees