JPH06309197A - Storage area management system - Google Patents

Storage area management system

Info

Publication number
JPH06309197A
JPH06309197A JP5098044A JP9804493A JPH06309197A JP H06309197 A JPH06309197 A JP H06309197A JP 5098044 A JP5098044 A JP 5098044A JP 9804493 A JP9804493 A JP 9804493A JP H06309197 A JPH06309197 A JP H06309197A
Authority
JP
Japan
Prior art keywords
block
hole
free list
size
management data
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
JP5098044A
Other languages
Japanese (ja)
Other versions
JP3353376B2 (en
Inventor
Hisayoshi Kurosawa
寿好 黒沢
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.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP09804493A priority Critical patent/JP3353376B2/en
Publication of JPH06309197A publication Critical patent/JPH06309197A/en
Application granted granted Critical
Publication of JP3353376B2 publication Critical patent/JP3353376B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

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

Abstract

PURPOSE:To increase the processing speed by providing a block management table, which corresponds to divided blocks in 1:1, with flags indicating not only the sizes or the like but also whether pertinent blocks are used at present or not. CONSTITUTION:When a release request of a block 22 is generated, information of block management data B21 of a block 21 just preceding the block 22 is checked, and it is connected to the just preceding hole because flag information is F. Next, block management data B32 of a block 32 obtained from size information of block management data B23 of a block 23 is checked, and it is connected to the just succeeding hole because flag information is F, thus completing the release processing. When a release request of a block 15 is generated, block management data B15 is connected to the start of a free list and flag information is changed to F because flag information of block management data B14 of a block 14 is not F. Then, the release processing is completed because flag information of block management data B16 of a block 16 is not F.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、OS内の処理時間を保
証することを目的としたリアルタイムOSに関し、特に
任意サイズのメモリ割付及び解放を可能とするリアルタ
イムOSのメモリ管理方式に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a real-time OS intended to guarantee processing time in the OS, and more particularly to a memory management system for the real-time OS which enables memory allocation and release of arbitrary size.

【0002】[0002]

【従来の技術】一般にリアルタイムOSでは、メモリの
効率的な管理及び利用者の要求に対する高速な応答性を
確保するために、メモリをある固定サイズのブロックで
区切り、利用者へ現在割り当てている使用中ブロック
と、割当てていない空きブロック(または使用可能ブロ
ック)とに分けて管理している。メモリ割り当て要求時
には要求サイズを満たす連続した空きブロック(以降一
つ以上の連続した空きブロックをホールと呼ぶ)を検出
し、要求サイズ分を利用者へ割り当てる。残部は新しい
ホールとして管理する。メモリ解放要求時には全空きブ
ロック中での解放位置を検出し、ブロックの断片化を防
止するため、解放要求のあるメモリ域の前後のホールと
連続しているならば結合し、新しいホールとして管理す
る。
2. Description of the Related Art Generally, in a real-time OS, in order to efficiently manage the memory and ensure high-speed responsiveness to the user's request, the memory is divided into blocks of a fixed size and currently allocated to the user. The medium blocks and the unallocated free blocks (or usable blocks) are managed separately. At the time of memory allocation request, continuous empty blocks satisfying the requested size (hereinafter, one or more continuous empty blocks are called holes) are detected, and the requested size is allocated to the user. The rest will be managed as a new hole. When a memory release request is made, the release position in all free blocks is detected, and in order to prevent block fragmentation, the holes before and after the memory area where the release request is made are combined and managed as a new hole. .

【0003】従来、このようなホールの管理として、1
989年4月21日株式会社アスキー出版の「MINI
Xオペレーティングシステム」242ページ〜244ペ
ージに記載の方式がある。この方式の1例として、図1
5にリアルタイムOSの保持する管理データと、メモリ
との関係を示す。図15において、1はメモリを概念的
に示したもので、斜線部分がホール、白抜き部分が既に
割当済みのメモリブロックである。41は1つのホール
に対して1つ対応付けられているホール管理テーブルで
あり、そのホールのサイズ及び次のホールを指すポイン
タを持つ。3は上記ホール管理テーブル41からなるリ
ストの先頭を指すフリーリストである。リアルタイムO
Sはメモリ確保要求が発生するとフリーリスト3をもと
に検索し、要求サイズを満たすホールを検出する。この
検出したホールが要求サイズと等しい時には、フリーリ
スト3からホールを取り出し、利用者へ割り当てる。ま
た、検出したホールが要求サイズより大きい時には、要
求サイズ分利用者へ割り当て、ホールのサイズから要求
サイズを差し引く。一方、メモリの解放要求が発生する
とフリーリスト3を順に検索し、解放ホールの前後に連
続するホールがあるかを検出する。前後に連続するホー
ルがある場合にはそのホールをフリーリスト3から取り
外し、解放ホールと連結した後、再度フリーリスト3へ
繋げる。
Conventionally, the management of such a hole is 1
April 21, 989 "MINI
X operating system ”on pages 242 to 244. As an example of this method, FIG.
5 shows the relationship between the management data held by the real-time OS and the memory. In FIG. 15, reference numeral 1 denotes a memory conceptually, in which the shaded area is a hole and the white area is a memory block that has already been allocated. Reference numeral 41 is a hole management table associated with one hole, and has a size of the hole and a pointer pointing to the next hole. Reference numeral 3 is a free list that points to the beginning of the list including the hole management table 41. Real time O
When a memory reservation request occurs, S searches based on the free list 3 and detects a hole satisfying the requested size. When the detected hole is equal to the required size, the hole is taken out from the free list 3 and assigned to the user. When the detected hole is larger than the requested size, the requested size is allocated to the user and the requested size is subtracted from the size of the hole. On the other hand, when a memory release request is issued, the free list 3 is sequentially searched to detect whether there are consecutive holes before and after the released hole. If there is a continuous hole before and after, remove that hole from the free list 3, connect it to the open hole, and connect it to the free list 3 again.

【0004】[0004]

【発明が解決しようとする課題】ところが上記メモリ管
理方式においては、メモリの割当時には要求サイズを満
たすホールを検出するために、また解放時には、前後の
ホールとの連結のために解放メモリ域の解放位置を検出
するために、フリーリストの探索が必要であった。その
ため、フリーリストの先頭近くに所望のホールが繋がれ
ている場合には高速だが、最後尾に近いホールで初めて
所望のホールが検出される場合には検索時間が長くな
り、CPUの占有時間が長くなるという問題があった。
However, in the memory management method described above, the released memory area is released in order to detect a hole satisfying the required size when allocating the memory and to connect with the holes before and after when releasing the memory. A search of the free list was required to find the location. Therefore, the speed is high when the desired hole is connected near the beginning of the free list, but the search time becomes long when the desired hole is detected for the first time near the end of the free list, and the CPU occupation time is long. There was a problem that it would be long.

【0005】本発明は上記問題点を鑑みてなされたもの
で、メモリ割り当て及び解放時に、フリーリストの検索
を不要とし、効率の良いメモリ管理を提供するものであ
る。
The present invention has been made in view of the above problems, and it is an object of the present invention to provide efficient memory management by eliminating the need to search the free list when allocating and releasing memory.

【0006】[0006]

【課題を解決するための手段】請求項1に記載の発明に
係る記憶領域管理方式は、記憶装置を固定長サイズのブ
ロックに分割して、使用中のブロックと未使用のブロッ
クに分け、一つ以上の連続した未使用のブロックをホー
ルとして管理する記憶領域管理方式において、下記の要
素を有するものである。 (a)前記ホールをリストとして管理するためのフリー
リスト (b)分割されたブロックに対応して存在し、少なくと
もそのサイズと次ホールの先頭を指すポインターと使用
中か否かを示すフラグを格納するブロック管理テーブル (c)記憶領域の解放時に解放するブロックの前後の前
記フラグを参照してそのブロックがホールか否かを判定
する手段 (d)前記フラグの状態を判定する手段により判定した
結果を用いてブロック管理テーブルをメンテナンスする
手段。
A storage area management system according to a first aspect of the present invention divides a storage device into blocks of a fixed length size, and divides the blocks into a used block and an unused block. The storage area management method for managing one or more continuous unused blocks as holes has the following elements. (A) Free list for managing the hole as a list (b) Stores at least the size of the block, a pointer indicating the beginning of the next hole, and a flag indicating whether the block is in use Block management table (c) A means for determining whether or not the block is a hole by referring to the flags before and after the block to be released when the storage area is released (d) A result of determination by the means for determining the state of the flag A means for maintaining the block management table using.

【0007】請求項2に記載の発明に係る記憶領域管理
方式は、記憶装置を固定長サイズのブロックに分割し
て、使用中のブロックと未使用のブロックに分け、一つ
以上の連続した未使用のブロックをホールとして管理す
る記憶領域管理方式において、下記の要素を有するもの
である。 (a)前記ホールをリストとして管理するN個のフリー
リストからなるフリーリスト群 (b)前記フリーリストよりポイントされ、ホールを管
理する少なくともそのサイズ、次のホールを示すための
ポインターおよび対応する記憶装置上のアドレスから成
るホール管理データ群 (c)前記フリーリスト群のk番目のフリーリストには
下記の式を満足するホールを管理する前記ホール管理デ
ータをポインターで接続する手段 0≦k≦N、 2k ≦ ホールのサイズ <2k+1 (d)記憶領域の割当処理時において下記の式を満足す
るフリーリストnにポイントされている先頭のホールを
割り当てる手段。 1≦n≦N、 2n-1 ≦ 割り当てる記憶サイズ <2
n
According to a second aspect of the storage area management system of the present invention, the storage device is divided into blocks of a fixed length size, and is divided into a block in use and an unused block, and one or more continuous blocks The storage area management method for managing used blocks as holes has the following elements. (A) A free list group consisting of N free lists for managing the holes as a list (b) At least the size of the holes to be managed by the free list, a pointer for indicating the next hole, and a corresponding memory Hole management data group consisting of addresses on the device (c) Means for connecting the hole management data for managing holes satisfying the following formula to the k-th free list of the free list group by a pointer 0 ≦ k ≦ N , 2 k ≤ hole size <2 k + 1 (d) Means for allocating the first hole pointed to the free list n satisfying the following expression during the memory area allocation processing. 1 ≤ n ≤ N, 2 n-1 ≤ storage size to be allocated <2
n

【0008】請求項3に記載の発明に係る記憶領域管理
方式は、前記請求項2に記載の発明に加えて、前記フリ
ーリスト群の各々に前記ホール管理データが存在するか
否かを示すフラグを有するリスト管理テーブルを前記フ
リーリスト群に対応して設けたものである。
A storage area management system according to a third aspect of the present invention is, in addition to the invention according to the second aspect, a flag indicating whether or not the hole management data exists in each of the free list groups. A list management table having the above is provided corresponding to the free list group.

【0009】[0009]

【作用】請求項1に記載の発明に係る記憶領域管理方式
においては、分割されたブロックと1対1に対応するブ
ロック管理テーブルにサイズ等と共に使用中か否かを示
すフラグを設けたことに特徴がある。このことにより、
記憶領域の解放時に解放する領域の前後のブロックのフ
ラグを参照して解放処理を行うことができるので処理の
高速化が図れる。
In the storage area management system according to the first aspect of the present invention, the block management table corresponding to the divided blocks on a one-to-one basis is provided with a flag indicating the size and the like and whether the block is in use. There are features. By this,
When the storage area is released, the release processing can be performed by referring to the flags of blocks before and after the area to be released, so that the processing speed can be increased.

【0010】請求項2に記載の発明に係る記憶領域管理
方式においては、ホールのサイズを(2n ≦ ホールの
サイズ <2n+1 )の区分で分類し、nを指標として持
つフリーリストの群である冪乗番号リストを設けたこと
に特徴がある。このようにして記憶領域の割り当て要求
時には要求サイズを満たすホールの繋がれている冪乗番
号リストを要求サイズから求め、そのリストの先頭ホー
ルを所望のホールとしてリストからはずし、要求サイズ
を割り当てた後、残部を再度冪乗番号リストへ返却す
る。記憶領域の解放要求時には、解放要求の前後のホー
ルと連結可能であれば、連結し、その後解放領域のサイ
ズから繋げるべき冪乗番号リストを求め、そのリストの
最後尾に繋げる。このようにして特に記憶領域の割り当
て処理の高速化が図れる。
In the storage area management system according to the second aspect of the present invention, the size of holes is classified by the division of (2 n ≤ hole size <2 n + 1 ) and n of the free list is used as an index. It is characterized by having a group of power numbers. In this way, at the time of requesting the allocation of the storage area, the exponentiation number list in which holes satisfying the required size are connected is obtained from the requested size, the first hole of the list is removed from the list as the desired hole, and the requested size is assigned. , The rest is returned to the power number list again. At the time of requesting the release of the storage area, if the holes before and after the release request can be connected, they are connected, and then a power number list to be connected is obtained from the size of the release area, and connected to the end of the list. In this way, the speed of the storage area allocation process can be increased.

【0011】請求項3に記載の発明に係る記憶領域管理
方式においては、請求項2に記載の発明に加えて、フリ
ーリスト群の各々に対応したリスト管理テーブルを設け
たことに特徴がある。このことにより所望のホールの繋
がれている冪乗番号リストを検出するために、冪乗リス
トの探索ではなく、リスト管理テーブルのフラグチェッ
クにより可能として、更なる処理の高速化を可能とす
る。
The storage area management system according to the invention of claim 3 is characterized in that, in addition to the invention of claim 2, a list management table corresponding to each free list group is provided. In this way, in order to detect the exponentiation number list in which a desired hole is connected, it is possible not to search the exponentiation list but to check the flag of the list management table, and further speed up the processing.

【0012】[0012]

【実施例】【Example】

実施例1 本発明の1実施例について説明する。図1は、本発明に
係る記憶領域管理方式における、管理データ及びメモリ
との関連図であり、図において1は概念的に記述したメ
モリで、従来例と同じく一定サイズのブロックに分割さ
れ、使用中のブロック(白抜き部分)と未使用のブロッ
ク(斜線部分)に分かれ、連続した未使用ブロックは1
つのホールとして管理されている。
Example 1 One example of the present invention will be described. FIG. 1 is a diagram showing a relation between management data and a memory in a storage area management system according to the present invention. In the figure, 1 is a conceptually described memory, which is divided into blocks of a constant size as in the conventional example and is used. Divided into inner blocks (outlined parts) and unused blocks (hatched parts), consecutive unused blocks are 1
It is managed as one hall.

【0013】2は上記ブロックの個々に対応付けられた
ブロック管理データ群で、次のホールの先頭ブロックの
ブロック管理データを指し示すnextと、ホールのサ
イズを示すsizeと、ホールの最後尾ブロックならF
が、それ以外ならUが、格納されているflagの情報
から構成される。
Reference numeral 2 is a block management data group associated with each of the above blocks. Next indicates the block management data of the first block of the next hole, size indicating the size of the hole, and F for the last block of the hole.
Otherwise, U is composed of the stored flag information.

【0014】3はホールを繋げたリストの先頭ブロック
管理データを指し示すフリーリストである。本実施例に
おいてメモリの割り付け発生時の処理は従来例と同じ
く、フリーリストの検索によって所望のホールを検出す
る。
Reference numeral 3 is a free list indicating the head block management data of the list in which holes are connected. In the present embodiment, when the memory allocation occurs, the desired hole is detected by searching the free list as in the conventional example.

【0015】次にメモリ領域の解放要求が発生した時の
メモリ管理の動作について図1及び図2のフローチャー
トに沿って説明する。図1において例えばブロック22
(対応するブロック管理データは図1のB22)の解放
要求が発生した場合、まず、ブロック22の直前のブロ
ック21のブロック管理データB21の情報を調べ(ス
テップ10)、flag情報がFであるため(ステップ
11)、直前のホールと連結するために図3のフローチ
ャートに示す処理を行なう(ステップ12)。
Next, the operation of memory management when a memory area release request occurs will be described with reference to the flowcharts of FIGS. 1 and 2. In FIG. 1, for example, block 22
When the release request (corresponding block management data is B22 in FIG. 1) is generated, first, the information of the block management data B21 of the block 21 immediately before the block 22 is checked (step 10), and the flag information is F. (Step 11), the process shown in the flowchart of FIG. 3 is performed to connect with the immediately preceding hole (Step 12).

【0016】次に、ブロック22の直後のブロック23
のブロック管理データB23のsize情報から求めら
れるブロック32のブロック管理データB32を調べ
(ステップ13)、flag情報がFであるため(ステ
ップ14)、直後のホールと連結するために図4のフロ
ーチャートに示す処理を行ない(ステップ15)、解放
処理を完了する。
Next, block 23 immediately after block 22
Check the block management data B32 of the block 32 obtained from the size information of the block management data B23 (step 13). Since the flag information is F (step 14), the flow chart of FIG. The process shown is performed (step 15), and the release process is completed.

【0017】また、ブロック15(対応するブロック管
理データは図1のB15)の解放要求が発生した場合、
ステップ11にてブロック14のブロック管理データB
14のflag情報がFでないため、ステップ16でフ
リーリストの先頭にブロック管理データB15を繋げ、
flag情報をFに変更する。また、ステップ14にて
ブロック16のブロック管理データB16のflag情
報がFでないため、そのまま解放処理を完了する。図5
にブロック15の解放処理を実施した後のブロック管理
テーブルとメモリの関係図を示す。
When a release request for block 15 (corresponding block management data is B15 in FIG. 1) is issued,
Block management data B of block 14 in step 11
Since the flag information of 14 is not F, the block management data B15 is connected to the beginning of the free list in step 16.
Change the flag information to F. Further, since the flag information of the block management data B16 of the block 16 is not F in step 14, the releasing process is completed as it is. Figure 5
FIG. 9 shows a relationship diagram between the block management table and the memory after the block 15 is released.

【0018】次に図2のステップ12における直前のホ
ール(ブロック21)との連結を図3のフローチャート
に沿って説明する。直前のホールとの連結は、直前のホ
ールの先頭ブロック管理データB21のnext情報を
そのまま利用することにより、フリーリストへの挿入は
不要となる。
Next, the connection with the immediately preceding hole (block 21) in step 12 of FIG. 2 will be described with reference to the flowchart of FIG. In connection with the immediately preceding hole, the next information of the leading block management data B21 of the immediately preceding hole is used as it is, so that insertion into the free list is unnecessary.

【0019】そこでまず、直前のホールの先頭ブロック
管理データB21のsize情報に解放領域のサイズ1
を加える(ステップ20)。そして、ブロック管理デー
タB21のflag情報をクリアし(ステップ21)、
解放領域の最後尾ブロック管理データB22のflag
情報にFをセットし(ステップ22)、直前ホールとの
連結処理を完了する。
Therefore, first, in the size information of the leading block management data B21 of the immediately preceding hole, the size 1 of the release area is set.
Is added (step 20). Then, the flag information of the block management data B21 is cleared (step 21),
Flag of the last block management data B22 of the release area
F is set to the information (step 22), and the connecting process with the immediately preceding hole is completed.

【0020】次に図2のステップ15における直後のホ
ール(ブロック23〜32)との連結を図4のフローチ
ャートに沿って説明する。図2のステップ11による直
前のホールとの連結処理の有無に係わらず、解放領域は
既にフリーリストに繋がれているため、フリーリストで
利用するnext情報は解放領域の先頭ブロック管理デ
ータB21ものを利用すれば良い。
Next, the connection with the holes (blocks 23 to 32) immediately after step 15 in FIG. 2 will be described with reference to the flowchart in FIG. The free area is already linked to the free list regardless of the presence / absence of connection processing with the immediately preceding hole in step 11 of FIG. 2, so the next information used in the free list is the first block management data B21 of the free area. You can use it.

【0021】そこでまず、直後のホールの先頭ブロック
管理データB23をフリーリストからはずし(ステップ
30)、解放領域の先頭ブロック管理データB21のs
ize情報にブロック管理データB23のsize情報
である10を加える(ステップ31)。そして、解放領
域の最後尾ブロック管理データB22のflag情報を
クリアする(ステップ32)。図6にブロック22を解
放処理した結果、得られるブロック管理テーブルとメモ
リの関連図を示す。
Therefore, first, the head block management data B23 of the immediately following hole is removed from the free list (step 30), and s of the head block management data B21 of the released area is deleted.
10 which is the size information of the block management data B23 is added to the size information (step 31). Then, the flag information of the last block management data B22 of the release area is cleared (step 32). FIG. 6 shows a relational diagram of the block management table and the memory obtained as a result of the release processing of the block 22.

【0022】実施例2 次に本発明に係る他の実施例について説明する。図7
は、本実施例に係るメモリ管理における、管理データ及
びメモリとの関連図であり、図において1はメモリを示
し、割当済みの使用中メモリブロック(白抜部分)と、
未使用ブロックの集まりであるホール(斜線部分)で満
たされている。41は、従来例と同じくホールを管理す
るための管理データで、少くともホールのサイズとメモ
リブロックを示すアドレス及びリストを構成するための
ポインタからなる。
Embodiment 2 Next, another embodiment according to the present invention will be described. Figure 7
FIG. 3 is a relational diagram of management data and memory in the memory management according to the present embodiment. In FIG. 1, reference numeral 1 denotes a memory, and allocated memory blocks in use (white areas),
It is filled with holes (shaded areas) that are a collection of unused blocks. Reference numeral 41 is management data for managing holes as in the conventional example, which is composed of at least a hole size, an address indicating a memory block, and a pointer for forming a list.

【0023】42は、フリーリスト群であり、ホールの
サイズを2n 〜2n+1 で区切り、各n毎に一つのフリー
リストを構成している。ここでは説明を簡単にするため
に、図7に示すように、メモリは32のブロックから構
成され、サイズ1、2、5、6、10のホールがそれぞ
れ一つずつ存在しているものと仮定する。また、フリー
リストの個数は、32=25 であるため5つのリストか
ら構成すれば良く、フリーリスト0にはサイズ1のホー
ルが、フリーリスト1にはサイズ2〜3のホールが、フ
リーリスト2にはサイズ4〜7のホールが、フリーリス
ト3にはサイズ8〜15のホールが、フリーリスト4に
はサイズ16〜31のホールがそれぞれ繋がれる。
Reference numeral 42 denotes a free list group, which divides the size of holes by 2 n to 2 n + 1 to form one free list for each n. Here, for simplification of explanation, it is assumed that the memory is composed of 32 blocks and that there is one hole of size 1, 2, 5, 6, and 10 as shown in FIG. To do. Further, since the number of free lists is 32 = 2 5 , it may be composed of five lists. Free list 0 has holes of size 1 and free list 1 has holes of sizes 2-3. 2, holes 4 to 7 are connected to the free list 3, holes 8 to 15 are connected to the free list 3, and holes 16 to 31 are connected to the free list 4.

【0024】このような状態において、サイズ5のメモ
リ割り当て要求が発生した時の動作を図7及び図8のフ
ローチャートに沿って説明する。まず、サイズ5の割当
を確実に満たすことのできるホールを持つフリーリスト
の番号を求める(ステップ50)。この時、求めるフリ
ーリストの番号をnとすれば、2n-1 ≦要求サイズ<2
n を満たすnを求めれば良い。これは5を2進表記した
時の最上位ビット番号に1を加えた値、即ちn=3とな
る。
In such a state, the operation when a memory allocation request of size 5 occurs will be described with reference to the flowcharts of FIGS. 7 and 8. First, the number of the free list having holes that can surely satisfy the size 5 allocation is obtained (step 50). At this time, if the number of the desired free list is n, 2 n-1 ≦ request size <2
It suffices to find n that satisfies n. This is a value obtained by adding 1 to the most significant bit number when 5 is represented in binary, that is, n = 3.

【0025】次にステップ50にて求めたn=3がフリ
ーリストの番号の上限を越えているかをチェックする
(ステップ51)。本実施例の場合フリーリストの番号
の上限値は4であり、nは上限値を越えていないため、
フリーリスト3にホールが繋がれているかをチェックす
る(ステップ52)。本実施例では、フリーリスト3に
はホールが繋がれているため、フリーリスト3の先頭の
ホール管理データを取り外し(ステップ53)、このホ
ールのサイズが要求サイズ5より大きいかをチェックす
る(ステップ54)。本実施例の場合、ホール管理デー
タのサイズは10であり、要求サイズ5より大きいた
め、ホール管理データのサイズを要求サイズ分減算して
5にセットする(ステップ55)。次に、この残ホール
管理データを繋げるべきフリーリストの番号を求める
(ステップ56)。この時、求めるフリーリストの番号
をnとすれば、2n ≦ホールの残サイズ<2n+1 を満た
すnを求めれば良い。これは5を2進表記した時の最上
位ビット番号の値、即ちn=2となる。
Next, it is checked whether n = 3 obtained in step 50 exceeds the upper limit of the free list number (step 51). In the case of this embodiment, the upper limit value of the number of the free list is 4, and since n does not exceed the upper limit value,
It is checked whether a hole is connected to the free list 3 (step 52). In this embodiment, since holes are linked to the free list 3, the hole management data at the beginning of the free list 3 is removed (step 53), and it is checked whether the size of this hole is larger than the required size 5 (step 53). 54). In the case of the present embodiment, the size of the hole management data is 10, which is larger than the requested size 5, so the size of the hole management data is subtracted by the requested size and set to 5 (step 55). Next, the number of the free list to which the remaining hole management data should be connected is obtained (step 56). At this time, if the number of the desired free list is n, then n satisfying 2 n ≦ remaining hole size <2 n + 1 may be obtained. This is the value of the most significant bit number when 5 is represented in binary, that is, n = 2.

