JP2003108392A - Synchronous program and method therefor - Google Patents

Synchronous program and method therefor

Info

Publication number
JP2003108392A
JP2003108392A JP2001304027A JP2001304027A JP2003108392A JP 2003108392 A JP2003108392 A JP 2003108392A JP 2001304027 A JP2001304027 A JP 2001304027A JP 2001304027 A JP2001304027 A JP 2001304027A JP 2003108392 A JP2003108392 A JP 2003108392A
Authority
JP
Japan
Prior art keywords
synchronization
threads
thread
reached
area
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.)
Withdrawn
Application number
JP2001304027A
Other languages
Japanese (ja)
Inventor
Katsuyoshi Moriya
勝由 守屋
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.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2001304027A priority Critical patent/JP2003108392A/en
Publication of JP2003108392A publication Critical patent/JP2003108392A/en
Withdrawn legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To achieve parallel high-speed processing such that, with respect to a synchronous program and synchronous method for managing parallel processing of a plurality of threads, all threads perform load distribution by making reference and setting in parallel and also reduce cache miss. SOLUTION: The synchronous program is arranged to function as a means for arranging each synchronous area associated with a plurality of threads and a means; for setting the effect that arrived at synchronous point in the synchronous area for self when each thread has reached a synchronous point; thereafter, for setting the effect that both threads have reached the synchronous point simultaneously in the synchronous area, when it has become clear that the thread has reached the synchronous point by referring to the synchronous area of other thread of a predetermined position in a fixed direction; for reopening the processing by determining that the synchronization is completed when all threads have reached the synchronous point; and further for repeating the processing with respect to the synchronous area of other threads of the predetermined position in the fixed direction when all threads have not reached the synchronous point.

Description

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

【0001】[0001]

【発明の属する技術分野】本発明は、複数スレッドの並
列処理を管理する同期プログラムおよび同期方法に関す
るものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a synchronization program and a synchronization method for managing parallel processing of a plurality of threads.

【0002】[0002]

【従来の技術】複数CPUを搭載などした高速計算機シ
ステムでは、複数のスレッドに処理を分割して割り当て
て並列に処理を行い、高速化を図っている。これら複数
のスレッド間では、同期をとる必要がある。
2. Description of the Related Art In a high-speed computer system equipped with a plurality of CPUs, the processing is divided into a plurality of threads and allocated to perform the processing in parallel to increase the speed. It is necessary to synchronize these threads.

【0003】従来、複数スレッド間の同期は、例えば図
6に示すように、スレッド1,2,3,4が同期ポイン
トに到達したときにそれぞれ待機し、全てのスレッドが
到達した後に、一斉に処理を再開するようにしている。
この際、各スレッド1,2,3,4は同期ポイントに到
達したときにそれぞれの同期フラグをセットし、いずれ
か1つの特定スレッド、例えばスレッド1が他のスレッ
ド2,3,4の同期フラグを参照して全てのスレッド
1,2,3,4の同期フラグがセットされたことを確認
したときに、解放フラグをセットし、各スレッドが解放
フラグを参照してセットされていると判明したときに、
処理をそれぞれ再開するようにしていた。
Conventionally, synchronization between a plurality of threads is performed by waiting for each of threads 1, 2, 3 and 4 when they reach a synchronization point, and after all the threads have arrived, as shown in FIG. The process is restarted.
At this time, each of the threads 1, 2, 3 and 4 sets their respective synchronization flags when reaching the synchronization point, and any one of the specific threads, for example, the thread 1 synchronizes with the synchronization flags of the other threads 2, 3, and 4. When it was confirmed that the synchronization flags of all threads 1, 2, 3, 4 were set by referring to, the release flag was set, and it was found that each thread was set by referring to the release flag. sometimes,
Each process was restarted.

【0004】[0004]

【発明が解決しようとする課題】上述した従来のシステ
ムでは、スレッドの並列数がN(前記例ではN=4)の
とき、 ・特定スレッド(前記例ではスレッド1)は、(N−
1)回の同期フラグの参照と、1回の解放フラグの設定 ・その他のスレッド(前記例ではスレッド2,3,4)
は、1回の同期フラグの設定と、1回の解放フラグの参
照 がそれぞれ必要となり、特定スレッドに負荷が偏ってし
まい、処理が遅くなってしまうという問題があった。ま
た、解放のときに、同一領域への参照を行うために、キ
ャッシュミスが発生してしまい処理が遅くなってしまう
という問題もあった。
In the above-mentioned conventional system, when the parallel number of threads is N (N = 4 in the above example), the specific thread (thread 1 in the above example) is (N-
1) Reference of synchronization flag once and setting of release flag once and other threads (threads 2, 3, 4 in the above example)
However, there is a problem in that it is necessary to set the synchronization flag once and refer to the release flag once, and the load is biased to a specific thread, which slows down the processing. In addition, since there is a reference to the same area at the time of release, there is a problem that a cache miss occurs and the processing becomes slow.

【0005】本発明は、これらの問題を解決するため、
スレッド毎に同期領域を設けて各スレッドが同期ポイン
トに到達したときに設定すると共に一定方向の他のスレ
ッドの同期領域を参照して同期ポイントに到達していた
ときに両者を併せた同期設定を行うことを並列に繰り返
し、全スレッドが同期ポイントに到達と判明したときに
全スレッドが処理再開し、全スレッドが参照、設定を並
列に行って負荷分散すると共にキャッシュミスを低減し
て並列高速処理を実現することを目的としている。
The present invention solves these problems.
Set a synchronization area for each thread and set it when each thread reaches the synchronization point, and also refer to the synchronization area of another thread in a certain direction and set the synchronization settings for both when it reaches the synchronization point. When all threads are found to reach the synchronization point, all threads restart processing, all threads reference and set in parallel to distribute the load, reduce cache misses, and perform parallel high-speed processing. The purpose is to realize.

