JP3726701B2 - Kernel space demand paging swap-out method and method - Google Patents

Kernel space demand paging swap-out method and method Download PDF

Info

Publication number
JP3726701B2
JP3726701B2 JP2001131195A JP2001131195A JP3726701B2 JP 3726701 B2 JP3726701 B2 JP 3726701B2 JP 2001131195 A JP2001131195 A JP 2001131195A JP 2001131195 A JP2001131195 A JP 2001131195A JP 3726701 B2 JP3726701 B2 JP 3726701B2
Authority
JP
Japan
Prior art keywords
swap
page
kernel
priority
demand paging
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 - Fee Related
Application number
JP2001131195A
Other languages
Japanese (ja)
Other versions
JP2002328841A (en
Inventor
純 田辺
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.)
NEC Corp
Original Assignee
NEC 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 NEC Corp filed Critical NEC Corp
Priority to JP2001131195A priority Critical patent/JP3726701B2/en
Publication of JP2002328841A publication Critical patent/JP2002328841A/en
Application granted granted Critical
Publication of JP3726701B2 publication Critical patent/JP3726701B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Description

【0001】
【発明の属する技術分野】
本発明はカーネル空間のデマンドページング・スワップアウト方式および方法に関し、特にカーネルが単一のロードモジュールとして生成されている仮想記憶オペレーティングシステムにおけるカーネル空間のデマンドページング・スワップアウト方式および方法に関する。
【0002】
【従来の技術】
現在、世の中に存在する一般的なカーネルは、その構造面に着目すると、単一のロードモジュールとして生成される伝統的なモノリシックカーネルと、機能単位のスレッドの集合により実現されるマイクロカーネルとの2種類に分類することができる。
【0003】
たとえば、特開平8−16412号公報には、マイクロカーネル,パーソナリティ・ニュートラル・サービスおよびパーソナリティ・サーバからなるマイクロカーネルシステムが開示されている。しかし、マイクロカーネルでは、メモリ管理機能,プロセス管理機能,実行管理機能,ファイル管理機能,ドライバ機能などの個々の実行単位が互いに疎結合されて、カーネル全体の機能が実現されるので、カーネル全体が物理メモリ上に展開されCPU(Central Processing Unit)を占有するのではなく、必要な機能単位のみが物理メモリに展開され、個別にCPU資源を確保することで、メモリ資源やCPU資源を有効かつ円滑に利用することができる。反面、機能単位間のインターフェイスが抽象化され、疎結合しているために機能の相互呼び出しにオーバヘッドが生じ、カーネルの全体機能の性能低下を招くという問題がある。
【0004】
一方、従来のモノリシックカーネルでは、全ての機能が単一のロードモジュールとして蜜結合されているため、機能間のインターフェイスが最適化され、機能の相互呼び出しのオーバヘッドを最小に抑えることができる。反面、カーネルの全機能(通常必要なのは全体の内のごく一部にしかすぎない)が物理メモリ上に展開されることで必要以上にメモリ資源を消費し、さらに一度カーネルモードに移行すると、本来独立に実行可能なカーネルの複数機能をまたいでユーザモードに抜けるまでCPU資源を独占することになり、資源が有効に利用できないという問題がある。特に、モノリシックカーネルでは、カーネル空間が全て物理メモリ上に展開されていることを前提としていたが、システム運用において実際に必要とされるカーネル機能は限られており、カーネル全体のごく一部である場合が多い。たとえば、立ち上げ/立ち下げシーケンスは高々一度しか実行されず、また多くのドライバ類は対応するデバイスが実装されていなければ決して実行されない。また、実装されていたとしても実行されるとは限らない。さらに、カーネルテキストの多くを占める異常系処理も、実行されることはまれである。したがって、カーネルが実装されている物理メモリを有効に活用するために、通常使用されることのないこれらの物理メモリを有効に使用するための仕組みが必要であった。
【0005】
この問題を解決するために、たとえば、特開平2−178747号公報には、スワップアウトできないカーネルコードであっても、物理メモリの空き記憶領域が不足している場合には、スワッピングに関するデータベースを参照して、参照結果に応じて物理メモリを解放できるようにした仮想記憶計算システムのメモリ管理方式が開示されている。
【0006】
【発明が解決しようとする課題】
しかし、従来の技術では、機能単位による分割にとどまり、それぞれ専用の処理が必要である割に物理メモリの使用効率にさほどの改善が見られるものではないという問題点があった。
【0007】
本発明の目的は、機能間の相互呼び出し時のオーバヘッドが少ないモノリシックカーネルにおいて、通常のオペレーティングシステム一般に広く見られるデマンドページングおよびスワップアウトをカーネル空間に適用し、メモリ資源を有効に活用するカーネル空間のデマンドページング・スワップアウト方式および方法を提供することにある。
【0008】
また、本発明の他の目的では、さらにスワップアウト時間からスワップアウト優先度を決定する手法を導入し、容易にメモリ資源の利用効率を上げることができるカーネル空間のデマンドページング・スワップアウト方式および方法を提供することにある。
【0009】
【課題を解決するための手段】
本発明のカーネル空間のデマンドページング・スワップアウト方式は、単一のロードモジュールとして生成されているモノリシックカーネルを採用する仮想記憶計算システムにおいて、システム運用時にカーネル空間でページフォルトが発生した場合にスワップイン対象ページをスワップデバイスから物理メモリにスワップインするカーネルデマンドページング部と、システム運用時にユーザプロセスが前記物理メモリのページ確保に失敗した場合にスワップアウト優先度が最も高いページを選択して前記物理メモリから前記スワップデバイスにスワップアウトするカーネルスワップアウト部と、カーネルの立ち上げシーケンスの終了直後に前記カーネルスワップアウト部を呼び出して、前記カーネルデマンドページング部が存在するページを除く、カーネル空間の残余のページを前記物理メモリから前記スワップデバイスにスワップアウトさせる立ち上げ時カーネルスワップアウト部とを含むことを特徴とする。
【0010】
また、本発明のカーネル空間のデマンドページング・スワップアウト方式は、前記カーネルデマンドページング部が、フォルト発生ページおよびフォルト要因を特定するページフォルトハンドリング手段と、このページフォルトハンドリング手段により特定されたフォルト発生ページのタイムスタンプ値およびスワップアウト優先度に基づいてスワップアウト優先度の再計算を行うスワップアウト優先度再計算手段と、前記ページフォルトハンドリング手段により特定されたフォルト発生ページに対する前記物理メモリの再ページ確保およびカーネル空間へのマッピングを行い、前記物理メモリが足りない場合にはメモリ確保アルゴリズムを呼び出して前記物理メモリのページ確保を試みるメモリマッピング手段とを備えることを特徴とする。
【0011】
さらに、本発明のカーネル空間のデマンドページング・スワップアウト方式は、前記カーネルスワップアウト部が、各ページのスワップアウト優先度に基づいてスワップアウト対象ページを選択するスワップアウトページ選択手段と、このスワップアウトページ選択手段により選択されたスワップアウト対象ページのタイムスタンプ値に現在時刻を設定するタイムスタンプ手段と、前記スワップアウトページ選択手段により選択されたスワップアウト対象ページを前記物理メモリから前記スワップデバイスにスワップアウトするスワップアウト手段とを備えることを特徴とする。
【0012】
さらにまた、本発明のカーネル空間のデマンドページング・スワップアウト方式は、前記立ち上げ時カーネルスワップアウト部が、カーネル空間の各ページのタイムスタンプ値およびスワップアウト優先度を初期化するタイムスタンプ値・スワップアウト優先度初期化手段と、前記カーネルデマンドページング部が存在するページのスワップアウト優先度にスワップアウト抑止値を設定するカーネルデマンドページング部スワップアウト抑止手段と、カーネル空間のページ数と前記カーネルデマンドページング部のページ数との差を要求ページ数として前記カーネルスワップアウト部を呼び出すカーネルスワップアウト部呼出し手段とを備えることを特徴とする。
【0013】
また、本発明のカーネル空間のデマンドページング・スワップアウト方式は、前記スワップアウト優先度再計算手段が、同一ページに対するn回目のページフォルト発生時のスワップアウト優先度Pを、前回までのスワップアウト優先度Pn−1およびスワップアウト時間Tに基づいて、P=F(Pn−1,T)として計算することを特徴とする。
【0014】
さらに、本発明のカーネル空間のデマンドページング・スワップアウト方式は、前記カーネルスワップアウト部が、スワップアウトページ選択手段をさらに備え、
前記スワップアウト優先度再計算手段は、前記スワップアウト優先度 を、スワップアウト時間Tの平均値 =P n−1 +(T −P n−1 )/nとして再計算するものであり、
前記スワップアウトページ選択手段は、前記スワップアウト優先度 の値の大きなページをスワップアウト対象ページとして選択するものである、ことを特徴とする。
【0015】
一方、本発明のカーネル空間のデマンドページング・スワップアウト方法は、カーネルが単一のロードモジュールとして生成されている仮想記憶オペレーティングシステムにおいて、システム運用時にカーネル空間でページフォルトが発生した場合にスワップイン対象ページを前記スワップデバイスから物理メモリにスワップインするカーネルデマンドページング処理と、
システム運用時にユーザプロセスが前記物理メモリのページ確保に失敗した場合にスワップアウト優先度が最も高いページを選択し前記物理メモリから前記スワップデバイスにスワップアウトするカーネルスワップアウト処理と、
カーネルの立ち上げシーケンスの終了直後に前記カーネルスワップアウト処理を呼び出して、前記カーネルデマンドページング処理を行うカーネルデマンドページング部が存在するページを除く、カーネル空間の残余のページを前記物理メモリから前記スワップデバイスにスワップアウトさせる立ち上げ時カーネルスワップアウト処理とを含むことを特徴とする。
【0016】
また、本発明のカーネル空間のデマンドページング・スワップアウト方法は、前記カーネルデマンドページング処理が、フォルト発生ページおよびフォルト要因を特定するページフォルトハンドリング工程と、このページフォルトハンドリング工程で特定されたフォルト発生ページのタイムスタンプ値およびスワップアウト優先度に基づいてスワップアウト優先度の再計算を行うスワップアウト優先度再計算工程と、前記ページフォルトハンドリング工程で特定されたフォルト発生ページに対して前記物理メモリの再ページ確保およびカーネル空間へのマッピングを行い、前記物理メモリが足りない場合にはメモリ確保アルゴリズムを呼び出して前記物理メモリのページ確保を試みるメモリマッピング工程とからなることを特徴とする。
【0017】
さらに、本発明のカーネル空間のデマンドページング・スワップアウト方法は、前記カーネルスワップアウト処理が、各ページのスワップアウト優先度に基づいてスワップアウト対象ページを選択するスワップアウトページ選択工程と、このスワップアウトページ選択工程で選択されたスワップアウト対象ページのタイムスタンプ値に現在時刻を設定するタイムスタンプ工程と、前記スワップアウトページ選択工程で選択されたスワップアウト対象ページを前記物理メモリから前記スワップデバイスにスワップアウトするスワップアウト工程とからなることを特徴とする。
【0018】
さらにまた、本発明のカーネル空間のデマンドページング・スワップアウト方法は、前記立ち上げ時カーネルスワップアウト処理が、カーネル空間の各ページのタイムスタンプ値およびスワップアウト優先度を初期化するタイムスタンプ値・スワップアウト優先度初期化工程と、前記カーネルデマンドページングが存在するページのスワップアウト優先度にスワップアウト抑止値を設定するカーネルデマンドページング処理スワップアウト抑止工程と、カーネル空間のページ数と前記カーネルデマンドページングのページ数との差を要求ページ数として前記カーネルスワップアウト処理を呼び出すカーネルスワップアウト処理呼出し工程とを備えることを特徴とする。
【0019】
また、本発明のカーネル空間のデマンドページング・スワップアウト方法は、前記スワップアウト優先度再計算工程が、同一ページに対するn回目のページフォルト発生時のスワップアウト優先度Pを、前回までのスワップアウト優先度Pn−1およびスワップアウト時間Tに基づいて、P=F(Pn−1,T)として計算することを特徴とする。
【0020】
さらに、本発明のカーネル空間のデマンドページング・スワップアウト方法は、前記カーネルスワップアウト処理が、スワップアウトページ選択工程をさらに含み、
前記スワップアウト優先度再計算工程では、前記スワップアウト優先度 を、スワップアウト時間Tの平均値 =P n−1 +(T −P n−1 )/nとして再計算するものであり、
前記スワップアウトページ選択工程では、前記スワップアウト優先度 の値の大きなページをスワップアウト対象ページとして選択するものである、ことを特徴とする。
【0021】
一方、本発明のプログラムは、コンピュータを、システム運用時にカーネル空間でページフォルトが発生した場合にスワップイン対象ページをスワップデバイスから物理メモリにスワップインするカーネルデマンドページング部,システム運用時にユーザプロセスが前記物理メモリのページ確保に失敗した場合にスワップアウト優先度が最も高いページを選択して前記物理メモリから前記スワップデバイスにスワップアウトするカーネルスワップアウト部,およびカーネルの立ち上げシーケンスの終了直後に前記カーネルスワップアウト部を呼び出して、前記カーネルデマンドページング部が存在するページを除く、カーネル空間の残余のページを前記物理メモリから前記スワップデバイスにスワップアウトさせる立ち上げ時カーネルスワップアウト部として機能させる。
【0022】
また、本発明のプログラムは、前記カーネルデマンドページング部が、フォルト発生ページおよびフォルト要因を特定するページフォルトハンドリング手段と、このページフォルトハンドリング手段により特定されたフォルト発生ページのタイムスタンプ値およびスワップアウト優先度に基づいてスワップアウト優先度の再計算を行うスワップアウト優先度再計算手段と、前記ページフォルトハンドリング手段により特定されたフォルト発生ページに対する前記物理メモリの再ページ確保およびカーネル空間へのマッピングを行い、前記物理メモリが足りない場合にはメモリ確保アルゴリズムを呼び出して前記物理メモリのページ確保を試みるメモリマッピング手段とを備えることを特徴とする。
【0023】
さらに、本発明のプログラムは、前記カーネルスワップアウト部が、各ページのスワップアウト優先度に基づいてスワップアウト対象ページを選択するスワップアウトページ選択手段と、このスワップアウトページ選択手段により選択されたスワップアウト対象ページのタイムスタンプ値に現在時刻を設定するタイムスタンプ手段と、前記スワップアウトページ選択手段により選択されたスワップアウト対象ページを前記物理メモリから前記スワップデバイスにスワップアウトするスワップアウト手段とを備えることを特徴とする。
【0024】
さらにまた、本発明のプログラムは、前記立ち上げ時カーネルスワップアウト部が、カーネル空間の各ページのタイムスタンプ値およびスワップアウト優先度を初期化するタイムスタンプ値・スワップアウト優先度初期化手段と、前記カーネルデマンドページング部が存在するページのスワップアウト優先度にスワップアウト抑止値を設定するカーネルデマンドページング部スワップアウト抑止手段と、カーネル空間のページ数と前記カーネルデマンドページング部のページ数との差を要求ページ数として前記カーネルスワップアウト部を呼び出すカーネルスワップアウト部呼出し手段とを備えることを特徴とする。
【0025】
また、本発明のプログラムは、前記スワップアウト優先度再計算手段が、同一ページに対するn回目のページフォルト発生時のスワップアウト優先度Pを、前回までのスワップアウト優先度Pn−1およびスワップアウト時間Tに基づいて、P=F(Pn−1,T)として計算することを特徴とする。
【0026】
さらに、本発明のプログラムは、前記カーネルスワップアウト部が、スワップアウトページ選択手段をさらに備え、
前記スワップアウト優先度再計算手段は、前記スワップアウト優先度 を、スワップアウト時間Tの平均値 =P n−1 +(T −P n−1 )/nとして再計算するものであり、
前記スワップアウトページ選択手段は、前記スワップアウト優先度 の値の大きなページをスワップアウト対象ページとして選択するものである、ことを特徴とする。
【0027】
本発明の特徴は、単一のロードモジュールとして生成されているモノリシックカーネルで、カーネル空間の全てのページが物理メモリ上に展開されていることを保証せず、必要とするカーネル機能のページが物理メモリに展開されていなかった場合に発生するページフォルトをきっかけとして、当該ページをスワップデバイスから物理メモリへスワップインするデマンドページングを適用することで、メモリ資源を有効に活用するというものである。また、使用されていない、あるいは使用頻度の低いカーネル機能のページを物理メモリからスワップデバイスにスワップアウトすることで、メモリ資源を有効に活用するというものである。
【0028】
ここで、本発明の作用を、図1および図2を参照して説明する。
【0029】
通常、モノリシックカーネルはファイル記憶装置(図示せず)上に単一のファイル(ロードモジュール)として存在し、ブートストラップ機能により、ファイル記憶装置から物理メモリ5に展開され、特定のポイントより実行が開始される。
【0030】
本発明では、ブートストラップ機能により一度カーネルの全てのテキストおよびデータ領域を物理メモリ5に展開するが、立ち上げシーケンスの終了直後に、カーネルスワップアウト部3によりカーネルデマンドページング部2が存在するページを除く、カーネル空間4aの残余のページを物理メモリ5からスワップデバイス6に一旦スワップアウトする。その後、ページフォルトが発生するたびにカーネルデマンドページング部2を使用して、スワップイン対象ページをスワップデバイス6から物理メモリ5にスワップインしてページフォルト地点から実行を再開する。また、各ページは属性値としてスワップアウト優先度42を保持し、ユーザプロセスによるメモリ要求時に、LRU(Least RecentlyUsed)等のメモリ確保アルゴリズムによる物理メモリ5のページ確保に失敗した場合、スワップアウト優先度42の高い順にページを物理メモリ5からスワップデバイス6にスワップアウトして、物理メモリ5のページ確保を試みる。
【0031】
詳しくは、立ち上げ時カーネルスワップアウト部1は、タイムスタンプ値・スワップアウト優先度初期化手段11により、まずタイムスタンプ値41およびスワップアウト優先度42の初期化(ゼロクリア)を行う。次に、カーネルデマンドページング部スワップアウト抑止手段12により、カーネルデマンドページング部2が存在するページのスワップアウト優先度42にスワップアウト抑止値を設定する。カーネル自身は、カーネルデマンドページング部2のテキストの開始アドレスおよび終了アドレスを知り得るので、カーネルデマンドページング部2が存在するページを特定することが可能である。スワップアウト抑止値は、スワップアウト優先度42の再計算式の結果として得られることのない任意の値である必要がある。たとえば、0または負の値をスワップアウト抑止値として使用できる。最後に、カーネルスワップアウト部呼出し手段13により、要求するスワップアウトサイズ(要求ページ数)として(カーネル空間4aのページ数−カーネルデマンドページング部2のページ数)を指定してカーネルスワップアウト部3を呼び出す。
【0032】
カーネルスワップアウト部3は、スワップアウトページ選択手段31により、スワップアウト優先度42に基づいてスワップアウト対象ページを選択するが、このとき、スワップアウト抑止値が設定されているカーネルデマンドページング部2のページはスワップアウト対象ページとして選択しない。
【0033】
以上により、立ち上げ時カーネルスワップアウト部1は、カーネルデマンドページング部2が存在するページを除く、カーネル空間4aの残余のページを物理メモリ5からスワップデバイス6にスワップアウトすることができる。
【0034】
【発明の実施の形態】
以下、本発明の実施の形態について図面を参照して詳細に説明する。
【0035】
(1)第1の実施の形態
図1は、本発明の第1の実施の形態に係るカーネル空間のデマンドページング・スワップアウト方式の構成を示すブロック図である。本実施の形態に係るカーネル空間のデマンドページング・スワップアウト方式は、立ち上げ時カーネルスワップアウト部1と、カーネルデマンドページング部2と、カーネルスワップアウト部3と、カーネル空間4aおよびユーザ空間4b(図2参照)からなる仮想空間4(図2参照)と、主記憶である物理メモリ5と、磁気ディスク装置等でなるスワップデバイス6とから、その主要部が構成されている。
【0036】
立ち上げ時カーネルスワップアウト部1は、カーネル空間4aの各ページのタイムスタンプ値41およびスワップアウト優先度42を初期化するタイムスタンプ値・スワップアウト優先度初期化手段11と、カーネルデマンドページング部2が存在するページのスワップアウト優先度42にスワップアウト抑止値を設定するカーネルデマンドページング部スワップアウト抑止手段12と、カーネル空間4aのページ数とカーネルデマンドページング部2のページ数との差を要求ページ数としてカーネルスワップアウト部3を呼び出すカーネルスワップアウト部呼出し手段13とから構成されている。
【0037】
カーネルデマンドページング部2は、フォルト発生ページおよびフォルト要因を特定するページフォルトハンドリング手段21と、フォルト発生ページのタイムスタンプ値41およびスワップアウト優先度42に基づいてスワップアウト優先度42の再計算を行うスワップアウト優先度再計算手段22と、物理メモリ5の再ページ確保およびカーネル空間4aへのマッピングを行い、要求ページ数に満たない場合にはメモリ確保アルゴリズムを呼び出して物理メモリ5のページ確保を試みるメモリマッピング手段23とから構成されている。
【0038】
カーネルスワップアウト部3は、各ページのスワップアウト優先度42に基づいてスワップアウト対象ページを選択するスワップアウトページ選択手段31と、スワップアウト対象ページのタイムスタンプ値41に現在時刻を設定するタイムスタンプ手段32と、カーネル空間4aのスワップアウト対象ページを物理メモリ5からスワップデバイス6にスワップアウトするスワップアウト手段33とから構成されている。
【0039】
仮想空間4を構成する各ページには、属性値として、タイムスタンプ値41と、スワップアウト優先度42とを付属する。
【0040】
図3は、タイムスタンプ値41およびスワップアウト優先度42を、通常の仮想記憶で用いられるページテーブル43に保持させるようにした一例を示す。ページテーブル43の各エントリは、有効フラグ,タイムスタンプ値41,スワップアウト優先度42,および物理ページまたはディスクアドレスからなる。有効フラグがオン(”1”)のときに物理ページアドレスが格納され、有効フラグがオフ(”0”)のときにディスクアドレスが格納される。
【0041】
図4を参照すると、第1の実施の形態に係るカーネル空間のデマンドページング・スワップアウト方式の初期化処理は、カーネル立ち上げステップS101と、タイムスタンプ値・スワップアウト優先度初期化ステップS102と、カーネルデマンドページング部スワップアウト抑止ステップS103と、カーネルスワップアウト部呼出しステップS104と、ユーザプロセス移行ステップS105とからなる。
【0042】
図5を参照すると、カーネルデマンドページング部2の処理は、ページフォルトハンドリングステップS201と、タイムスタンプ値・スワップアウト優先度取得ステップS202と、スワップアウト優先度再計算ステップS203と、スワップアウト優先度設定ステップS204と、メモリマッピングステップS205とからなる。
【0043】
同じく、図5を参照すると、カーネルスワップアウト部3の処理は、スワップアウト優先度順ページ選択ステップS301と、抑止ページ判定ステップS302と、タイムスタンプ値設定ステップS303と、スワップアウトステップS304と、要求ページ数判定ステップS305とからなる。
【0044】
次に、このように構成された第1の実施の形態に係るカーネル空間のデマンドページング・スワップアウト方式の動作について、図1ないし図5を参照しながら説明する。
【0045】
まず、カーネルの立ち上げシーケンスが終了すると(ステップS101)、立ち上げ時カーネルスワップアウト部1が実行される。
【0046】
立ち上げ時カーネルスワップアウト部1は、タイムスタンプ値・スワップアウト優先度初期化手段11により、カーネル空間4aの各ページのタイムスタンプ値41およびスワップアウト優先度42を初期化(ゼロクリア)する(ステップS102)。
【0047】
次に、立ち上げ時カーネルスワップアウト部1は、カーネルデマンドページング部スワップアウト抑止手段12により、カーネルデマンドページング部2が存在するページのスワップアウト優先度42に、たとえば0または負の値でなるスワップアウト抑止値を設定する(ステップS103)。
【0048】
続いて、立ち上げ時カーネルスワップアウト部1は、カーネルスワップアウト部呼出し手段13により、(カーネル空間4aのページ数−カーネルデマンドページング部2のページ数)を要求ページ数としてカーネルスワップアウト部3を呼び出す(ステップS104)。
【0049】
カーネルスワップアウト部3は、スワップアウトページ選択手段31により、カーネル空間4a中のページをスワップアウト優先度42の高い順に選択し(ステップS301)、スワップアウト優先度42がスワップアウト抑止値(たとえば0または負の値)であるかどうかに基づいてカーネルデマンドページング部2が存在するページであるかどうかを判定する(ステップS302)。カーネルデマンドページング部2が存在するページであれば、ステップS301に制御を戻し、次にスワップアウト優先度42の高いページを選択する。
【0050】
カーネルデマンドページング部2が存在するページでなければ、カーネルスワップアウト部3は、タイムスタンプ手段32により、現在時刻をタイムスタンプ値41に設定する(ステップS303)。
【0051】
続いて、カーネルスワップアウト部3は、スワップアウト手段33により、物理メモリ5上のページをスワップデバイス2にスワップアウトし(ステップS304)、要求ページ数に達したか否か、つまりカーネルデマンドページング部2が存在するページを除く、カーネル空間4aの残余のページを物理メモリ5からスワップデバイス6にスワップアウトし終えたかどうかを判定する(ステップS305)。要求ページ数に達していなければ、ステップS301に制御を戻し、次にスワップアウト優先度42の高いページを選択する。要求ページ数に達していれば、ユーザプロセス(通常はinitプロセス)に移行する(ステップS105)。
【0052】
システム運用時に、カーネル空間4a内のページでページフォルトが発生すると、カーネルデマンドページング部2が起動される。
【0053】
カーネルデマンドページング部2は、ページフォルトハンドリング手段21により、フォルトが発生したページ(フォルト発生ページ)やフォルトの要因(フォルト要因)を特定する(ステップS201)。
【0054】
次に、カーネルデマンドページング部2は、スワップアウト優先度再計算手段22により、フォルト発生ページのタイムスタンプ値41およびスワップアウト優先度42を取得し(ステップS202)、スワップアウト優先度42を再計算し(ステップS203)、これをスワップアウト優先度42に再設定する(ステップS204)。
【0055】
詳しくは、各ページは、スワップアウト時からページフォルト発生時までのスワップアウトされていた時間(スワップアウト時間)Tを統計的に保持し、これをスワップアウト優先度42として、スワップアウトの可否の判断材料として使用する。すなわち、スワップアウト時間Tは、スワップアウト発生時間とページフォルト発生時間との差で与えられる。同一ページに対するn回目のページフォルト発生時のスワップアウト優先度Pは、前回までのスワップアウト優先度Pn−1とスワップアウト時間Tとを使用し、P=F(Pn−1,T)で表される。
【0056】
例として、F(Pn−1,T)=Pn−1+(T−Pn−1)/nであった場合、スワップアウト優先度Pは、スワップアウト時間Tの平均値として表され、スワップアウト優先度Pの値の大きなページからスワップアウト対象ページとして選択するなどの手法が可能である。
【0057】
最後に、カーネルデマンドページング部2は、メモリマッピング手段23により、物理メモリ5の再ページ確保およびカーネル空間4aへのマッピングを行う(ステップS205)。この際、要求ページ数に満たない場合は、メモリ確保アルゴリズムを呼び出し、物理メモリ5のページ確保を試みる。
【0058】
システム運用時に、ユーザプロセス(図示せず)が物理メモリ5のページ確保に失敗した場合、メモリ確保アルゴリズムに従い、まずユーザ空間4bのページを物理メモリ5からスワップデバイス6にスワップアウトする。
【0059】
ユーザ空間4bのページを物理メモリ5からスワップデバイス6にスワップアウトしても要求ページ数に満たない場合、従来は物理メモリ5の容量不足としてユーザプロセスがエラーとなっていたが、本実施の形態では、カーネルスワップアウト部3が呼び出される。
【0060】
カーネルスワップアウト部3は、スワップアウトページ選択手段31により、カーネル空間4a中のスワップアウト優先度42の高い順にページを選択し(ステップS301)、スワップアウト優先度42がスワップアウト抑止値(たとえば0または負の値)であるカーネルデマンドページング部2が存在するページであるかどうかを判定する(ステップS302)。カーネルデマンドページング部2が存在するページであれば、ステップS301に制御を戻し、次にスワップアウト優先度42の高いページを選択する。
【0061】
カーネルデマンドページング部2が存在するページでなければ、カーネルスワップアウト部3は、タイムスタンプ手段32により、現在時刻をタイムスタンプ値41に設定する(ステップS303)。
【0062】
続いて、カーネルスワップアウト部3は、スワップアウト手段33により、物理メモリ5上のページをスワップデバイス2にスワップアウトし(ステップS304)、要求ページ数に達したか否かを判定する(ステップS305)。要求ページ数に達していなければ、ステップS301に制御を戻し、次にスワップアウト優先度42の高いページを選択する。要求ページ数に達していれば、ユーザプロセスに制御を戻す。
【0063】
このように、第1の実施の形態によれば、従来、カーネルが常駐していた物理メモリ5のページのうち、ほとんど使用されることのない物理メモリ5のページをユーザプロセス等に解放することで、メモリ資源を有効に活用することができる。
【0064】
(2)第2の実施の形態
図6は、本発明の第2の実施の形態に係るカーネル空間のデマンドページング・スワップアウト方式の構成を示すブロック図である。本実施の形態に係るカーネル空間のデマンドページング・スワップアウト方式は、図1に示した第1の実施の形態に係るカーネル空間のデマンドページング・スワップアウト方式に比べて、コンピュータ100に仮想記憶オペレーティングシステム200をプログラムとして備える点が異なっている。
【0065】
仮想記憶オペレーティングシステム200は、コンピュータ100に読み込まれ、当該コンピュータ100の動作を、立ち上げ時カーネルスワップアウト部1(タイムスタンプ値・スワップアウト優先度初期化手段11,カーネルデマンドページング部スワップアウト抑止手段12,およびカーネルスワップアウト部呼出し手段13),カーネルデマンドページング部2(ページフォルトハンドリング手段21,スワップアウト優先度再計算手段22,およびメモリマッピング手段23),およびカーネルスワップアウト部3(スワップアウトページ選択手段31,タイムスタンプ手段32,およびスワップアウト手段33)として制御する。仮想記憶オペレーティングシステム200の制御によるカーネル空間のデマンドページング・スワップアウト方式の動作は、第1の実施の形態に係るカーネル空間のデマンドページング・スワップアウト方式における立ち上げ時カーネルスワップアウト部1(タイムスタンプ値・スワップアウト優先度初期化手段11,カーネルデマンドページング部スワップアウト抑止手段12,およびカーネルスワップアウト部呼出し手段13),カーネルデマンドページング部2(ページフォルトハンドリング手段21,スワップアウト優先度再計算手段22,およびメモリマッピング手段23),およびカーネルスワップアウト部3(スワップアウトページ選択手段31,タイムスタンプ手段32,およびスワップアウト手段33)の動作と全く同様になるので、その詳しい説明を割愛する。
【0066】
なお、上記各実施の形態では、スワップアウト優先度42の再計算式が、P=F(Pn−1,T)=Pn−1+(T−Pn−1)/nである場合を例示して説明したが、スワップアウト優先度42の再計算式は上式に限られるわけではなく、P=F(Pn−1,T)で表せる全ての式で、本発明のカーネル空間のデマンドページング・スワップアウト方式および方法が適用可能であることはいうまでもない。
【0067】
【発明の効果】
第1の効果は、従来はカーネルが常駐していた物理メモリのページのうち、ほとんど使用されることのなかった物理メモリのページをユーザプロセスに解放することで、メモリ資源を有効に活用できることである。
【図面の簡単な説明】
【図1】本発明の第1の実施の形態に係るカーネル空間のデマンドページング・スワップアウト方式の構成を示すブロック図である。
【図2】第1の実施の形態に係るカーネル空間のデマンドページング・スワップアウト方式におけるカーネルデマンドページングおよびカーネルスワップアウトを説明する図である。
【図3】図1中のタイムスタンプ値およびスワップアウト優先度をページテーブルに格納するようにした一例を示す図である。
【図4】図1中の立ち上げ時カーネルスワップアウト部の処理を示すフローチャートである。
【図5】図1中のカーネルデマンドページング部およびカーネルスワップアウト部の処理を示すフローチャートである。
【図6】本発明の第2の実施の形態に係るカーネル空間のデマンドページング・スワップアウト方式の構成を示すブロック図である。
【符号の説明】
1 立ち上げ時カーネルスワップアウト部
2 カーネルデマンドページング部
3 カーネルスワップアウト部
4 仮想空間
4a カーネル空間
4b ユーザ空間
5 物理メモリ
6 スワップデバイス
11 タイムスタンプ値・スワップアウト優先度初期化手段
12 カーネルデマンドページング部スワップアウト抑止手段
13 カーネルスワップアウト部呼出し手段
21 ページフォルトハンドリング手段
22 スワップアウト優先度再計算手段
23 メモリマッピング手段
31 スワップアウトページ選択手段
32 タイムスタンプ手段
33 スワップアウト手段
41 タイムスタンプ値
42 スワップアウト優先度
43 ページテーブル
100 コンピュータ
200 仮想記憶オペレーティングシステム
S101 カーネル立ち上げステップ
S102 タイムスタンプ値・スワップアウト優先度初期化ステップ
S103 カーネルデマンドページング部スワップアウト抑止ステップ
S104 カーネルスワップアウト部呼出しステップ
S105 ユーザプロセス移行ステップ
S201 ページフォルトハンドリングステップ
S202 タイムスタンプ値・スワップアウト優先度取得ステップ
S203 スワップアウト優先度再計算ステップ
S204 スワップアウト優先度設定ステップ
S205 メモリマッピングステップ
S301 スワップアウト優先度順ページ選択ステップ
S302 抑止ページ判定ステップ
S303 タイムスタンプ値設定ステップ
S304 スワップアウトステップ
S305 要求ページ数判定ステップ
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a kernel space demand paging swap-out method and method, and more particularly to a kernel space demand paging swap-out method and method in a virtual memory operating system in which a kernel is generated as a single load module.
[0002]
[Prior art]
At present, the general kernels that exist in the world are focused on the structural aspect. The traditional monolithic kernel generated as a single load module and the microkernel realized by a set of functional unit threads are divided into two. Can be classified into types.
[0003]
For example, Japanese Patent Application Laid-Open No. 8-16412 discloses a microkernel system including a microkernel, a personality neutral service, and a personality server. However, in the microkernel, individual execution units such as the memory management function, process management function, execution management function, file management function, and driver function are loosely coupled together to realize the entire kernel function. Rather than deploying on the physical memory and occupying the CPU (Central Processing Unit), only necessary functional units are deployed in the physical memory, and by securing the CPU resources individually, memory resources and CPU resources are effectively and smoothly Can be used. On the other hand, the interface between the functional units is abstracted and loosely coupled, so there is a problem that overhead occurs in mutual call of functions and the performance of the entire kernel function is reduced.
[0004]
On the other hand, in the conventional monolithic kernel, since all functions are combined as a single load module, the interface between functions is optimized, and the overhead of mutual call of functions can be minimized. On the other hand, all the functions of the kernel (usually only a small part of the whole are required) are deployed on physical memory, consuming more memory resources than necessary, and once entering kernel mode, CPU resources are monopolized until the user mode is exited across a plurality of independently executable kernel functions, and there is a problem that resources cannot be used effectively. In particular, in the monolithic kernel, it was assumed that the entire kernel space was expanded on physical memory. However, the kernel functions actually required for system operation are limited, and only a small part of the entire kernel. There are many cases. For example, the startup / shutdown sequence is executed at most once, and many drivers are never executed unless the corresponding device is implemented. Moreover, even if it is mounted, it is not always executed. In addition, abnormal processing occupying most of the kernel text is rarely executed. Therefore, in order to effectively use the physical memory on which the kernel is mounted, a mechanism for effectively using these physical memories that are not normally used is required.
[0005]
In order to solve this problem, for example, Japanese Laid-Open Patent Publication No. 2-178747 refers to a database related to swapping when there is a shortage of free storage area in physical memory even if the kernel code cannot be swapped out. Thus, a memory management method for a virtual storage computing system is disclosed in which physical memory can be released according to a reference result.
[0006]
[Problems to be solved by the invention]
However, in the conventional technology, there is a problem that the use efficiency of the physical memory is not so much improved although the division by the functional unit is limited and the dedicated processing is required.
[0007]
An object of the present invention is to apply demand paging and swap-out commonly found in ordinary operating systems to a kernel space in a monolithic kernel with a low overhead at the time of mutual call between functions, and to effectively use memory resources. It is to provide a demand paging swap-out method and method.
[0008]
Further, according to another object of the present invention, a method and a method for demand paging / swap-out of a kernel space that can further increase the use efficiency of memory resources by introducing a method for determining a swap-out priority from a swap-out time. Is to provide.
[0009]
[Means for Solving the Problems]
The demand paging swap-out method of the kernel space according to the present invention is a swapping-in method when a page fault occurs in the kernel space during system operation in a virtual memory computing system employing a monolithic kernel generated as a single load module. Kernel demand paging unit that swaps in the target page from the swap device to the physical memory, and the physical memory by selecting the page with the highest swap-out priority when the user process fails to secure the page of the physical memory during system operation. And a page where the kernel demand paging unit exists by calling the kernel swap out unit immediately after completion of the kernel startup sequence. Except, wherein the pages of the remaining kernel space from the physical memory and a said start-up time of the kernel swap-out unit to be swapped out to the swap device.
[0010]
Further, the kernel space demand paging swap-out method according to the present invention is such that the kernel demand paging unit specifies a fault occurrence page and a fault factor, and a fault occurrence page specified by the page fault handling means. Swapout priority recalculating means for recalculating swapout priority based on the time stamp value and swapout priority, and re-allocating the physical memory for the faulted page specified by the page fault handling means And memory mapping means for performing mapping to kernel space and, when the physical memory is insufficient, calling a memory allocation algorithm to try to allocate a page of the physical memory.
[0011]
Furthermore, the kernel space demand paging swap-out method of the present invention is characterized in that the kernel swap-out unit selects a swap-out page selection means based on the swap-out priority of each page, and the swap-out page selection means. Time stamp means for setting the current time to the time stamp value of the swap-out target page selected by the page selection means, and swap the swap-out target page selected by the swap-out page selection means from the physical memory to the swap device And swap-out means for out.
[0012]
Furthermore, the kernel space demand paging swap-out method of the present invention is such that the startup kernel swap-out unit initializes the time stamp value and swap-out priority of each page of the kernel space. Out priority initialization means, kernel demand paging section swap-out suppression means for setting a swap-out suppression value in the swap-out priority of the page where the kernel demand paging section exists, the number of pages in the kernel space, and the kernel demand paging And a kernel swap-out section calling unit that calls the kernel swap-out section with a difference from the number of pages of the section as a requested page number.
[0013]
Also, in the demand paging / swap-out method of the kernel space according to the present invention, the swap-out priority recalculation unit is configured such that the swap-out priority P when the n-th page fault occurs for the same page.n, Swap-out priority P until the previous timen-1And swap-out time TnBased on Pn= F (Pn-1, Tn) As a feature.
[0014]
  Furthermore, in the demand paging swap-out method of the kernel space according to the present invention, the kernel swap-out unit further includes a swap-out page selection unit,
  The swap out priority recalculation means is configured to calculate the swap out priority.P n Is the average value of the swap-out time TP n = P n-1 + (T n -P n-1 ) / NAnd recalculate as
  The swap-out page selection means is configured to select the swap-out priority.P n A page having a large value is selected as a swap-out target page.