【0026】次にステップ56にて求めたn=2から、
フリーリスト2の最後尾に残ホールを繋げ(ステップ5
7)、メモリ割当処理を完了する。図10に以上の処理
をした後のホール管理データとメモリの関係図を示す。
Next, from n = 2 obtained in step 56,
Connect the remaining holes to the end of Free List 2 (Step 5
7) The memory allocation process is completed. FIG. 10 shows a relationship diagram between the hole management data and the memory after the above processing.

【0027】一方、サイズ10のメモリ割り当て要求が
発生した場合には、ステップ50にてn=4となり、ス
テップ52ではフリーリスト4にホールが繋がれていな
いため、ステップ58に進む。ステップ58ではnに1
を加えてn=5にし、nの値が上限を越えていないかを
チェックする(ステップ51)。本実施例の場合、上限
値4をnが越えるため、ステップ59にすすむ。ステッ
プ59ではフリーリスト(n−1)=3を探索し、サイ
ズ10を満たすホールがあるかを探索する。探索の結
果、サイズ10を満たすホールがない場合は、要求サイ
ズのメモリ割り付けができないことを利用者へ通知す
る。
On the other hand, when a memory allocation request of size 10 is generated, n = 4 at step 50 and no hole is connected to the free list 4 at step 52, so the routine proceeds to step 58. 1 in n in step 58
Is added to make n = 5, and it is checked whether the value of n exceeds the upper limit (step 51). In the case of the present embodiment, n exceeds the upper limit value 4, and therefore the process proceeds to step 59. In step 59, the free list (n-1) = 3 is searched to see if there is a hole satisfying the size 10. If there is no hole satisfying the size 10 as a result of the search, the user is notified that the requested size memory cannot be allocated.

