【発明の詳細な説明】[産業上の利用分野コ本発明は電子計算機に関わり、特に、プログラムを実行
する際に必要な作業領域の有効利用に関する。DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to electronic computers, and particularly relates to effective use of work areas required when executing programs.
[従来の技術]従来、実行時に必要となる作業領域は、必要とするプロ
グラムが必要な領域を主記憶上に確保して、読み込みや
書き込みを行っていた。この方法だと、−時的にしか利
用しない作業領域であっても恒常的に主記憶の一部を占
育しているため、主記憶の利用効率を低下させていた。[Prior Art] Conventionally, as a work area required during execution, an area necessary for the required program was secured in the main memory, and reading and writing were performed. With this method, even if the work area is only used temporarily, a part of the main memory is permanently occupied, reducing the efficiency of main memory use.
そこで、プログラム全体で1個の連続する記憶領域を主
記憶上に確保しそれを作業領域とし、プログラムが作業
領域を必要としたときにその一部を割り当て、不要とな
ったときにそれを開放することにより、プログラムが作
業領域を必要とする期間だけその一部が割り当てられる
ことになり、結果として主記憶を有効に利用できる作業
領域の割り当て方法が考えられた。この方法において、
主記憶上の1個の連続した作業領域をヒープ領域と呼ぶ
。この方法では、ヒープ領域初期化手段と作業領域割当
手段と作業領域開放手段とを育する。Therefore, we allocate one continuous storage area in main memory for the entire program, use it as a work area, allocate a part of it when the program needs a work area, and release it when it no longer needs it. By doing this, a part of the work area is allocated only for the period when the program requires it, and as a result, a method of allocating the work area that can effectively utilize the main memory has been devised. In this method,
One continuous work area on main memory is called a heap area. In this method, a heap area initialization means, a work area allocation means, and a work area release means are developed.
まず、ヒープ領域初期化手段により主記憶上に1個の連
続した領域がヒープ領域として確保される。First, one continuous area is secured as a heap area on the main memory by the heap area initialization means.
この時、ヒープ領域のほとんどすべての領域は、1個の
連続する未使用領域として存在している。At this time, almost all of the heap area exists as one continuous unused area.
作業領域が必要となったときには、必要な大きさの作業
領域を作業領域割当手段により該ヒープ領域中の未使用
領域から割り当てる。割り当てられた作業領域は、使用
中領域として未使用領域とは区別される。プログラムで
は、該使用中領域を作業領域として読み込みと書き込み
を行う。該使用中領域が不必要となったときには、該使
用中領域を作業領域開放手段により未使用領域として作
業領域割当手段の対象となるように戻す。When a work area is required, a work area of the required size is allocated from an unused area in the heap area by the work area allocation means. The allocated work area is distinguished from unused areas as a used area. The program uses the currently used area as a work area for reading and writing. When the in-use area is no longer needed, the in-use area is returned as an unused area to the work area allocating unit by the work area release means.
[発明が解決しようとする課題および目的コいくつかの
使用中領域が存在している状態では、それぞれの領域の
大きさを保持するとともに、使用中領域と未使用領域と
を区別する必要がある。[Problems and Objectives to be Solved by the Invention] When there are several areas in use, it is necessary to maintain the size of each area and to distinguish between areas in use and unused areas. .
従来の方法では、使用中領域と未使用領域とを区別する
ための情報を保持するために作業領域の一部を使用して
いたために、ヒープ領域の使用効率が悪かった。In the conventional method, a part of the work area is used to hold information for distinguishing between used areas and unused areas, resulting in inefficient use of the heap area.
本発明は、このような問題に鑑み、作業領域を使用せず
に使用中領域と未使用領域との区別をするための手段を
備えた電子計算機を実現する方法を提供することを目的
とする。In view of such problems, an object of the present invention is to provide a method for realizing a computer equipped with a means for distinguishing between a used area and an unused area without using a work area. .
[課題を解決するための手段]本発明の電子計算機は、(a)読み込みと書き込みが可能な主記憶装置と、(b)前記主記憶装置の一部に割り当てられた連続する
ヒープ領域と、(c)ヒープ領域中の使用中領域を示す使用中ポインタ
と、(d)ヒープ領域中の未使用領域を示す未使用ポインタ
と、(e)前記ヒープ領域を利用可能な状態に初期化するヒ
ープ領域初期化手段と、(f)前記ヒープ領域の一部を独立した作業領域として
確保する作業領域割当手段と、(g)前記作業領域割当
手段により確保した作業領域を開放し再び利用可能な状
態にする作業領域開放手段と、(h)上記手段を実行し、主記憶に対する読み込みと書
き込みを行う処理装置とを少なくとも備えていることを
特徴とする。[Means for Solving the Problems] An electronic computer of the present invention includes: (a) a readable and writable main memory; (b) a continuous heap area allocated to a part of the main memory; (c) an in-use pointer indicating an area in use in the heap area; (d) an unused pointer indicating an unused area in the heap area; and (e) a heap pointer that initializes the heap area to a usable state. area initialization means; (f) work area allocation means for securing part of the heap area as an independent work area; and (g) a state in which the work area secured by the work area allocation means is released and can be used again. (h) a processing device that executes the above-mentioned means and reads and writes to the main memory.
[作用コ本発明の上記構成によれば、主記憶上に確保したヒープ
領域を使用中領域と未使用領域とに区分し、必要なとき
には未使用領域から作業領域を割り当てて使用中領域と
し、作業領域が不必要になったときにはその使用中領域
を開放して未使用領域に戻すことにより、ヒープ領域を
効率的に使用することができる。[Function] According to the above configuration of the present invention, the heap area secured on the main memory is divided into a used area and an unused area, and when necessary, a work area is allocated from the unused area to make it a used area, When a work area is no longer needed, the heap area can be used efficiently by releasing the area in use and returning it to an unused area.
[実施例コ以下に本発明の実施例を図面に基づいて説明する。[Example code]Embodiments of the present invention will be described below based on the drawings.
第1図は、本発明における、ヒープ領域の効率的な使用
手段を備えた電子計算機の概念図である。FIG. 1 is a conceptual diagram of an electronic computer equipped with means for efficiently using a heap area according to the present invention.
11は、処理装置である。12は、主記憶である。11 is a processing device. 12 is a main memory.
13は、主記憶中のヒープ領域である。処理装置11は
、主記憶12中のいかなる領域に対しても、読み込みと
書き込みを行うことができる。14は、ヒープ領域初期
化手段である。15は、作業領域別当手段である。16
は、作業領域開放手段である。ヒープ領域初期化手段1
4、および、作業領域割当手段15、作業領域開放手段
16は、処理装置11により実行される。13 is a heap area in the main memory. The processing device 11 can read and write to any area in the main memory 12. 14 is a heap area initialization means. Reference numeral 15 denotes a work area specific means. 16
is a work area opening means. Heap area initialization means 1
4, the work area allocation means 15, and the work area release means 16 are executed by the processing device 11.
第2図は、本発明における、ヒープ領域初期化手段14
を実行した直後のヒープ領域の状態を示す概念図である
。13は、ヒープ領域である。21は、使用中領域を示
す使用中ポインタである。FIG. 2 shows the heap area initialization means 14 in the present invention.
FIG. 2 is a conceptual diagram showing the state of the heap area immediately after execution. 13 is a heap area. 21 is an in-use pointer indicating an area in use.
22は、未使用領域を示す未使用ポインタである。22 is an unused pointer indicating an unused area.
23は、ヒープ領域中の未使用領域である。24は、未
使用領域のリンクポインタである。25は、ヒープ領域
13の終端である。ヒープ領域初期化手段14を実行し
た直後には、未使用ポインタ22は、唯一存在する未使
用領域23をポイントし、未使用領域23のリンクポイ
ンタ24と使用中ポインタ21は、ヒープ領域終端25
をポイントしている。未使用領域23の大きさは、未使
用領域23のリンクポインタ24において、リンクポイ
ンタ24の値と、リンクポインタ24自身のアドレスと
の差により求められる。23 is an unused area in the heap area. 24 is a link pointer of an unused area. 25 is the end of the heap area 13. Immediately after executing the heap area initialization means 14, the unused pointer 22 points to the only existing unused area 23, and the link pointer 24 and in-use pointer 21 of the unused area 23 point to the heap area end 25.
is the point. The size of the unused area 23 is determined by the difference between the value of the link pointer 24 of the unused area 23 and the address of the link pointer 24 itself.
第3図は、ヒープ領域初期化手段I4を実行した後、作
業領域割当手段15を3回続けて実行した後のヒープ領
域の状態を示す概念図である。13は、ヒープ領域であ
る。21は、使用中領域を示す使用中ポインタである。FIG. 3 is a conceptual diagram showing the state of the heap area after executing the heap area initializing means I4 and then executing the work area allocating means 15 three times in succession. 13 is a heap area. 21 is an in-use pointer indicating an area in use.
22は、未使用領域を示す未使用ポインタである。31
は、1回目の作業領域割当手段15を実行したときに確
保された使用中領域である。32は、使用中領域31の
リンクポインタである。33は、2回目の作業領域開放
手段工5を実行したときに確保された使用中領域である
。34は、使用中領域33のリンクポインタである。3
5は、3回目の作業領域割当手段15を実行したときに
確保された使用中領域である。36は、使用中領域35
のリンクポインタである。37は、未使用領域である。22 is an unused pointer indicating an unused area. 31
is an area in use that is secured when the work area allocation means 15 is executed for the first time. 32 is a link pointer of the area 31 in use. 33 is an area in use that is secured when the second work area opening procedure 5 is executed. 34 is a link pointer of the area 33 in use. 3
5 is an area in use that is secured when the work area allocation means 15 is executed for the third time. 36 is the area in use 35
is a link pointer. 37 is an unused area.
38は、未使用領域37のリンクポインタである。使用
中ポインタ21は使用中領域31をポイントし、そのリ
ンクポインタ32は使用中領域33をポイントシ、その
リンクポインタ34は使用中領域35をポイントし、そ
のリンクポインタ36はヒープ領域終端25をポイント
している。このように、使用中ポインタ21から始まる
使用中領域を示すリンクは、すべての使用中領域を経由
して、最終的にヒープ領域終端へ繋がっている。未使用
ポインタ22は未使用領域37をポイントし、そのリン
クポインタ38はヒープ領域終端25をポイントしてい
る。使用中領域31の大きさは、そのリンクポインタ3
2の値と、リンクポインタ32のアドレスとの差により
求められる。使用中領域33の大きさは、そのリンクポ
インタ34の値と、リンクポインタ34のアドレスとの
差により求められる。使用中領域35の大きさは、未使
用ポインタ22の値と、使用中領域35のリンクポイン
タ36のアドレスとの差により求められる。未使用領域
37の大きさは、そのリンクポインタ38の値と、リン
クポインタ38のアドレスとの差により求められる。38 is a link pointer of the unused area 37. The in-use pointer 21 points to the in-use area 31, the link pointer 32 points to the in-use area 33, the link pointer 34 points to the in-use area 35, and the link pointer 36 points to the end of the heap area 25. are doing. In this way, the link indicating the in-use area starting from the in-use pointer 21 passes through all the in-use areas and finally connects to the end of the heap area. The unused pointer 22 points to an unused area 37, and its link pointer 38 points to the end 25 of the heap area. The size of the area in use 31 is determined by its link pointer 3.
2 and the address of the link pointer 32. The size of the in-use area 33 is determined by the difference between the value of the link pointer 34 and the address of the link pointer 34. The size of the in-use area 35 is determined by the difference between the value of the unused pointer 22 and the address of the link pointer 36 of the in-use area 35. The size of the unused area 37 is determined by the difference between the value of the link pointer 38 and the address of the link pointer 38.
第4図は、第3図の後、使用中領域33を作業領域開放
手段16により未使用の状態に戻したときのヒープ領域
の状態を示す概念図である。13は、ヒープ領域である
。21は、使用中領域を示す使用中ポインタである。2
2は、未使用領域を示す未使用ポインタである。3Iは
、1回目の作業領域割当手段15を実行したときに確保
された使用中領域である。32は、使用中領域31のリ
ンクポインタである。41は、作業領域開放手段16の
実行により未使用となった領域である。42は、未使用
領域41のリンクポインタである。FIG. 4 is a conceptual diagram showing the state of the heap area when the in-use area 33 is returned to an unused state by the work area release means 16 after FIG. 3. 13 is a heap area. 21 is an in-use pointer indicating an area in use. 2
2 is an unused pointer indicating an unused area. 3I is an area in use that is secured when the work area allocation means 15 is executed for the first time. 32 is a link pointer of the area 31 in use. Reference numeral 41 indicates an area that has become unused due to execution of the work area opening means 16. 42 is a link pointer of the unused area 41.
未使用領域41およびそのリンクポインタ42は、第3
図における使用中領域33およびそのリンクポインタ3
4と同じ領域を占有している35は、3回目の作業領域
割当手段15を実行したときに確保された使用中領域で
ある。36は、使用中領域35のリンクポインタである
。37は、未使用領域である。38は、未使用領域37
のリンクポインタである。使用中ポインタ21は使用中
領域31をポイントし、そのリンクポインタ32は使用
中領域35をポイントし、そのリンクポインタ36はヒ
ープ領域終端25をポイントしている。The unused area 41 and its link pointer 42 are
In-use area 33 and its link pointer 3 in the diagram
35, which occupies the same area as 4, is an area in use that was secured when the work area allocation means 15 was executed for the third time. 36 is a link pointer of the area 35 in use. 37 is an unused area. 38 is an unused area 37
is a link pointer. The in-use pointer 21 points to the in-use area 31, its link pointer 32 points to the in-use area 35, and its link pointer 36 points to the end 25 of the heap area.
未使用ポインタ22は未使用領域41をポイントし、そ
のリンクポインタ42は未使用領域37をポイントし、
そのリンクポインタ38はヒープ領域終端25をポイン
トしている。このように、未使用ポインタ22から始ま
る未使用領域を示すリンクはすべての未使用領域を経由
して最終的にヒープ領域終端へ繋がっている。使用中領
域31の大きさは、未使用ポインタ22の値と、使用中
領域31のリンクポインタ32のアドレスとの差により
求められる。未使用領域41の大きさは、使用中領域3
1のリンクポインタ32の値と、未使用領域41のリン
クポインタ42のアドレスとの差により求められる。使
用中領域35の大きさは、未使用領域41のリンクポイ
ンタ42の値と、使用中領域35のリンクポインタ36
のアドレスとの差により求められる。未使用領域37の
大きさは、そのリンクポインタ38の値と、リンクポイ
ンタ38のアドレスとの差により求められる。The unused pointer 22 points to the unused area 41, the link pointer 42 points to the unused area 37,
The link pointer 38 points to the end 25 of the heap area. In this way, the link indicating the unused area starting from the unused pointer 22 is finally connected to the end of the heap area via all the unused areas. The size of the in-use area 31 is determined by the difference between the value of the unused pointer 22 and the address of the link pointer 32 of the in-use area 31. The size of the unused area 41 is the same as that of the used area 3.
It is determined by the difference between the value of the link pointer 32 of 1 and the address of the link pointer 42 of the unused area 41. The size of the in-use area 35 is determined by the value of the link pointer 42 of the unused area 41 and the link pointer 36 of the in-use area 35.
It is determined by the difference between the address and the address. The size of the unused area 37 is determined by the difference between the value of the link pointer 38 and the address of the link pointer 38.
第5図〜第9図は、本発明における、作業領域割当手段
15の実現方法を示す図である。5 to 9 are diagrams showing a method of implementing the work area allocation means 15 in the present invention.
第5図は、本発明における、作業領域割当手段15の概
略を示すフローチャートである。51は、未使用ポイン
タ22から導かれる最初の未使用領域の大きさを求める
手段である。52は、得られた未使用領域の大きさが確
保する作業領域の大きさに対して十分に大きいか否かを
判断する手段である。53は、判断52の結果未使用領
域が小さい時に実行されるもので、その未使用領域が最
後の未使用領域であるか否かを、そのリンクポインタが
ヒープ領域終端25を差しているか否かにより判断する
手段である。54は、判断53の結果最後の未使用領域
でない時に実行されるもので、次の未使用領域の大きさ
を求める手段である。手段54により大きさを求めた後
、再び判断52によりその大きさを判断する。55は、
判断53の結果最後の未使用領域である時に実行される
もので、作業領域割当手段15がヒープ領域13の不足
のためにエラー状態にあることを返す手段である。56
は、判断52の結果未使用領域が十分に大きい時に実行
されるもので、リンクポインタを変更することにより使
用中領域を確保する手段である。57は、作業領域割当
手段15が正常に終了した時に確保した使用中領域を作
業領域としてそのアドレスを返す手段である。FIG. 5 is a flow chart showing an outline of the work area allocating means 15 in the present invention. Reference numeral 51 denotes means for determining the size of the first unused area derived from the unused pointer 22. 52 is a means for determining whether the size of the obtained unused area is sufficiently larger than the size of the work area to be secured. 53 is executed when the unused area is small as a result of the judgment 52, and it is determined whether the unused area is the last unused area or not, and whether the link pointer points to the end of the heap area 25. This is a means of making a judgment based on the following. 54 is a means for determining the size of the next unused area, which is executed when the result of judgment 53 is that it is not the last unused area. After determining the size by the means 54, the size is determined again by the judgment 52. 55 is
This is executed when the result of judgment 53 is that the area is the last unused area, and is a means for returning that the work area allocation means 15 is in an error state due to lack of heap area 13. 56
is executed when the result of judgment 52 is that the unused area is sufficiently large, and is a means of securing the used area by changing the link pointer. Reference numeral 57 denotes a means for returning the address of the in-use area secured when the work area allocating means 15 normally ends as a work area.
第6図〜第9図は、第5図におけるリンクポインタを変
更する手段56の実現方法を示す概念図である。6 to 9 are conceptual diagrams showing a method of implementing the means 56 for changing the link pointer in FIG. 5.
第6図〜第7図は、得られた未使用領域の大きさが確保
する作業領域の大きさと一致する時に、リンクポインタ
を変更する手段56の実現方法を示す概念図である。6 and 7 are conceptual diagrams showing a method for implementing the means 56 for changing the link pointer when the size of the obtained unused area matches the size of the work area to be secured.
第6図は、リンクポインタを変更する手段56を実行す
る前のヒープ領域13の様子を示す概念図である。13
は、ヒープ領域である。63は、得られた未使用領域で
ある。64は、未使用領域63のリンクポインタである
。65は、未使用領域63よりも後にある使用中領域の
リンクポインタである。未使用領域63よりも後に使用
中領域がない時には、ヒープ領域終端25がこれを代用
する。61は、未使用領域64よりも前にある使用中領
域のリンクポインタであって、リンクポインタ65をポ
イントしている。62は、未使用領域63を示す未使用
領域のリンクポインタである。FIG. 6 is a conceptual diagram showing the state of the heap area 13 before the link pointer changing means 56 is executed. 13
is the heap area. 63 is the obtained unused area. 64 is a link pointer of the unused area 63. Reference numeral 65 indicates a link pointer of a used area after the unused area 63. When there is no in-use area after the unused area 63, the heap area end 25 takes its place. Reference numeral 61 indicates a link pointer of a used area before the unused area 64, and points to a link pointer 65. 62 is an unused area link pointer indicating an unused area 63.
66は、未使用領域63のリンクポインタ64が示す未
使用領域またはヒープ領域終端26である。Reference numeral 66 denotes the end 26 of the unused area or heap area indicated by the link pointer 64 of the unused area 63.
第7図は、リンクポインタを変更する手段56を実行し
た後のヒープ領域13の様子を示す概念図である。71
は、第6図における未使用領域63と同じ領域が使用中
領域となったものである。FIG. 7 is a conceptual diagram showing the state of the heap area 13 after executing the link pointer changing means 56. 71
In this case, the same area as the unused area 63 in FIG. 6 is used as the used area.
64は、使用中領域7エのリンクポインタである。64 is a link pointer of the area in use 7e.
使用中領域のリンクポインタ61は、確保した使用中領
域71を示すように変更される。未使用領域のリンクポ
インタ62は、次の未使用領域66を示すように変更さ
れる。確保した使用中領域71のリンクポインタ64は
、次の使用中領域65を示すように変更される。これら
の変更により、第6図における未使用領域63の使用中
領域71への変更が実現する。The in-use area link pointer 61 is changed to indicate the in-use area 71 that has been secured. The unused area link pointer 62 is changed to point to the next unused area 66. The link pointer 64 of the secured in-use area 71 is changed to indicate the next in-use area 65. Through these changes, the unused area 63 in FIG. 6 is changed to the used area 71.
第8図〜第9図は、得られた未使用領域の大きさが確保
する作業領域の大きさよりも大きい時に、リンクポイン
タを変更する手段56の実現方法を示す概念図である。8 and 9 are conceptual diagrams showing a method for implementing the means 56 for changing the link pointer when the size of the obtained unused area is larger than the size of the work area to be secured.
第8図は、リンクポインタを変更する手段56を実行す
る前のヒープ領域13の様子を示す概念図である。81
は、得られた未使用領域である。FIG. 8 is a conceptual diagram showing the state of the heap area 13 before the link pointer changing means 56 is executed. 81
is the obtained unused area.
82は、未使用領域81のリンクポインタである。82 is a link pointer of the unused area 81.
未使用領域の番号が変更されている点を除けば、第6図
と一致している。This corresponds to FIG. 6 except that the numbers of unused areas have been changed.
第9図は、リンクポインタを変更する手段56を実行し
た後のヒープ領域13の様子を示す概念図である。91
は、第8図における未使用領域81の一部であり、使用
中領域となったものである。FIG. 9 is a conceptual diagram showing the state of the heap area 13 after executing the link pointer changing means 56. 91
is a part of the unused area 81 in FIG. 8, which has become an area in use.
そのリンクポインタ82は、未使用領域81のリンクポ
インタがそのまま使用される。92は、未使用領域81
から使用中領域91を取除いた残りの未使用領域である
。93は、未使用領域92のリンクポインタである。使
用中領域のリンクポインタ61、未使用領域のリンクポ
インタ62、次の使用中領域65、および、次の未使用
領域66は、第8図と一致している。使用中領域のリン
クポインタ61は、確保した使用中領域91を示すよう
に変更される。未使用領域のリンクポインタ62は、次
の未使用領域92を示すように変更される。確保した使
用中領域91のリンクポインタ82は、次の使用中領域
65を示すように変更される。未使用領域92のリンク
ポインタ93は、次の未使用領域66を示すように変更
される。これらの変更により、第8図における未使用領
域81から使用中領域91を確保する手段が実現する。As the link pointer 82, the link pointer in the unused area 81 is used as is. 92 is an unused area 81
This is the unused area remaining after the in-use area 91 is removed from the area. 93 is a link pointer of the unused area 92. The link pointer 61 of the used area, the link pointer 62 of the unused area, the next used area 65, and the next unused area 66 match those shown in FIG. The in-use area link pointer 61 is changed to indicate the in-use area 91 that has been secured. The unused area link pointer 62 is changed to point to the next unused area 92. The link pointer 82 of the secured in-use area 91 is changed to point to the next in-use area 65. The link pointer 93 of the unused area 92 is changed to point to the next unused area 66. These changes realize means for securing the used area 91 from the unused area 81 in FIG. 8.
第10図〜第15図は、本発明における作業領域開放手
段16の実現方法を示す図である。作業領域開放手段1
6の対象となる使用中領域は、ヒープ領域13における
相対的な位置関係から、「直前が未使用領域であり直後
が使用中領域である場合」、「直前が使用中領域であり
直後が未使用領域である場合」、「前後が未使用領域の
場合」、「前後が使用中領域の場合」の4通りに分類で
きる。この4通りの他に、対象となる使用中領域がヒー
プ領域の先頭にある場合と、ヒープ領域の末尾にある場
合とがあるが、それぞれ、直前または直後が使用中領域
である場合と同様の手段により作業領域開放手段16が
実現される。10 to 15 are diagrams showing a method for realizing the work area opening means 16 in the present invention. Working area opening means 1
From the relative positional relationship in the heap area 13, the in-use area subject to step 6 is determined as follows: ``the immediately before is an unused area and the immediately after is an in-use area'', ``the immediately before is an in-use area and the immediately after is an unused area''. The area can be classified into four types: ``the area is in use'', ``the area before and after is unused area'', and ``the area before and after is in use''. In addition to these four cases, there are cases where the target in-use area is at the beginning of the heap area, and cases where it is at the end of the heap area. A working area opening means 16 is realized by the means.
第10図〜第11図は、対象となる使用中領域の直前が
未使用領域であり直後が使用中領域である場合の作業領
域開放手段16の実現方法を示す図である。FIGS. 10 and 11 are diagrams showing a method of implementing the work area opening means 16 when the area immediately before the target in-use area is an unused area and the area immediately after it is an in-use area.
第10図は、作業領域開放手段16を実行する直前のヒ
ープ領域の状態を示す概念図である。103は、対象と
なる使用中領域である。104は、使用中領域103の
リンクポインタである。101は、使用中領域103の
直前にある未使用領域である。102は、未使用領域1
01のリンクポインタである。105は、使用中領域1
03の直後にある使用中領域である。106は、使用中
領域105のリンクポインタである。61は、使用中領
域103を示す使用中領域のリンクポインタである。6
2は、未使用領域101を示す未使用領域のリンクポイ
ンタである。65は、使用中領域105のリンクポイン
タ106により示された、次の使用中領域またはヒープ
領域終端25である。FIG. 10 is a conceptual diagram showing the state of the heap area immediately before the work area release means 16 is executed. Reference numeral 103 indicates a target in-use area. 104 is a link pointer of the area in use 103. 101 is an unused area immediately before the currently used area 103. 102 is unused area 1
01 link pointer. 105 is the area in use 1
This is the currently used area immediately after 03. 106 is a link pointer of the area 105 in use. 61 is an in-use area link pointer indicating the in-use area 103. 6
2 is an unused area link pointer indicating the unused area 101. 65 is the next in-use area or heap area end 25 indicated by the link pointer 106 of the in-use area 105.
66は、未使用領域101のリンクポインタ102によ
り示された、次の未使用領域またはヒープ領域終端25
である。66 is the next unused area or heap area end 25 indicated by the link pointer 102 of the unused area 101.
It is.
第11図は、第10図の状態で使用中領域103を作業
領域開放手段16により開放した後の状態を示す図であ
る。61.62.65.66.105.106は、第1
0図におけるものと一致している。1工Iは、未使用領
域であって、第10図における未使用領域101と使用
中領域103を結合したものである。102は、未使用
領域111のリンクポインタであり、第10図における
未使用領域101のリンクポインタに対応している。使
用中領域のリンクポインタ61は、使用中領域105を
示すように変更される。この変更により、第10図にお
ける使用中領域103の未使用領域への還元が実現され
る。FIG. 11 is a diagram showing a state after the in-use area 103 is opened by the work area opening means 16 in the state shown in FIG. 61.62.65.66.105.106 is the first
This is consistent with that in Figure 0. 1 engineering I is an unused area, which is a combination of the unused area 101 and the used area 103 in FIG. 102 is a link pointer of the unused area 111, which corresponds to the link pointer of the unused area 101 in FIG. The in-use area link pointer 61 is changed to indicate the in-use area 105. With this change, the in-use area 103 in FIG. 10 can be returned to an unused area.
第12図〜第13図は、対象となる使用中領域の直前が
使用中領域であり直後が未使用領域である場合の作業領
域開放手段16の実現方法を示す図である。FIGS. 12 and 13 are diagrams showing a method for realizing the work area opening means 16 when the area immediately before the target area in use is the area in use and the area immediately after it is an unused area.
第12図は、作業領域開放手段16を実行する直前のヒ
ープ領域の状態を示す概念図である。123は、対象と
なる使用中領域である。124は、使用中領域123の
リンクポインタである。121は、使用中領域123の
直前にある使用中領域である。122は、使用中領域1
21のリンクポインタである。125は、使用中領域1
23の直後にある未使用領域である。126は、未使用
領域125のリンクポインタである。61は、使用中領
域121を示す使用中領域のリンクポインタである。6
2は、未使用領域125を示す未使用領域のリンクポイ
ンタである。65は、使用中領域123のリンクポイン
タ124により示された、次の使用中領域またはヒープ
領域終端25である。FIG. 12 is a conceptual diagram showing the state of the heap area immediately before the work area release means 16 is executed. 123 is a target in-use area. 124 is a link pointer of the area 123 in use. Reference numeral 121 indicates an in-use area immediately before the in-use area 123. 122 is the area in use 1
21 link pointers. 125 is the area in use 1
This is an unused area immediately after 23. 126 is a link pointer of the unused area 125. 61 is an in-use area link pointer indicating the in-use area 121. 6
2 is an unused area link pointer indicating the unused area 125. 65 is the next in-use area or heap area end 25 indicated by the link pointer 124 of the in-use area 123.
66は、未使用領域126のリンクポインタ126によ
り示された、次の未使用領域またはヒープ領域終端25
である。66 is the next unused area or heap area end 25 indicated by the link pointer 126 of the unused area 126.
It is.
第43図は、第12図の状態で使用中領域123を作業
領域開放手段16により開放した後の状態を示す図であ
る。61.62.65.66.12L 122は、第
12図におけるものと一致している。131は、未使用
領域であって、第12図における使用中領域123と未
使用領域125を結合したものである。124は、未使
用領域131のリンクポインタであり、第12図におけ
る使用中領域123のリンクポインタに対応している。FIG. 43 is a diagram showing a state after the in-use area 123 is opened by the work area opening means 16 in the state shown in FIG. 12. 61.62.65.66.12L 122 corresponds to that in FIG. Reference numeral 131 denotes an unused area, which is a combination of the used area 123 and the unused area 125 in FIG. 124 is a link pointer of the unused area 131, which corresponds to the link pointer of the used area 123 in FIG.
使用中領域121のリンクポインタ122は、次の使用
中領域65を示すように変更される。未使用領域のリン
クポインタ62は、未使用領域131を示すように変更
される。未使用領域131のリンクポインタ124は、
次の未使用領域66を示すように変更される。これらの
変更により、第12図における使用中領域123の未使
用領域への還元が実現される。The link pointer 122 of the area in use 121 is changed to point to the next area in use 65. The unused area link pointer 62 is changed to point to the unused area 131. The link pointer 124 of the unused area 131 is
It is changed to indicate the next unused area 66. By these changes, the in-use area 123 in FIG. 12 can be returned to an unused area.
第14図〜第15図は、対象となる使用中領域の前後が
未使用領域である場合の作業領域開放手段16の実現方
法を示す図である。FIGS. 14 and 15 are diagrams showing a method for implementing the work area opening means 16 when the area before and after the target in-use area is an unused area.
第14図は、作業領域開放手段16を実行する直前のヒ
ープ領域の状態を示す概念図である。143は、対象と
なる使用中領域である。144は、使用中領域143の
リンクポインタである。141は、使用中領域143の
直前にある未使用領域である。142は、未使用領域1
41のリンクポインタである。145は、使用中領域1
43の直後にある未使用領域である。146は、未使用
領域145のリンクポインタである。61は、使用中領
域143を示す使用中領域のリンクポインタである。6
2は、未使用領域141を示す未使用領域のリンクポイ
ンタである。65は、使用中領域143のリンクポイン
タ144により示された、次の使用中領域またはヒープ
領域終端25である。FIG. 14 is a conceptual diagram showing the state of the heap area immediately before the work area release means 16 is executed. 143 is a target in-use area. 144 is a link pointer of the area in use 143. 141 is an unused area immediately before the currently used area 143. 142 is unused area 1
41 link pointers. 145 is the area in use 1
This is an unused area immediately after 43. 146 is a link pointer of the unused area 145. 61 is an in-use area link pointer indicating the in-use area 143. 6
2 is an unused area link pointer indicating the unused area 141. 65 is the next in-use area or heap area end 25 indicated by the link pointer 144 of the in-use area 143.
66は、未使用領域145のリンクポインタ146によ
り示された、次の未使用領域またはヒープ領域終端25
である。66 indicates the next unused area or heap area end 25 indicated by the link pointer 146 of the unused area 145.
It is.
第15図は、第14図の状態で使用中領域143を作業
領域開放手段16により開放した後の状態を示す図であ
る。61.62.65.66は、第14図におけるもの
と一致している。151は、未使用領域であって、第1
4図における使用中領域143と未使用領域141およ
び未使用領域145を結合したものである。142は、
未使用領域151のリンクポインタであり、第14図に
おける未使用領域141のリンクポインタに対応してい
る。使用中領域のリンクポインタ61は、次の使用中領
域65を示すように変更される。未使用領域151のリ
ンクポインタ142は、次の未使用領域66を示すよう
に変更される。これらの変更により、第12図における
使用中領域123の未使用領域への還元が実現される。FIG. 15 is a diagram showing a state after the in-use area 143 is opened by the work area opening means 16 in the state shown in FIG. 61.62.65.66 match those in FIG. 151 is an unused area, and the first
This is a combination of the in-use area 143, the unused area 141, and the unused area 145 in FIG. 142 is
This is a link pointer of the unused area 151, and corresponds to the link pointer of the unused area 141 in FIG. The in-use area link pointer 61 is changed to indicate the next in-use area 65. The link pointer 142 of the unused area 151 is changed to point to the next unused area 66. By these changes, the in-use area 123 in FIG. 12 can be returned to an unused area.
もう一つの場合である、前後が使用中領域である場合の
作業領域開放手段16の実現方法は、第3図〜第4図に
おけるリンクポインタの変更方法により典型例で示した
。Another example of a method for implementing the work area opening means 16 in the case where the front and rear are in-use areas is shown as a typical example by the link pointer changing method in FIGS. 3 and 4.
[発明の効果コ以上に述べた発明によれば、使用中ポインタからのリン
クにより使用中領域を接続し、未使用ポインタからのリ
ンクにより未使用領域を接続することによって、各領域
の状態を判定するための情報を保持しておく領域が不必
要になり、結果として、ヒープ領域の効率的な使用を実
現した。とくに、小さな作業領域を数多く確保する場合
には、ヒープ領域を無駄に消費することがないので、よ
り多くの作業領域を確保することができるという効果を
有する。[Effects of the Invention] According to the invention described above, the status of each area can be determined by connecting used areas with links from used pointers and connecting unused areas with links from unused pointers. This eliminates the need for an area to hold the information used to store information, resulting in more efficient use of the heap area. In particular, when securing a large number of small work areas, the heap area is not wasted and therefore more work areas can be secured.
第1図から第15図は、本発明を示す図である。第1図は、本発明における、ヒープ領域の効率的な使用
手段を備えた電子計算機の概念図である。第2図から第4図は、本発明における、ヒーブ領域の状
態を示す1α念図である。第2図は、ヒープ領域初期化手段を実行した直後のヒー
プ領域の状態を示す概念図である。第3図は、ヒープ領域初期化手段を実行した後、作業領
域割当手段を3回続けて実行したときのヒープ領域の状
態を示す概念図である。第4図は、使用中領域を作業領域開放手段により未使用
の状態に戻したときのヒープ領域の状態を示す概念図で
ある。第5図は、本発明における、作業領域割当手段の概略を
示すフローチャートである。第6図は、作業領域割当手段において確保する作業領域
の大きさと未使用領域の大きさが一致した場合に、リン
クポインタを変更する手段を実行する前のヒープ領域の
様子を示す概念図である。第7図は、第6図の状態にある時に、リンクポインタを
変更する手段を実行した後のヒープ領域の様子を示す概
念図である。第8図は、作業領域割当手段において確保する作業領域
の大きさよりも未使用領域の大きさの方が大きい場合に
、リンクポインタを変更する手段を実行する前のヒープ
領域の様子を示す概念図である。第9図は、第8図の状態にある時に、リンクポインタを
変更する手段を実行した後のヒープ領域13の様子を示
す概念図である。第10図は、対象となる使用中領域の直前が未使用領域
であり直後が使用中領域である場合に、作業領域開放手
段を実行する直前のヒープ領域の状態を示す概念図であ
る。第11図は、第10図の状態で、使用中領域を作業領域
rA放平手段より開放した後の状態を示す図である。第12図は、対象となる使用中領域の直前が使用中領域
であり直後が未使用領域である場合に、作業領域開放手
段を実行する直前のヒープ領域の状態を示す概念図であ
る。第13図は、第12図の状態で、使用中領域を作業領域
開放手段により開放した後の状態を示す図である。第14図は、対象となる使用中領域の前後が未使用領域
である場合に、作業領域開放手段を実行する直前のヒー
プ領域の状態を示す概念図である。第1.5図は、第14図の状態で、使用中領域を作業領
域開放手段により開放した後の状態を示す図である。11・・・・・・処理装置12・・・・・・主記憶13・・・・・・ヒープ領域14・・・・・・ヒープ領域初期化手段15・・・・・
・作業領域割当手段16・・・・・・作業領域開放手段21・・・・・・使用中ポインタ22・・・・・・未使用ポインタ23・・・・・・未使用領域(初期状態)24・・・・
・・未使用領域23のリンクポインタ25・・・・・・
ヒープ領域終端31・・・・・・使用中領域(1回目で確保された)3
2・・・・・・使用中領域31のリンクポインタ33・
・・・・・使用中領域(2回目で確保された)34・・
・・・・使用中領域33のリンクポインタ35・・・・
・・使用中領域(3回目で確保された)36・・・・・
・使用中領域35のリンクポインタ37・・・・・・未
使用領域(残りの領域)38・・・・・・未使用領域3
7のリンクポインタ41・・・・・・未使用領域(開放
された領域)42・・・・・・未使用領域41のリンク
ポインタ51・・・・・・最初の未使用領域の大きさを
求める処理52・・・・・・未使用領域が十分な大きさかどうかを
判断する処理53・・・・・・最後の未使用領域であるか否かを判断
する処理54・・・・・・次の未使用領域の大きさを求める処理55・・・・・・ヒープ領域が不足していることをエラ
ーで返す処理56・・・・・・未使用領域から作業領域を確保するた
めにリンクポインタを変更する処理57・・・・・・確保した使用中領域のアドレスを返す
処理61・・・・・・使用中領域のリンクポインタ62・・
・・・・未使用領域のリンクポインタ63・・・・・・
未使用領域64・・・・・・未使用領域63のリンクポインタ65
・・・・・・次の使用中領域66・・・・・・次の未使用領域71・・・・・・確保した使用中領域81・・・・・・未使用領域82・・・・・・未使用領域81のリンクポインタ91
・・・・・・確保した使用中領域92・・・・・・未使用領域93・・・・・・未使用領域92のリンクポインタ10
1・・・直前の未使用領域102・・・未使用領域102のリンクポインタ103
・・・開放する使用中領域104・・・使用中領域103のリンクポインタ105
・・・直後の使用中領域106・・・使用中領域105のリンクポインタ第1図111・・・開放された未使用領域121・・・直前の使用中領域122・・・使用中領域121のリンクポインタ123
・・・開放する使用中領域124・・・使用中領域123のリンクポインタ125
・・・直後の未使用領域126・・・未使用領域125のリンクポインタ131
・・・開放された未使用領域141・・・直前の未使用領域142・・・未使用領域141のリンクポインタ143
・・・開放する使用中領域144・・・使用中領域143のリンクポインタ145
・・・直後の未使用領域148・・・未使用領域145のリンクポインタ151
・・・開放された未使用領域以上1 to 15 are diagrams illustrating the present invention. FIG. 1 is a conceptual diagram of an electronic computer equipped with means for efficiently using a heap area according to the present invention. FIGS. 2 to 4 are 1α conceptual diagrams showing the state of the heave region in the present invention. FIG. 2 is a conceptual diagram showing the state of the heap area immediately after executing the heap area initialization means. FIG. 3 is a conceptual diagram showing the state of the heap area when the work area allocation means is executed three times in succession after the heap area initialization means is executed. FIG. 4 is a conceptual diagram showing the state of the heap area when the in-use area is returned to an unused state by the work area release means. FIG. 5 is a flowchart showing an outline of the work area allocating means in the present invention. FIG. 6 is a conceptual diagram showing the state of the heap area before executing the means for changing the link pointer when the size of the work area secured by the work area allocation means matches the size of the unused area. . FIG. 7 is a conceptual diagram showing the state of the heap area after executing the means for changing the link pointer in the state shown in FIG. 6. FIG. 8 is a conceptual diagram showing the state of the heap area before executing the means for changing the link pointer when the size of the unused area is larger than the size of the work area secured by the work area allocation means. It is. FIG. 9 is a conceptual diagram showing the state of the heap area 13 after executing the means for changing the link pointer in the state shown in FIG. 8. FIG. 10 is a conceptual diagram showing the state of the heap area immediately before executing the work area release means when the area immediately before the target in-use area is an unused area and the area immediately after it is an in-use area. FIG. 11 is a diagram showing a state after the area in use is opened by the work area rA leveling means in the state shown in FIG. 10. FIG. 12 is a conceptual diagram showing the state of the heap area immediately before executing the work area release means when the area immediately before the target in-use area is the in-use area and the area immediately after it is the unused area. FIG. 13 is a diagram showing a state after the area in use is opened by the work area opening means in the state shown in FIG. 12. FIG. 14 is a conceptual diagram showing the state of the heap area immediately before executing the work area release means when there are unused areas before and after the target in-use area. FIG. 1.5 is a diagram showing a state after the in-use area is opened by the work area opening means in the state shown in FIG. 14. 11... Processing device 12... Main memory 13... Heap area 14... Heap area initialization means 15...
・Work area allocation means 16...Work area release means 21...Used pointer 22...Unused pointer 23...Unused area (initial state) 24...
...Link pointer 25 of unused area 23...
End of heap area 31... Area in use (secured at the first time) 3
2... Link pointer 33 of the area in use 31.
... Area in use (secured on the second try) 34...
...Link pointer 35 of area in use 33...
...Used area (secured on the third try) 36...
・Link pointer 37 of used area 35... Unused area (remaining area) 38... Unused area 3
Link pointer 41 of 7... Unused area (released area) 42... Link pointer 51 of unused area 41... Size of the first unused area Process for determining 52... Process for determining whether the unused area is large enough 53... Process for determining whether it is the last unused area 54... Process to find the size of the next unused area 55... Process to return an error that the heap area is insufficient 56... Link to secure a work area from the unused area Process for changing the pointer 57... Process for returning the address of the reserved area in use 61... Link pointer for the area in use 62...
...Link pointer 63 of unused area...
Unused area 64...Link pointer 65 of unused area 63
...Next used area 66...Next unused area 71...Secured used area 81...Unused area 82... ...Link pointer 91 of unused area 81
...Secured used area 92...Unused area 93...Link pointer 10 of unused area 92
1... Previous unused area 102... Link pointer 103 of unused area 102
...Used area 104 to be released...Link pointer 105 of in-use area 103
...Immediately following in-use area 106...Link pointer of in-use area 105 Fig. 1 111... Released unused area 121... Immediately before in-use area 122... Link pointer of in-use area 105 Link pointer 123
... In-use area 124 to be released... Link pointer 125 of in-use area 123
... Unused area 126 immediately after... Link pointer 131 of unused area 125
. . . Released unused area 141 . . . Immediately before unused area 142 . . . Link pointer 143 of unused area 141
... In-use area 144 to be released... Link pointer 145 of in-use area 143
... Unused area 148 immediately after... Link pointer 151 of unused area 145
・・・More than released unused area
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP14247389AJPH036755A (en) | 1989-06-05 | 1989-06-05 | Electronic computer |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP14247389AJPH036755A (en) | 1989-06-05 | 1989-06-05 | Electronic computer |
| Publication Number | Publication Date |
|---|---|
| JPH036755Atrue JPH036755A (en) | 1991-01-14 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP14247389APendingJPH036755A (en) | 1989-06-05 | 1989-06-05 | Electronic computer |
| Country | Link |
|---|---|
| JP (1) | JPH036755A (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6344977B1 (en) | 1999-10-20 | 2002-02-05 | Fujitsu Limited | Foldaway electronic device and flexible cable for same |
| JP2013073594A (en)* | 2011-09-29 | 2013-04-22 | Fujitsu Ltd | Storage device, control device and storage device control method |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6344977B1 (en) | 1999-10-20 | 2002-02-05 | Fujitsu Limited | Foldaway electronic device and flexible cable for same |
| US6738264B2 (en) | 1999-10-20 | 2004-05-18 | Fujitsu Limited | Foldaway electronic device and flexible cable for same |
| US6788551B2 (en) | 1999-10-20 | 2004-09-07 | Fujitsu Limited | Foldaway electronic device and flexible cable for same |
| US6982880B2 (en) | 1999-10-20 | 2006-01-03 | Fujitsu Limited | Foldaway electronic device and flexible cable for same |
| JP2013073594A (en)* | 2011-09-29 | 2013-04-22 | Fujitsu Ltd | Storage device, control device and storage device control method |
| Publication | Publication Date | Title |
|---|---|---|
| US5420999A (en) | Free memory cell management | |
| KR930010981A (en) | Storage device using flash memory | |
| JPH08195093A (en) | File controller for nonvolatile memory | |
| KR101263307B1 (en) | Method and device to improve USB flash write performance | |
| JPH036755A (en) | Electronic computer | |
| JPS608557B2 (en) | Computer with programmable read-only memory | |
| JP3471838B2 (en) | How to manage circular sequential files | |
| JPS5952334A (en) | DMA transfer method | |
| JPS61296455A (en) | How to determine memory size | |
| EP0488780A2 (en) | Portable storage device | |
| JPS5987567A (en) | Variable length data storage controlling system | |
| JP2969776B2 (en) | Data identification method | |
| JPS617874A (en) | Display unit | |
| JPS62108346A (en) | Inter-process communication system | |
| JPS60169946A (en) | Task control method | |
| JPH04325993A (en) | Memory card | |
| JPH01219941A (en) | Memory management system for microprocessor system | |
| JPH02232883A (en) | Floppy disk reorganizing device | |
| JPH0289119A (en) | data processing equipment | |
| JPS60176144A (en) | Register file device | |
| JPS60196858A (en) | Input processor of data with label | |
| JPS61251955A (en) | System for preventing competition of common memory | |
| JPS60176106A (en) | Sequence controller | |
| JPH0546412A (en) | Multitask controller | |
| JPS6488818A (en) | Memory structure |