[0015]
  On the other hand, the demand paging swap-out method of the kernel space according to the present invention is a swap-in target when a page fault occurs in the kernel space during system operation in a virtual memory operating system in which the kernel is generated as a single load module. Kernel demand paging process to swap pages into physical memory from the swap device;
  A kernel swap-out process that selects a page with the highest swap-out priority when a user process fails to secure a page of the physical memory during system operation, and swaps out the physical memory to the swap device;
  Call the kernel swap-out process immediately after the end of the kernel startup sequence,Kernel demand paging unit for performing the kernel demand paging processAnd a boot-up kernel swap-out process for swapping out the remaining pages of the kernel space from the physical memory to the swap device.
[0016]
The kernel space demand paging swap-out method according to the present invention includes a page fault handling step in which the kernel demand paging process specifies a fault occurrence page and a fault factor, and a fault occurrence page specified in the page fault handling step. A swap-out priority recalculation step for recalculating the swap-out priority based on the time stamp value and the swap-out priority, and the physical memory re-calculation for the faulted page specified in the page fault handling step. It comprises a memory mapping step of performing page reservation and mapping to a kernel space, and, when the physical memory is insufficient, calls a memory reservation algorithm to try to secure a page of the physical memory.
[0017]
Furthermore, the demand paging swap-out method of the kernel space according to the present invention includes the swap-out page selection step in which the kernel swap-out process selects a swap-out target page based on the swap-out priority of each page, and the swap-out process. A time stamp process for setting a current time to a time stamp value of a swap-out target page selected in the page selection process, and a swap-out target page selected in the swap-out page selection process is swapped from the physical memory to the swap device. It is characterized by comprising a swap-out process of out.
[0018]
Furthermore, in the demand paging / swap-out method of the kernel space according to the present invention, the startup kernel swap-out process initializes the time stamp value and swap-out priority of each page of the kernel space. Out priority initialization process and kernel demand pagingPartDemand paging process for setting swap-out to the swap-out priority of a page where there is a swap-out process Swap-out suppression process, the number of pages in the kernel space, and the kernel demand pagingPartAnd a kernel swap-out process calling step for calling the kernel swap-out process using the difference from the number of pages as the requested page number.
[0019]
Also, in the demand paging / swap-out method of the kernel space according to the present invention, the swap-out priority recalculation step includes the swap-out priority P when the n-th page fault occurs for the same page.n, Swap-out priority P until the previous timen-1And swap-out time TnBased on Pn= F (Pn-1, Tn) As a feature.
[0020]
  Furthermore, in the demand paging swap-out method for kernel space of the present invention, the kernel swap-out process further includes a swap-out page selection step,
  In the swap-out priority recalculation step, the swap-out priorityP n Is the average value of the swap-out time TP n = P n-1 + (T n -P n-1 ) / NAnd recalculate as
  In the swap-out page selection step, the swap-out priorityP n A page having a large value is selected as a swap-out target page.