【0028】本実施例の場合ホール管理データが要求サ
イズ10を満たすため、ステップ53へ進み、ホール管
理データをフリーリスト4からはずす。次にホール5の
サイズと要求サイズを比較する(ステップ54)。その
結果、ホール5のサイズと要求サイズはとはもに10で
等しいため、そのまま割付処理を終了する。図11にサ
イズ10のメモリ割当てを実施した後のホール管理デー
タとメモリの関係図を示す。
In the case of this embodiment, since the hole management data satisfies the required size 10, the process proceeds to step 53, and the hole management data is removed from the free list 4. Next, the size of the hole 5 is compared with the required size (step 54). As a result, the size of the hole 5 and the requested size are both equal to 10, so that the allocation process is terminated. FIG. 11 shows a relationship diagram between the hole management data and the memory after the memory allocation of size 10 is performed.

【0029】次に図7の状態において、ブロック22の
解放要求が発生した場合について、図7及び図9のフロ
ーチャートに沿って説明する。まず、従来例と同じよう
にホール管理データ群をたどってブロック22の直前に
ホールが存在するかを検出する(ステップ60)。もし
直前にホールが存在しなければそのままステップ61へ
進む。本実施例の場合には、ホール4が存在するため、
ステップ61にてホール4を管理するホール管理データ
(本実施例の場合フリーリスト0がポイントしている)
をフリーリスト0からはずす。その後、ブロック22を
ホール4と連結し、サイズ2のホールとする(ステップ
62)。次にブロック22の直後にホールが存在するか
を検出する(ステップ63)。もし、直後にホールが存
在しなければそのままステップ64へ進む。本実施例の
場合には、ホール5が存在するため、ステップ64にて
ホール5を管理するホール管理データをフリーリスト3
からはずす。その後、ブロック21〜22をホール5と
連結し、サイズ12のホールとする。
Next, a case where a release request for the block 22 is generated in the state of FIG. 7 will be described with reference to the flowcharts of FIGS. 7 and 9. First, as in the conventional example, the group of hole management data is traced to detect whether a hole exists immediately before the block 22 (step 60). If there is no hole immediately before, the process directly proceeds to step 61. In the case of this embodiment, since the hole 4 exists,
Hall management data for managing the hole 4 in step 61 (in this embodiment, the free list 0 points)
Is removed from free list 0. Then, the block 22 is connected to the hole 4 to form a size 2 hole (step 62). Next, it is detected whether or not there is a hole immediately after the block 22 (step 63). If there is no hole immediately after, the process proceeds directly to step 64. In the case of the present embodiment, since the hole 5 exists, the hole management data for managing the hole 5 is set to the free list 3 in step 64.
Remove from Then, the blocks 21 to 22 are connected to the hole 5 to form a size 12 hole.