【0006】[0006]

【課題を解決するための手段】図1を参照して課題を解
決するための手段を説明する。図1において、スレッド
1,2は、並列に処理を実行するものであって、同期ポ
イントで同期化する対象のスレッドである。
[Means for Solving the Problems] Means for solving the problems will be described with reference to FIG. In FIG. 1, threads 1 and 2 execute processing in parallel and are threads to be synchronized at a synchronization point.

【0007】同期処理ルーチン12は、同期処理を実行
するルーチン(プログラム)である。次に、動作を説明
する。
The synchronization processing routine 12 is a routine (program) for executing synchronization processing. Next, the operation will be described.

【0008】複数スレッドに対応づけてそれぞれの同期
領域を設け、同期処理ルーチン12は各スレッドが同期
ポイントに到達したときに、当該スレッド用の同期領域
に同期ポイントに到達した旨をセットした後、一定方向
の所定位置の他のスレッドの同期領域を参照して同期ポ
イントに到達していると判明したときに両者のスレッド
が併せて同期ポイントに到達した旨を当該同期領域にセ
ットし、全てのスレッドが同期ポイントに到達していた
ときに同期完了と判断して処理を再開し、全てのスレッ
ドが同期ポイントに到達していないときに、更に、一定
方向の所定位置の他のスレッドの同期領域について繰り
返すようにしている。
Each synchronization area is provided in association with a plurality of threads, and when each thread reaches the synchronization point, the synchronization processing routine 12 sets the synchronization area for the thread to the effect that the synchronization point has been reached. When it is found that the synchronization points have been reached by referring to the synchronization areas of other threads at a predetermined position in a certain direction, the fact that both threads have reached the synchronization point together is set in the synchronization area, and all threads are set. When a thread has reached the sync point, it is judged that the synchronization is complete and processing is restarted. When all threads have not reached the sync point, the synchronization area of another thread at a predetermined position in a certain direction. I'm trying to repeat it.

【0009】この際、同期領域をキャッシュメモリの異
なるキャッシュラインにそれぞれ割り当てて、キャッシ
ュミスが発生しないようにしている。また、一定方向の
所定位置として、2N (N=0,1,2・・・)とする
ようにしている。
At this time, the synchronization areas are respectively assigned to different cache lines of the cache memory so that cache miss does not occur. Further, the predetermined position in the fixed direction is set to 2 N (N = 0, 1, 2, ...).

【0010】従って、スレッド毎に同期領域を設けて各
スレッドが同期ポイントに到達したときに設定すると共
に一定方向の他のスレッドの同期領域を参照して同期ポ
イントに到達していたときに両者を併せた同期設定を行
うことを並列に繰り返し、全スレッドが同期ポイントに
到達と判明したときに全スレッドが処理再開することに
より、全スレッドが参照、設定を並列に行って負荷分散
すると共にキャッシュミスを低減して並列高速処理を実
現することが可能となる。
Therefore, a synchronization area is provided for each thread, and is set when each thread reaches the synchronization point. At the same time, when both threads reach the synchronization point by referring to the synchronization areas of other threads in a certain direction. Repeatedly perform the synchronous setting together, and when all threads are found to have reached the synchronization point, all threads restart processing, and all threads perform reference and settings in parallel to distribute the load and cache misses. It is possible to realize parallel high-speed processing by reducing.

【0011】[0011]

【発明の実施の形態】次に、図1から図5を用いて本発
明の実施の形態および動作を順次詳細に説明する。
BEST MODE FOR CARRYING OUT THE INVENTION Next, embodiments and operations of the present invention will be sequentially described in detail with reference to FIGS.

【0012】図1は、本発明のシステム構成図を示す。
図1において、スレッド1,2は、並列に処理を実行す
るものであって、同期ポイントで同期化する対象のスレ
ッドである。スレッド1は、システム起動時に作成され
たものであり、当該スレッド1が並列化処理するために
スレッド2,3、・・・Nを作成し、処理を割り当てる
と共に、同期の必要なポイントに同期ポイントを設定す
る。各スレッドは処理を実行して設定された同期ポイン
トに到達すると、同期処理ルーチン12を呼び出し、本
願発明に係わる同期処理を実行する(図2から図5を用
いて後述する)。同期完了後に、各スレッドが処理を再
開する。
FIG. 1 shows a system configuration diagram of the present invention.
In FIG. 1, threads 1 and 2 execute processing in parallel and are threads to be synchronized at a synchronization point. The thread 1 is created when the system is started up. The thread 1 creates threads 2, 3, ... N for parallel processing, allocates the processing, and synchronizes to a point requiring synchronization. To set. When each thread executes the process and reaches the set synchronization point, it calls the synchronization process routine 12 to execute the synchronization process according to the present invention (which will be described later with reference to FIGS. 2 to 5). After the synchronization is completed, each thread resumes processing.

【0013】同期処理ルーチン12は、複数スレッドの
同期処理を行うルーチン(プログラム)であって、ここ
では、代入手段13、比較手段14、終了判定手段1
5、変更手段16などから構成されるものである。
The synchronization processing routine 12 is a routine (program) for performing synchronization processing of a plurality of threads, and here, the substitution means 13, the comparison means 14 and the end determination means 1 are used.
5 and changing means 16 and the like.

