JPH01189723A - Merging sorter - Google Patents

Merging sorter

Info

Publication number
JPH01189723A
JPH01189723A JP1270888A JP1270888A JPH01189723A JP H01189723 A JPH01189723 A JP H01189723A JP 1270888 A JP1270888 A JP 1270888A JP 1270888 A JP1270888 A JP 1270888A JP H01189723 A JPH01189723 A JP H01189723A
Authority
JP
Japan
Prior art keywords
string
strings
input
cell
mode
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
Application number
JP1270888A
Other languages
Japanese (ja)
Other versions
JPH0437455B2 (en
Inventor
Kazuhide Iwata
岩田 和秀
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.)
National Institute of Advanced Industrial Science and Technology AIST
Original Assignee
Agency of Industrial Science and Technology
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 Agency of Industrial Science and Technology filed Critical Agency of Industrial Science and Technology
Priority to JP1270888A priority Critical patent/JPH01189723A/en
Publication of JPH01189723A publication Critical patent/JPH01189723A/en
Publication of JPH0437455B2 publication Critical patent/JPH0437455B2/ja
Granted legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

PURPOSE:To shorten a sort processing time by eliminating a delay time by processing a string by a pass mode when the number of strings processed by a cell is odd, and processing the strings other than that by a sort mode. CONSTITUTION:An operation mode is used properly at an operation mode control circuit 19 as follows by finding the number of strings to be processed actually from the number of records of a stream and string length possible to be processed by the cell supplied as control information. The circuit 19 controls a switch 20 so as to process only a firstly inputted string by the pass mode and process the remaining strings by the sort mode when the value of the number of obtained strings is odd, and process the string only by the pass mode when the value is even. Thus, by introducing a pass mode function without storing a first string in a memory when the number of strings to be processed by the cell is odd, the delay time can be eliminated, and the sort processing time can be shortened.

Description

【発明の詳細な説明】 [発明の目的] (産業上の利用分野) この発明はデータベース処理に代表される非数値処理分
野における基本演算の1つであるソート処理を高速に効
率良く実行し得るようにしたマージ・ソータに関する。
[Detailed Description of the Invention] [Objective of the Invention] (Industrial Application Field) The present invention is capable of quickly and efficiently performing sort processing, which is one of the basic operations in the field of non-numerical processing represented by database processing. Regarding the merge sorter.

(従来の技術) データを特定の順序に並び換えるソート処理は非数値処
理分野における基本演算の1つであり、古くから数多く
のソフトウェアのアルゴリズム(単純選択法、単純交換
法、ヒープソート法、分割ソート法、クイックソート法
、マージソート法等)か提案されて、目的に応じた使い
分けが行われてきた。
(Prior art) Sorting processing, which arranges data in a specific order, is one of the basic operations in the field of non-numeric processing, and has been used in many software algorithms (simple selection method, simple exchange method, heap sort method, partition sort method) for a long time. method, quick sort method, merge sort method, etc.) have been proposed and used depending on the purpose.

1970年代に入ると、ホスト計算機のソート処理ルー
チンを付加プロセッサのファームウェアn個のレコード
をn個のセルを用いてソートするパイトニック・ソータ
や並列計数ソータ、log n個のセルを用いてn個数
のレコードをソートするパイプライン方式のソータ等が
ある。これらを現状の技術を用いて実現するという観点
からみると、ハードウェアの小型化が可能という利点か
ら、log n個のセルを用いてn個のレコードをソー
トするパイプライン方式のソータが実用的であるとされ
ている。
In the 1970s, host computer sort processing routines were added to processor firmware, such as pitonic sorters and parallel counting sorters that sort n records using n cells, and log sorting routines that sort n records using n cells. There are pipeline type sorters that sort records. From the perspective of realizing these using current technology, a pipeline type sorter that sorts n records using log n cells is practical because it allows for miniaturization of hardware. It is said that