【0030】次に連結の完了したホールをつなげるべき
フリーリストの番号を求める(ステップ66)。この
時、求めるフリーリストの番号をnとすれば、2n ≦ホ
ールの残サイズ<2n+1 を満たすnを求めれば良い。こ
れは12を2進表記した時の最上位ビット番号の値、即
ちn=3となる。
Next, the number of the free list to which the connected holes are to be connected is obtained (step 66). At this time, if the number of the desired free list is n, then n satisfying 2 n ≦ remaining hole size <2 n + 1 may be obtained. This is the value of the most significant bit number when 12 is represented in binary, that is, n = 3.

【0031】次にステップ66にて求めたn=3から、
フリーリスト3の最後尾に連結したホールをつなげ(ス
テップ67)、メモリ解放処理を完了する。図12にブ
ロック22の解放処理を実施した後のホール管理データ
とメモリの関係図を示す。
Next, from n = 3 obtained in step 66,
The holes connected to the end of the free list 3 are connected (step 67), and the memory release processing is completed. FIG. 12 shows a relationship diagram between the hole management data and the memory after the release processing of the block 22 is performed.

【0032】実施例3 次に本発明に係る他の実施例について説明する。図13
は、請求項第3項に係るメモリ管理における、管理デー
タ及びメモリとの関連図であり、図において、1〜42
は実施例2における図7のものと同じ、71はフリーリ
スト群42の各フリーリストに1対1に対応したリスト
管理ビット列を示すリスト管理テーブルであり、対応す
るフリーリストにホール管理データがつながれている場
合には1が、つながれていない場合には0がセットされ
ている。
Embodiment 3 Next, another embodiment according to the present invention will be described. FIG.
Is a relational diagram with the management data and the memory in the memory management according to claim 3;
7 is the same as that of FIG. 7 in the second embodiment, and 71 is a list management table showing a list management bit string corresponding to each free list of the free list group 42 on a one-to-one basis. Hole management data is connected to the corresponding free list. 1 is set when it is connected, and 0 is set when it is not connected.