【0014】代入手段13は、同期領域でスレッドが同
期ポイントに到達している旨などを表すデータを他の位
置に代入するものである(図3から図5を用いて後述す
る)。
The substituting means 13 is for substituting data indicating that the thread has reached the synchronization point in the synchronization area to another position (described later with reference to FIGS. 3 to 5).

【0015】比較手段14は、同期領域で所定番目のデ
ータと他の所定番目のデータとを比較し、同期ポイント
に到達しているかなどを判別するものである(図3から
図5を用いて後述する)。
The comparison means 14 compares the predetermined data in the synchronization area with the other predetermined data to determine whether or not the synchronization point has been reached (see FIGS. 3 to 5). See below).

【0016】終了判定手段15は、全てのスレッドが同
期ポイントに到達しているか判別するものである(図3
から図5を用いて後述する)。変更手段16は、全ての
スレッドが同期ポイントに到達していると判明したとき
に、次に各スレッドに割り当てる同期領域を変更するも
のである(図3から図5を用いて後述する)。
The end determination means 15 determines whether all threads have reached the synchronization point (FIG. 3).
From FIG. 5). The changing unit 16 changes the synchronization area to be assigned to each thread next when it is determined that all the threads have reached the synchronization point (described later with reference to FIGS. 3 to 5).

【0017】次に、図2のフローチャートに従い、全体
の動作を説明する。図2は、本発明の全体フローチャー
トを示す。図2において、S1は、Fortran実行
開始する。これは、ソフトウェアの実行を開始し、当該
実行の中でマスタースレッドを生成する。
Next, the overall operation will be described with reference to the flowchart of FIG. FIG. 2 shows an overall flow chart of the present invention. In FIG. 2, S1 starts execution of Fortran. This starts the execution of the software and creates a master thread in the execution.

【0018】S2は、並列化(スレッドの生成)を行
う。これは、S1で生成されたマスタースレッドが並列
実行するためのスレッドを生成すると共に各種並列化の
ために必要な処理を行う。
In step S2, parallelization (thread generation) is performed. This generates a thread for the master thread generated in S1 to execute in parallel, and also performs processing necessary for various parallelization.

【0019】S3は、並列化ルート内部において、必要
な場合に同期処理を行う。これは、S2で生成された複
数のスレッドが並列に処理を行い、その並列処理の中で
同期が必要な同期ポイントで本発明に係わる、図3から
図5で後述する同期処理を行う。
In step S3, a synchronization process is performed within the parallelizing route when necessary. This is because a plurality of threads generated in S2 perform processing in parallel, and in the parallel processing, synchronization processing described later with reference to FIGS. 3 to 5 according to the present invention is performed at a synchronization point that requires synchronization.

【0020】S4は、並列化終了する。次に、図2のS
3の同期処理について図3のフローチャートの順番に従
い詳細に説明する。
In S4, parallelization is completed. Next, S in FIG.
The synchronization processing of No. 3 will be described in detail according to the order of the flowchart of FIG.

【0021】図3は、本発明の動作説明フローチャート
を示す。図3において、S11は、同期領域の獲得を行
う。これは、後述する図4、図5のスレッド毎の同期領
域21を獲得する。
FIG. 3 shows a flowchart for explaining the operation of the present invention. In FIG. 3, S11 acquires a synchronization area. This acquires the synchronization area 21 for each thread in FIGS. 4 and 5 described later.

【0022】S12は、並列化(スレッドの生成)を行
い、各スレッド用の同期領域を自スレッドの番号の領域
とする。これらは、並列実行するためのスレッドを、例
えば後述する図5の(a)の場合には、スレッド1,
2,3,4,5と5つ生成し、各スレッド1から5が同
期領域1から5をそれぞれ自己用の同期領域と初期設定
する。尚、2回目はS23でΣ2N先の同期領域を自己
用の同期領域に変更することを繰り返し、連続して同じ
同期領域とならないようにする。
In step S12, parallelization (thread generation) is performed, and the synchronization area for each thread is set as the area of the own thread number. These are threads for parallel execution, for example, in the case of FIG.
Five threads 2, 3, 4, 5 are generated, and each thread 1 to 5 initializes the synchronization areas 1 to 5 as its own synchronization area. It should be noted that the second time, in S23, the Σ2 N destination synchronization area is repeatedly changed to the own synchronization area so that the same synchronization area is not continuously obtained.

【0023】S13は、同期ポイントに到達か判別す
る。これは、既述した図1の各スレッドが実行を開始
し、同期ポイントに到達か判別する。YESの場合に
は、S14に進む。NOの場合には、S24で同期処理
が必要か判別し、YESのときにS13に戻り繰り返し
て待機し、NOのときに終了する。
In step S13, it is determined whether the synchronization point has been reached. This is to judge whether each thread in FIG. 1 described above starts execution and reaches the synchronization point. If YES, the process proceeds to S14. In the case of NO, it is determined in S24 whether or not the synchronization process is necessary, and if YES, the process returns to S13 to repeatedly wait, and if NO, ends.