パイプライン方式のソータで実用化されたちの1つに2
ウエイ・マージ・ソータかある。このソータは、2つの
ソートされたレコード列(以下、ストリングと呼ぶ)を
突き合せて1つのソートされたストリングを生成するマ
ージ操作を、1次元に多数個配置したセルにより連続的
に行うものである。第5図に3段の2ウエイ・マージ・
ソータを用いて昇順に並んだ5個のレコード(1,2゜
・・・の順に入力されるとする)を降順に並び換える時
のこのソータの動作原理を示し、第6図にそのパイプラ
イン動作動作の様子を示す。ソータの各一’−:15<
 U Mに、偶数番目の入力ストリングがLMに交互に
格納される。ソータは、入力レコード列(以下、ストリ
ームと呼ぶ)を長さ1のストリングが−”並んたものと
見なして、これを入力順に2個ずつマージし、各段でス
トリング長(ストリングのレコード数)を倍々にしてい
く。即ち、第5図に示されているように、セル21に入
力されるストリング長は1であるから、セル21は、長
さ1のストリング1,2,3,4.5を入力順にUMと
LMに交互に格納しつつUMとLMのレコードのマージ
操作を行い、長さが2のストリング[2,j]c4.、
 3] [5,−]を生成し、セル22に出力する動作
を行う。セル2 は、セル21より送られてくる長さ2
のストリングを入力順にUMとLMに交互に格納しつつ
UMと’LMのレコードのマージ操作を行い、長さ4の
ストリング[4,3゜2.11  [5,−、−+−1
を生成し、セル23に出力する動作を行う。このように
セル2i  (i−1,2,・)はセル21−1より送
られてくる長さ2 j−1のストリングを入力順にメモ
リー1のUMとLMに交互に格納しつつUMとLMのレ
コードのマージ操作を行い、長さ21のストリングを生
成し、セル2 i+1に出力する。この時、各段は偶数
番口のストリングの先頭データが入力される毎′贋に処
理を開始し、第6図に示すようなパイプライン動作を行
う。第6図より本ソータの処理時間T(1)を求めると
、 T (1) = t i + d L +d 2 + 
t O・・・(1)となる。ここで、tlとtoはそれ
ぞれ5個のレコードからなるストリームを入力する時間
と出力する時間d1はストリームのレコード数が2の累
ノ 乗値からずれたために生じた遅れ時間を、d2はストリ
ームがセルを通過するための遅れ時間を示す。ストリー
ムのレコード数をC1セル数をN。
One of the pipeline type sorters that has been put into practical use is 2.
There is a way merge sorter. This sorter continuously performs a merge operation that matches two sorted record strings (hereinafter referred to as strings) to generate one sorted string using a large number of cells arranged in one dimension. be. Figure 5 shows the three-stage 2-way merge.
The operating principle of this sorter is shown when five records arranged in ascending order (assuming that they are input in the order of 1, 2°, etc.) are sorted in descending order using a sorter, and the pipeline is shown in Figure 6. Shows how it works. Sorter each one'-:15<
In UM, even-numbered input strings are stored alternately in LM. The sorter considers the input record string (hereinafter referred to as a stream) to be a string of length 1 lined up, merges two strings in input order, and calculates the string length (number of records in the string) at each stage. That is, as shown in FIG. 5, since the string length input to cell 21 is 1, cell 21 contains strings 1, 2, 3, 4, . . . of length 1. 5 is stored alternately in UM and LM in the input order, and the records of UM and LM are merged to create a string [2,j]c4. with a length of 2.
3] Generates [5, -] and outputs it to the cell 22. Cell 2 is the length 2 sent from cell 21.
While storing strings alternately in UM and LM in the input order, merging the records of UM and 'LM is performed, and a string of length 4 [4,3°2.11 [5, -, -+-1]
is generated and output to the cell 23. In this way, cell 2i (i-1, 2, .) stores the string of length 2j-1 sent from cell 21-1 alternately in UM and LM of memory 1 in the order of input. performs a merge operation on the records of , generates a string of length 21, and outputs it to cell 2 i+1. At this time, each stage starts processing every time the first data of an even numbered string is input, and performs a pipeline operation as shown in FIG. Determining the processing time T(1) of this sorter from FIG. 6, we get T (1) = t i + d L + d 2 +
t O...(1). Here, tl and to are the input time and output time of a stream consisting of 5 records, respectively. d1 is the delay time caused by the number of records in the stream deviating from the power of 2, and d2 is the time when the stream is Indicates the delay time for passing through a cell. The number of records in the stream is C1, and the number of cells is N.

1ステツプの処理時間をTとすると(1)式は次のよう
に表わされる。
When the processing time for one step is T, equation (1) is expressed as follows.

T(1)=CT+ (2a−C)T+ (N−1)T+
CT           ・・・(2)ただし、a 
=<10g2C> (< >□は小数点以下を切り上げ
た整数値) 、ti =tO=C’r、   di=(
2a−C)T、d2=(N−1)Tである。
T(1)=CT+ (2a-C)T+ (N-1)T+
CT...(2) However, a
=<10g2C>(<>□ is an integer value rounded up to the nearest whole number), ti =tO=C'r, di=(
2a-C)T, d2=(N-1)T.