【0033】このような状態におけるメモリ割り付け処
理を図14のフローチャートに沿って説明する。図14
においてステップ50〜ステップ59は、図8のフロー
チャートと同じ処理である。
The memory allocation process in such a state will be described with reference to the flowchart of FIG. 14
In step 50 to step 59, the same processing as in the flowchart of FIG. 8 is performed.

【0034】ステップ51にて、ステップ50で求めた
nが上限を越えていない場合、ビット番号nよりリスト
管理テーブルをサーチし、最初にビットが“1”である
ビット番号を求める(ステップ80)。求めるビットが
リスト管理テーブルにない場合には(ステップ81)ス
テップ59に進み、以降実施例2と同じ動作をする。
In step 51, if n obtained in step 50 does not exceed the upper limit, the list management table is searched from the bit number n, and the bit number whose bit is "1" is first obtained (step 80). . If the requested bit is not in the list management table (step 81), the process proceeds to step 59, and the same operation as that of the second embodiment is performed thereafter.

【0035】ステップ81にて求めるビットがリスト管
理テーブルにあった場合にはステップ53に進み、以降
実施例2と同じ動作をする。
If the bit obtained in step 81 is found in the list management table, the process proceeds to step 53, and the same operation as that of the second embodiment is performed thereafter.

【0036】[0036]