【0024】S14は、自スレッド用の同期領域の1番
目の値を2番目に代入する。これは、例えば後述する図
5の(a)のスレッド1が、同期ポイントに到達したと
きに、自スレッド1用の同期領域1の1番目の値(○)
を2番目に代入し、図5の(b)の上段の同期領域1の
代入のようにし、当該スレッド1が同期ポイントに到
達した旨を設定する。
In S14, the first value of the synchronization area for the own thread is substituted into the second value. This is because, for example, when the thread 1 in FIG. 5A, which will be described later, reaches the synchronization point, the first value (◯) of the synchronization area 1 for its own thread 1
Is assigned to the second, and it is set like the substitution of the synchronization area 1 in the upper part of FIG. 5B, and the fact that the thread 1 has reached the synchronization point is set.

【0025】S15は、自スレッド用の同期領域の1番
目の値とΣ2n(n=0)先の同期領域の1番目の値が
等しいか判別する。例えば図5の(b)の比較に示す
ように比較する。
In step S15, it is determined whether or not the first value in the synchronization area for the own thread is equal to the first value in the synchronization area Σ2 n (n = 0) ahead. For example, the comparison is performed as shown in the comparison of FIG.

【0026】S16は、Σ2n (n=0)先の同期領域の2
番目の値を参照する。S17は、1番目の値と等しいか
判別する。これらS16、S17は、後述する図5の
(b)の比較に示すように、比較して等しいか判別す
る(Σ2n(n=0)先のスレッド、ここでは、スレッド2が
同期ポイントに到達しているか判別する)。YESの場
合には、S18に進む。NOの場合には、S17を繰り
返し待機する。
In S16, 2 of the synchronization area ahead of Σ2 n (n = 0)
Refer to the th value. In S17, it is determined whether it is equal to the first value. As shown in the comparison of FIG. 5B described later, these S16 and S17 are compared to determine whether they are equal (Σ2 n (n = 0) destination thread, here thread 2 reaches the synchronization point). Determine if you are doing). If YES, the process proceeds to S18. If NO, S17 is repeatedly waited.

【0027】S18は、全てのスレッドが同期ポイント
に到達したか判別する。YESの場合には、S22に進
む。NOの場合には、S19に進む。S19は、Σ2n
(n=0から始まり1づつインクリメントされる)先の同期
領域の1番目の値を3(=n+2)番目(次回ののと
きは4(=n+2)番目)に代入する(図5の(b)の
代入のように、代入する)。この代入により、図5で
は、スレッド1、2が併せて同期ポイントに到達した旨
を当該代入して設定することが可能となる。
In step S18, it is determined whether all threads have reached the synchronization point. If YES, the process proceeds to S22. If NO, the process proceeds to S19. S19 is Σ2 n
The first value of the previous synchronization area (starting from n = 0 and incremented by 1) is assigned to the 3 (= n + 2) th (4 (= n + 2) th at the next time) ((b in FIG. 5). ) Substitute, like). By this substitution, in FIG. 5, it is possible to set that the threads 1 and 2 have reached the synchronization point together.

【0028】S20は、Σ2n (n=1)(nはこのタイ
ミングでインクリメントされる)先の同期領域の3(=
n+1)番目(次回ののときは4(=n+1)番目)
の値を参照する。
In step S20, 3 (=) of the synchronization area ahead of Σ2 n (n = 1) (n is incremented at this timing).
n + 1) th (4 (= n + 1) th next time)
Refer to the value of.

【0029】S21は、1番目の値と等しいか判別す
る。これらS20、S21は、例えば後述する図5の
(c)のの比較(1番目と3番目を比較)し、等しいと
きには当該スレッド4と、1つ前のスレッド3とが併せ
て同期ポイントに到達していると判明する(他のスレッ
ドによる既述したS13からS19の処理で設定したと
判明する)。YESの場合には、S18に戻り、S18
でYESのときにS22に進み、S18でNOのときに
S19からS21を繰り返す(代入、比較のように
繰り返す)。一方、S21のNOの場合には、S21を
繰り返し待機する。
In step S21, it is determined whether it is equal to the first value. In S20 and S21, for example, the comparison (1st and 3rd) in (c) of FIG. 5 to be described later is performed, and when they are equal, the thread 4 and the thread 3 immediately before reach the synchronization point. It is determined that the setting is being performed (it is determined that the setting has been made in the processing of S13 to S19 described by another thread). If YES, the process returns to S18 and S18.
If YES in step S22, the process proceeds to step S22. If NO in step S18, steps S19 to S21 are repeated (substitution and comparison are repeated). On the other hand, if NO in S21, S21 is repeatedly waited.

【0030】S22は、S18のYESで全てのスレッ
ドが同期ポイントに到達したと判明したので、Σ2n
の同期領域の1番目の値を変更する。S23は、Σ2n
先の同期領域を自スレッド用の同期領域に設定する。こ
れらS22、S23は、S18のYESで全てのスレッ
ドが同期ポイントに到達したと判明したので、各スレッ
ドについて、それぞれΣ2n先の図5の同期領域の先頭
(左端)のビットを異なる他の値に変更すると共に当該
変更した同期領域(新たな同期領域)を自スレッドの同
期領域と設定する。これにより、デッドロックの発生を
防止できる。
In S22, since it is determined that all threads have reached the synchronization point in YES in S18, the first value in the synchronization area Σ2 n ahead is changed. S23 is Σ2 n
Set the previous synchronization area as the synchronization area for the own thread. In S22 and S23, since it is determined that YES in S18, all the threads have reached the synchronization point. Therefore, for each thread, other bits differing by Σ2 n from the beginning (left end) bit of the synchronization area in FIG. And the changed synchronization area (new synchronization area) is set as the synchronization area of the own thread. This can prevent the occurrence of deadlock.