上述の例の場合、C=5、N=3であるからa=3とな
り、T(1)は15Tとなる。
In the case of the above example, since C=5 and N=3, a=3 and T(1) becomes 15T.

−、、=、、 (L )式において、ti、to、d2
はバードウ”::”lニアの仕様により定まる値である
が、dlはストリーj−ムのレコード数により決まる値
であるため1、制御方式を工夫することにより除去する
ことが可−6= 能である。
−,,=,, (L) In formula, ti, to, d2
is a value determined by the specifications of the nearer, but dl is a value determined by the number of records in the stream, so it can be removed by devising a control method. It is.

、:そこで、従来より、」二記d1を取り除く方式とし
て、疑似レコード追加方式マージ・ソータ(Todd、
S、:Algorithm and Hardware
 for a MergeSort Using Mu
ltiple Processors、lBM J、R
ES。
, : Conventionally, as a method to remove ``d1'', a pseudo record addition method merge sorter (Todd,
S: Algorithm and Hardware
for a MergeSort Using Mu
ltiple Processors, lBM J,R
E.S.

DEVELOP、、Vol、22.No、5.PP、5
09−517(1978))やダイナミック・マージ方
式マージ・ソータ(林、他;パイプラインマージンート
アルゴリズムの改良によるソート時間の短縮 情報処理
学会第29口金国大会PP−763−764(1984
))が提案されている。
DEVELOP, Vol. 22. No, 5. PP, 5
09-517 (1978)) and the dynamic merge type merge sorter (Hayashi, et al.; Reducing sorting time by improving the pipeline margin algorithm. Information Processing Society of Japan 29th National Conference PP-763-764 (1984)
)) is proposed.

疑似レコード追加方式マージ・ソータは、第7図に示す
ように、ストリームのレコード数が2の累乗値になるよ
うに、入力ストリームの先頭に疑似レコード(十)を追
加して仮想的な動作を考え、第8図に示すステップ4よ
り実際にソータを動作させることにより遅れ時間(dl
)を除去しようとするものである。しかし、ソータをス
テップ4より動作させるためには、ステップ1,2.3
の処理が終了したものとしてセル21〜23に制御パラ
メータの初期値をセットする必要があるので、−なる欠
点を有している。
As shown in Figure 7, the pseudo record addition method merge sorter performs virtual operations by adding pseudo records (10) to the beginning of the input stream so that the number of records in the stream becomes a power of 2. The delay time (dl
). However, in order to make the sorter operate beyond step 4, steps 1, 2.3
Since it is necessary to set the initial values of the control parameters in the cells 21 to 23 as if the processing has been completed, this method has a negative drawback.

′1 )一方、ダイナミック・マージ方式マージ・ソー〉は第
9図に示すように、ストリング数が奇数となるセルで最
後のストリングが入力されてきた時に、その時のマージ
動作を中断して最後にストリングが先にマージされるよ
うにストリームのダイナミックな切換を行うことにより
、遅れ時間(dl)を除去するものである。この方式の
処理例を第10図に示す。第10図ではステップ5と6
でダイナミック・マージ動作が行なわれている。
'1) On the other hand, as shown in Figure 9, in the dynamic merging method Merge Saw, when the last string is input in a cell with an odd number of strings, the current merge operation is interrupted and the last string is input. Delay time (dl) is eliminated by dynamically switching streams so that strings are merged first. An example of processing using this method is shown in FIG. In Figure 10, steps 5 and 6
A dynamic merge operation is being performed.