【発明の効果】以上のように本発明では、リアルタイム
OSでのメモリの管理単位であるブロックに、1つづつ
管理データを対応させ、この管理データに対応するブロ
ックが割当済みか利用可能かを判定する情報を持たせ、
割当済みメモリ域の解放要求発生時には、前後のホール
との連結の必要性の有無を、解放域の直前のブロックに
対応する管理データと、直後のブロックに対応する管理
データの情報を調べれば良い構成にしたので、メモリ解
放要求時での繰り返し処理の回避を実現することができ
る。
As described above, according to the present invention, management data is associated with each block, which is a memory management unit in the real-time OS, and whether the block corresponding to this management data is allocated or available. Have information to judge,
When a request to release the allocated memory area is issued, it is necessary to check the information on the management data corresponding to the block immediately before the free area and the management data corresponding to the block immediately after the free area to determine whether it is necessary to connect the holes before and after. Since the configuration is adopted, it is possible to avoid the repeated processing at the time of the memory release request.

【0037】また、利用可能な連続したブロックである
ホールを管理するフリーリストを複数持たせ、各ホール
をそのサイズの冪乗で分類し、メモリ割り当て要求時に
は、確実に割り付け可能なホールのリストから得ること
ができる構成にしたので、メモリ割り当て要求時での繰
り返し処理の回避を実現することができる。
In addition, a plurality of free lists for managing holes, which are consecutive blocks that can be used, are provided, each hole is classified by a power of its size, and when a memory allocation request is made, from the list of holes that can be reliably allocated, Since the configuration is such that it can be obtained, it is possible to avoid repetition processing at the time of memory allocation request.