【0031】以上のように、各スレッドに同期領域を設
けて1番目の値を初期値にセットし、各スレッドが同期
ポイントに到達したときに1番目の値を2番目に代入
(代入)して同期ポイントに到達した旨をセットする
と共に、同期領域の1番目とΣ2n先の同期領域の1番
目とを比較(比較)して等しいときに、Σ2n先のス
レッドの同期領域の1番目と2番目を比較(比較)し
て等しいときに1番目を3番目に代入(代入)して両
者のスレッドが併せて同期ポイントに到達している旨を
設定し、続いて、Σ2先のスレッドの1番目と3番目
を比較(比較)して等しい(当該スレッドと前のスレ
ッドとが併せて同期ポイントに到達していることが判
明)を繰り返し、全てのスレッドが同期ポイントに到達
しているか否かを全てのスレッドが並列にチェックして
負荷分散を図ることが可能となると共に、重複したチェ
ックを可及的に少なくし処理量を少なくして同期処理を
実行することが可能となる。
As described above, the synchronization area is provided in each thread, the first value is set to the initial value, and when each thread reaches the synchronization point, the first value is assigned to the second value. That the synchronization point has been reached, and when the first synchronization area and the synchronization area that is Σ2 n ahead are compared (compared), the first synchronization area of the thread that is Σ2 n ahead is equal. And the second is compared (compared), and when they are equal, the first is assigned to the third (substitution) to set that both threads have reached the synchronization point together, and then Σ2 n The first and third threads are compared (compared) and equalized (it is found that the thread and the previous thread have reached the synchronization point together), and all threads have reached the synchronization point. Whether or not all threads It becomes possible to check the column achieving load balancing, duplicate checked with less as possible less processing amount becomes possible to execute the synchronization process.

【0032】図4は、本発明の説明図を示す。これは、
既述した同期領域の例を模式的に示す。同期領域21
は、図示のように、log2(スレッド数)+1のビットを
持つ同期フラグを持つ領域であって、スレッド数分だけ
設ける。この際、キャッシュメモリで同時にアクセスで
きるサイズ(キャッシュライン)毎に設け、全てのスレ
ッド用の同期領域21がヒットするように設定する。こ
れにより、後述する図5のスレッド1,2,3,4,5
用の同期領域1,2,3,4,5がそれぞれキャッシュ
メモリ上に常駐してヒットし、同期領域21について、
代入、比較、比較、代入、比較、代入、
比較などの処理を高速処理することが可能となる。
FIG. 4 shows an explanatory diagram of the present invention. this is,
An example of the synchronization area described above is schematically shown. Synchronization area 21
Is a region having a synchronization flag having a bit of log2 (the number of threads) +1 as shown, and is provided for the number of threads. At this time, the cache memory is provided for each size (cache line) that can be accessed simultaneously, and is set so that the synchronization areas 21 for all threads are hit. As a result, threads 1, 2, 3, 4, 5 of FIG.
Synchronization areas 1, 2, 3, 4, and 5 respectively reside in the cache memory and hit, and the synchronization area 21
Assignment, comparison, comparison, assignment, comparison, assignment,
High speed processing such as comparison can be performed.

【0033】図5は、本発明の動作説明図を示す。図示
の構成は、スレッド1,2,3,4,5の5つのスレッ
ドが並列処理を行い、スレッド1,2,3,4,5用と
して同期領域1,2,3,4,5を初期状態(1回目)
に割り当てた状態(2回目は例えばスレッド1、2,
3,4,5に、同期領域3,4,5,1,2を割り当て
るというように変更(既述した図3のS22、S2
3))する。また、図中のからは、既述した図3の
からにそれぞれ対応する。
FIG. 5 shows an operation explanatory diagram of the present invention. In the illustrated configuration, five threads 1, 2, 3, 4, 5 perform parallel processing, and the synchronization areas 1, 2, 3, 4, 5 are initialized for the threads 1, 2, 3, 4, 5. State (first time)
State (the second time, for example, threads 1, 2,
The synchronization areas 3, 4, 5, 1 and 2 are assigned to 3, 4, and 5 (S22 and S2 in FIG.
3)) Do. Further, from in the figure correspond to those in FIG.

【0034】図5の(a)は、初期状態を示す。この状
態では、スレッド1,2,3,4,5には、同期領域
1,2,3,4,5をそれぞれ割り当て、先頭のビット
(フラグ)に○(例えば”1”)を図示のようにそれぞ
れ設定する。
FIG. 5A shows the initial state. In this state, the synchronization areas 1, 2, 3, 4, 5 are assigned to the threads 1, 2, 3, 4, 5 respectively, and the leading bit (flag) is indicated by ◯ (for example, “1”). Set to each.

【0035】図5の(a)において、代入は、既述し
た図3のS13のYESでスレッドが同期ポイントに到
達したときに、S14で1番目の値を2番目に代入する
様子を示す。これにより、各スレッドが同期ポイントに
到達したときに、同期領域の1番目の値を2番目に代入
してその旨が設定されることとなる。
In FIG. 5 (a), the substitution indicates a state in which the first value is substituted into the second value in S14 when the thread reaches the synchronization point with YES in S13 of FIG. As a result, when each thread reaches the synchronization point, the first value in the synchronization area is substituted into the second value and that effect is set.