[0021]
On the other hand, the program of the present invention includes a kernel demand paging unit that swaps in a swap-in target page from a swap device to a physical memory when a page fault occurs in a kernel space during system operation. A kernel swap-out unit that selects a page having the highest swap-out priority when the physical memory page allocation fails and swaps out the page from the physical memory to the swap device, and the kernel immediately after completion of the kernel startup sequence Call up the swap-out unit to swap out the remaining pages of the kernel space from the physical memory to the swap device, excluding the page where the kernel demand paging unit exists. To function as an out-section.
[0022]
In the program of the present invention, the kernel demand paging unit includes a page fault handling means for specifying a fault occurrence page and a fault factor, a time stamp value of the fault occurrence page specified by the page fault handling means, and swap-out priority. Swap-out priority recalculating means for recalculating swap-out priority based on the degree, and re-allocating the physical memory to the fault occurrence page specified by the page fault handling means and mapping to the kernel space And memory mapping means for calling a memory reservation algorithm when the physical memory is insufficient to try to secure a page of the physical memory.
[0023]
Further, the program of the present invention includes a swap-out page selection unit that selects a page to be swapped out based on the swap-out priority of each page, and the swap selected by the swap-out page selection unit. A time stamp unit that sets a current time to a time stamp value of an out target page; and a swap out unit that swaps out the swap out target page selected by the swap out page selection unit from the physical memory to the swap device. It is characterized by that.
[0024]
Furthermore, in the program of the present invention, the startup kernel swap-out unit initializes the timestamp value and swap-out priority of each page in the kernel space, and a swap-out priority initialization unit; A kernel demand paging unit swap-out suppression means for setting a swap-out suppression value to a swap-out priority of a page in which the kernel demand paging unit exists, a difference between the number of pages in the kernel space and the number of pages in the kernel demand paging unit. Kernel swap-out section calling means for calling the kernel swap-out section as the number of requested pages.
[0025]
Further, according to the program of the present invention, the swap-out priority recalculation unit is configured such that the swap-out priority P when the n-th page fault occurs for the same page.n, Swap-out priority P until the previous timen-1And swap-out time TnBased on Pn= F (Pn-1, Tn) As a feature.
[0026]
  Furthermore, in the program of the present invention, the kernel swap-out unit further includes swap-out page selection means,
  The swap out priority recalculation means is configured to calculate the swap out priority.P n Is the average value of the swap-out time TP n = P n-1 + (T n -P n-1 ) / NAnd recalculate as
  The swap-out page selection means is configured to select the swap-out priority.P n A page having a large value is selected as a swap-out target page.
