JP2526384B2 - Garbage collection method - Google Patents

Garbage collection method

Info

Publication number
JP2526384B2
JP2526384B2 JP63171793A JP17179388A JP2526384B2 JP 2526384 B2 JP2526384 B2 JP 2526384B2 JP 63171793 A JP63171793 A JP 63171793A JP 17179388 A JP17179388 A JP 17179388A JP 2526384 B2 JP2526384 B2 JP 2526384B2
Authority
JP
Japan
Prior art keywords
cell
pointer
area
shared
garbage collection
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 - Lifetime
Application number
JP63171793A
Other languages
Japanese (ja)
Other versions
JPH0222746A (en
Inventor
克人 中島
宏 西川
裕和 立野
Original Assignee
工業技術院長
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 工業技術院長 filed Critical 工業技術院長
Priority to JP63171793A priority Critical patent/JP2526384B2/en
Publication of JPH0222746A publication Critical patent/JPH0222746A/en
Application granted granted Critical
Publication of JP2526384B2 publication Critical patent/JP2526384B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Description

【発明の詳細な説明】 〔産業上の利用分野〕 この発明は計算機においてプログラム実行中に動的に
生成されたガベージデータを実メモリの一端に詰め合わ
せるガベージコレクション方式に関するものである。
Description: TECHNICAL FIELD The present invention relates to a garbage collection system for packing garbage data dynamically generated during execution of a program in a computer into one end of an actual memory.

〔従来の技術〕[Conventional technology]

従来の計算機の応用分野は数値計算が主流であった。
近年人間の知識を直接取扱ういわゆる記号処理が注目を
集め、記号処理では、主記憶(実メモリ)中の有意なデ
ータをポインタとよばれる主記憶のアドレスを内容とす
るデータで指し示し必要なデータをポインタでつなぐ処
理が多発する。
Numerical calculations have been the mainstream of conventional computer applications.
In recent years, so-called symbol processing, which directly handles human knowledge, has been attracting attention. In symbol processing, significant data in the main memory (real memory) is pointed to by the data containing the address of the main memory called a pointer, and the necessary data is indicated. The process of connecting with a pointer occurs frequently.

このポインタでつなぐ処理はプログラム実行中に必要
に応じて行われ、ポインタの張替えなども行われる。ポ
インタの張替えにより参照されなくなったデータはそれ
以後のプログラム実行中に二度と参照されない。このよ
うなデータをガベージと呼ぶ。ガベージデータはプログ
ラム実行中に生成され主記憶中に散在しているのでこれ
を検出し主記憶上に新たなポインタ生成用の領域を再生
する処理,すなわちガベージコレクションの機能が記号
処理では必要となる。
The process of connecting with the pointer is performed as needed during the execution of the program, and the pointers are changed. Data that is no longer referenced due to pointer relocation is never referenced during subsequent program execution. Such data is called garbage. Since garbage data is generated during program execution and scattered in the main memory, the process of detecting it and regenerating a new pointer generation area in the main memory, that is, the garbage collection function is required for symbol processing. .

マーク&スライディングコンパクション方式のガベー
ジコレクションでは、まずプログラム実行のために必要
なデータを保持している主記憶セルにマーク付け(マー
キングと呼ぶ)を行う。次にスライディングコンパクシ
ョンではマーク付けのされているセルを主記憶の一端か
ら順次詰め合わせることがなされる。
In the garbage collection of the mark & sliding compaction method, first, the main memory cells holding the data necessary for program execution are marked (called marking). Next, in sliding compaction, marked cells are sequentially packed from one end of the main memory.

スライディングコンパクションのアルゴリズムは、CO
MM OF THE ACM,21,8,1978(PP662−665)に発表された
モリスの方法が有名である。これは、ガベージコレクシ
ョン対象領域の詰め合わせを行うことにより、必要とな
るポインタの値の変更(ポインタのメンテナンスと呼
ぶ)を特別な作業領域を用いるかわりに、逆転ポインタ
を使用し、対象領域を2回スイープすることによって行
う方式である。
The sliding compaction algorithm is CO
Morris' method published in MM OF THE ACM, 21, 8, 1978 (PP662-665) is famous. This is because the garbage collection target area is packed, and the necessary pointer value change (called pointer maintenance) is performed by using the reverse pointer instead of using a special work area, and the target area is changed twice. This is a method performed by sweeping.

第7図〜第10図は先に述べたモリスのアルゴリズムと
して知られるスライディングコンパクションの解読図で
ある。第7図において、1はプログラムの実行単位であ
るプロセス毎に独立した論理空間に対応する実メモリの
1セルずつスイープするためのスイープポインタ、2は
セル3を参照する上向きポインタ4を保持しているセ
ル、5はセル3からセル2を参照する逆転ポインタであ
る。第8図において、6は逆転ポインタ5を処理するこ
とによって得られる上向きポインタ4に対応するもので
ガベージコレクション後のセル3の移動先を示している
ものである。第9図において、7は不要領域(ごみ)で
ないセルを論理空間の一端から詰め合わせるためのロケ
ーションポインタ、8はセル11を参照している下向きポ
インタ、12はポインタ8を処理した時に生成される逆転
ポインタである。第10図において、13は逆転ポインタ12
を処理することで得られる上記ポインタ8に対応するガ
ベージコレクション後のポインタである。
7 to 10 are decoding diagrams of the sliding compaction known as the Morris algorithm described above. In FIG. 7, 1 is a sweep pointer for sweeping one cell of the real memory corresponding to an independent logical space for each process which is an execution unit of a program, and 2 is an upward pointer 4 for referencing the cell 3 The cell 5 that is present is a reverse pointer that references cell 3 to cell 2. In FIG. 8, reference numeral 6 corresponds to the upward pointer 4 obtained by processing the reverse pointer 5, and shows the moving destination of the cell 3 after garbage collection. In FIG. 9, 7 is a location pointer for assembling cells that are not unnecessary areas (garbage) from one end of the logical space, 8 is a downward pointer referencing the cell 11, and 12 is generated when the pointer 8 is processed. The reverse pointer. In FIG. 10, 13 is a reverse pointer 12
Is a pointer after garbage collection corresponding to the pointer 8 obtained by processing

次にモリスの方法によるコンパクション動作について
説明する。コンパクションはガベージコレクションの対
象とする論理空間のスイープを2パスすなわち2回のス
イープによって行なわれる。このとき、前提条件として
対象領域中のガベージセルの総数がわかっていること、
ガベージでないセルにはマーク付けがなされていること
が必要である。これらの条件を満足するようにマーキン
グはなされねばならない。
Next, the compaction operation by the Morris method will be described. The compaction is performed by sweeping the logical space targeted for garbage collection by two passes, that is, two sweeps. At this time, as a prerequisite, the total number of garbage cells in the target area is known,
Cells that are not garbage need to be marked. Marking must be done to meet these conditions.

第7図及び第8図はコンパクションフェーズの1パス
目の処理を示す。1パス目のスイープは詰め合わせを行
う方向と同一方向に行う。主記憶のスイープポインタ1
はセル2からセル3の方向へスイープする。又図中にお
いてセル2の論理アドレスはセル3の論理アドレスより
大きい。1パス目の処理では、上向きポインタ(ポイン
タの書かれているセルより論理アドレスの小さいセルを
参照しているポインタ)と逆転ポインタのみが処理対象
となる。
7 and 8 show the processing of the first pass of the compaction phase. The sweep of the first pass is performed in the same direction as the assembling. Main memory sweep pointer 1
Sweeps from cell 2 to cell 3. Also, in the figure, the logical address of cell 2 is larger than the logical address of cell 3. In the processing of the first pass, only the upward pointer (a pointer that refers to a cell whose logical address is smaller than the cell in which the pointer is written) and the reverse pointer are subject to processing.

第7図はスイープポインタ1が上向きポインタ4を検
出した時の処理である。この場合、セル3にセル2への
逆転ポインタ5を書き、セル2にはセル3の内容をコピ
ーする。
FIG. 7 shows the processing when the sweep pointer 1 detects the upward pointer 4. In this case, the reverse pointer 5 to cell 2 is written in cell 3, and the contents of cell 3 are copied to cell 2.

第8図はスイープポインタ1が逆転ポインタ5を検出
した時の処理である。逆転ポインタ5の参照しているセ
ル2には、セル3のガベージコレクション後移動先アド
レスを計算し、セル3の移動先セル4′へのポインタ6
を書く。又、セル2の内容はセル3にコピーする。この
ガベージコレクション後の移動先アドレスは、以下のよ
うにして求める。スイープポインタ1は、不要領域のセ
ルを検出するごとに、コンパクション開始時に知ってい
たコンパクション対象領域の不要領域セル数を減らして
ゆく。このようにすることで、スイープポインタ1は現
在スイープ中の論理アドレスと未スイープ領域中に存在
する不要領域セル数とから現在スイープ中のセルのガベ
ージコレクション後、移動先論理アドレスを計算するこ
とが可能である。
FIG. 8 shows the processing when the sweep pointer 1 detects the reverse pointer 5. For the cell 2 referred to by the reverse pointer 5, the move destination address of the cell 3 after the garbage collection is calculated, and the pointer 6 to the move destination cell 4 ′ of the cell 3 is calculated.
write. Also, the contents of cell 2 are copied to cell 3. The destination address after this garbage collection is obtained as follows. Each time the sweep pointer 1 detects a cell in an unnecessary area, it reduces the number of unnecessary area cells in the compaction target area that was known at the start of compaction. By doing so, the sweep pointer 1 can calculate the destination logical address after the garbage collection of the cell currently being swept, from the logical address currently swept and the number of unnecessary area cells existing in the unswept area. It is possible.

第9図及び第10図は2パス目の論理空間スイープでス
イープポインタ1がポインタの書かれているセルを検出
した場合の処理である。この時実際の論理空間内でのセ
ルの詰め合わせと下向きポインタの処理、および下向き
ポインタの処理中に生成した逆転ポインタの処理を行
う。ロケーションポインタ7は初めに論理アドレスが最
小のセル9を押さえる。スイープポインタ1が不要領域
でないセル10を検出し、かつ、そのセル10の内容がポイ
ンタでなければロケーションポインタ7のポイント先セ
ルにスイープポインタ1のポイント先セルの内容をコピ
ーしロケーションポインタ7の値を1増す。
9 and 10 show the processing when the sweep pointer 1 detects a cell in which the pointer is written in the second-pass logical space sweep. At this time, assembling of cells in the actual logical space, processing of the downward pointer, and processing of the reverse pointer generated during the processing of the downward pointer are performed. The location pointer 7 first presses the cell 9 having the smallest logical address. If the sweep pointer 1 detects a cell 10 that is not an unnecessary area and the content of the cell 10 is not a pointer, the content of the point destination cell of the sweep pointer 1 is copied to the point destination cell of the location pointer 7 and the value of the location pointer 7 is copied. Increase by 1.

第9図において、スイープポインタ1は下向きポイン
タ8の書かれているセル10を検出している。この時セル
10の内容および下向きポインタ8の参照しているセル11
にはロケーションポインタ7が参照しているセル9への
ポインタ12を書く。第9図に示した例ではロケーション
ポインタ7の参照しているセル9にXが書かれている。
これはXがポインタでなかった場合であり、正確にはス
イープポインタ1が参照していたセル10の内容が、Xで
あったと考えて処理を続ける。
In FIG. 9, the sweep pointer 1 detects the cell 10 in which the downward pointer 8 is written. Cell at this time
Contents of 10 and cell 11 referred to by the downward pointer 8
A pointer 12 to the cell 9 which the location pointer 7 refers to is written in. In the example shown in FIG. 9, X is written in the cell 9 referred to by the location pointer 7.
This is the case where X is not a pointer, and to be precise, the contents of the cell 10 referred to by the sweep pointer 1 are considered to be X, and the processing is continued.

第10図はスイープポインタ1が逆転ポインタ12の書か
れているセル11を検出している。この時、逆転ポインタ
12の参照しているセル9にはロケーションポインタ7の
参照しているセル14へのポインタ13が書かれる。
In FIG. 10, the sweep pointer 1 detects the cell 11 in which the reverse pointer 12 is written. At this time, the reverse pointer
A pointer 13 to a cell 14 referred to by the location pointer 7 is written in the cell 9 referred to by 12.

このように第9図の左側に示したセル9とセル11の関
係はそのままにして論理空間のアドレスのより小さい側
に詰め合わされる。又、第10図に示すように2パス目の
処理において、スイープポインタ1が上向きポインタ12
を検出した場合、上向きポインタ12の値はすでに1パス
目の処理でガベージコレクション後の値にメンテナンス
されているので、スイープポインタ1が参照しているセ
ル11の内容をロケーションポインタ7の参照しているセ
ル14にコピーすれば良い。
In this way, the relationship between the cell 9 and the cell 11 shown on the left side of FIG. Also, as shown in FIG. 10, in the processing of the second pass, the sweep pointer 1
Is detected, the value of the upward pointer 12 has already been maintained at the value after garbage collection in the processing of the first pass, so the content of the cell 11 referred to by the sweep pointer 1 is referred to by the location pointer 7. Copy it to cell 14

〔発明が解決しようとする課題〕[Problems to be Solved by the Invention]

ところで、従来のガベージコレクション方式,即ちマ
ーク&スライディングコンパクション方式のアルゴリズ
ムにおいて、各セルに書かれているポインタの向きは上
述したようにそのセルの論理アドレスとセルの内容によ
って決定され、このときポインタの向きに応じて関連す
るセルの内容を書き換える操作を行うため、論理アドレ
スと物理アドレス(実メモリアドレス)との対応が1対
1に対応することが必須である。
By the way, in the conventional garbage collection method, that is, in the mark & sliding compaction method algorithm, the direction of the pointer written in each cell is determined by the logical address of the cell and the content of the cell as described above. In order to perform the operation of rewriting the content of the related cell according to the orientation, it is essential that the correspondence between the logical address and the physical address (real memory address) is one-to-one.

ところが、プロセス毎に与えられた論理空間の一部に
対応する物理空間(実メモリ)が全プロセスで共有され
る場合、第11図に示すような状況が起り得る。即ち、プ
ロセスiの論理空間は物理空間17と全プロセスで共有さ
れる物理空間15にマッピングされ、プロセスjの論理空
間は物理空間16と物理空間15とにマッピングされる。こ
のとき、セル18とセル19とが共に共有領域中のセル20を
参照している。このような場合、上記従来のガベージコ
レクション方式では対象とし得る論理空間は1種類のみ
であり、このため第11図に示すようにプロセスiのガベ
ージコレクションを行った場合、セル19が参照していた
セル20の移動先アドレスが分らなくなってしまう。そこ
で、従来のガベージコレクション方式では第11図のよう
に複数のセルが同じセルを参照している場合、各セルは
ポインタで関連付けが行われるのであるが、例えば、セ
ル18とセル19とは論理空間が異なるためポインタを張る
ことができず、スライディングコンパクションは不可能
となる問題点があった。
However, when the physical space (real memory) corresponding to a part of the logical space given for each process is shared by all processes, a situation as shown in FIG. 11 may occur. That is, the logical space of the process i is mapped to the physical space 17 and the physical space 15 shared by all processes, and the logical space of the process j is mapped to the physical space 16 and the physical space 15. At this time, both the cell 18 and the cell 19 refer to the cell 20 in the shared area. In such a case, the above-mentioned conventional garbage collection method can target only one type of logical space. Therefore, when the garbage collection of the process i is performed as shown in FIG. 11, the cell 19 refers to it. I don't know the destination address of cell 20. Therefore, in the conventional garbage collection method, when a plurality of cells refer to the same cell as shown in FIG. 11, each cell is associated with a pointer, for example, the cell 18 and the cell 19 are logical. Since the space is different, it is not possible to set a pointer, which makes sliding compaction impossible.

この発明は上記のような問題点を解消するためになさ
れたもので、プロセス単位毎に独立した論理空間と、プ
ロセス間で共有される論理空間とを与えるようなシステ
ム上で全プロセスが使用している論理空間を対象とする
ガベージコレクション機能をマーキングアンドスライデ
ィングコンパクションによって実現するものである。
The present invention has been made to solve the above problems, and is used by all processes on a system in which a logical space independent for each process and a logical space shared between processes are provided. It realizes the garbage collection function for the existing logical space by marking and sliding compaction.

〔課題を解決するための手段〕[Means for solving the problem]

この発明に係るガベージコレクション方法は、プログ
ラムの実行単位であるプロセス毎に独立した論理空間を
与え、かつ、この論理空間の一部分が各プロセス間で共
有されるような多重論理空間を持つ計算機システム上
で、共有論理空間を合わせたプロセスすべてのセルに対
し、スライディング方式のガベージコレクションを行う
方法であって、全プロセス間で共有される上記共有論理
空間に対応するプロセス共有領域中におけるガベージコ
レクション対象外の領域に、各プロセスから参照されて
いる共有論理空間中のセルの総数分に比例した大きさを
持つ作業領域を設け、この作業領域を構成する実メモリ
セルにプロセス共有領域のセルの内容を移動し、プロセ
ス共有領域のセルには当該移動を示すデータを格納する
とともに、プロセス固有領域のセルからは前記作業領域
の実メモリセルを参照するようにポインタの変更を行っ
てマーク付けを行い、その上で、作業領域及びプロセス
共有領域を連続した領域としてスライディング方式によ
るコンパクションを行うことを特徴とするものである。
The garbage collection method according to the present invention provides a logical space independent for each process, which is a program execution unit, on a computer system having a multiple logical space such that a part of this logical space is shared between the processes. Is a method of performing a garbage collection in a sliding method for all cells in the process including the shared logical space, which is not subject to garbage collection in the process shared area corresponding to the shared logical space shared by all processes. In this area, a work area with a size proportional to the total number of cells in the shared logical space referenced by each process is provided, and the contents of the cells in the process shared area are assigned to the actual memory cells that make up this work area. Move and store the data indicating the move in the cell of the process sharing area, and Marking is performed by changing the pointer so that the cells in the area refer to the actual memory cells in the work area, and then the work area and the process sharing area are made continuous areas to perform compaction by the sliding method. It is characterized by.

〔作用〕[Action]

上記作業領域21は、実メモリセル29,30,31のマーキン
グ時に各プロセス固有の論理空間から共有論理空間への
中間テーブルとして作成される。したがって、マーキン
グ終了後、共有領域のコンパクションを実行すると、作
業領域21中に作られた中間テーブルには共有領域20中の
参照されていたセルの移動先アドレスが入る。
The work area 21 is created as an intermediate table from the logical space unique to each process to the shared logical space when the actual memory cells 29, 30, 31 are marked. Therefore, when the compaction of the shared area is performed after the marking is completed, the transfer destination address of the cell referred to in the shared area 20 is stored in the intermediate table created in the work area 21.

〔発明の実施例〕Example of Invention

第1図はこの発明の一実施例に係るガベージコレクシ
ョン方式によるガベージコレクション実行前、マーキン
グ終了、および共有領域のコンパクション後の動作の説
明図である。図において、22はガベージコレクション実
行前の主記憶(実メモリ)の状態例、16,17は物理空間
実メモリ領域、18,27,19,28はセル、20は全プロセス間
で共有される共有領域、21は共有領域中におけるガベー
ジコレクション対象外の領域にとられたガベージコレク
ション用作業領域、23,24,25,26はポインタを示す。ま
た、39はマーキングの終了時点の主記憶の状態例、27,2
8,29,30,31はセル、32,33,34,35,36,37,38はポインタを
示す。また、43は共有領域のコンパクション終了時の主
記憶の状態例、40,41,42は作業領域21中に書き込まれた
他のセルから参照されていた共有領域中セルのガベージ
コレクション終了時の移動先アドレスを示すポインタで
ある。
FIG. 1 is an explanatory diagram of the operation before the garbage collection is performed by the garbage collection method according to the embodiment of the present invention, the marking is completed, and the shared area is compacted. In the figure, 22 is an example of the state of the main memory (real memory) before execution of garbage collection, 16 and 17 are physical space real memory areas, 18, 27, 19 and 28 are cells, and 20 is shared among all processes. An area 21, a work area for garbage collection taken in an area of the shared area that is not subject to garbage collection, and 23, 24, 25, 26 are pointers. 39 is an example of the state of the main memory at the end of marking, 27,2
8, 29, 30, 31 indicate cells, and 32, 33, 34, 35, 36, 37, 38 indicate pointers. Also, 43 is an example of the state of the main memory at the end of compaction of the shared area, and 40, 41, 42 are movements at the end of garbage collection of cells in the shared area that were referenced by other cells written in the work area 21. This is a pointer indicating the destination address.

第2図に、この発明による一実施例で扱うデータタイ
プ及び1語の構成を示す。図において、44はガベージコ
レクタが各セルの意味(セル状態)を知るためのフラグ
としてのgcビット(2ビット)、45は値部46のデータ属
性を示すタグ部である。データタイプとしてはvect,cds
c,INTがある。vectは共有領域中に連続してとられる領
域へのポインタであり、ポインタ先のデータはcdsc(記
述子)である。cdscの値部は連続してとられている領域
の大きさが書かれている。INTは値部が整数であること
を表している。vectでポイントしている共有領域中の連
続領域をvect bodyと呼ぶ。又、共有領域中にのみvect
bodyはとられる。vect body中に現れるデータタイプと
しては、INTとvectとが許される。
FIG. 2 shows the data type and the structure of one word handled in one embodiment according to the present invention. In the figure, 44 is a gc bit (2 bits) as a flag for the garbage collector to know the meaning (cell state) of each cell, and 45 is a tag part indicating the data attribute of the value part 46. Vect, cds as the data type
There is c, INT. vect is a pointer to an area continuously taken in the shared area, and the data at the pointer destination is cdsc (descriptor). In the value part of cdsc, the size of the continuous area is written. INT indicates that the value part is an integer. The continuous area in the shared area pointed to by vect is called a vect body. Also, vect only in the shared area
body is taken. INT and vect are allowed as data types appearing in the vect body.

なお、vectは第3図に示すようにvect body中に入れ
子のようになることはないものとする。又、共有領域上
に作られる構造体は木構造である。gcビットは、ガベー
ジコレクション開始前は全て0であり、ガベージコレク
ション後も必要なセルのgcビットはmk,en,revの3状態
のいずれかにされる。mkはすでにそのセルのマーキング
が終了しており、かつそのセルを参照しているセルが存
在しないことを意味する。enはそのセルを参照している
セルが存在することを意味する。revはコンパクション
時に生成されるポインタであり、セルの内容が逆転ポイ
ンタであることを表している。
It should be noted that the vect does not have a nest inside the vect body as shown in FIG. The structure created on the shared area is a tree structure. The gc bits are all 0 before the garbage collection is started, and the gc bits of the cells required after the garbage collection are set to one of the three states of mk, en and rev. mk means that the marking of the cell has already been completed, and there is no cell referencing the cell. en means that there is a cell that refers to the cell. rev is a pointer generated at the time of compaction, and indicates that the content of the cell is a reverse pointer.

ガベージコレクションのマーキング時には、プロセス
固有領域の内に書かれているデータのうちプログラム実
行上必要なデータの書かれているセルに順次gcビットを
立ててゆく。このとき、共有領域へのポインタvectを検
出すると(以下このポインタをルートポインタと呼
ぶ)、そのvectからたどり得る共有領域中のセルのgcビ
ットを立てる。
At the time of marking garbage collection, the gc bit is sequentially set in the cell in which the data necessary for program execution is written among the data written in the process specific area. At this time, when the pointer vect to the shared area is detected (hereinafter, this pointer is called a root pointer), the gc bit of the cell in the shared area that can be traced from the vect is set.

第4図はルートポインタから始まるマーキング手順を
示すフローチャートである。ルートポインタのポイント
先セルを読み(ステップS1)、gcビット判定を行い(ス
テップS2)、gcビットがen状態であればルートの処理I
を実行する(ステップS3)。このルートの処理Iを第5
図に示す。プロセス固有領域17中のセル50から共有領域
20中のセル51を参照している。セル51のgcビットはすで
にenであり、セル51の内容はすでに作業領域21へのポイ
ンタである。この場合、セル50にセル51の内容をコピー
する。
FIG. 4 is a flowchart showing the marking procedure starting from the root pointer. The cell pointed to by the route pointer is read (step S1), the gc bit is determined (step S2), and if the gc bit is in the en state, the route process I
Is executed (step S3). Process I of this route
Shown in the figure. Shared area from cell 50 in process-specific area 17
References cell 51 in 20. The gc bit of cell 51 is already en and the content of cell 51 is already a pointer to work area 21. In this case, the contents of cell 51 are copied to cell 50.

また、ステップS2においてgcビットがun(mk,en,rev
のいずれにも属さない状態)であると判定されると、ス
テップS4のルートの処理IIを実行する。このルートの処
理IIを第6図に示す。プロセス固有領域17中のセル53か
ら共有領域20中のセル54を参照している。セル54のgcビ
ットはunである。作業領域21の未使用セル55にセル54の
内容をコピーしgcビットをmkとする。その後、セル54の
値部にはセル55の論理アドレスを書く。このようにルー
トポインタの処理跡、終了判定(ステップS7)がなされ
るまでvectの本体をマーキングする(ステップS6)。こ
のようにマーキングすることで、マーキング終了時に第
1図に示す39の状態になる。
Also, in step S2, the gc bit is un (mk, en, rev
If it is determined that the state does not belong to any of the above), the process II of the route in step S4 is executed. Processing II of this route is shown in FIG. The cell 53 in the process-specific area 17 is referred to the cell 54 in the shared area 20. The gc bit of cell 54 is un. The contents of the cell 54 are copied to the unused cell 55 of the work area 21, and the gc bit is set to mk. After that, the logical address of the cell 55 is written in the value part of the cell 54. In this way, the main body of vect is marked (step S6) until the processing trace of the route pointer and the end judgment (step S7) are made. By marking in this way, the state of 39 shown in FIG. 1 is reached at the end of marking.

次にコンパクション処理について述べる。基本的には
先に述べたモリスの方法と同様であるが以下の点が異な
る。共有領域20の詰め合わせを論理アドレスの小さい方
へ行う場合、作業領域21の論理アドレスは共有領域20の
論理アドレスより小さいものとして扱う。共有領域20,
作業領域21を連続した領域としコンパクションの対象領
域とする。コンパクションの1パス目のスイープに於い
て、gcビットがenのセルを検出した場合の処理がモリス
の方法に付加される。不要領域ではないセルの総数は、
共有領域20の不要領域ではないセルの総数と使用した作
業領域21との和である。enのセルを検出した場合、enの
セルが参照している作業領域21のセル内容はenのセルに
書かれていたとして処理する。このとき、enのセルが参
照していた作業領域21のセルにはenセルの論理アドレス
を書く。また、1パス目のスイープは共有領域20まで行
う。次に2パス目の処理は、作業領域21からモリスの方
法と同じ手順で実施する。作業領域21の確保は、通常の
プログラム実行中に共有領域20へのポインタを1個生成
するタイミングで1語ずつ確保する。
Next, the compaction process will be described. Basically, it is the same as the Morris method described above, but the following points are different. When the shared area 20 is packed to the smaller logical address, the logical address of the work area 21 is treated as being smaller than the logical address of the shared area 20. Shared area 20,
The work area 21 is a continuous area and is a target area for compaction. In the sweep of the first pass of compaction, the processing when a cell whose gc bit is en is detected is added to Morris' method. The total number of cells that are not unnecessary areas is
This is the sum of the total number of cells that are not unnecessary areas in the shared area 20 and the used work area 21. When the en cell is detected, the cell content of the work area 21 referred to by the en cell is processed as if it was written in the en cell. At this time, the logical address of the en cell is written in the cell of the work area 21 that was referenced by the en cell. The sweep of the first pass is performed up to the shared area 20. Next, the processing of the second pass is performed from the work area 21 in the same procedure as Morris' method. The work area 21 is secured word by word at a timing when one pointer to the shared area 20 is generated during normal program execution.

なお、上記実施例では、共有領域20上に許されるデー
タ構造を木構造に限定したが、ルートポインタの処理を
変更することで木構造でないような場合にも同様の効果
を奏する。
Although the data structure permitted on the shared area 20 is limited to the tree structure in the above-described embodiment, the same effect can be obtained even when the data structure is not a tree structure by changing the processing of the root pointer.

上記実施例によれば、各プログラム実行単位(プロセ
ス)間で共有される領域にガベージコレクタのための作
業領域をとり、この作業領域を使用し各プログラム実行
単位固有の論理空間上に対応するセルから共有論理空間
上へのポインタのメンテナンスを行うので、従来のコン
パクションアルゴリズムでは不可能であったコンパクシ
ョンを動作可能にする。
According to the above embodiment, the work area for the garbage collector is set in the area shared between the program execution units (processes), and this work area is used to create a cell corresponding to the logical space unique to each program execution unit. The maintenance of the pointer from the to the shared logical space enables the compaction, which was impossible with the conventional compaction algorithm.

〔発明の効果〕〔The invention's effect〕

以上のように本発明によれば、各プロセス間で共有さ
れる実メモリ上の領域にガベージコレクタのための作業
領域をとり、この作業領域を使い、各プロセス固有の論
理空間に対応するプロセス固有領域と、全プロセス間で
共有される共有論理空間間に対応するプロセス共有領域
を連続した領域としてコンパクションを行うようにした
ので、プロセス単位毎に独立した論理空間と、プロセス
間で共有される論理空間とを与えるようなシステム上で
全プロセスが使用している論理空間を対象とするガベー
ジコレクション機能をマーキングアンドスライディング
コンパクションによって実現でき、したがって従来のス
ライディングコンパクションアルゴリズムでは動作不可
能であった複数の論理空間に対するガベージコレクショ
ンが可能となり、効率の良い実メモリの再利用が可能と
なるという効果が得られる。
As described above, according to the present invention, the work area for the garbage collector is set in the area on the real memory shared by the processes, and this work area is used to identify the process-specific logical space corresponding to the process-specific logical space. Compaction is performed as a continuous area in the process shared area corresponding to the area and the shared logical space shared by all processes, so an independent logical space for each process and a logical shared between processes Space-giving and garbage collection functions for the logical space used by all processes on the system can be realized by marking-and-sliding compaction, and thus multiple logical logics that cannot be operated by the conventional sliding compaction algorithm. Garbage collection for space becomes possible, The effect is obtained that the re-use of real memory is possible good.

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

第1図はこの発明の一実施例に係るガベージコレクショ
ン方式によるガベージコレクション実行前、マーキング
終了、および共有領域のコンパクション後の動作を説明
するための図、第2図および第3図はこの実施例におい
て共有領域中に許したデータ構成図、第4図〜第6図は
この実施例でのマーキングの説明図、第7図〜第10図は
従来のモリスのアルゴリズムとして知られるコンパクシ
ョンの説明図、第11図はこのモリスのアルゴリズムの問
題点の説明図である。 16,17……物理空間(プロセス固有領域)、18,19,27,2
8,29,30,31……実メモリセル、20……共有領域、21……
作業領域。
FIG. 1 is a diagram for explaining the operation before the garbage collection is executed by the garbage collection method according to the embodiment of the present invention, the end of marking, and the operation after the compaction of the shared area, and FIGS. 2 and 3 are the embodiments. In FIG. 4, the data structure allowed in the shared area, FIGS. 4 to 6 are explanatory diagrams of marking in this embodiment, and FIGS. 7 to 10 are explanatory diagrams of compaction known as a conventional Morris algorithm. FIG. 11 is a diagram for explaining the problems of this Morris algorithm. 16,17 …… Physical space (process-specific area), 18,19,27,2
8,29,30,31 …… Real memory cell, 20 …… Shared area, 21 ……
Work area.

Claims (1)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】プログラムの実行単位であるプロセス毎に
独立した論理空間を与え、かつ、この論理空間の一部分
が各プロセス間で共有されるような多重論理空間を持つ
計算機システム上で、共有論理空間を合わせたプロセス
すべてのセルに対し、スライディング方式のガベージコ
レクションを行う方法であって、 全プロセス間で共有される上記共有論理空間に対応する
プロセス共有領域中におけるガベージコレクション対象
外の領域に、各プロセスから参照されている共有論理空
間中のセルの総数分に比例した大きさを持つ作業領域を
設け、 この作業領域を構成する実メモリセルにプロセス共有領
域のセルの内容を移動し、プロセス共有領域のセルには
当該移動を示すデータを格納するとともに、プロセス固
有領域のセルからは前記作業領域の実メモリセルを参照
するようにポインタの変更を行ってマーク付けを行い、
その上で、作業領域及びプロセス共有領域を連続した領
域としてスライディング方式によるコンパクションを行
うことを特徴とするガベージコレクション方法。
1. A shared logic is provided on a computer system having a multiple logical space in which an independent logical space is provided for each process which is an execution unit of a program, and a part of this logical space is shared by each process. A method of performing a garbage collection in a sliding method for all cells in a space-combined process, in the area not subject to garbage collection in the process shared area corresponding to the shared logical space shared among all processes, A work area with a size proportional to the total number of cells in the shared logical space referenced by each process is provided, and the contents of the process shared area cells are moved to the actual memory cells that make up this work area. Data indicating the movement is stored in the shared area cell, and the work area is stored in the process specific area cell. Performs a marked make changes of the pointer to reference the actual memory cell of,
Then, a compaction method using a sliding method is performed, in which a work area and a process sharing area are contiguous to each other and compaction is performed.
JP63171793A 1988-07-12 1988-07-12 Garbage collection method Expired - Lifetime JP2526384B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP63171793A JP2526384B2 (en) 1988-07-12 1988-07-12 Garbage collection method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP63171793A JP2526384B2 (en) 1988-07-12 1988-07-12 Garbage collection method

Publications (2)

Publication Number Publication Date
JPH0222746A JPH0222746A (en) 1990-01-25
JP2526384B2 true JP2526384B2 (en) 1996-08-21

Family

ID=15929801

Family Applications (1)

Application Number Title Priority Date Filing Date
JP63171793A Expired - Lifetime JP2526384B2 (en) 1988-07-12 1988-07-12 Garbage collection method

Country Status (1)

Country Link
JP (1) JP2526384B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2425577B (en) 2004-02-05 2007-08-15 Yugen Kaisha Newly Lab Fluid Sealing Mechanism And Heavy Cargo Supporting System Comprising Fluid Sealing Mechanism

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS61170844A (en) * 1985-01-25 1986-08-01 Fujitsu Ltd Dynamic storage allocating system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
「情報処理学会論文誌」Vol.27,No.11,P.1137−1144

Also Published As

Publication number Publication date
JPH0222746A (en) 1990-01-25

Similar Documents

Publication Publication Date Title
CA1180463A (en) Method and apparatus for hashing cache addresses in a cached disk storage system
EP2817741B1 (en) Method and apparatus utilizing non-uniform hash functions for placing records in non-uniform access memory
KR100512665B1 (en) Space-limited marking structure for tracing garbage collectors
US5241673A (en) System for garbage collecting unused memory space represented by a digraph by assigning values of node identifiers to selected variables based upon predetermined conditions
CN103914398B (en) Method and device for managing utilization of memory including physical address space
EP1548598A1 (en) Database re-organizing system and database
JP2679805B2 (en) Memory management system for digital computer system
CN105893274B (en) A kind of device for establishing checkpoint towards isomery memory system
JPS6258479A (en) Label writing method for file data
JPH03139777A (en) Graphic display system and method
JPS62174849A (en) Memory managing system
Lang et al. Incremental incrementally compacting garbage collection
KR20010023280A (en) Reference counting mechanism for garbage collectors
JPH05509189A (en) Method of operating a computer system and memory management device in a computer system
CN104021089B (en) Flash memory control chip, storage device and flash memory control method
CN106155833A (en) A kind of method and apparatus of asynchronous remote copy
JP2526384B2 (en) Garbage collection method
JP2002541550A (en) Memory reuse method and apparatus
CN100595796C (en) Triangular net cutting and reconstruction method based on AIF
Appel Garbage collection
US7321909B1 (en) Method and apparatus for forwarding references to objects concurrently with space-incremental garbage collection
CN111026890A (en) Picture data storage method, system, device and storage medium based on index table
JP3868585B2 (en) Memory management device and computer-readable recording medium
DeMartinis et al. A self managing secondary memory system
JP2867441B2 (en) List processing method

Legal Events

Date Code Title Description
EXPY Cancellation because of completion of term