【0036】図5の(b)は、比較、比較、代入
の様子を示す。図5の(b)において、比較は、既述
した図3のS15で同期領域の1番目とΣ2(n=
0)先のスレッド、例えばスレッド1がスレッド1用の
同期領域1の1番目の値と、スレッド2用の同期領域2
の1番目の値とを比較する。等しいときに、比較に進
む。
FIG. 5B shows the states of comparison, comparison, and substitution. In FIG. 5B, the comparison is performed by comparing the first synchronization area and Σ2 n (n = n ) in S15 of FIG.
0) The previous thread, for example, thread 1 has the first value of the synchronization area 1 for thread 1 and the synchronization area 2 for thread 2
Compare with the first value of. When they are equal, proceed to comparison.

【0037】比較は、既述した図3のS16、S17
でΣ2(n=0)先の例えばスレッド2用の同期領域
2の1番目の値と、2番目の値を比較する。等しいとき
(スレッド2が同期ポイントに到達していると判明)
に、既述した図3のS18に進み、全てのスレッドが同
期ポイントに到達していたとき(n=log2(スレッ
ド数)(小数点以下繰り上げ)となった場合)は終了
し、到達していないときは次の代入に進む。
The comparison is made with S16 and S17 shown in FIG.
Then, the first value and the second value of the synchronization area 2 for the thread 2, which is Σ2 n (n = 0) ahead, are compared. When equal (thread 2 is found to have reached the sync point)
Then, the process proceeds to S18 of FIG. 3 described above, and when all the threads have reached the synchronization point (when n = log2 (the number of threads) (rounded up to the decimal point)), the process ends and has not arrived. When, proceed to the next substitution.

【0038】代入は、既述した図3のS19でΣ2
(n=0)先の例えばスレッド2用の同期領域2の1番
目の値を、3番目に代入し、この例では、スレッド1,
2の両者が併せて同期ポイントに到達している旨を設定
する。
The substitution is Σ2 n in S19 of FIG. 3 described above.
(N = 0) For example, the first value of the synchronization area 2 for the thread 2 is substituted into the third value.
It is set that both 2 have reached the synchronization point together.