即ち、ステップ5において、セル41は[5コが最後の
ストリングで奇数番目であることを検出し、ストリング
[3]と[4]をマージしてストリング[4,,3]を
出力する動作を、[4]を出力した時点でストリング[
3]と[5]をマージする動作に切換える。また、セル
42は、ステップ6において、ストリング[2,1] 
と[4]をマージしてストリング[4,2,1]を出力
する動作を、4を出力した時点でストリング[2,1]
 と[5,3]をマージする動作に切換える。この方各
セルは処理ストリングのダイナミックな変更と糧々の長
さのストリングを扱う必要があるので制iが複雑になる
欠点を有している。
That is, in step 5, the cell 41 detects that [5] is an odd number in the last string, merges strings [3] and [4], and outputs the string [4,,3]. , [4], the string [
Switch to the operation of merging [3] and [5]. The cell 42 also contains the string [2,1] in step 6.
and [4] to output the string [4, 2, 1], and when 4 is output, the string [2, 1]
and [5,3] are merged. This method has the disadvantage that the control i is complicated because each cell must dynamically change the processing string and handle strings of reasonable length.

(発明が解決しようとする問題点) 上述の如く、従来のパイプラ・fン方式マージ・ソート
は入力ストリングのレコード数が2の累乗でない場合、
遅れ時間(dl)が生ずる欠点を有していた。この原因
は、2ウエイ・マージ・ソータの場合、各セルが2つの
ストリングをマージして1つのストリングを出力する動
作を繰返すため、セルで扱うストリング数が偶数であれ
ば良いが奇数の場合にはマージする相手のストリングが
無くなる場合かあるためである。この対策として、スト
リームのレコード数が2の累乗になるように疑似レコー
ドを追加する方法やダイナミック・マージを行う方法が
提案されていた。しかし、これらの方法はアルゴリズム
としては正しいものの、実現性に欠ける欠点を有してい
た。
(Problems to be Solved by the Invention) As mentioned above, in the conventional piper type merge sort, when the number of records in the input string is not a power of 2,
This method has the disadvantage that a delay time (dl) occurs. The reason for this is that in the case of a 2-way merge sorter, each cell repeats the operation of merging two strings and outputting one string. This is because the string to be merged may be lost. As a countermeasure to this problem, a method of adding pseudo records so that the number of records in a stream becomes a power of two, and a method of performing dynamic merging have been proposed. However, although these methods are correct as algorithms, they have the drawback of lacking in practicality.

本発明の目的は、複雑な制御を用いることなく、上記入
力ストリングのレコード数の2の累乗(問題点を解決す
るための手段) ゛ 本発明に係るマージ・ソータは、各段のセル選択す
る機能とを持たせ、これらの機能を組合わせることによ
り、各セルでマージ操作を行なうストリング数が常に偶
数になるようにしたものである。
The purpose of the present invention is to increase the number of records in the input string to a power of 2 (means for solving the problem) without using complicated control. ゛ The merge sorter according to the present invention selects cells in each stage. By combining these functions, the number of strings to be merged in each cell is always an even number.

ソート・モードは、前段から連続的に入力される2つの
人力ストリングをメモリに格納しつつ、後の上記入力ス
トリングの先頭のレコードか入力−1〇   − される毎に、前記両ストリングを構成するレコードの大
小関係を比較しその比較結果から決定される順序に並び
変えつつ前記両ストリングをマージして新たな1つのス
トリングとして次段に出力するモードである。
In the sorting mode, two manually input strings input successively from the previous stage are stored in memory, and each time the first record of the input string is input -10-, both strings are constructed. In this mode, the records are compared in size, rearranged in an order determined from the comparison results, and the two strings are merged and output as a new string to the next stage.

パス・モードは、前記入力ストリングを前記メモリを介
さずにそのまま次段に転送するモードである。
The pass mode is a mode in which the input string is directly transferred to the next stage without passing through the memory.

各セルは、当該セルで処理するストリング数が1 (作
 用) 1 本発明によれば、入力ストリング数が奇数の場合に
は、最初のストリングを直ちに次段に転送するので、通
常のマージ操作を行なう場合に比べて処理ステップ数を
削減する作用を呈する。また、各セルでは、マージ操作
を行なうストリング数が常に偶数となるため無駄のない
処理が行われ、入カレコード数の2の累乗値からのすれ
に起因する遅れ時間(dl)を除去することができる。
Each cell has 1 string to process. (Function) 1 According to the present invention, when the number of input strings is odd, the first string is immediately transferred to the next stage, so that the number of strings processed by the cell is 1. This has the effect of reducing the number of processing steps compared to the case where . In addition, since the number of strings to be merged is always an even number in each cell, efficient processing is performed, and the delay time (dl) due to deviation from the power of 2 of the number of input records is eliminated. Can be done.

(実施例) 本発明の一実施例に係るマージ・ソータの動作原理図を
第1図に、そのパイプライン処理動作の様子を第2図に
示す。
(Embodiment) FIG. 1 shows the principle of operation of a merge sorter according to an embodiment of the present invention, and FIG. 2 shows its pipeline processing operation.

このマージ・ソータは、3つの処理ユニット5.5.5
3を縦続接続して構成され、各処理ユニット5i(i=
1〜3)は、メモリ11とセル61とで構成されたもの
となっている。各セル61は、ソート・モードとパス・
モードとを持ち、自身が処理するストリング数が奇数の
時に最初のストリングだけをパス・モードで処理し残り
へ 1−・倉遅れ時間(dl)が生じない。以下、第1図と
第2図を用いてその理由を説明する。
This merge sorter has three processing units 5.5.5
3 are connected in cascade, and each processing unit 5i (i=
1 to 3) are composed of a memory 11 and a cell 61. Each cell 61 has a sort mode and a path.
mode, and when the number of strings to be processed by itself is an odd number, only the first string is processed in pass mode, and no delay time (dl) occurs for the remaining strings. The reason for this will be explained below using FIGS. 1 and 2.

ユ、1セル61は長さ1のストリングを5個、即ち、奇
数個のストリングを処理しなければならないので、まず
パス・モードで最初のストリング[1]をメモリを介さ
ずにそのままセル62に転送し、以後ソート・モードで
ストリング[2]をUMに、[3]をLMに格納しつつ
これら2つのストリングのマージ操作を行い、長さ2の
ストリング[3゜2]を、同様にして[5,4]をセル
6゜に出力する。次に、セル62は長さ2のストリング
を3個処理しなければならないので、セル1と同様に最
初のストリング[1,−]をパス・モードでセル63に
転送し、以後ソート・モードでストリング[3,2コを
UMに、[5,4]をLMに格納しつつこれら2つのス
トリングのマージ操作を行い、長さ4のストリング[5
,4,3,2]をセル6 に出力する。セル63は長さ
4のストリングを2個処理すればよいので、2番目のス
トリングの最初のレコードが入力されると直ちにマージ
、”めデータ若しくは入力レコード3を格納する入カシ レジスタ11とメモリ11のUM部とLM部から読み出
されたデータを格納するUレジスタ12及びLレジスタ
13と、Uレジスタ12とLレジスタ13の内容を比較
する比較器14と、この比較器14の比較結果によりU
レジスタ12又はLレジスタ13のデータを選択するセ
レクタ15と、選択されたデータを最終結果として、又
は次段のセルに出力するため一時保持する出力レジスタ
16と、メモリ11のリードアドレス及びライトアドレ
スを生成するアドレス制御回路17と、外部から制御情
報を保持する制御情報保持レジスタ18と、制御情報保
持レジスタ18の値により動作モードの切換信号を生成
する動作モード制御回路19と、モードの切換を行う切
換器20と、ソート・モード動作のシーフェンス発生器
21およびパス・モード動作シーフェンス発生器22と
より構成される。
Since one cell 61 must process five strings of length 1, that is, an odd number of strings, first, in pass mode, the first string [1] is directly transferred to cell 62 without going through memory. After that, store string [2] in UM and [3] in LM in sort mode, merge these two strings, and create string [3゜2] of length 2 in the same way. Output [5, 4] to cell 6°. Next, cell 62 has to process three strings of length 2, so similarly to cell 1, it transfers the first string [1,-] to cell 63 in pass mode, and then in sort mode. While storing the string [3,2] in UM and [5,4] in LM, merge these two strings to create a string [5,4] with length 4.
, 4, 3, 2] is output to cell 6. The cell 63 only needs to process two strings of length 4, so as soon as the first record of the second string is input, it is merged, and the input register 11 and memory 11 that store the data or input record 3 are merged. A comparator 14 compares the contents of the U register 12 and the L register 13, and the U register 12 and L register 13 store the data read out from the UM section and the LM section.
A selector 15 that selects the data in the register 12 or the L register 13, an output register 16 that temporarily holds the selected data in order to output it as the final result or to the next cell, and a read address and a write address of the memory 11. An address control circuit 17 that generates an address, a control information holding register 18 that holds control information from the outside, and an operation mode control circuit 19 that generates an operation mode switching signal based on the value of the control information holding register 18, and switches the mode. It is composed of a switching device 20, a siefence generator 21 operating in a sort mode, and a siefence generator 22 operating in a pass mode.

セル61は3サイクルで第4図に示すようなソート・モ
ード動作またはパス・モード動作の1処′即ち、ソート
・モードでは、最初のストリングをUM部に格納して次
のストリングをLM部に格納しはじめると、第4図に示
すように、サイクル1で入力データの入力レジスタ11
へのセットとメモリ11のUM部のデータのUレジスタ
12への読み出し動作を、サイクル2でメモリ11のL
M部のデータのしレジスタ13への読み出し動作を、サ
イクル3で両者の比較を行って所定のデータを出力レジ
スタにセットする動作と入力レジスタ11の内容をメモ
リ11に格納する動作とを行う。
The cell 61 performs one of the sort mode operation or pass mode operation as shown in FIG. 4 in three cycles. In the sort mode, the first string is stored in the UM section and the next string is stored in the LM section. When the storage starts, as shown in FIG.
In cycle 2, the data in the UM part of the memory 11 is set to the
In cycle 3, the data read operation to the register 13 of the M part is compared, and the operation of setting predetermined data in the output register and the operation of storing the contents of the input register 11 in the memory 11 are performed.

一方、パス・モードでは、入力データをサイクル1で入
力レジスタ11に受は取り、サイクル2でそれをUレジ
スタ12に転送し、サイクル3でそれを出力レジスタ1
6に転送する動作を行う。
On the other hand, in pass mode, input data is received in input register 11 in cycle 1, transferred to U register 12 in cycle 2, and transferred to output register 1 in cycle 3.
Perform the operation to transfer to 6.

これらの動作モードは、動作モード制御回路19で、制
御情報として与えられるストリームのレコード数と当該
セルで処理できるストリング長(ストリングのレコード
数)から当該セルが実際に処理するストリング数を求め
ることにより次の、路19は、求めたストリング数の値
が奇数の時は、゛1人力されてくる最初のストリングだ
けをノくス・モ1:it “′ニドで、残りのストリングをソート・モードで処、
門し、偶数の時はパス・モードだけで処理するよ゛うに
切換器20を制御する。
These operation modes are determined by the operation mode control circuit 19 determining the number of strings actually processed by the cell from the number of records in the stream given as control information and the string length (number of string records) that can be processed by the cell. Next, path 19, when the value of the number of strings obtained is an odd number, ``1: Sort only the first string that is input manually.'' Where,
When the number is even, the switch 20 is controlled so that processing is performed only in pass mode.

このように、当該セルで処理すべきストリング数が奇数
の時は最初のストリングをメモリに格納しないで直接次
段のセルに転送するパス・モード機能を導入することに
より、遅れ時間(dl)を除去してソート処理時間を短
縮することができる。
In this way, when the number of strings to be processed in the cell is odd, the delay time (dl) can be reduced by introducing a pass mode function that directly transfers the first string to the next cell without storing it in memory. The sort processing time can be shortened by removing them.

なお、上記実施例では2ウエイ・マージ・ソータについ
て述べたが、本発明は2ウエイ・マージ・ソータに限定
されるものではなくマルチウェイ・マージ・ソータにも
適用可能である。
In the above embodiment, a two-way merge sorter has been described, but the present invention is not limited to a two-way merge sorter, but can also be applied to a multi-way merge sorter.

[発明の効果] 本発明によれば、マージ・ソータの各セルは、ソート・
モード動作とパス・モード動作を行う2処理し残りをソ
ート・モードで処理するという極めで簡単な制御によっ
て、各セルでの操作を行う・ストリング数をいつも偶数
にすることができるので、」二記入カストリングのレコ
ード数の2の累乗値からのずれに起因する遅れ時間(d
l)を簡単1゜ な制御回路で除去することかできる。
[Effects of the Invention] According to the present invention, each cell of the merge/sorter
By using extremely simple control that performs two processes, mode operation and pass mode operation, and processing the rest in sort mode, operations on each cell can be performed and the number of strings can always be an even number. The delay time (d
l) can be removed with a simple 1° control circuit.

【図面の簡単な説明】[Brief explanation of the drawing]

1 第1図は本発明の一実施例に係るマージ・ソ−タの
動作原理図、第2図は同マージ・ソータのパイプライン
処理動作の様子を示す図、第3図は同マージ・ソータを
構成するセルの更に詳細な構成図、第4図は同マージ・
ソータの各セルにおけるソート・モード動作とパス・モ
ード動作の説明図、第5図は従来方式のマージ・ソータ
の動作原理図、第6図は同マージ・ソータのパイプライ
ン処理動作の様子を示す図、第7図は擬似レコード追加
方式マージ・ソータの動作原理図、第8図は同マージ・
ソータのパイプライン処理動作の様子を示す図、第9図
はダイナミック・マージ方式のマージ・ソータの動作原
理図、第10図は同マー= 17− ジ・ソータのパイプライン処理動作の様子を示す図であ
る。 1〜1 ・・・メモリ、2〜2.3〜3 。 4〜4.6〜6 ・・・セル、51〜53・・・処理ユ
ニット、211・・・入力レジスタ、12・・・Uレジ
ースタ\ 13・・・Lレジスタ、14・・・比較器、
15・・・・、゛ □′女レしタ、16・・・出力レジスタ、17・・・ア
ドレス制御回路、18・・・制御情報保持レジスタ、1
9・・・“・動作モード制御回路、20・・・切換器、
21・・ソー3]i: = 10図
1 Fig. 1 is a diagram showing the operating principle of a merge sorter according to an embodiment of the present invention, Fig. 2 is a diagram showing the pipeline processing operation of the same merge sorter, and Fig. 3 is a diagram showing the operation of the same merge sorter. A more detailed configuration diagram of the cells that make up the cell, Figure 4 shows the same merge.
An explanatory diagram of the sort mode operation and pass mode operation in each cell of the sorter. Figure 5 shows the operating principle of a conventional merge sorter. Figure 6 shows the pipeline processing operation of the same merge sorter. Figure 7 shows the operating principle of the pseudo record addition method merge sorter, and Figure 8 shows the same merge sorter.
Figure 9 shows the operation principle of a merge sorter using the dynamic merge method; Figure 10 shows the pipeline processing operation of the sorter. It is a diagram. 1-1...Memory, 2-2.3-3. 4-4.6-6...Cell, 51-53...Processing unit, 211...Input register, 12...U register\13...L register, 14...Comparator,
15...,゛□'Female letter, 16...Output register, 17...Address control circuit, 18...Control information holding register, 1
9..."・Operating mode control circuit, 20... Switching device,
21...So3] i: = 10 figure