[0027]
A feature of the present invention is a monolithic kernel generated as a single load module, which does not guarantee that all pages in the kernel space are expanded in physical memory, and the pages of the required kernel functions are physical. Triggered by a page fault that occurs when the page is not expanded in memory, demand paging is performed to swap in the page from the swap device to the physical memory, thereby effectively utilizing the memory resources. In addition, memory resources are effectively used by swapping out pages of kernel functions that are not used or are not frequently used from physical memory to a swap device.
[0028]
Here, the operation of the present invention will be described with reference to FIGS.
[0029]
Normally, the monolithic kernel exists as a single file (load module) on a file storage device (not shown), and is expanded from the file storage device to the physical memory 5 by the bootstrap function, and execution starts from a specific point. Is done.
[0030]
In the present invention, all the text and data areas of the kernel are once expanded in the physical memory 5 by the bootstrap function. However, immediately after the start-up sequence is finished, the page where the kernel demand paging unit 2 exists is displayed by the kernel swap-out unit 3. The remaining pages of the kernel space 4a are temporarily swapped out from the physical memory 5 to the swap device 6. Thereafter, whenever a page fault occurs, the kernel demand paging unit 2 is used to swap in the swap-in target page from the swap device 6 to the physical memory 5 and resume execution from the page fault point. Each page holds the swap-out priority 42 as an attribute value. When a memory request by the user process is requested, if the page reservation of the physical memory 5 by a memory reservation algorithm such as LRU (Least Recently Used) fails, the swap-out priority The pages are swapped out from the physical memory 5 to the swap device 6 in ascending order of 42 to try to secure the pages in the physical memory 5.
[0031]
Specifically, the startup kernel swap-out unit 1 first initializes the time stamp value 41 and the swap-out priority 42 (zero clear) by the time stamp value / swap-out priority initialization unit 11. Next, the kernel demand paging unit swap-out suppression unit 12 sets a swap-out suppression value to the swap-out priority 42 of the page where the kernel demand paging unit 2 exists. Since the kernel itself can know the start address and the end address of the text of the kernel demand paging unit 2, it is possible to specify the page where the kernel demand paging unit 2 exists. The swap-out suppression value needs to be an arbitrary value that is not obtained as a result of the recalculation formula of the swap-out priority 42. For example, 0 or a negative value can be used as the swap-out suppression value. Finally, the kernel swap-out unit calling means 13 designates (the number of pages in the kernel space 4a−the number of pages in the kernel demand paging unit 2) as the requested swap-out size (number of requested pages), and the kernel swap-out unit 3 call.
[0032]
The kernel swap-out unit 3 uses the swap-out page selection unit 31 to select a swap-out target page based on the swap-out priority 42. At this time, the kernel demand paging unit 2 in which the swap-out suppression value is set is selected. The page is not selected as a page to be swapped out.
[0033]
As described above, the startup kernel swap-out unit 1 can swap out the remaining pages of the kernel space 4a from the physical memory 5 to the swap device 6 except for the page where the kernel demand paging unit 2 exists.
[0034]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.
[0035]
(1) First embodiment
FIG. 1 is a block diagram showing a configuration of a demand paging swap-out system for a kernel space according to the first embodiment of the present invention. The demand paging / swap-out method of the kernel space according to the present embodiment includes a startup kernel swap-out unit 1, a kernel demand paging unit 2, a kernel swap-out unit 3, a kernel space 4a and a user space 4b (see FIG. 2)), a physical memory 5 that is a main memory, and a swap device 6 that is a magnetic disk device or the like.
[0036]
The startup kernel swap-out unit 1 includes a timestamp value / swap-out priority initialization unit 11 for initializing the timestamp value 41 and swap-out priority 42 of each page of the kernel space 4a, and the kernel demand paging unit 2. Kernel demand paging section swap-out suppression means 12 for setting a swap-out suppression value in the swap-out priority 42 of the page in which there is a request, and the difference between the number of pages in the kernel space 4a and the number of pages in the kernel demand paging section 2 is requested page It comprises kernel swap-out unit calling means 13 for calling the kernel swap-out unit 3 as a number.
[0037]
The kernel demand paging unit 2 recalculates the swap-out priority 42 based on the page fault handling means 21 that identifies the fault occurrence page and the fault cause, the time stamp value 41 of the fault occurrence page, and the swap-out priority 42. The swap-out priority recalculating means 22 performs re-page reservation of the physical memory 5 and mapping to the kernel space 4a. If the number of requested pages is not reached, the memory reservation algorithm is called to try to secure the page of the physical memory 5. And memory mapping means 23.
[0038]
The kernel swap-out unit 3 includes a swap-out page selection unit 31 that selects a swap-out target page based on the swap-out priority 42 of each page, and a time stamp that sets the current time in the time stamp value 41 of the swap-out target page. Means 32 and swap-out means 33 for swapping out pages to be swapped out of the kernel space 4 a from the physical memory 5 to the swap device 6.
[0039]
Each page constituting the virtual space 4 is accompanied by a time stamp value 41 and a swap-out priority 42 as attribute values.
[0040]
FIG. 3 shows an example in which the time stamp value 41 and the swap-out priority 42 are held in the page table 43 used in normal virtual storage. Each entry in the page table 43 includes a valid flag, a time stamp value 41, a swap-out priority 42, and a physical page or disk address. The physical page address is stored when the valid flag is on (“1”), and the disk address is stored when the valid flag is off (“0”).
[0041]
Referring to FIG. 4, the initialization process of the kernel space demand paging / swap-out method according to the first embodiment includes a kernel startup step S101, a timestamp value / swap-out priority initialization step S102, Kernel demand paging part swap-out suppression step S103, kernel swap-out part call step S104, and user process transition step S105.
[0042]
Referring to FIG. 5, the processing of the kernel demand paging unit 2 includes a page fault handling step S201, a time stamp value / swap out priority acquisition step S202, a swap out priority recalculation step S203, and a swap out priority setting. It consists of step S204 and memory mapping step S205.
[0043]
Similarly, referring to FIG. 5, the process of the kernel swap-out unit 3 includes a swap-out priority order page selection step S301, a suppression page determination step S302, a time stamp value setting step S303, a swap-out step S304, a request It consists of page number determination step S305.
[0044]
Next, the operation of the demand paging / swap-out method in the kernel space according to the first embodiment configured as described above will be described with reference to FIGS.
[0045]
First, when the kernel startup sequence ends (step S101), the startup kernel swap-out unit 1 is executed.
[0046]
The startup kernel swap-out unit 1 initializes the time stamp value 41 and the swap-out priority 42 of each page of the kernel space 4a by the time stamp value / swap out priority initialization means 11 (zero clear) (step clear). S102).
[0047]
Next, the startup kernel swap-out unit 1 uses the kernel demand paging unit swap-out suppression unit 12 to set the swap-out priority 42 of the page where the kernel demand paging unit 2 is present to, for example, 0 or a negative value. An out suppression value is set (step S103).
[0048]
Subsequently, the startup kernel swap-out unit 1 uses the kernel swap-out unit calling means 13 to call the kernel swap-out unit 3 with (number of pages in the kernel space 4a−number of pages in the kernel demand paging unit 2) as the requested number of pages. Call (step S104).
[0049]
The kernel swap-out unit 3 uses the swap-out page selection unit 31 to select pages in the kernel space 4a in descending order of the swap-out priority 42 (step S301), and the swap-out priority 42 is a swap-out suppression value (for example, 0). Whether or not the page is the kernel demand paging unit 2 is determined based on whether it is a negative value (step S302). If it is a page in which the kernel demand paging unit 2 exists, control is returned to step S301, and the page with the next highest swap-out priority 42 is selected.
[0050]
If the kernel demand paging unit 2 does not exist, the kernel swap-out unit 3 sets the current time to the time stamp value 41 by the time stamp means 32 (step S303).
[0051]
Subsequently, the kernel swap-out unit 3 uses the swap-out means 33 to swap out the pages on the physical memory 5 to the swap device 2 (step S304), and whether or not the requested number of pages has been reached, that is, the kernel demand paging unit. It is determined whether or not the remaining pages of the kernel space 4a, excluding the page in which 2 exists, have been swapped out from the physical memory 5 to the swap device 6 (step S305). If the requested number of pages has not been reached, control is returned to step S301, and the page with the next highest swap-out priority 42 is selected. If the requested number of pages has been reached, the process shifts to a user process (usually an init process) (step S105).
[0052]
When a page fault occurs in a page in the kernel space 4a during system operation, the kernel demand paging unit 2 is activated.
[0053]
The kernel demand paging unit 2 uses the page fault handling means 21 to identify the page where the fault has occurred (fault occurrence page) and the cause of the fault (fault cause) (step S201).
[0054]
Next, the kernel demand paging unit 2 acquires the time stamp value 41 and the swap-out priority 42 of the fault occurrence page by the swap-out priority re-calculating means 22 (step S202), and re-calculates the swap-out priority 42. (Step S203), this is reset to the swap-out priority 42 (Step S204).
[0055]
Specifically, each page statistically holds the swap-out time T (swap-out time) T from the time of swap-out to the time of page fault occurrence, and uses this as the swap-out priority 42 to determine whether swap-out is possible or not. Use as judgment material. That is, the swap-out time T is given by the difference between the swap-out occurrence time and the page fault occurrence time. Swap-out priority P when the n-th page fault occurs for the same pagenIs the swap-out priority P up to the previous timen-1And swap-out time TnAnd use Pn= F (Pn-1, Tn).
[0056]
As an example, F (Pn-1, Tn) = Pn-1+ (Tn-Pn-1) / N, swap-out priority PnIs expressed as the average value of the swap-out time T, and the swap-out priority PnIt is possible to select a page as a swap-out target page from a page with a large value of.
[0057]
Finally, the kernel demand paging unit 2 uses the memory mapping unit 23 to reserve the physical memory 5 again and map it to the kernel space 4a (step S205). At this time, if the requested number of pages is not reached, a memory allocation algorithm is called to try to allocate a page in the physical memory 5.
[0058]
When a user process (not shown) fails to secure a page in the physical memory 5 during system operation, first, a page in the user space 4b is swapped out from the physical memory 5 to the swap device 6 according to a memory securing algorithm.
[0059]
When the page of the user space 4b is swapped out from the physical memory 5 to the swap device 6 and the required number of pages is not reached, the user process has conventionally caused an error due to insufficient capacity of the physical memory 5. Then, the kernel swap-out unit 3 is called.
[0060]
The kernel swap-out unit 3 uses the swap-out page selection unit 31 to select pages in descending order of the swap-out priority 42 in the kernel space 4a (step S301), and the swap-out priority 42 has a swap-out suppression value (for example, 0). It is determined whether or not the kernel demand paging unit 2 is a negative page (step S302). If it is a page in which the kernel demand paging unit 2 exists, control is returned to step S301, and the page with the next highest swap-out priority 42 is selected.
[0061]
If the kernel demand paging unit 2 does not exist, the kernel swap-out unit 3 sets the current time to the time stamp value 41 by the time stamp means 32 (step S303).
[0062]
Subsequently, the kernel swap-out unit 3 uses the swap-out means 33 to swap out the pages on the physical memory 5 to the swap device 2 (step S304), and determines whether the requested number of pages has been reached (step S305). ). If the requested number of pages has not been reached, control is returned to step S301, and the page with the next highest swap-out priority 42 is selected. If the requested number of pages has been reached, control is returned to the user process.
[0063]
As described above, according to the first embodiment, among the pages of the physical memory 5 in which the kernel has conventionally resided, the pages of the physical memory 5 that are hardly used are released to the user process or the like. Thus, memory resources can be used effectively.
[0064]
(2) Second embodiment
FIG. 6 is a block diagram showing a configuration of a kernel space demand paging swap-out method according to the second embodiment of the present invention. The demand paging / swap-out method of the kernel space according to the present embodiment is a virtual storage operating system in the computer 100 as compared with the demand paging / swap-out method of the kernel space according to the first embodiment shown in FIG. The difference is that 200 is provided as a program.
[0065]
The virtual storage operating system 200 is read into the computer 100, and the operation of the computer 100 is changed to the startup kernel swap-out unit 1 (time stamp value / swap-out priority initialization unit 11, kernel demand paging unit swap-out suppression unit) 12, kernel swap-out section calling means 13), kernel demand paging section 2 (page fault handling means 21, swap-out priority recalculation means 22, and memory mapping means 23), and kernel swap-out section 3 (swap-out page) The selection means 31, time stamp means 32, and swap-out means 33) are controlled. The operation of the kernel space demand paging / swap-out method under the control of the virtual memory operating system 200 is the same as that of the kernel space demand paging / swap-out method according to the first embodiment. Value / swap out priority initialization means 11, kernel demand paging section swap out suppression means 12, kernel swap out section calling means 13), kernel demand paging section 2 (page fault handling means 21, swap out priority recalculation means) 22 and the memory mapping means 23) and the kernel swap-out unit 3 (swap-out page selection means 31, time stamp means 32, and swap-out means 33). Since, it omitted the detailed description.
[0066]
In each of the above embodiments, the recalculation formula of the swap-out priority 42 is Pn= F (Pn-1, Tn) = Pn-1+ (Tn-Pn-1) / N, the recalculation formula of the swap-out priority 42 is not limited to the above formula.n= F (Pn-1, TnNeedless to say, the demand paging swap-out method and method for the kernel space of the present invention can be applied to all the expressions that can be expressed as follows.
[0067]
【The invention's effect】
The first effect is that memory resources can be effectively utilized by releasing, to a user process, a page of physical memory that has rarely been used among physical memory pages in which the kernel has been resident. is there.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a configuration of a demand paging / swap-out method for a kernel space according to a first embodiment of the present invention.
FIG. 2 is a diagram for explaining kernel demand paging and kernel swap-out in the kernel space demand paging / swap-out method according to the first embodiment;
FIG. 3 is a diagram showing an example in which the time stamp value and the swap-out priority in FIG. 1 are stored in a page table.
FIG. 4 is a flowchart showing processing of a startup kernel swap-out unit in FIG. 1;
FIG. 5 is a flowchart showing processing of a kernel demand paging unit and a kernel swap-out unit in FIG. 1;
FIG. 6 is a block diagram showing a configuration of a kernel space demand paging swap-out method according to a second embodiment of the present invention;
[Explanation of symbols]
1 Kernel swap-out part at startup
2 Kernel demand paging section
3 Kernel swap-out section
4 Virtual space
4a kernel space
4b User space
5 Physical memory
6 Swap devices
11 Time stamp value / swap out priority initialization means
12 Kernel demand paging part swap-out suppression means
13 Kernel swap-out part calling means
21 Page fault handling means
22 Swap out priority recalculation means
23 Memory mapping means
31 Swap out page selection means
32 Time stamp means
33 Swap-out means
41 Timestamp value
42 Swap out priority
43 page table
100 computers
200 Virtual memory operating system
S101 Kernel startup step
S102 Time stamp value / swap out priority initialization step
S103 Kernel demand paging part swap-out suppression step
S104 Kernel swap-out part calling step
S105 User process transition step
S201 Page fault handling step
S202 Time stamp value / swap out priority acquisition step
S203 Swap out priority recalculation step
S204 Swap-out priority setting step
S205 Memory mapping step
S301 Swap out priority order page selection step
S302 Suppression page determination step
S303 Time stamp value setting step
S304 Swap out step
S305 Requested page number determination step

Claims (18)

単一のロードモジュールとして生成されているモノリシックカーネルを採用する仮想記憶計算システムにおいて、
システム運用時にカーネル空間でページフォルトが発生した場合にスワップイン対象ページをスワップデバイスから物理メモリにスワップインするカーネルデマンドページング部と、
システム運用時にユーザプロセスが前記物理メモリのページ確保に失敗した場合にスワップアウト優先度が最も高いページを選択して前記物理メモリから前記スワップデバイスにスワップアウトするカーネルスワップアウト部と、
カーネルの立ち上げシーケンスの終了直後に前記カーネルスワップアウト部を呼び出して、前記カーネルデマンドページング部が存在するページを除く、カーネル空間の残余のページを前記物理メモリから前記スワップデバイスにスワップアウトさせる立ち上げ時カーネルスワップアウト部と
を含むことを特徴とするカーネル空間のデマンドページング・スワップアウト方式。
In a virtual memory computing system that employs a monolithic kernel generated as a single load module,
A kernel demand paging unit that swaps in a swap target page from a swap device to physical memory when a page fault occurs in the kernel space during system operation;
A kernel swap-out unit that selects a page with the highest swap-out priority and swaps out the physical memory to the swap device when a user process fails to secure the physical memory page during system operation;
Immediately after completion of the kernel startup sequence, the kernel swap-out unit is called to swap out the remaining pages of the kernel space from the physical memory to the swap device, excluding the page where the kernel demand paging unit exists. A kernel space demand paging swap-out method characterized by including a kernel swap-out section.
前記カーネルデマンドページング部が、フォルト発生ページおよびフォルト要因を特定するページフォルトハンドリング手段と、このページフォルトハンドリング手段により特定されたフォルト発生ページのタイムスタンプ値およびスワップアウト優先度に基づいてスワップアウト優先度の再計算を行うスワップアウト優先度再計算手段と、前記ページフォルトハンドリング手段により特定されたフォルト発生ページに対する前記物理メモリの再ページ確保およびカーネル空間へのマッピングを行い、前記物理メモリが足りない場合にはメモリ確保アルゴリズムを呼び出して前記物理メモリのページ確保を試みるメモリマッピング手段とを備えることを特徴とする請求項1記載のカーネル空間のデマンドページング・スワップアウト方式。The kernel demand paging unit has a page fault handling means for identifying a fault occurrence page and a fault factor, and a swap out priority based on a time stamp value and a swap out priority of the fault occurrence page specified by the page fault handling means. Swap out priority recalculating means for performing recalculation, and reallocating the physical memory to the fault occurrence page specified by the page fault handling means and mapping to the kernel space, and the physical memory is insufficient The kernel space demand paging swap-out system according to claim 1, further comprising memory mapping means for calling a memory allocation algorithm to try to allocate a page of the physical memory. 前記カーネルスワップアウト部が、各ページのスワップアウト優先度に基づいてスワップアウト対象ページを選択するスワップアウトページ選択手段と、このスワップアウトページ選択手段により選択されたスワップアウト対象ページのタイムスタンプ値に現在時刻を設定するタイムスタンプ手段と、前記スワップアウトページ選択手段により選択されたスワップアウト対象ページを前記物理メモリから前記スワップデバイスにスワップアウトするスワップアウト手段とを備えることを特徴とする請求項1記載のカーネル空間のデマンドページング・スワップアウト方式。The kernel swap-out unit selects a swap-out page selection unit that selects a swap-out target page based on the swap-out priority of each page, and the time stamp value of the swap-out target page selected by the swap-out page selection unit. 2. A time stamp means for setting a current time, and a swap-out means for swapping out a swap-out target page selected by the swap-out page selection means from the physical memory to the swap device. Demand paging swap-out method of kernel space as described. 前記立ち上げ時カーネルスワップアウト部が、カーネル空間の各ページのタイムスタンプ値およびスワップアウト優先度を初期化するタイムスタンプ値・スワップアウト優先度初期化手段と、前記カーネルデマンドページング部が存在するページのスワップアウト優先度にスワップアウト抑止値を設定するカーネルデマンドページング部スワップアウト抑止手段と、カーネル空間のページ数と前記カーネルデマンドページング部のページ数との差を要求ページ数として前記カーネルスワップアウト部を呼び出すカーネルスワップアウト部呼出し手段とを備えることを特徴とする請求項1記載のカーネル空間のデマンドページング・スワップアウト方式。The startup kernel swap-out unit initializes the timestamp value and swap-out priority of each page in the kernel space, and the page where the kernel demand paging unit exists Kernel demand paging part swap-out suppression means for setting a swap-out suppression value in the swap-out priority of the kernel swap-out part with the difference between the number of pages in the kernel space and the number of pages in the kernel demand paging part as the requested page number 2. The kernel space demand paging swap-out method according to claim 1, further comprising: a kernel swap-out unit calling means for calling. 前記スワップアウト優先度再計算手段が、同一ページに対するn回目のページフォルト発生時のスワップアウト優先度Pを、前回までのスワップアウト優先度Pn−1およびスワップアウト時間Tに基づいて、P=F(Pn−1,T)として計算することを特徴とする請求項2記載のカーネル空間のデマンドページング・スワップアウト方式。The swap-out priority recalculating means determines the swap-out priority P n when the n-th page fault occurs for the same page based on the previous swap-out priority P n−1 and the swap-out time T n . 3. The demand paging swap-out method for a kernel space according to claim 2, wherein the calculation is performed as P n = F (P n−1 , T n ). 前記カーネルスワップアウト部が、スワップアウトページ選択手段をさらに備え、
前記スワップアウト優先度再計算手段は、前記スワップアウト優先度 を、スワップアウト時間Tの平均値 =P n−1 +(T −P n−1 )/nとして再計算するものであり、
前記スワップアウトページ選択手段は、前記スワップアウト優先度 の値の大きなページをスワップアウト対象ページとして選択するものである、ことを特徴とする請求項5記載のカーネル空間のデマンドページング・スワップアウト方式。
The kernel swap-out unit further comprises swap-out page selection means,
The swap-out priority recalculation means recalculates the swap-out priority P n as an average value P n = P n−1 + (T n −P n−1 ) / n of the swap out time T. And
6. The demand paging swap-out in the kernel space according to claim 5, wherein the swap-out page selection means selects a page having a large value of the swap-out priority P n as a page to be swapped out. method.
カーネルが単一のロードモジュールとして生成されている仮想記憶オペレーティングシステムにおいて、システム運用時にカーネル空間でページフォルトが発生した場合にスワップイン対象ページを前記スワップデバイスから物理メモリにスワップインするカーネルデマンドページング処理と、
システム運用時にユーザプロセスが前記物理メモリのページ確保に失敗した場合にスワップアウト優先度が最も高いページを選択し前記物理メモリから前記スワップデバイスにスワップアウトするカーネルスワップアウト処理と、
カーネルの立ち上げシーケンスの終了直後に前記カーネルスワップアウト処理を呼び出して、前記カーネルデマンドページング処理を行うカーネルデマンドページング部が存在するページを除く、カーネル空間の残余のページを前記物理メモリから前記スワップデバイスにスワップアウトさせる立ち上げ時カーネルスワップアウト処理とを含むことを特徴とするカーネル空間のデマンドページング・スワップアウト方法。
In a virtual memory operating system in which the kernel is generated as a single load module, a kernel demand paging process that swaps in a swap-in target page from the swap device to physical memory when a page fault occurs in the kernel space during system operation When,
A kernel swap-out process that selects a page with the highest swap-out priority when a user process fails to secure a page of the physical memory during system operation, and swaps out the physical memory to the swap device;
Immediately after the end of the kernel startup sequence, the kernel swap-out process is called, and the remaining pages in the kernel space are removed from the physical memory except the page where the kernel demand paging unit for performing the kernel demand paging process exists. A kernel space demand paging swap-out method, comprising:
前記カーネルデマンドページング処理が、フォルト発生ページおよびフォルト要因を特定するページフォルトハンドリング工程と、このページフォルトハンドリング工程で特定されたフォルト発生ページのタイムスタンプ値およびスワップアウト優先度に基づいてスワップアウト優先度の再計算を行うスワップアウト優先度再計算工程と、前記ページフォルトハンドリング工程で特定されたフォルト発生ページに対して前記物理メモリの再ページ確保およびカーネル空間へのマッピングを行い、前記物理メモリが足りない場合にはメモリ確保アルゴリズムを呼び出して前記物理メモリのページ確保を試みるメモリマッピング工程とからなることを特徴とする請求項7記載のカーネル空間のデマンドページング・スワップアウト方法。The kernel demand paging process is based on the page fault handling process for identifying the faulting page and the fault factor, and the time out value and the swapout priority of the faulting page specified in the page fault handling process. Swap out priority recalculation step for performing recalculation, and reallocating the physical memory to the fault occurrence page specified in the page fault handling step and mapping to the kernel space, and the physical memory is sufficient. 8. The demand paging swap-out method for a kernel space according to claim 7, further comprising a memory mapping step of calling a memory allocation algorithm to try to allocate a page of the physical memory when there is not. 前記カーネルスワップアウト処理が、各ページのスワップアウト優先度に基づいてスワップアウト対象ページを選択するスワップアウトページ選択工程と、このスワップアウトページ選択工程で選択されたスワップアウト対象ページのタイムスタンプ値に現在時刻を設定するタイムスタンプ工程と、前記スワップアウトページ選択工程で選択されたスワップアウト対象ページを前記物理メモリから前記スワップデバイスにスワップアウトするスワップアウト工程とからなることを特徴とする請求項7記載のカーネル空間のデマンドページング・スワップアウト方法。The kernel swap-out process selects a swap-out page selection step for selecting a swap-out target page based on the swap-out priority of each page, and the time-stamp value of the swap-out target page selected in the swap-out page selection step. 8. A time stamp process for setting a current time, and a swap-out process for swapping out a swap-out target page selected in the swap-out page selection process from the physical memory to the swap device. Demand paging swap-out method of kernel space as described. 前記立ち上げ時カーネルスワップアウト処理が、カーネル空間の各ページのタイムスタンプ値およびスワップアウト優先度を初期化するタイムスタンプ値・スワップアウト優先度初期化工程と、前記カーネルデマンドページングが存在するページのスワップアウト優先度にスワップアウト抑止値を設定するカーネルデマンドページング処理スワップアウト抑止工程と、カーネル空間のページ数と前記カーネルデマンドページングのページ数との差を要求ページ数として前記カーネルスワップアウト処理を呼び出すカーネルスワップアウト処理呼出し工程とを備えることを特徴とする請求項7記載のカーネル空間のデマンドページング・スワップアウト方法。The startup kernel swap-out process initializes the timestamp value and swap-out priority of each page in the kernel space, and the page where the kernel demand paging unit exists. Demand-paging process for setting swap-out suppression value to swap-out priority of the swap-out process, and the kernel swap-out process using the difference between the number of pages in the kernel space and the number of pages in the kernel demand paging unit as the requested page number A kernel space demand paging swap-out method according to claim 7, further comprising: a kernel swap-out process calling step for calling. 前記スワップアウト優先度再計算工程が、同一ページに対するn回目のページフォルト発生時のスワップアウト優先度Pを、前回までのスワップアウト優先度Pn−1およびスワップアウト時間Tに基づいて、P=F(Pn−1,T)として計算することを特徴とする請求項8記載のカーネル空間のデマンドページング・スワップアウト方法。In the swap-out priority recalculation step, the swap-out priority P n at the time of the n-th page fault occurrence for the same page is determined based on the previous swap-out priority P n−1 and the swap-out time T n . 9. The demand paging swap-out method for a kernel space according to claim 8, wherein the calculation is performed as P n = F (P n−1 , T n ). 前記カーネルスワップアウト処理が、スワップアウトページ選択工程をさらに含み、
前記スワップアウト優先度再計算工程では、前記スワップアウト優先度 を、スワップアウト時間Tの平均値 =P n−1 +(T −P n−1 )/nとして再計算するものであり、
前記スワップアウトページ選択工程では、前記スワップアウト優先度 の値の大きなページをスワップアウト対象ページとして選択するものである、ことを特徴とする請求項11記載のカーネル空間のデマンドページング・スワップアウト方法。
The kernel swap-out process further includes a swap-out page selection step;
In the swap-out priority recalculation step, the swap-out priority P n is recalculated as an average value P n = P n−1 + (T n −P n−1 ) / n of the swap-out time T. And
Wherein in the swapped out page selection process, the swap-out priority large pages of the values of P n and selects a swap-out target page, demand paging swapped out of kernel space according to claim 11, wherein the Method.
コンピュータを、システム運用時にカーネル空間でページフォルトが発生した場合にスワップイン対象ページをスワップデバイスから物理メモリにスワップインするカーネルデマンドページング部,システム運用時にユーザプロセスが前記物理メモリのページ確保に失敗した場合にスワップアウト優先度が最も高いページを選択して前記物理メモリから前記スワップデバイスにスワップアウトするカーネルスワップアウト部,およびカーネルの立ち上げシーケンスの終了直後に前記カーネルスワップアウト部を呼び出して、前記カーネルデマンドページング部が存在するページを除く、カーネル空間の残余のページを前記物理メモリから前記スワップデバイスにスワップアウトさせる立ち上げ時カーネルスワップアウト部として機能させるためのプログラム。Kernel demand paging unit that swaps in the swap-in target page from the swap device to the physical memory when a page fault occurs in the kernel space during system operation of the computer. The user process failed to secure the physical memory page during system operation. In this case, the page having the highest swap-out priority is selected and swapped out from the physical memory to the swap device, and the kernel swap-out unit is called immediately after the end of the kernel startup sequence, To function as a kernel swap-out unit at startup that swaps out the remaining pages of the kernel space from the physical memory to the swap device, excluding the page where the kernel demand paging unit exists Of the program. 前記カーネルデマンドページング部が、フォルト発生ページおよびフォルト要因を特定するページフォルトハンドリング手段と、このページフォルトハンドリング手段により特定されたフォルト発生ページのタイムスタンプ値およびスワップアウト優先度に基づいてスワップアウト優先度の再計算を行うスワップアウト優先度再計算手段と、前記ページフォルトハンドリング手段により特定されたフォルト発生ページに対する前記物理メモリの再ページ確保およびカーネル空間へのマッピングを行い、前記物理メモリが足りない場合にはメモリ確保アルゴリズムを呼び出して前記物理メモリのページ確保を試みるメモリマッピング手段とを備えることを特徴とする請求項13記載のプログラム。The kernel demand paging unit has a page fault handling means for identifying a fault occurrence page and a fault factor, and a swap out priority based on a time stamp value and a swap out priority of the fault occurrence page specified by the page fault handling means. Swap out priority recalculating means for performing recalculation, and reallocating the physical memory to the fault occurrence page specified by the page fault handling means and mapping to the kernel space, and the physical memory is insufficient 14. The program according to claim 13, further comprising memory mapping means for calling a memory reservation algorithm to try to secure a page of the physical memory. 前記カーネルスワップアウト部が、各ページのスワップアウト優先度に基づいてスワップアウト対象ページを選択するスワップアウトページ選択手段と、このスワップアウトページ選択手段により選択されたスワップアウト対象ページのタイムスタンプ値に現在時刻を設定するタイムスタンプ手段と、前記スワップアウトページ選択手段により選択されたスワップアウト対象ページを前記物理メモリから前記スワップデバイスにスワップアウトするスワップアウト手段とを備えることを特徴とする請求項13記載のプログラム。The kernel swap-out unit selects a swap-out page selection unit that selects a swap-out target page based on the swap-out priority of each page, and the time stamp value of the swap-out target page selected by the swap-out page selection unit. 14. A time stamp means for setting a current time, and a swap out means for swapping out a swap out target page selected by the swap out page selection means from the physical memory to the swap device. The listed program. 前記立ち上げ時カーネルスワップアウト部が、カーネル空間の各ページのタイムスタンプ値およびスワップアウト優先度を初期化するタイムスタンプ値・スワップアウト優先度初期化手段と、前記カーネルデマンドページング部が存在するページのスワップアウト優先度にスワップアウト抑止値を設定するカーネルデマンドページング部スワップアウト抑止手段と、カーネル空間のページ数と前記カーネルデマンドページング部のページ数との差を要求ページ数として前記カーネルスワップアウト部を呼び出すカーネルスワップアウト部呼出し手段とを備えることを特徴とする請求項13記載のプログラム。The startup kernel swap-out unit initializes the timestamp value and swap-out priority of each page in the kernel space, and the page where the kernel demand paging unit exists Kernel demand paging part swap-out suppression means for setting a swap-out suppression value in the swap-out priority of the kernel swap-out part with the difference between the number of pages in the kernel space and the number of pages in the kernel demand paging part as the requested page number 14. The program according to claim 13, further comprising a kernel swap-out part calling means for calling. 前記スワップアウト優先度再計算手段が、同一ページに対するn回目のページフォルト発生時のスワップアウト優先度Pを、前回までのスワップアウト優先度Pn−1およびスワップアウト時間Tに基づいて、P=F(Pn−1,T)として計算することを特徴とする請求項14記載のプログラム。The swap-out priority recalculating means determines the swap-out priority P n when the n-th page fault occurs for the same page based on the previous swap-out priority P n−1 and the swap-out time T n . The program according to claim 14, wherein the calculation is performed as P n = F (P n−1 , T n ). 前記カーネルスワップアウト部が、スワップアウトページ選択手段をさらに備え、
前記スワップアウト優先度再計算手段は、前記スワップアウト優先度 を、スワップアウト時間Tの平均値 =P n−1 +(T −P n−1 )/nとして再計算するものであり、
前記スワップアウトページ選択手段は、前記スワップアウト優先度 の値の大きなページをスワップアウト対象ページとして選択するものである、ことを特徴とする請求項17記載のプログラム。
The kernel swap-out unit further comprises swap-out page selection means,
The swap-out priority recalculation means recalculates the swap-out priority P n as an average value P n = P n−1 + (T n −P n−1 ) / n of the swap out time T. And
The program according to claim 17, wherein the swap-out page selection unit selects a page having a large value of the swap-out priority P n as a swap-out target page.
JP2001131195A 2001-04-27 2001-04-27 Kernel space demand paging swap-out method and method Expired - Fee Related JP3726701B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001131195A JP3726701B2 (en) 2001-04-27 2001-04-27 Kernel space demand paging swap-out method and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2001131195A JP3726701B2 (en) 2001-04-27 2001-04-27 Kernel space demand paging swap-out method and method

Publications (2)

Publication Number Publication Date
JP2002328841A JP2002328841A (en) 2002-11-15
JP3726701B2 true JP3726701B2 (en) 2005-12-14

Family

ID=18979426

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001131195A Expired - Fee Related JP3726701B2 (en) 2001-04-27 2001-04-27 Kernel space demand paging swap-out method and method

Country Status (1)

Country Link
JP (1) JP3726701B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7146466B2 (en) * 2004-03-23 2006-12-05 International Business Machines System for balancing multiple memory buffer sizes and method therefor
CN100385417C (en) * 2005-06-15 2008-04-30 乐金电子(惠州)有限公司 Demand paging method and method for inputting related page information into page
JP5245231B2 (en) * 2006-09-07 2013-07-24 日本電気株式会社 MEMORY MANAGEMENT METHOD, MEMORY MANAGEMENT DEVICE, AND PROGRAM

Also Published As

Publication number Publication date
JP2002328841A (en) 2002-11-15

Similar Documents

Publication Publication Date Title
US5727178A (en) System and method for reducing stack physical memory requirements in a multitasking operating system
KR101378390B1 (en) System and method to allocate portions of a shared stack
JP5385347B2 (en) Method and computer for enlarging free memory in main memory
US20160085601A1 (en) Transparent user mode scheduling on traditional threading systems
US9043806B2 (en) Information processing device and task switching method
JP2003167737A (en) Stack use method
EP1999596A2 (en) Method and apparatus for dynamic resizing of cache partitions based on the execution phase of tasks
EP2375324A2 (en) Virtualization apparatus for providing a transactional input/output interface
US6895583B1 (en) Task control block for a computing environment
JP3726701B2 (en) Kernel space demand paging swap-out method and method
CN113127263B (en) Kernel crash recovery method, device, equipment and storage medium
JP5941868B2 (en) Virtual computer system and I / O execution method in virtual computer
JP2002258971A (en) Method for restarting computer system
JP4287411B2 (en) Virtual memory system and virtual storage method
JP2001290678A (en) Asynchronous memory dump executing system
CN115495392B (en) Memory multiplexing method and device in multi-stage starting, storage medium and processor
CN115098244B (en) Distribution method of kernel stack, electronic equipment, chip and storage medium
JP4888713B2 (en) Computer system activation method, information processing apparatus, and program
JPH10312297A (en) Resource managing method, resource managing device and recording medium for information processing system having multi-task function
WO2023030173A1 (en) Method for managing dynamic library and corresponding apparatus
JPH06266619A (en) Page saving/restoring device
JP2005071141A (en) Method and device for managing stack and stack management program
JP2003330737A (en) Computer system
JP2011257973A (en) Memory management method and memory management device
JP5561147B2 (en) Virtual storage management device, virtual storage management method, and virtual storage management program

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20041014

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20041027

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20041224

RD01 Notification of change of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7421

Effective date: 20050124

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20050308

RD01 Notification of change of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7421

Effective date: 20050309

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050418

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20050614

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050805

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20050906

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20050919

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20091007

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20091007

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20101007

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20111007

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20121007

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20131007

Year of fee payment: 8

LAPS Cancellation because of no payment of annual fees