【0039】図5の(c)は、比較の様子を示す。図
5の(c)において、比較は、既述した図3の2回目
のS20でΣ2(n=1)先の例えばスレッド4用の
同期領域4の3番目の値と、1番目の値を比較する。等
しいとき(スレッド4と直前のスレッド3が同期ポイン
トに到達していると判明)に、既述した図3のS18に
進み、全てのスレッドが同期ポイントに到達していたと
き(n=log2(スレッド数)(小数点以下繰り上
げ)となった場合)は終了し、到達していないときは次
の代入に進む。
FIG. 5C shows the state of comparison. In (c) of FIG. 5, the comparison is performed with the third value and the first value of the synchronization area 4 for, for example, the thread 4 that is Σ2 n (n = 1) ahead in the second S20 of FIG. To compare. When equal (when it is found that the thread 4 and the immediately preceding thread 3 have reached the synchronization point), the process proceeds to S18 of FIG. 3 described above, and when all the threads have reached the synchronization point (n = log2 ( The number of threads) (when the number is rounded up to the right of the decimal point) is terminated, and if not reached, the process proceeds to the next assignment.

【0040】代入は、代入と同様に、既述した図3
のS19でΣ2(n=1)先の例えばスレッド4用の
同期領域4の1番目の値を、4番目に代入する。図5の
(d)は、比較の様子を示す。
The substitution is similar to the substitution shown in FIG.
In S19, the first value of the synchronization area 4 for Σ2 n (n = 1) ahead, for example, the thread 4 is substituted into the fourth value. FIG. 5D shows the state of comparison.

【0041】図5の(d)において、比較は、既述し
た図3の2回目のS20でΣ2(n=2)先の例えば
スレッド3用の同期領域3の4番目の値と、1番目の値
を比較する。等しいときに、既述した図3のS18に進
み、全てのスレッドが同期ポイントに到達していたとき
(n=log2(スレッド数)(小数点以下繰り上げ)
となった場合)は終了する。
In (d) of FIG. 5, the comparison is performed with the fourth value of the synchronization area 3 for the thread 3, which is Σ2 n (n = 2) ahead in the second S20 of FIG. Compare the th value. When they are equal, the process proceeds to S18 of FIG. 3 described above, and when all threads have reached the synchronization point (n = log2 (number of threads) (rounded up to the right of the decimal point)
If it becomes), the process ends.

【0042】(付記1)複数スレッドの並列処理を管理
する同期プログラムにおいて、複数スレッドに対応づけ
てそれぞれの同期領域を設ける手段と、各スレッドが同
期ポイントに到達したときに、自己用の上記同期領域に
同期ポイントに到達した旨をセットした後、一定方向の
所定位置の他のスレッドの同期領域を参照して同期ポイ
ントに到達していると判明したときに両者のスレッドが
併せて同期ポイントに到達した旨を当該同期領域にセッ
トし、全てのスレッドが同期ポイントに到達していたと
きに同期完了と判断して処理を再開し、全てのスレッド
が同期ポイントに到達していないときに、更に、一定方
向の所定位置の他のスレッドの同期領域について繰り返
す手段として機能させるための同期プログラム。
(Supplementary Note 1) In a synchronization program for managing parallel processing of a plurality of threads, means for providing respective synchronization areas in association with the plurality of threads, and the above-mentioned synchronization for its own use when each thread reaches a synchronization point. After setting that the synchronization point has been reached in the area, when it is found that the synchronization point has been reached by referring to the synchronization area of another thread at a predetermined position in a certain direction, both threads collectively set the synchronization point. The fact that it has arrived is set in the relevant synchronization area, when all threads have reached the synchronization point, it is judged that synchronization has been completed and processing is restarted, and when all threads have not reached the synchronization point, further , A synchronization program that functions as a means for repeating the synchronization area of another thread at a predetermined position in a certain direction.

【0043】(付記2)各同期領域をキャッシュメモリ
の異なるキャッシュラインにそれぞれ割り当てたことを
特徴とする付記1記載の同期プログラム。
(Supplementary Note 2) The synchronization program according to Supplementary Note 1, wherein each synchronization area is assigned to a different cache line of the cache memory.

【0044】(付記3)上記一定方向の所定位置とし
て、2N (N=0,1,2・・・)としたことを特徴と
する付記1あるいは付記2記載の同期プログラム。
(Supplementary note 3) The synchronization program according to Supplementary note 1 or Supplementary note 2, wherein 2 N (N = 0, 1, 2, ...) Is set as the predetermined position in the fixed direction.

【0045】(付記4)複数スレッドの並列処理を管理
する同期方法において、複数スレッドに対応づけてそれ
ぞれの同期領域を設けるステップと、各スレッドが同期
ポイントに到達したときに、自己用の上記同期領域に同
期ポイントに到達した旨をセットした後、一定方向の所
定位置の他のスレッドの同期領域を参照して同期ポイン
トに到達していると判明したときに両者のスレッドが併
せて同期ポイントに到達した旨を当該同期領域にセット
し、全てのスレッドが同期ポイントに到達していたとき
に同期完了と判断して処理を再開し、全てのスレッドが
同期ポイントに到達していないときに、更に、一定方向
の所定位置の他のスレッドの同期領域について繰り返す
ステップとを有する同期方法。
(Supplementary Note 4) In a synchronization method for managing parallel processing of a plurality of threads, a step of providing respective synchronization areas in association with a plurality of threads, and the above-mentioned synchronization for its own use when each thread reaches a synchronization point After setting that the synchronization point has been reached in the area, when it is found that the synchronization point has been reached by referring to the synchronization area of another thread at a predetermined position in a certain direction, both threads collectively set the synchronization point. The fact that it has arrived is set in the relevant synchronization area, when all threads have reached the synchronization point, it is judged that synchronization has been completed and processing is restarted, and when all threads have not reached the synchronization point, further , Repeating with respect to a synchronization area of another thread at a predetermined position in a certain direction.

【0046】[0046]

【発明の効果】以上説明したように、本発明によれば、
スレッド毎に同期領域を設けて各スレッドが同期ポイン
トに到達したときに設定すると共に一定方向の他のスレ
ッドの同期領域を参照して同期ポイントに到達していた
ときに両者を併せた同期設定を行うことを並列に繰り返
し、全スレッドが同期ポイントに到達と判明したときに
全スレッドが処理再開する構成を採用しているため、全
スレッドが参照、設定を並列に行って負荷分散すると共
にキャッシュミスを低減して並列高速処理を実現するこ
とが可能となる。
As described above, according to the present invention,
Set a synchronization area for each thread and set it when each thread reaches the synchronization point, and also refer to the synchronization area of another thread in a certain direction and set the synchronization settings for both when it reaches the synchronization point. By repeating the process in parallel, all threads resume processing when it is determined that all threads have reached the synchronization point, so all threads perform parallel reference and settings to distribute the load and cache misses. It is possible to realize parallel high-speed processing by reducing.

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

【図1】本発明のシステム構成図である。FIG. 1 is a system configuration diagram of the present invention.

【図2】本発明の全体フローチャートである。FIG. 2 is an overall flowchart of the present invention.

【図3】本発明の動作説明フローチャートである。FIG. 3 is a flowchart for explaining the operation of the present invention.

【図4】本発明の説明図である。FIG. 4 is an explanatory diagram of the present invention.

【図5】本発明の動作説明図である。FIG. 5 is an operation explanatory diagram of the present invention.

【図6】従来技術の説明図である。FIG. 6 is an explanatory diagram of a conventional technique.

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

1、2:スレッド 12:同期処理ルーチン 13:代入手段 14:比較手段 15:終了判定手段 16:変更手段 21:同期領域 1, 2: Thread 12: Synchronous processing routine 13: Substitution means 14: Comparison means 15: End determination means 16: Change means 21: Sync area

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】複数スレッドの並列処理を管理する同期プ
ログラムにおいて、 複数スレッドに対応づけてそれぞれの同期領域を設ける
手段と、 各スレッドが同期ポイントに到達したときに、自己用の
上記同期領域に同期ポイントに到達した旨をセットした
後、一定方向の所定位置の他のスレッドの同期領域を参
照して同期ポイントに到達していると判明したときに両
者のスレッドが併せて同期ポイントに到達した旨を当該
同期領域にセットし、全てのスレッドが同期ポイントに
到達していたときに同期完了と判断して処理を再開し、
全てのスレッドが同期ポイントに到達していないとき
に、更に、一定方向の所定位置の他のスレッドの同期領
域について繰り返す手段として機能させるための同期プ
ログラム。
1. A synchronization program for managing parallel processing of a plurality of threads, a means for providing each synchronization area in association with a plurality of threads, and a synchronization area for its own use when each thread reaches a synchronization point. After setting that the synchronization point was reached, when both threads reached the synchronization point when it was found that the synchronization point was reached by referring to the synchronization area of another thread at a predetermined position in a certain direction To that effect in the synchronization area, when all threads have reached the synchronization point, it is determined that synchronization is complete and processing is restarted.
A synchronization program for functioning as a means for repeating the synchronization area of another thread at a predetermined position in a certain direction when all threads have not reached the synchronization point.
【請求項2】上記一定方向の所定位置として、2N (N
=0,1,2・・・)としたことを特徴とする請求項1
あるいは請求項2記載の同期プログラム。
2. The predetermined position in the fixed direction is 2 N (N
= 0, 1, 2 ...).
Alternatively, the synchronization program according to claim 2.
【請求項3】複数スレッドの並列処理を管理する同期方
法において、 複数スレッドに対応づけてそれぞれの同期領域を設ける
ステップと、 各スレッドが同期ポイントに到達したときに、自己用の
上記同期領域に同期ポイントに到達した旨をセットした
後、一定方向の所定位置の他のスレッドの同期領域を参
照して同期ポイントに到達していると判明したときに両
者のスレッドが併せて同期ポイントに到達した旨を当該
同期領域にセットし、全てのスレッドが同期ポイントに
到達していたときに同期完了と判断して処理を再開し、
全てのスレッドが同期ポイントに到達していないとき
に、更に、一定方向の所定位置の他のスレッドの同期領
域について繰り返すステップとを有する同期方法。
3. A synchronization method for managing parallel processing of a plurality of threads, wherein each synchronization area is provided in association with a plurality of threads, and when each thread reaches a synchronization point, the synchronization area for its own use is created. After setting that the synchronization point was reached, when both threads reached the synchronization point when it was found that the synchronization point was reached by referring to the synchronization area of another thread at a predetermined position in a certain direction To that effect in the synchronization area, when all threads have reached the synchronization point, it is determined that synchronization is complete and processing is restarted.
When all threads have not reached the synchronization point, further repeating for the synchronization area of another thread at a predetermined position in a certain direction.
JP2001304027A 2001-09-28 2001-09-28 Synchronous program and method therefor Withdrawn JP2003108392A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001304027A JP2003108392A (en) 2001-09-28 2001-09-28 Synchronous program and method therefor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2001304027A JP2003108392A (en) 2001-09-28 2001-09-28 Synchronous program and method therefor

Publications (1)

Publication Number Publication Date
JP2003108392A true JP2003108392A (en) 2003-04-11

Family

ID=19124015

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001304027A Withdrawn JP2003108392A (en) 2001-09-28 2001-09-28 Synchronous program and method therefor

Country Status (1)

Country Link
JP (1) JP2003108392A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011134145A (en) * 2009-12-25 2011-07-07 Fujitsu Ltd Multithread processing method and multithread processor
WO2012086041A1 (en) * 2010-12-22 2012-06-28 富士通株式会社 Synchronous processing method
US9626230B2 (en) 2013-09-11 2017-04-18 Fujitsu Limited Processor and control method of processor
US11829806B2 (en) 2019-04-23 2023-11-28 Fujitsu Limited High-speed barrier synchronization processing that includes a plurality of different processing stages to be processed stepwise with a plurality of registers

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011134145A (en) * 2009-12-25 2011-07-07 Fujitsu Ltd Multithread processing method and multithread processor
WO2012086041A1 (en) * 2010-12-22 2012-06-28 富士通株式会社 Synchronous processing method
JP5672311B2 (en) * 2010-12-22 2015-02-18 富士通株式会社 Synchronous processing method
US9690633B2 (en) 2010-12-22 2017-06-27 Fujitsu Limited Synchronization method
US9626230B2 (en) 2013-09-11 2017-04-18 Fujitsu Limited Processor and control method of processor
US11829806B2 (en) 2019-04-23 2023-11-28 Fujitsu Limited High-speed barrier synchronization processing that includes a plurality of different processing stages to be processed stepwise with a plurality of registers

Similar Documents

Publication Publication Date Title
JP4276028B2 (en) Multiprocessor system synchronization method
KR100834432B1 (en) Method and apparatus for managing resource contention in a multisystem cluster
US20190044883A1 (en) NETWORK COMMUNICATION PRIORITIZATION BASED on AWARENESS of CRITICAL PATH of a JOB
US7111289B2 (en) Method for implementing dual link list structure to enable fast link-list pointer updates
CN1258716C (en) Double ring method for monitoring partial cache consistency of on-chip multiprocessors
JP2003108392A (en) Synchronous program and method therefor
CN111404818A (en) Routing protocol optimization method for general multi-core network processor
JPH05233331A (en) Task state constructing method
WO2022183572A1 (en) Command submitting method and apparatus, command reading method and apparatus, and electronic device
WO2011121709A1 (en) Semiconductor device
WO2023193783A1 (en) Blockchain consensus method and blockchain copy device
CN116663639A (en) Gradient data synchronization method, system, device and medium
JP2006146758A (en) Computer system
US20220300322A1 (en) Cascading of Graph Streaming Processors
JP2000137620A (en) Method and system for changing program of transaction processing system and storage medium
US7007134B2 (en) Microcomputer, method of controlling cache memory, and method of controlling clock
JP6079518B2 (en) Arithmetic processing device and control method of arithmetic processing device
JPH02144657A (en) Parallel arithmetic processor
JPH0877039A (en) Test method
Peng et al. Fast wait-free construction for pool-like objects with weakened internal order: Stacks as an example
CN116501801B (en) High-performance transaction asynchronous concurrent processing method for license-oriented blockchain
JP3763452B2 (en) Information processing system, object priority management method, operating system, and recording medium
JPWO2011001519A1 (en) Computer apparatus and parallel computer system
JPH09319643A (en) Data base procedure sharing means
JPH10507548A (en) Data processing systems and methods and communication systems with such systems

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20081202