Claims (1)

【特許請求の範囲】 複数のストリングからなるレコード列を格納するメモリ
と、連続的に入力される前記複数のストリングを所定の
順序で前期メモリに格納するとともに、所定の規定に従
ってマージして出力するセルとからなる処理ユニットを
複数段接続して構成され、これら処理ユニットによるパ
イプライン処理によって入力レコード列をソーティング
するマージ・ソータにおいて、 前記各セルは、前段から連続的に入力される2つの入力
ストリングを前記メモリに格納しつつ、後の上記入力ス
トリングの先頭のレコードが入力される毎に、前記両ス
トリングを構成するレコードの大小関係を比較しその比
較結果から決定される順序に並び変えながら前記両スト
リングをマージして新たな1つのストリングとして次段
に出力するソート・モードと、前記入力ストリングを前
記メモリを介さずにそのまま次段に転送するパス・モー
ドとを有し、当該セルで処理するストリング数が奇数の
時は、最初のストリングが入力されたら直ちに該ストリ
ングだけを前期パス・モードで処理し、その他のストリ
ングについては前期ソート・モードで処理するものであ
ることを特徴とするマージ・ソータ。
[Claims] A memory for storing a record string consisting of a plurality of strings, and a memory for storing the plurality of strings that are continuously inputted in a predetermined order, and merging and outputting them according to a predetermined regulation. In the merge sorter, which is configured by connecting multiple stages of processing units consisting of cells and sorting an input record string through pipeline processing by these processing units, each cell has two inputs that are successively input from the previous stage. While storing the string in the memory, each time the first record of the later input string is input, the records constituting both strings are compared in size and rearranged in the order determined from the comparison result. It has a sort mode in which both the strings are merged and output as a new string to the next stage, and a pass mode in which the input string is transferred as it is to the next stage without going through the memory, and When the number of strings to be processed is odd, as soon as the first string is input, only that string is processed in the early pass mode, and the other strings are processed in the early sort mode. Marge Sota.
JP1270888A 1988-01-25 1988-01-25 Merging sorter Granted JPH01189723A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP1270888A JPH01189723A (en) 1988-01-25 1988-01-25 Merging sorter

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP1270888A JPH01189723A (en) 1988-01-25 1988-01-25 Merging sorter