【0038】また、フリーリストにホール管理データが
繋がっているかどうかを示すリスト管理テーブルを設け
たので、更なる処理の高速化が図れる。
Further, since the list management table indicating whether or not the hole management data is connected to the free list is provided, the processing speed can be further increased.

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

【図1】本発明の実施例1に係る管理データとメモリの
関係図である。
FIG. 1 is a relationship diagram of management data and a memory according to a first embodiment of the present invention.

【図2】本発明の実施例1に係るメモリ解放処理を示す
フローチャートである。
FIG. 2 is a flowchart showing a memory release process according to the first embodiment of the present invention.

【図3】図2における直前のホールとの連結処理を示す
フローチャートである。
FIG. 3 is a flowchart showing a connecting process with the immediately preceding hole in FIG.

【図4】図2における直後のホールとの連結処理を示す
フローチャートである。
FIG. 4 is a flowchart showing a connecting process with a hole immediately after in FIG.

【図5】本発明の実施例1におけるブロック15のメモ
リ領域解放処理後のブロック管理テーブルとメモリの関
係図である。
FIG. 5 is a diagram showing a relationship between a block management table and a memory after a memory area release process of a block 15 according to the first embodiment of the present invention.

【図6】本発明の実施例1におけるブロック22のメモ
リ領域解放後のブロック管理テーブルとメモリの関係図
である。
FIG. 6 is a diagram showing a relationship between a block management table and a memory after releasing a memory area of a block 22 according to the first embodiment of the present invention.

【図7】本発明の実施例2に係るホール管理データとメ
モリの関係図である。
FIG. 7 is a relationship diagram of hole management data and a memory according to the second embodiment of the present invention.

【図8】本発明の実施例2に係るメモリ割当処理を示す
フローチャートである。
FIG. 8 is a flowchart showing a memory allocation process according to the second embodiment of the present invention.

【図9】本発明の実施例2に係るメモリ解放処理を示す
フローチャートである。
FIG. 9 is a flowchart showing a memory release process according to the second embodiment of the present invention.

【図10】本発明の実施例2におけるサイズ5のメモリ
領域割当後のホール管理データとメモリの関係図であ
る。
FIG. 10 is a diagram showing the relationship between hole management data and memory after allocating a memory area of size 5 according to the second embodiment of the present invention.

【図11】本発明の実施例2におけるサイズ10のメモ
リ領域割当後のホール管理データとメモリの関係図であ
る。
FIG. 11 is a diagram showing the relationship between hole management data and memory after allocating a memory area of size 10 in Example 2 of the present invention.

【図12】本発明の実施例2におけるブロック22のメ
モリ領域割当後のホール管理データとメモリの関係図で
ある。
FIG. 12 is a diagram showing the relationship between hole management data and memory after memory area allocation in block 22 according to the second embodiment of the present invention.

【図13】本発明の実施例3に係るホール管理データと
メモリの関係図である。
FIG. 13 is a relationship diagram of hole management data and memory according to the third embodiment of the present invention.

【図14】本発明の実施例3に係るメモリ割当処理を示
すフローチャートである。
FIG. 14 is a flowchart showing a memory allocation process according to the third embodiment of the present invention.

【図15】従来のメモリ管理に係るホール管理データと
メモリの関係図である。
FIG. 15 is a relationship diagram of hole management data and memory relating to conventional memory management.

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

1 メモリ 2 ブロック管理テーブル 3 フリーリスト 41 ホール管理データ群 42 フリーリスト群 71 リスト管理テーブル 1 memory 2 block management table 3 free list 41 hole management data group 42 free list group 71 list management table

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】 記憶装置を固定長サイズのブロックに分
割して、使用中のブロックと未使用のブロックに分け、
一つ以上の連続した未使用のブロックをホールとして管
理する記憶領域管理方式において、下記の要素を有する
記憶領域管理方式。 (a)前記ホールをリストとして管理するためのフリー
リスト (b)分割されたブロックに対応して存在し、少なくと
もそのサイズと次ホールの先頭を指すポインターおよび
使用中か否かを示すフラグとを格納するブロック管理テ
ーブル (c)記憶領域の解放時に解放するブロックの前後の前
記フラグを参照してそのブロックがホールか否かを判定
する手段 (d)前記フラグの状態を判定する手段により判定した
結果を用いてブロック管理テーブルをメンテナンスする
手段。
1. A storage device is divided into blocks of a fixed length size and divided into a used block and an unused block,
In a storage area management method for managing one or more consecutive unused blocks as holes, a storage area management method having the following elements. (A) A free list for managing the holes as a list (b) A free list that exists corresponding to the divided blocks and has at least its size, a pointer that points to the beginning of the next hole, and a flag that indicates whether or not the hole is in use. Block management table to be stored (c) A means for determining whether or not the block is a hole by referring to the flags before and after the block to be released when the storage area is released (d) A means for determining the state of the flag A means of maintaining the block management table using the results.
【請求項2】 記憶装置を固定長サイズのブロックに分
割して、使用中のブロックと未使用のブロックに分け、
一つ以上の連続した未使用のブロックをホールとして管
理する記憶領域管理方式において、下記の要素を有する
記憶領域管理方式。 (a)前記ホールをリストとして管理するN個のフリー
リストからなるフリーリスト群 (b)前記フリーリストよりポイントされ、ホールを管
理する少なくともそのサイズと次のホールを示すための
ポインターおよび対応する記憶装置上のアドレスから成
るホール管理データ群 (c)前記フリーリスト群のk番目のフリーリストには
下記の式を満足するホールを管理する前記ホール管理デ
ータをポインターで接続する手段 0≦k≦N、 2k ≦ ホールのサイズ <2k+1 (d)記憶領域の割当処理時において下記の式を満足す
るフリーリストnにポイントされている先頭のホールを
割り当てる手段。 1≦n≦N、 2n-1 ≦ 割り当てる記憶サイズ <2
n
2. The storage device is divided into blocks of a fixed length size and divided into a used block and an unused block,
In a storage area management method for managing one or more consecutive unused blocks as holes, a storage area management method having the following elements. (A) A free list group consisting of N free lists for managing the holes as a list (b) At least the size of the holes managed by the free list, a pointer for indicating the next hole, and a corresponding memory Hole management data group consisting of addresses on the device (c) Means for connecting the hole management data for managing holes satisfying the following formula to the k-th free list of the free list group by a pointer 0 ≦ k ≦ N , 2 k ≤ hole size <2 k + 1 (d) Means for allocating the first hole pointed to the free list n satisfying the following expression during the memory area allocation processing. 1 ≤ n ≤ N, 2 n-1 ≤ storage size to be allocated <2
n
【請求項3】 前記フリーリスト群の各々に前記ホール
管理データが存在するか否かを示すフラグを有するリス
ト管理テーブルを前記フリーリスト群に対応して設けた
ことを特徴とする請求項2に記載の記憶領域管理方式。
3. A list management table having a flag indicating whether or not the hole management data exists in each of the free list groups is provided corresponding to the free list group. Described storage area management method.
JP09804493A 1993-04-23 1993-04-23 Storage area management method Expired - Fee Related JP3353376B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP09804493A JP3353376B2 (en) 1993-04-23 1993-04-23 Storage area management method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP09804493A JP3353376B2 (en) 1993-04-23 1993-04-23 Storage area management method

Publications (2)

Publication Number Publication Date
JPH06309197A true JPH06309197A (en) 1994-11-04
JP3353376B2 JP3353376B2 (en) 2002-12-03

Family

ID=14209153

Family Applications (1)

Application Number Title Priority Date Filing Date
JP09804493A Expired - Fee Related JP3353376B2 (en) 1993-04-23 1993-04-23 Storage area management method

Country Status (1)

Country Link
JP (1) JP3353376B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006126973A (en) * 2004-10-26 2006-05-18 Mitsubishi Electric Corp Storage area management method, storage area allocation program, garbage collection processing program, storage area management program, and message management program
US7613895B2 (en) 2006-05-18 2009-11-03 Konica Minolta Business Technologies, Inc. Memory administrating method

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS58171780A (en) * 1982-03-31 1983-10-08 Fujitsu Ltd Managing method of main storage
JPH02193231A (en) * 1989-01-20 1990-07-30 Fujitsu Ltd File space free area management system
JPH03265944A (en) * 1990-03-15 1991-11-27 Fujitsu Ltd File control system
JPH04219836A (en) * 1990-12-20 1992-08-10 Nec Corp Block control system
JPH04236639A (en) * 1991-01-21 1992-08-25 Nec Corp File space management system
JPH04349546A (en) * 1991-05-28 1992-12-04 Hitachi Ltd Shared memory pool managing system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS58171780A (en) * 1982-03-31 1983-10-08 Fujitsu Ltd Managing method of main storage
JPH02193231A (en) * 1989-01-20 1990-07-30 Fujitsu Ltd File space free area management system
JPH03265944A (en) * 1990-03-15 1991-11-27 Fujitsu Ltd File control system
JPH04219836A (en) * 1990-12-20 1992-08-10 Nec Corp Block control system
JPH04236639A (en) * 1991-01-21 1992-08-25 Nec Corp File space management system
JPH04349546A (en) * 1991-05-28 1992-12-04 Hitachi Ltd Shared memory pool managing system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006126973A (en) * 2004-10-26 2006-05-18 Mitsubishi Electric Corp Storage area management method, storage area allocation program, garbage collection processing program, storage area management program, and message management program
US7613895B2 (en) 2006-05-18 2009-11-03 Konica Minolta Business Technologies, Inc. Memory administrating method

Also Published As

Publication number Publication date
JP3353376B2 (en) 2002-12-03

Similar Documents

Publication Publication Date Title
JP4250190B2 (en) Efficient storage of objects in the file system
US8521790B2 (en) Increasing efficiency of data storage in a file system
JP2858795B2 (en) Real memory allocation method
US5481702A (en) Allocation optimization with different block-sized allocation maps
JP4323637B2 (en) Memory allocation method, memory allocation device, and storage medium
JPH02300949A (en) Memory control
JPH10254756A (en) Use of three-state reference for managing referred object
US20040128463A1 (en) Apparatus and method for controlling memory allocation for variable size packets
JPH04213129A (en) Memory control system and memory control method
JPH05274152A (en) Object management system
US8589652B2 (en) Reorganization of a fragmented directory of a storage data structure comprised of the fragmented directory and members
CN108804571B (en) Data storage method, device and equipment
JPH06309197A (en) Storage area management system
US6389549B1 (en) List management system, a list management method, a recording medium wherein a computer program for realizing the list management system is recorded and a packet exchange wherein the list management system is applied
EP0117906B1 (en) Key-accessed file organization
JPS5883377A (en) Buffer memory control system
CN109284234A (en) A kind of memory address allocation method and system
CN116737664B (en) Efficient index organization method of object-oriented embedded database
JP2994138B2 (en) Catalog Variable Management Method for Interactive Processing System
KR20030044498A (en) Data Structure, Block Assignment and Record Retrieval Method of Main Memory DataBase Management System
JPH0793192A (en) File managing method
JP2000010842A (en) Method and system for file management
JPH0744564B2 (en) Communication control device
JPH02193232A (en) System for retrieving free area in file
JP2743857B2 (en) Data area management system for area shared files

Legal Events

Date Code Title Description
FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080927

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080927

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090927

Year of fee payment: 7

LAPS Cancellation because of no payment of annual fees