Publications (2)

Publication Number Publication Date
JPH01189723A true JPH01189723A (en) 1989-07-28
JPH0437455B2 JPH0437455B2 (en) 1992-06-19

Family

ID=11812913

Family Applications (1)

Application Number Title Priority Date Filing Date
JP1270888A Granted JPH01189723A (en) 1988-01-25 1988-01-25 Merging sorter

Country Status (1)

Country Link
JP (1) JPH01189723A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05274117A (en) * 1992-03-25 1993-10-22 Masaru Kiregawa Sort processing system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05274117A (en) * 1992-03-25 1993-10-22 Masaru Kiregawa Sort processing system

Also Published As

Publication number Publication date
JPH0437455B2 (en) 1992-06-19

Similar Documents

Publication Publication Date Title
WO2003091872A1 (en) Parallel merge/sort processing device, method, and program
CN112015366B (en) Data sorting method, data sorting device and database system
JP2752634B2 (en) Sorting device
JPH01189723A (en) Merging sorter
JPS6142031A (en) Sorting processor
US5542080A (en) Method for controlling execution of data driven type information processor
JPH01173230A (en) Merge processing system
JP3264114B2 (en) Sorting device
JPH09128241A (en) Method and apparatus for arrangement with reference to belonging function value of language input value of fuzzy logic processor
JP3525960B2 (en) Parallel sort method
JP3447180B2 (en) Data operation circuit
JP2588932B2 (en) Sorting device
JPH02162419A (en) Data retrieving circuit
JPH01177122A (en) Sort processor
JPH01288920A (en) Data sorting device
JPH04112319A (en) Data storing method and first-in/first-out device
JPS62154140A (en) Merge processor
JPH01188933A (en) Data processor
JPS61110233A (en) Data processor
JPH0926872A (en) Pipeline merge sorter
JPS6324324A (en) Sort processor
JPH0512011A (en) Pipeline circuit
JPH0334015A (en) Input/output parallel processing method in quick sorting technique
JPS58107960A (en) Microprocessor
JPS62160568A (en) Vector computer

Legal Events

Date Code Title Description
EXPY Cancellation because of completion of term