JP3557026B2 - Virtual memory management method - Google Patents
Virtual memory management method Download PDFInfo
- Publication number
- JP3557026B2 JP3557026B2 JP00437296A JP437296A JP3557026B2 JP 3557026 B2 JP3557026 B2 JP 3557026B2 JP 00437296 A JP00437296 A JP 00437296A JP 437296 A JP437296 A JP 437296A JP 3557026 B2 JP3557026 B2 JP 3557026B2
- Authority
- JP
- Japan
- Prior art keywords
- area
- page
- virtual storage
- access
- page table
- 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
Links
Images
Landscapes
- Memory System Of A Hierarchy Structure (AREA)
Description
【0001】
【発明の属する技術分野】
この発明は仮想記憶管理方法に関し、特に計算機システム上で実行される全てのプロセスによって共有される単一の仮想記憶空間を利用し、ページングによる仮想記憶管理を行う仮想記憶管理方法に関する。
【0002】
【従来の技術】
近年、計算機アーキテクチャの改良、記憶装置の大容量化、および、プロセッサの64ビット化などによる利用可能な仮想記憶空間の大幅な拡大に伴い、複数のプログラムやデータを単一の仮想記憶空間上に配置することによって、これらを一元的に管理する手法が有効視されてきている。これは、すべてのプロセスに同一の仮想記憶空間を共有させることにより、仮想記憶上に配置されるプログラムやデータなどのオブジェクトと、仮想記憶上の仮想アドレスとを一意に対応づけて、それらオブジェクトを統一的に定義/管理しようというものである。
【0003】
具体的な利点としては、ある計算機上の全てのプロセスについて、仮想アドレスと物理アドレスとの対応関係が同一となることにより、どのプロセスからもある特定の仮想アドレスによって同一のオブジェクトが参照できるというオブジェクトの同値性が保証されるだけでなく、オブジェクトの永続化、空間上に配置される複数のプログラム領域を跨るダイレクトなプロセス間通信、データ共有の容易化などが挙げられている。
【0004】
こうした単一仮想記憶機構をOSなどの基本ソフトウェアで提供する際に問題となる点がいくつか挙げられている。
【0005】
その一つに、単一仮想記憶空間上に配置される各領域の保護をどのように実現するかという問題がある。単一仮想空間自体は、生成されるプロセスすべてに対して全空間のアドレッシング可能性を提示しているが、マルチユーザ環境などで使用される場合には、実際に空間内に配置される個々の領域について、各ユーザあるいは各プロセスに対するアクセス保護を指定/設定できるようにすることが必要である。これは、不用意な参照や誤った操作による領域破壊、悪意のある操作などから領域を保護するためであり、この保護機能はOSにとって本質的に不可欠な機能となる。
【0006】
領域毎にプロセスに対するアクセス保護属性を設定するということは、言い替えると、プロセス毎にアクセス可能な領域の範囲が規定されるということになる。
【0007】
そこで、こうしたプロセス毎のアクセス可能な領域の範囲を「アクセス保護領域」と呼ぶことにし、以下、この保護機能を実現するための手法を考察する。ここでは、現在数多くのアーキテクチャで採用されているアドレス変換テーブル(これは、ページテーブルやTLB(Translation Lookaside Buffer)などを指す)を使用して仮想/物理アドレス変換を行なう仮想記憶管理機構を具備した計算機上で前述の保護機能を実現する場合を考える。
【0008】
【発明が解決しようとする課題】
(1)まず、全プロセスで単一のアドレス変換テーブルを共有してプロセス毎のアクセス保護領域を実現することを考える。この場合、ページフォルト時には、ページフォルトの発生したページとプロセスの保護関係に従ってページング機能による保護検査を適用することができる。しかし、この保護検査はページフォルト時のみに行われるので、もしあるプロセスによって一度参照されたページを、アクセス許可を持たない他のプロセスが再度アクセスしようとすると、アドレス変換テーブル中の参照ページに対応するアドレス変換テーブルエントリが有効化されていた場合には、ページフォルトが発生しないため、この不法なアクセスをソフトウェア的にもハードウェア的にも探知することができない。この様子を図25に示す。
【0009】
図25には、プロセス1,2が同一ページテーブルを共有しており、プロセス1のみがアクセス可能な領域Aに対応するページが物理ページフレーム(物理メモリ)上に存在している場合において、アクセス権を持たないプロセス2によるそのページへの不当アクセスが行われる様子が示されている。
【0010】
このように、プロセス間で、同一ページに対するread,write,executeなどの保護属性の組合せが異なる場合には、同じアドレス変換テーブルを共有することはできない。
【0011】
すなわち、アクセス保護領域の範囲/属性が異なるプロセス同士でアドレス変換テーブルを共有すると、領域保護に関する一貫性は保証できなくなってしまう。
【0012】
(2)そこで、次に、各プロセス毎に別々のアドレス変換テーブルを保持させることを考える。この手法では、各プロセス毎にアクセス可能な領域の範囲は、図26に示されているように、各々のアドレス変換テーブルによって独立して管理されることになるため、アクセス権を持たないプロセス2による領域A内のページへのアクセスが禁止され、安全な空間利用が可能となる。プロセスは別々のアドレス変換テーブルを保持するため、プロセス切り替え毎に、このアドレス変換テーブルの切り替え(TLBを装備する場合はTLBフラッシュも含む)を必ず伴うことになる。
【0013】
この手法では、複数のプロセスで同じページを共有する場合、同時に参照している該ページに対応する各プロセス付随のアドレス変換テーブルエントリ状態はある時点で有効となる(ただし、該ページを参照可能なプロセスであっても、該ページを参照していない場合には、該アドレス変換テーブルエントリの状態は非有効のままでも構わない)。
【0014】
その後、あるプロセスが新しいページを必要とするときに物理メモリ上に未使用ページが無ければ、ページアウトが行われる。このページアウト対象のページに現在複数のプロセスにより参照中の共有ページが選択される場合、テーブルの一貫性を保証するために、該ページに対して現在参照中の各プロセス対応アドレス変換テーブルエントリの状態をすべて非有効化にする必要が生じて、このための非有効化通知コストは参照プロセス数に応じて増加する。
【0015】
更に、各プロセスが各々ページテーブルを保持しているため、多段階化されたページテーブルを採用するアーキテクチャを使用する場合であっても、こうした記憶管理用資源のために浪費される物理メモリや2次記憶の記憶領域の量はプロセス数に比例して増大することになってしまい、その結果、キャッシュヒット率の低下、プロセス切り替え時のページテーブル切り替えやTLBフラッシュなどのオーバヘッドがシステムの効率に影響してくる。
【0016】
以上のように、全プロセスで単一のアドレス変換テーブルを共有するという(1)の方法の場合には、記憶資源の消費は少なく、アドレス変換情報の一貫性の保持は容易に行なわれるが、アクセス保護の実現が不可能なため、システムが常に危険にさらされることになり安全に使用することができない。一方、プロセス毎にアドレス変換テーブルを別個に用いる(2)の方法では、メモリ資源の浪費などが引き起こされる問題がある。
【0017】
(3)こうした問題点を解消するための手段として、アクセス保護領域の一致するプロセス間同士でのみ、アドレス変換テーブルを共有させて、プロセス毎のアクセス保護機能を維持したまま、記憶管理用資源の最適化をはかることが考えられる。
【0018】
しかしながら、プロセス間でアクセス保護領域が完全に一致するためには、該アクセス保護領域がこのグループ化される複数プロセス内で固定的に定まるものでなければならないため、実行中のある時点で該複数プロセス中のあるプロセスに対してのみ、アクセス可能な保護領域の追加や変更を動的に行うような柔軟な保護機能の実現はこのままでは困難である。
【0019】
一方、プロセス生成時にシステムにより設定されるアクセス保護領域の情報は、該生成プロセスが利用可能な領域のサブセットであり、空間内で利用可能なすべての情報を含まないのが一般的と考えられる。これは、広大な仮想記憶空間内には、どのプロセスからの参照でも許可する領域が多数存在している可能性があり、これらを逐一抽出し、生成プロセスに付随されるアクセス保護領域情報として反映させ、これを維持することは現実的ではないからである。よって、プロセスに付随されるアクセス保護領域の追加、削除などの変更は、プログラムからの指示や、現在のアクセス保護領域情報として保持されている領域以外の他の領域に対してアクセスを行なってページフォルトを起こし、アクセス許可の検査を受けて許可された場合に、動的に行なわれるという手法が自然と考えられる。このような状況下では、厳密な意味でのアクセス保護領域の完全な一致を保証することは難しい。
【0020】
以上、単一仮想記憶空間を利用して、アクセス可能な領域の範囲をプロセス毎に柔軟に設定する機能を実現する際に問題となる事項を述べてきたが、多重仮想記憶空間を利用したアーキテクチャでも、あるアドレス空間内で走行するプロセスの、アドレス変換テーブルの共有化や、実用コンテキストの最小化などによりプロセスの軽量化をはかった最適化例がいくつか存在する。ただし、これらは一般に多重仮想記憶方式のような仮想記憶空間全体が保護領域と完全に一致しており、適用できる範囲がある仮想記憶空間内のみに限定されているため、これらの中で適用される手法では、単一仮想記憶空間上に複数個配置される領域の範囲が動的に変更されうるような状況において効率的に機能するアクセス保護機能の最適化手法に関する解を与えない。
【0021】
次に、単一仮想記憶空間上でアクセス可能領域範囲を各々設定することが可能なプロセスをスケジューリングする際の問題点について述べる。通常、多重仮想記憶空間を利用するアーキテクチャでは、プロセスを実行待ち行列に収容し、これらを順番にディスパッチしていく場合、プロセス切り替え時に毎回、ページテーブル切り替えやTLBフラッシュなどが必要となる。しかし、複数のプロセス間でページテーブルが共有できるような単一仮想記憶空間を利用するアーキテクチャでは、スケジューラが、次期実行プロセスとして選択するプロセスを、現実行プロセスとページテーブルを共有しているものと判定できる場合には、ディスパッチ時に上記の操作は本来不要である。しかし、従来のスケジューリング手法では、アドレス変換テーブルに関する共有化情報はスケジューリングに何ら利用されていないので、一般的なスケジューリング手法を単一仮想記憶空間を利用したアーキテクチャに適用すると、プロセス切り替え毎に必ずページテーブル切り替えやTLBフラッシュが実行されてしまう。
【0022】
次に、単一仮想記憶空間上でアクセス可能領域範囲を各々設定できるようなプロセスを分散メモリ型(疎結合型)マルチプロセッサシステム環境下でプロセッサに割り付ける場合の問題点について説明する。
【0023】
該マルチプロセッサシステム環境下では、各CPUにMMU、局所メモリが付随する構成となるが、各CPUは自分に付随する局所メモリへの他CPUからのアクセスを許さないため、アドレス変換テーブルを共有する2つのプロセスが別々のCPUに割り当てられた場合、一方のプロセスは、アドレス変換テーブルの複製を対応するCPUの局所メモリ上に作成し、これを新たに利用することになる。この場合、アドレス変換テーブルを共有化しうるメリットを失い、キャッシュ内容も切り替わるため、プロセッサを移動するたびに再キャッシュしてデータを取り込む必要が生じてくる。
【0024】
このような、各プロセッサ上のキャッシュの親和性を考慮した従来技術には、例えば、プロセス(スレッド)をなるべく同じプロセッサ上で実行するよう制御しようとするcache affinity scheduling[文献:R.Vaswani and J.Zahorjan.“The implementations of cache affinity on processor scheduling for multiprogrammed,shared memory multiprocessors”,In Proceedings of 13th ACM Symposium on Operating Systems Principles,pp.26−40,1991.]というスケジューリング方式が存在する。ただし、上記スケジューリング方式では、1つのプロセス(スレッド)をなるべく同一のプロセッサ上で実行するようプロセッサ割り付けを制御することによるキャッシュ効果の向上しか対象としておらず、これが割り付けられるプロセスと、アドレス変換テーブルの共有可能なプロセス群との親和性に関しては考慮されていない。
【0025】
本発明は上記の問題点を考慮してなされたものであり、単一仮想記憶空間を全てのプロセスで共有するシステムにおいて、プロセスそれぞれについてのアクセス保護を保証しつつ、プロセス間でのアドレス変換テーブルの共有化可能性を十分に高められるようにし、信頼性が高く、且つ記憶管理用資源、プロセス切り替え時のコストの最小化を実現することが可能な仮想記憶管理方法を提供することを目的とする。
【0026】
【課題を解決するための手段】
本発明は、計算機システム上で実行される複数のプロセスによって共有される単一の仮想記憶空間を利用し、ページングによる仮想記憶管理を行う仮想記憶管理方法において、前記単一仮想記憶空間に配置され得る複数の領域の各々について、前記プロセス毎にアクセス可能な領域とその領域に対するアクセス保護の属性とを規定し、あるプロセスのアクセス可能領域の中で物理メモリ内に現在読み込まれているページが属しているアクセス可能領域がアクセス可能で、且つその領域に対するアクセス保護属性が前記プロセスと同一のプロセスを検出し、それらプロセス間で、仮想アドレスを物理アドレスに変換するためのアドレス変換テーブルを共有化させることを特徴とする。
【0027】
この仮想記憶管理方法においては、あるプロセスのアクセス可能領域の中で物理メモリ内に現在読み込まれているページが属しているアクセス可能領域に着眼し、そのアクセス可能領域がアクセス可能で、且つアクセス保護属性が同一の他のプロセスが存在すれば、それらプロセス間でアドレス変換テーブルが共有化される。したがって、アクセス可能領域およびアクセス保護属性が全て一致しなくても、現在物理メモリ内に読み込まれているページに対応する領域についてのみアクセス保護属性が一致すれば、アドレス変換テーブルの共有が行われる。これにより、プロセスそれぞれについてのアクセス保護機能を保証しつつ、プロセス間でのアドレス変換テーブルの共有化可能性を十分に高められるようになり、信頼性が高く、且つ記憶管理用資源、プロセス切り替え時のコストの最小化を実現することが可能となる。
【0028】
また、ページフォルトの発生によって、前記アドレス変換テーブルを共有するプロセス間におけるアクセス保護の一貫性を保証できない新たな領域に属するページが前記物理メモリに読み込まれるときは、前記アドレス変換テーブルの共有化を解除することが好ましい。これにより、領域保護の一貫性を保証できる。
【0033】
【発明の実施の形態】
以下、図面を参照してこの発明の実施形態を説明する。
【0034】
図1〜図3には、この発明の一実施形態に係る仮想記憶管理方法が適用される計算機アーキテクチャの構成例が示されている。図1の計算機アーキテクチャは、単一プロセッサ計算機であり、1つのCPU11と物理メモリ13を有し、MMU12(Memory Management Unit)などの仮想記憶を実現するための機構を装備している。この計算機は、OSなどの基本ソフトウェアを有しており、その制御下で仮想記憶管理のための制御が行われる。また、2次記憶装置14は、swap用バッキングストレッジとして使用される。
【0035】
図2は、複数のプロセッサから構成される分散メモリ型(疎結合型)マルチプロセッサシステムであり、各プロセッサは、1つのCPU11と物理メモリ13を有し、またMMU12(Memory Management Unit)などの仮想記憶を実現するための機構を装備している。また、2次記憶装置14は、swap用バッキングストレッジとしてプロセッサ間で共用される。
【0036】
図3は、複数のプロセッサから構成される分散メモリ型(疎結合型)マルチプロセッサシステムの他の構成例であり、LANやWANなどのネットワークを介して複数のプロセッサが結合される分散計算機システムが例示されている。各プロセッサの2次記憶装置14は、通常swap用バッキングストレッジとして使用されるが、ネットワーク環境下で他計算機上の2次記憶装置資源が該swap領域として利用できる場合には、必ずしも各プロセッサ毎に別個に二次記憶を設ける必要はない。
【0037】
図4は、前記計算機上での実行プロセスとデータとの関係の一例を説明するものである。前記計算機環境下で提供されるOSのプロセス管理機構及び仮想記憶管理機構により、図示する単一の仮想記憶空間上に全プログラムやデータなどの各種領域(これを「メモリセクション領域」と呼ぶことにする)が複数配置されうる形態を実現し、全走行プロセスからの単一仮想記憶空間の共有を可能とする。すなわち、各プロセスからある特定の仮想アドレス上へのデータ参照を行なう場合、全走行プロセスに対して同一のバイト列が見えることになる。また、全プロセスから同一仮想記憶空間を共有しているので、ある特定の仮想アドレス上のデータ変更は、変更を行なったプロセス以外の他プロセスに対しても即座に反映されることになる。
【0038】
図4においては、メモリセクション領域Aに配置されたプログラムA上で走行しているプロセス1がメモリセクション領域Bのデータを変更し、その変更されたデータを、メモリセクション領域Cに配置されたプログラムB上で走行しているプロセス2が参照している様子が示されている。
【0039】
図5は、プロセス間仮想記憶管理の対象である各プロセスとアクセス保護領域範囲との関係の一例を示したものである。単一仮想記憶空間上で実行される複数のプロセスには、各々独立にアクセスの許可されうるメモリセクション領域範囲の設定/変更が可能なアクセス保護機構が提供される。すなわち、各プロセスには、単一仮想記憶空間上に配置される各メモリセクション領域に対して、読み込み可能、書き込み可能、実行可能など(以降、これら操作を総称してアクセスまたは参照と呼称する)のアクセス保護属性が指定されることにより、各プロセス単位にアクセス可能/不可能な領域範囲を自由に設定することができる。上記アクセス保護機構により、許可の無いプロセスからの意図的/不用意なアクセスから、該メモリセクション領域を保護することが可能となる。
【0040】
図5においては、メモリセクション領域A、B、Dがプロセス1のアクセス保護領域として割り当てられ、メモリセクション領域D、Eがプロセス2のアクセス保護領域として割り当てられ、メモリセクション領域C、D、Eがプロセス3のアクセス保護領域として割り当てられている。
【0041】
図6には、この発明のプロセス間仮想記憶管理機構を実現するためのOSの一構成例が示されている。
【0042】
図示のように、本プロセス間仮想記憶管理機構は、プロセス管理部21と、仮想記憶管理部22とから構成され、仮想記憶管理部22は、ページテーブル管理部23、メモリセクション管理部24、保護領域管理部25から構成される。なお、ここで例示するページング方式としては、仮想/物理アドレス変換テーブル用にページテーブルを採用したアーキテクチャを対象とするが、図示しないTLB(Translation Lookaside Buffer)のようなページテーブルエントリ専用のキャッシュメモリを搭載していても良い。
【0043】
プロセス管理部21は、前記計算機上で実行されうるプロセスの生成や複数プロセスのスケジューリングなどを担当する部分であり、プロセス生成部211、プロセス情報退避部212、プロセス・スケジューリング部213、プロセス・ディスパッチ部214、プロセス情報設定部215、プロセス情報取得部216などから構成され、プロセス情報やプロセス実行待ち行列などの情報を保持する。
【0044】
ページテーブル管理部23は、各プロセスに付随するページテーブルの生成、ページテーブルエントリの設定などを担当する部分であり、ページテーブル生成部231、ページテーブルエントリ設定部232、ページテーブルエントリ情報取得部233、などから構成される。
【0045】
メモリセクション領域管理部24は、プログラムやデータなど単一仮想記憶空間上に配置されうる領域 (メモリセクション領域)の配置や対プロセス/対メモリセクション領域に関する保護属性の設定やアクセスを認めるかどうかの判定時に必要となる保護属性情報の獲得などを担当する部分であり、メモリセクション生成部241、メモリセクション保護属性設定部242、メモリセクション領域情報取得部243などから構成される。
【0046】
保護領域管理部25は、各プロセスごとに設定されるアクセス保護領域情報(後述)、アクティブ保護領域情報(後述)を元に、ページテーブルのプロセス間共有/分離のための判定/実行を担当する部分で、アクセス保護領域設定部251、アクセス保護領域情報取得部252、アクティブ保護領域設定部253、アクティブ保護領域情報取得部254、ページテーブル共有判定部/実行部255、ページテーブル分離判定部/実行部256などから構成される。
【0047】
各管理部は互いに関連し、各構成要素が連携をとってプロセス間仮想記憶制御機構の実現に必要な処理を行う。
【0048】
次に、プロセスにおけるメモリセクション領域の保護属性の設定方法(対プロセス)について説明する。
【0049】
メモリセクション領域は、各種プログラムの指示により各プロセスに対し設定される。OSは、各メモリセクション領域に関するアクセス許可属性のリストを、「アクセス保護領域」情報として保持し、アクセス保護領域管理部25によって管理している。あるプロセスに設定されるアクセス保護領域の範囲は、必ずしも単一仮想記憶空間内に複数配置される全領域に対する情報をカバーする必要は無く、プログラマあるいはシステムによって予め固定的に設定されるいくつかの領域範囲で十分である。これは、潜在的にアクセス可能/不可能な領域へのアクセス時に、動的にアクセス権のチェックが行われるからである。図7に、プロセス構造体の一例を示す。
【0050】
プロセス構造体内には、優先度やプロセス属性、レジスタ退避情報、例外処理時の飛び先などの他に、ページテーブル先頭アドレス(ここではレジスタ退避情報とは区別している)、アクセス保護領域リスト管理用構造体、アクティブ保護領域リスト管理用構造体(後述)が記録される。アクセス/アクティブ保護領域リスト管理構造体は、対応するプロセスのアクセス/アクティブ保護領域についての情報格納位置を指定するポインタ群である。ここで、アクセス保護領域とは、そのプロセスがアクセス可能な全てのメモリセクションを示す。また、アクティブ保護領域とは、アクセス保護領域の中で現在物理メモリに読み込まれているページが属するメモリセクション領域を示す。
【0051】
アクセス保護領域リスト管理構造体は、図8に示されているように、メモリセクション領域が配置される位置である仮想アドレスの昇順に連結されたメモリセクション領域構造体の先頭エントリおよび終端エントリから構成される。また、図のように最後に参照されたメモリセクション領域構造体エントリの位置を記録するようなヒントを含んでいてもよい。また、アクティブ保護領域リスト管理構造体も、アクセス保護領域リスト管理構造体と同様に、メモリセクション領域が配置される位置である仮想アドレスの昇順に連結されたアクティブなメモリセクション領域構造体の先頭エントリおよび終端エントリ、また、最後に参照されたメモリセクション領域構造体エントリの位置を記録するヒントから構成されている。
【0052】
各メモリセクション領域構造体は、図9に示されているように、前/後方向リンク、メモリセクションID等が保持され、メモリセクション領域に対するアクセス権のキャッシュとして利用する保護属性を含んでいてもよい。
【0053】
また、前記アクセス保護領域情報は、プロセスに対してのみ付随するのではなく、各メモリセクション領域に関して設定することも可能である。これは、通常、該領域が仮想記憶空間上に配置される際に指定/設定されうるもので、必要に応じて、配置後に動的にアクセス許可/不許可属性を変更する事も可能である。
【0054】
この場合、メモリセクション領域管理用データ構造は、図8と同様の双方向リストなどによって実現できる。また、図10に示すように、各メモリセクション領域構造体エントリ内には、該メモリセクション領域の先頭/終端仮想アドレス、前/後方向リンク、保護属性フラグ、対領域許可/不許可リスト、対プロセス許可/不許可リスト、などが含まれる。
【0055】
これにより、各メモリセクション領域には、プログラムの格納されたメモリセクション領域に対して、および、個々のプロセスに対して、独立にアクセス許可/不許可の設定が可能になる。このために維持されるエントリ内容を図11(a),(b)に示す。それぞれ、メモリセクションID/プロセスIDの他に、読みだし/書き込み/実行などの保護属性が記録される。また、メモリセクション領域構造体エントリ内の保護属性フラグを用いて、全プロセス(メモリセクション領域)からアクセス(読みだし/書き込み/実行など)を許可する/禁止するなどの指定が行えるようにも設定可能である。
【0056】
以降、これら各々を使用した実施形態について説明する。
【0057】
本実施形態1では、プロセス間で各プロセスに付随するアクティブ保護領域情報とアクセス保護領域情報との包含関係に基づき、ページテーブル共有化可能性の判定、共有化制御が行われる。
【0058】
このページテーブルの共有化可能性の判定や、実際に共有化を行う時期は、幾通りかあげられ、プログラマにより明示的に指定する場合や、OSなどのシステムにより暗黙裏にページテーブル共有可能プロセスが探索され自動的に共有化される場合、などが挙げられる。
【0059】
ここでは、プロセス生成時にプログラムがページテーブル共有相手となる他プロセスを指定する場合について例示する。
【0060】
図12では、プロセス1が既に生成されており、領域(A),(B),(C)がプロセス1のアクセス保護領域としてアクセス保護領域管理部によって設定/管理されている状態を示している。
【0061】
続いて、プロセス1の実行が開始され、領域(A)と領域(C)内の数ページが物理フレーム上に読み込まれて、対応するページテーブルエントリが有効になったとする。ここで、有効化されたページテーブルエントリに対応するページを含む領域(A),(C)がアクティブ保護領域となる(図13)。
【0062】
アクティブ保護領域は、ページテーブルに関して1対1に作成され、アクティブ保護領域管理部によって保持される。
【0063】
続いて、新たにプロセス2を生成する際に、プロセス1のページテーブルを共有することを要求して生成するケースを示す。
【0064】
図14は、マップ時にプロセス2に設定されるアクセス保護領域が領域(A),(C),(D)であることを示している。これらの状況をまとめた表を図15に示す。
【0065】
ここで、プロセス2の生成時に、プロセス2がプロセス1と同じページテーブルを共有可能ならばこれを共有するよう要求されてプロセス2を生成する場合の処理手順について、図16を参照して説明する。
【0066】
プロセス生成部では、プロセス構造体の割り当て、初期化などを行った後、ページテーブル管理部を呼び出して、ページテーブル共有に関する許可の判定を依頼する(S1501)。ページテーブル管理部では、ページテーブルの共有を要求されたプロセス1のアクティブ保護領域リストをアクティブ保護領域情報取得部より抽出し(S1502)、さらに、要求元であるプロセス2のアクセス保護領域リストをアクセス保護領域情報取得部より抽出する(S1503)。
【0067】
次に、ページテーブル管理部は、これら抽出した2つの情報を、システムあるいはユーザにより指定されていた共有条件となる判定基準情報に基づき、ページテーブル共有化判定部により両者を比較する(S1504)。具体的な前記判定基準情報の一例としては、該アクセス保護領域範囲が該アクティブ保護領域範囲を包含している場合(保護属性は一致するものとする)には共有する、ということなどが考えられる。例えば、図15のような状況においては、プロセス1のアクティブ保護領域A,Cをプロセス2がアクセス可能であり、且つそれらアクティブ保護領域A,Cのアクセス保護属性がプロセス1と2で同一であれば、共有化条件が満たされることになる。また、プロセス2がプロセス1のアクティブ保護領域Cをアクセスできない場合、またはアクティブ保護領域Cに関するアクセス保護属性が異なる場合であっても、そのアクティブ保護領域Cに対応するページを無効化すれば、アクセス保護の一貫性を保証した状態でページテーブルを共有するような前記判定基準を適用することもできる。
【0068】
ページテーブル共有化がページテーブル共有化判定部により許可されると、ページテーブル管理部は、ページテーブル共有化実行部を呼び出し、実際に要求元プロセス(プロセス2)のアクティブ保護領域リストとページテーブル先頭アドレス情報を要求先プロセス(プロセス1)と共有化するための処理をする(S1506)。
【0069】
最後に、ページテーブル管理部は、ページテーブル割り当て終了後、制御をプロセス生成部に移し、プロセス実行のために必要な準備を終了させ復帰する(S1509)。このときの共有状態(データ構造)を図17に示す。
【0070】
S1505において、共有化が許可されなかった場合は、要求元プロセスで独自にページテーブルを保持する必要があるために、新規ページテーブルの作成、該プロセスとの対応付け、ページテーブルエントリの設定や必要に応じてページインなどが行なわれ(S1507)。新たなアクティブ保護領域リストが要求元プロセスに対して設定される(S1508)。
【0071】
このように、本実施形態では、アクティブ保護領域を導入し、現時点での一貫性を維持したままページテーブルの共有化を許可することによって、共有化条件の緩和を実現し、共有化可能な機会を増加させている。
【0072】
条件が満たされない場合、共有化が認められず、上記のように別のページテーブルを作成して、これを新たにプロセス2が使用するか、もしくは、エラーを返して戻るということになる。こうした共有化に失敗した時の処理は、ページテーブルの共有化を要求してプロセスの生成を行うシステムコールなどのセマンティクスを、できる限り共有化をするが共有できない場合には別のページテーブルを用意してプロセスを生成する、あるいは、共有化できなければプロセスを生成しないというものにするかなどの方針の決め方に依存する。
【0073】
本プロセス間仮想記憶制御機構では、プロセスに付随するアクセス保護領域情報に保持される範囲以外の領域に対しても、その領域を参照しようとするプロセスおよびそのプロセスとページテーブルを共有している他のプロセスに対するアクセス許可が下りてさえいれば、領域に対する参照は可能で、アクティブ保護領域情報および各プロセスのアクセス保護領域情報にこの領域に対応するエントリを追加して、一貫性を保証することが可能である。
【0074】
なお、ここでは、共有対象ページテーブルの指定に、既に生成されたプロセスを指定する手法をとっているが、共有を要求するプロセス同士でグループを形成し、このグループ識別子を指定させて共有化を図る手法や、システムが自動的に共有可能なページテーブルを探索し、生成しようとするプロセスすべてに対してページテーブル共有化を試行するという手法などがこの変形として挙げられる。
次に、第2の実施形態について説明する。
【0075】
処理の概要
実施形態1で共有化されたページテーブルは、各プロセス間から実際に参照されるページ領域範囲がアクセス保護の一貫性を崩さない限り継続して利用する事が出来る。しかしながら、ページテーブル共有プロセスの内のあるプロセス群においてはアクセスが許可されるが、他のいずれかのプロセスにおいては許可でないような領域をアクセスしようとする場合において、このままアクセスを許可して処理を継続すると、領域のアクセス保護を保証できなくなってしまう。
【0076】
そこで、ページテーブルを共有化した後にこうしたアクセスが生じる際には、該アクセス要求を行うプロセスからページテーブルの共有を解約させ、新たに別のページテーブルを用意してこれを該プロセスが使用するよう制御することによって、アクセス保護の一貫性を保証するための機構を提供する。
【0077】
こうしたページテーブル共有プロセス群からあるプロセスを分離させる時期は、実際にアクセス保護の一貫性が維持できない参照が行われる時(ページフォルト時に検知される)に行うという手法の他に、数通り挙げることができる。
【0078】
例えば、このページフォルト時以外に、システムコールなどによるユーザ指定時、またそれぞれの契機に応じた併用も考えられる。
【0079】
ここでは、まず、ページフォルト時にページテーブル共有プロセス群からのプロセスの分離の必要性を判定する場合の分離処理について説明する。例えば、図18に示されているように、プロセス1が、そのプロセス1においてはアクセスが許可されるが、プロセス2においては許可でない領域Eを参照することによってページフォルトが発生すると、プロセス1がページテーブル共有化グループから分離される。
【0080】
以下、図19を参照して、ページフォルト発生時の分離処理の具体的手順を説明する。
【0081】
ページフォルトが発生(S1801)すると、ページフォルトハンドラ内よりアクティブ保護リスト管理部を呼び出し、ページ参照元プロセス(実行中プロセス)に付随のアクティブ保護領域リストを抽出する(S1802)。これは、実行中プロセスのプロセス構造体内属性であるアクティブ保護領域リスト管理用構造体の取得に対応する。抽出した該リストからフォルト先仮想アドレスが該リストによって保持される領域範囲に含まれるかどうかが調査される(S1803)。これは、該リストの先頭エントリから、該エントリ内部属性であるメモリセクションID先により識別されるメモリセクション領域構造体内の領域範囲情報(領域先頭/終端アドレス)と該フォルト先仮想アドレスとを順次比較することにより行われる。なお、該アクティブ保護領域リスト用エントリは、それぞれ仮想アドレスの昇順に連結しておき、直前に選択されたエントリをヒント情報として維持し、これから逐次検査するような探索の効率化をはかっても良い。フォルト先仮想アドレスが該アクティブ保護領域リスト内の範囲に含まれると検知された場合、対応するアクティブ保護領域リスト用エントリの保護属性(メモリセクション領域構造体メンバよりキャッシュされたもの)と参照時の操作(read,write,executeなど)からアクセス権を調査する(S1804)。S1805にてアクセス許可されていると判断された場合、ページテーブルエントリの設定など(仮想/物理アドレス変換/保護属性設定、必要に応じpage−in処理など)を行い(S1817)、復帰する(S1819)。S1805にてアクセス許可されていないと判断された場合、保護例外などのエラーを返して(S1818)、復帰する(S1819)。S1803にて、フォルト先アドレスが参照元プロセスのアクティブ保護領域の範囲外であると検知された場合、該プロセス付随のアクセス保護領域リストを抽出し(S1806)、該アクセス保護領域リスト内にフォルト先仮想アドレスを含むメモリセクション領域が含まれるかどうか調べる(S1807)。これが含まれる場合には、該メモリセクション領域に対応するアクセス保護領域リスト用エントリの保護属性(メモリセクション領域構造体メンバよりキャッシュされたもの)と参照時の操作(read,write,executeなど)からアクセス権を調査する(S1808)。S1809においてアクセス許可されていると判定される場合、他のページテーブル共有プロセス全てによってアクセス保護領域が共有されているかどうか調べる(S1810)。ページテーブル共有全プロセスから共有されている場合、ページテーブルエントリの設定などを行い、該プロセスのアクティブ保護領域リストに該ページを含むメモリセクション領域対応エントリを追加/設定して(S1817)、復帰する(S1819)。ページテーブル共有プロセス全てから共有されていない場合、ページテーブルを共有したままではアクセス保護の一貫性が維持できないため、該プロセス用に新たにページテーブルを作成するようページテーブル生成部に依頼し、必要であれば現在使用中の共有ページテーブルの内容を複写し、該プロセスをページテーブル共有プロセス群から分離し、新たに生成したページテーブルを該プロセスに付随させて、ページテーブルエントリの設定などを行い(S1811)、該プロセスのアクティブ保護領域リストに該ページを含むメモリセクション領域対応エントリを追加/設定して(S1812)、復帰する(S1819)。
【0082】
S1809にてアクセス許可されていないと判定される場合、read,write,executeの組合せのいずれかで拒絶されているため、保護例外などのエラーを返して(S1818)、復帰する(S1819)。
【0083】
S1817において、アクセス保護領域リスト内にフォルト先仮想アドレスが含まれない場合には、該フォルトページを含むメモリセクション領域情報を管理するメモリセクション領域リストを抽出し(S1813)、該メモリセクション領域管理用構造体メンバである、保護属性フラグ、対領域許可リスト、対領域不許可リスト、対プロセス許可リスト、対プロセス不許可リストより、該プロセスのアクセス権限を獲得する(S1814)。これによりアクセス権が認められていれば、該プロセスのアクセス保護領域リストに該ページを含むメモリセクション領域対応エントリを設定、仮想アドレスの昇順に挿入し、S1810へ制御を移す(S1816)。S1815にてアクセス権が認められなければ、保護例外などのエラーを返して(S1818)。復帰する(S1819)。なお、S1814によりアクセス権限が未定と判定される場合には、アクセス禁止とする。
【0084】
なお、上記のページテーブルエントリの仮想/物理アドレス変換用に、図20に示すような「仮想/物理アドレス変換共有マップ」のような多段化テーブルを用いて、アドレス変換情報を効率的に保持することも考えられる。これは、従来の多段化ページテーブルと同様な方式であり、仮想アドレスのページ識別部を2つに分け、前半をレベル1テーブル、後半をレベル2テーブル内のエントリへのオフセットとして使用する。各テーブル内エントリには、図21に示されているように、(物理アドレス/ページサイズ)が設定され、ページテーブルのような保護属性は設定されない。かわりに、レベル2テーブル内エントリ内の残りの数ビットに、対応するメモリセクション領域構造体用識別子をキャッシュとして設定して、再度、フォルト時の仮想アドレスから該アドレスを含むメモリセクション情報を高速に検索するのに利用しても良い。
【0085】
各プロセスに付随するページテーブル内のエントリは、上記の「仮想/物理アドレス変換共有マップ」の対応するエントリのアドレス変換情報が有効な場合(物理ページフレーム内に対応ページが読み込まれている場合)には、このエントリをコピーすることにより、高速に物理アドレス位置を設定することが出来る。対応するエントリのアドレス変換情報が無効な場合、必要に応じて、ページング処理が行われた後、仮想/物理アドレス変換共有マップのエントリが設定され、これが実行中のプロセス付随ページテーブル内の対応エントリ内に複写されることになる。アドレス変換情報の設定後、実行中プロセスの該メモリセクション領域へのアクセス権をもとに、該ページテーブルエントリ内の保護属性を設定することになる。
【0086】
本実施形態では、アクセスを引き起こしたひとつのプロセスのみがページテーブル共有プロセス群から脱却する形態を例示しているが、この変形として、該アクセスによってアクセス保護を失わない他のプロセスがいくつか存在する場合には、これらを伴って脱却することも考えられる。この場合、脱却したプロセス群間で新たにひとつのページテーブルが作成され共有されることになる。
【0087】
また、本実施形態では、ページテーブル共有プロセス群からの脱却の必要性に関して、ページフォルトを契機に判定させていたが、このページテーブル共有の解除を、プログラマによって明示的にシステムコールなどを用いて要求することも容易に実現できる。この場合、ページフォルト時の処理と異なる点は、(A)ページフォルト時におけるページフォルト発生、ページフォルトハンドラ呼び出しが、システムコール要求、システムコール処理に置き換わり、(B)OS内部での分離判断処理が不要となり、必ず分離するよう処理されることにより、以降の処理は同様に実現することが可能である。
【0088】
次に、第3の実施形態について説明する。
【0089】
ここでは、アドレス変換テーブルを共有するプロセス群が連続的に実行されるようなスケジューリング方式が採用される。これにより、プロセス間切り替えコストを大幅に低減させることができる。
【0090】
すなわち、ページテーブルが共有されるプロセス間では、ページテーブル切替え操作の必要は無いため、スケジューラのディスパッチ部に対して、プロセス実行待ち行列から選択される次期実行プロセスに付随するページテーブルが現在のものと等しいかどうか判定し、同値の場合にはページテーブルを変更しないという処理が行われる。実行中プロセスの実行コンテキスト退避からスケジューリングにより選択された次期実行プロセスへのディスパッチまでの簡単な流れを図22に示す。
【0091】
プロセス切り換え時には、まずS2002においてプロセス管理部のプロセス情報退避部によってレジスタ情報などの実行コンテキストが退避され、スケジューラ(プロセススケジューリング部)により実行待ち行列から次期実行プロセスの選択などがスケジューリングポリシーなどに応じて行なわれる(S2003)。次に、実行中プロセスと選択されたプロセスとのページテーブル先頭アドレス情報を比較し、同値かどうか判定する(S2004)。これが同値の場合には、選択プロセスのページテーブル先頭アドレス情報以外の実行コンテキストの回復を行ない(S2005)、復帰する(S2007)。S2004で同値でないと判定されれば、選択プロセスのページテーブル先頭アドレスを特定ハードウェアレジスタへ設定したりTLBフラッシュなどを行なった(S2006)後、選択されたプロセスのページテーブル先頭アドレス情報を除いた実行コンテキストを回復させ(S2005)、復帰する(S2007)。
【0092】
このページテーブルの継続利用によって、ディスパッチ時には、ページテーブルの切り替えやTLBフラッシュが不要となる。更に、プロセス切替え後には、直前のプロセスが参照したページへの再アクセス時に、該ページテーブルエントリが有効となっているページへの再アクセス時であれば、該ページテーブルエントリがそのまま利用できるため、該エントリの再設定コストも不要となる。
【0093】
また、本最適化方針は、任意のプロセス間切替え時に適用することができ、優先度の異なるプロセス間で次期実行プロセスが選択される場合にも適用可能である。
【0094】
また、次期実行プロセスを選択する際に同じ優先度を持つプロセスが複数個存在するときは、その中から直前に実行したプロセスと同じページテーブルを持つプロセスがあれば、それをなるべく選択するように制御することが好ましい。
【0095】
この方針には、いくつかの変形が考えられる。(A)スケジューラが次期実行プロセス選択時に直前に実行したプロセスと同じページテーブルを持つプロセスを実行待ち行列から順次探索する形式、(B)プロセス生成時やブロックされていたプロセスの再開時に優先度の同じ実行待ち行列内でページテーブルを共有するプロセスが存在する場合にその直後へプロセスエンティティを配置しなるべく連続させる形式、(C)実行中のプロセスがsleepしているプロセスをwakeupさせる際に対象プロセスが同じページテーブルを共有している場合優先的に次期実行スレッドとして選択する形式、などがある。これらを図示したものを図23に示す。
【0096】
上記の制御方式は、プロセス・エンティティの実行待ち行列内への登録時期、および、次期実行プロセス選択時期に、各プロセス構造体付随のページテーブル先頭アドレスを、システム/プログラマによって指定/規定されうる上記制御方針に基づき、比較/判定することによって実現することが出来る。
【0097】
ただし、これらのスケジューリング方針を優先しすぎると、プロセスの飢餓や一部のプロセス群実行への偏向を引き起こす可能性もあるため、時間的要因などに応じてスケジューリングのための計算が行われる必要がある。
【0098】
次に、第4の実施形態について説明する。
【0099】
ここでは、分散メモリ型(疎結合型)マルチプロセッサシステム環境下で、アドレス変換テーブルの共有可能なプロセス同士をなるべく同じプロセッサ上で実行できるようなディスパッチが行われる。
【0100】
図24に、第4の実施形態によるプロセス生成時のプロセッサの割り付け処理手順を示す。
【0101】
OSのプロセス管理部がプロセス生成要求を受信する(S2201)と、プロセス生成部が呼び出され、受信したプロセス生成要求に関してアドレス変換テーブルの共有可能なプロセスが存在するプロセッサ上へ配置されることを生成プロセス側が要求しているかどうか検査する(S2202)。この要求は、プロセス生成システムコールの引数内属性などを設定するなどしてプロセス生成側からOSに対して指示することにより可能となる。
【0102】
プロセス生成部では、上記の要求の指定が検知されない場合、該プロセス生成元プロセッサ上でのプロセス生成処理を行なう(S2206,S2208)。
【0103】
一方、このS2202の判定において、該テーブルの共有化要求の指定が検知される場合、該テーブル共有可能プロセス配置先プロセッサを探索するため、各プロセッサに対して探索依頼メッセージを送信する(S2203)。このメッセージ送信の手順として、まず、プロセッサ生成元プロセッサに対して探索を行なった後、検出できなかった場合に他のプロセッサに対する探索依頼を行なうようにしても良い。フローに戻って、S2203の探索要求が各プロセッサに通知され、該メッセージを受信した各プロセッサは該テーブル共有可能プロセスが自プロセッサ内に存在するかどうか探索する。この探索は、実施形態1に示したアドレス変換テーブル共有化判定手順と同様に、生成プロセス側のアクセス保護領域範囲と各プロセッサ内に格納されうる複数のアクティブ保護領域範囲に関する情報を比較するなどして処理することが可能である。
【0104】
次に、探索要求元プロセッサは、各プロセッサより返信される探索結果を受信し、アドレス変換テーブル共有可能プロセスを保持するプロセッサが検出の有無を判定する(S2204)。この判定処理の結果、該プロセッサが検出されなければ、プロセス生成元プロセッサを選択し、このプロセッサ上のプロセス生成部に生成プロセスの割り当て要求を生成部へ送信する。
【0105】
S2204の処理で、該アドレス変換テーブル共有可能プロセスを保持するプロセッサが検出されると、検出されたプロセッサ(群)にプロセス生成元プロセッサが含まれるかどうか調査する(S2205)。含まれる場合は、生成プロセス元プロセッサを選択後(S2206)、生成プロセスの割り当て要求を該生成プロセス元プロセッサのプロセス生成部へ送信する(S2208)。S2205で生成プロセス元プロセッサが含まれない場合には、検出プロセッサ(群)から任意のプロセッサを選択し(S2207)、該プロセッサ上のプロセス生成部へ生成プロセス割り当て要求を送信する(S2208)。該当するプロセッサが複数個検出された場合の選択方法は、いく通りが挙げられるが、最初に返信があったもの、あるいは、プロセッサ使用率、物理メモリの空き状態などを元にシステムやプログラマによって規定された選定基準に応じて適当なプロセッサを選択することが考えられる。
【0106】
上記の処理後、必要に応じて生成プロセスの選択プロセッサに付随する局所メモリ上への、プロセス情報、実行待ち行列エントリの配置処理が行われる。
【0107】
このように、疎結合型マルチプロセッサシステム環境下で、アドレス変換テーブルの共有可能なプロセス同士をなるべく同じプロセッサ上で実行できるようスケジューリングすることによって、記憶管理資源の削減、キャッシュ効率の向上がはかれる。また、有効化されたアドレス変換テーブルエントリの情報を利用してアドレス変換テーブルの共有化が行われているため、あらかじめ参照先のページが該プロセッサに付随する局所メモリに置かれている可能性が高いという特徴もある。
【0108】
本実施形態では、プロセス生成時にプロセッサへの配置の方法について述べたが、この応用例として、システムが暗黙裏かつ定期的に各局所メモリ上のアクティブ保護領域情報を調査し、あるアドレス変換テーブル共有可能なプロセスが複数プロセッサ上で配置されている状態を検出することによって、これらを一箇所の局所メモリ上へ移送し、結果的にプロセスマイグレーションを行うことも、本実施例を基にして比較的容易に実現できる。
【0109】
なお、以上の説明では、疎結合型マルチプロセッサシステム環境下でのアドレス変換テーブル共有可能プロセスのプロセッサ割り当て処理について説明したが、これを、各計算機ホストがネットワーク上に相互接続された図3のような分散システム環境下で適用する場合にも、基本的には疎結合タイプのマルチプロセッサと同等なメモリ配置形式となるため、一般性を失なうことなく実施形態4の制御機構により実現できる。
【0110】
以上説明したように、この発明の実施形態によれば、MMUを搭載し、ページングのアドレス変換方式にページングテーブルを使用する仮想的記憶管理機構を具備した計算機上で、単一の仮想記憶空間を提供し、単一仮想記憶空間内に複数配置される領域に対して、各プロセス毎にアクセス可能領域範囲を設定できるアクセス保護機構を提供するOSなどの基本ソフトウェア構成において、各プロセスに付随するアドレス変換テーブルにおいてて有効化されたエントリ情報に基づき有効ページ領域の範囲を算出して、複数プロセス間で領域に対するアクセス保護の一貫性を保証したアドレス変換テーブル共有化の機会を増加させることにより、仮想記憶空間管理用資源(ページテーブルやTLBなど)の削減や、これに伴う物理メモリ収納可能領域サイズ(キャッシュ率)の向上、アドレス変換テーブル共有化による該アドレス変換テーブル数の減少によるアドレス変換テーブル間一貫性制御のための変更通知頻度の低減、などが可能になる。
【0111】
また、アドレス変換テーブルを共有したままではアクセス保護の一貫性が保証できない領域への参照が行われるまで、新たな別アドレス変換テーブルの作成/新規アドレステーブルの該当プロセスへの対応づけ時期を遅延することができる。
【0112】
また、次期実行プロセスの選択、プロセス実行待ち行列内でのプロセス・エンティティの配置を、可能な限りアドレス変換テーブル共有プロセス群を検出して、スケジューリング制御することにより、プロセス切り替え時に生じるページテーブル切り替えTLBフラッシュ回数の低下、共有アドレス変換テーブルの継続使用によるキャッシュ率の向上、アドレス変換テーブルエントリの再設定の回避、などが可能になる。
【0113】
さらに、分散メモリ型(疎結合型)マルチプロセッサシステムにおいて、生成プロセスのアドレス変換テーブル共有可能性に着目したプロセッサ割り当てを行うことにより、各プロセッサの局所メモリごとに、仮想記憶空間管理用資源の削減や、仮想記憶管理用情報のプロセッサ間での一貫性制御通知頻度の低減、などが可能となる。
【0114】
なお、この発明は上述した各実施形態に限定されるものではなく、その要旨を逸脱しない範囲で、種々変形して実施することができる。
【0115】
【発明の効果】
以上説明したように、この発明によれば、単一仮想記憶空間を全てのプロセスで共有するシステムにおいて、プロセスそれぞれについてのアクセス保護機能を保証しつつ、プロセス間でのアドレス変換テーブルの共有化可能性を十分に高められるようになり、信頼性が高く、且つ記憶管理用資源、プロセス切り替え時のコストの最小化を実現することが可能となる。
【図面の簡単な説明】
【図1】この発明の一実施形態に係る仮想記憶管理方法が適用されるシングルプロセッサシステムの構成例を示すブロック図。
【図2】この発明の一実施形態に係る仮想記憶管理方法が適用されるマルチプロセッサシステムの第1の構成例を示すブロック図。
【図3】この発明の一実施形態に係る仮想記憶管理方法が適用されるマルチプロセッサシステムの第2の構成例を示すブロック図。
【図4】同実施形態における実行プロセスとデータとの関係の一例を示す図。
【図5】同実施形態における各プロセスとアクセス保護領域範囲との関係の一例を示す図。
【図6】同実施形態の仮想記憶管理方法を実現するためのOSの構成例を示すブロック図。
【図7】同実施形態の仮想記憶管理方法で使用されるプロセス構造体の一例を示す図。
【図8】同実施形態の仮想記憶管理方法で使用されるアクセス/アクティブ保護領域構造体の一例を示す図。
【図9】同実施形態の仮想記憶管理方法で使用されるアクセス/アクティブ保護領域リスト用エントリの構成を示す図。
【図10】同実施形態の仮想記憶管理方法で使用されるメモリセクション領域構造体エントリの構成を示す図。
【図11】同実施形態の仮想記憶管理方法で使用される対領域および対プロセスの許可/不許可エントリの構成を示す図。
【図12】同実施形態におけるプロセス1のアクセス保護領域の配置を示す図。
【図13】同実施形態におけるプロセス1実行中のアクティブ保護領域の配置を示す図。
【図14】同実施形態におけるプロセス2のアクセス保護領域の配置を示す図。
【図15】同実施形態におけるプロセス1,2間のアクセス/アクティブ保護領域の関係を示す図。
【図16】同実施形態におけるプロセス指定によるページテーブル共有化の処理の手順を示すフローチャート。
【図17】同実施形態におけるプロセス2によるプロセス1のアクティブ保護領域リストとページテーブルの共有化例を示す図。
【図18】同実施形態においてプロセス1が領域(E)を実行中にアクセスした後のアクティブ保護領域と各アクセス保護領域との状態を図。
【図19】同実施形態におけるページフォルト時におけるページテーブル共有化継続可能性の判定および分離時の処理手順を示すフローチャート。
【図20】同実施形態における仮想/物理アドレス変換共有マップと現実行プロセスのページテーブルとの関係を示す図。
【図21】図20におけるページテーブルエントリの構成を示す図。
【図22】同実施形態におけるページテーブル共有プロセス間でのディスパッチに対応したスケジューリングの流れを示すフローチャート。
【図23】同実施形態におけるページテーブル共有プロセスに関するプロセス・エンティティの選択/配置例を示す図。
【図24】同実施形態におけるプロセス生成時のプロセッサの割り付け処理の手順を示すフローチャート。
【図25】従来の単一仮想記憶空間管理方法の一例を示す図。
【図26】従来の単一仮想記憶空間管理方法の他の例を示す図。
【符号の説明】
11…CPU、12…MMU、13…物理メモリ、14…二次記憶、21…プロセス管理部、22…仮想記憶管理部、23…ページテーブル管理部、24…メモリセクション領域管理部、25…保護領域管理部。[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a virtual storage management method, and more particularly, to a virtual storage management method for performing virtual storage management by paging using a single virtual storage space shared by all processes executed on a computer system.
[0002]
[Prior art]
In recent years, with the improvement of the computer architecture, the increase in the capacity of storage devices, and the drastic expansion of the available virtual storage space due to the 64-bit processor, etc., multiple programs and data are stored on a single virtual storage space. A method of centrally managing these by arranging them has been regarded as effective. This is because, by making all processes share the same virtual storage space, objects such as programs and data placed on the virtual storage are uniquely associated with virtual addresses on the virtual storage, and these objects are associated with each other. It is to define / manage in a unified manner.
[0003]
A specific advantage is that the correspondence between the virtual address and the physical address is the same for all processes on a certain computer, so that the same object can be referenced from any process by a specific virtual address. In addition to guaranteeing the equivalence of objects, there are cited persistence of objects, direct inter-process communication across a plurality of program areas arranged in space, and easy data sharing.
[0004]
When providing such a single virtual storage mechanism with basic software such as an OS, there are some points which are problematic.
[0005]
One of the problems is how to realize protection of each area arranged in a single virtual storage space. The single virtual space itself presents the addressability of the entire space to all the spawned processes, but when used in a multi-user environment etc., the individual virtual space that is actually located in the space It is necessary to be able to specify / set access protection for each user or each process for an area. This is to protect the area from careless reference, area destruction due to erroneous operation, malicious operation, and the like. This protection function is essentially essential for the OS.
[0006]
Setting the access protection attribute for the process for each area means that the range of the accessible area is defined for each process.
[0007]
Therefore, the range of the accessible area for each process is referred to as an “access protection area”, and a method for realizing this protection function will be considered below. Here, a virtual storage management mechanism that performs virtual / physical address conversion using an address conversion table (this indicates a page table, a TLB (Translation Lookaside Buffer), etc.) currently used in many architectures is provided. Consider a case where the above-described protection function is realized on a computer.
[0008]
[Problems to be solved by the invention]
(1) First, consider that a single address conversion table is shared by all processes to realize an access protection area for each process. In this case, at the time of a page fault, the protection check by the paging function can be applied in accordance with the protection relationship between the page where the page fault has occurred and the process. However, since this protection check is performed only at the time of a page fault, if another process without access permission tries to access the page once accessed by one process, it will correspond to the reference page in the address translation table. If the address translation table entry to be executed is valid, no page fault occurs, so that this illegal access cannot be detected by software or hardware. This is shown in FIG.
[0009]
FIG. 25 shows a case where
[0010]
As described above, when the combination of protection attributes such as read, write, and execute for the same page differs between processes, the same address conversion table cannot be shared.
[0011]
That is, if processes having different ranges / attributes of the access protection area share the address conversion table, consistency in area protection cannot be guaranteed.
[0012]
(2) Then, it is considered that a separate address conversion table is held for each process. In this method, as shown in FIG. 26, the range of the area that can be accessed for each process is managed independently by each address conversion table, so that the
[0013]
In this method, when the same page is shared by a plurality of processes, the address translation table entry state associated with each process corresponding to the simultaneously referenced page becomes valid at some point (however, the page can be referenced). Even if it is a process, if the page is not referred to, the state of the address translation table entry may remain invalid.)
[0014]
Thereafter, when a process needs a new page and there are no unused pages in the physical memory, a page-out is performed. When a shared page currently being referred to by a plurality of processes is selected as a page to be paged out, in order to guarantee the consistency of the table, an address translation table entry for each process currently referred to for the page is checked. It becomes necessary to invalidate all states, and the invalidation notification cost for this increases with the number of reference processes.
[0015]
Further, since each process holds a page table, even when using an architecture adopting a multi-staged page table, the physical memory and the 2nd memory wasted due to such storage management resources. The amount of the storage area for the secondary storage increases in proportion to the number of processes. As a result, the cache hit rate decreases, and the overhead such as the page table switching and TLB flush at the time of process switching affects system efficiency. Will come.
[0016]
As described above, in the case of the method (1) in which a single address translation table is shared by all processes, the consumption of storage resources is small and the consistency of the address translation information can be easily maintained. Because access protection is not possible, the system is always at risk and cannot be used safely. On the other hand, the method (2) using the address translation table separately for each process has a problem that memory resources are wasted.
[0017]
(3) As means for solving such a problem, an address conversion table is shared only between processes having the same access protection area, and the storage management resource is maintained while maintaining the access protection function for each process. It is possible to optimize.
[0018]
However, in order for the access protection area to completely match between the processes, the access protection area must be fixedly defined in the plurality of processes to be grouped. It is difficult to realize a flexible protection function that dynamically adds or changes an accessible protection area only for a certain one of the processes.
[0019]
On the other hand, it is generally considered that the information of the access protection area set by the system when the process is generated is a subset of the area that can be used by the generation process and does not include all the information that can be used in the space. This is because there may be many areas in the vast virtual storage space that can be referenced by any process, and these are extracted one by one and reflected as access protection area information attached to the creation process. It is not practical to maintain this. Therefore, a change such as addition or deletion of the access protection area accompanying the process can be performed by giving an instruction from the program or accessing another area other than the area held as the current access protection area information. It is considered natural that the method is dynamically performed when a fault occurs, the access permission is checked, and the access is permitted. Under such circumstances, it is difficult to guarantee perfect matching of the access protection areas in a strict sense.
[0020]
As described above, the matters that are problematic when realizing the function of setting the range of the accessible area flexibly for each process using the single virtual storage space have been described. However, there are several examples of optimization of a process running in a certain address space by reducing the weight of the process by sharing an address translation table and minimizing the practical context. However, these are generally applied to the entire virtual storage space, such as the multiple virtual storage system, because the entire virtual storage space completely matches the protection area, and is limited only to the virtual storage space having an applicable range. This method does not provide a solution regarding an optimization method of an access protection function that functions efficiently in a situation where the range of a plurality of areas arranged in a single virtual storage space can be dynamically changed.
[0021]
Next, a problem in scheduling a process capable of setting each accessible area range on a single virtual storage space will be described. Normally, in an architecture using a multiple virtual storage space, when processes are accommodated in an execution queue and dispatched in order, it is necessary to switch a page table or TLB flush every time a process is switched. However, in an architecture that uses a single virtual storage space where the page table can be shared among multiple processes, the scheduler selects the process to be selected as the next execution process as the one that shares the page table with the current execution process. If it can be determined, the above operation is essentially unnecessary at the time of dispatch. However, in the conventional scheduling method, the shared information on the address translation table is not used for scheduling at all. Therefore, if a general scheduling method is applied to an architecture using a single virtual memory space, a page is always generated every time a process is switched. Table switching or TLB flush is performed.
[0022]
Next, a description will be given of a problem in a case where a process capable of setting each accessible area range on a single virtual storage space is assigned to a processor in a distributed memory type (loosely-coupled) multiprocessor system environment.
[0023]
Under the multiprocessor system environment, each CPU has a configuration in which an MMU and a local memory are attached. However, since each CPU does not allow another CPU to access its own local memory, it shares an address conversion table. When two processes are assigned to different CPUs, one process creates a copy of the address translation table on the local memory of the corresponding CPU and newly uses this. In this case, the advantage that the address translation table can be shared is lost, and the contents of the cache are also switched. Therefore, every time the processor is moved, it is necessary to recache and take in the data.
[0024]
Such a conventional technique considering the affinity of the cache on each processor includes, for example, cache affinity scheduling for controlling a process (thread) to be executed on the same processor as much as possible [Reference: R. Vaswani and J.M. Zahorjan. "The implementations of cache affinity on processor scheduling for multiprogrammed, shared memory multiprocessors. In Proceedings of Osm. 26-40, 1991. ] Exists. However, the above-mentioned scheduling method is intended only to improve the cache effect by controlling the processor allocation so that one process (thread) is executed on the same processor as much as possible. No consideration is given to the affinity with the sharable processes.
[0025]
The present invention has been made in consideration of the above problems, and in a system in which a single virtual storage space is shared by all processes, an address translation table between processes is ensured while guaranteeing access protection for each process. The object of the present invention is to provide a virtual storage management method capable of sufficiently increasing the sharability of a virtual machine, and realizing a highly reliable storage management resource and minimizing the cost at the time of process switching. I do.
[0026]
[Means for Solving the Problems]
The present invention provides a virtual storage management method for performing virtual storage management by paging using a single virtual storage space shared by a plurality of processes executed on a computer system. For each of the plurality of areas to be obtained, an area accessible for each process and an attribute of access protection for the area are defined, and a page currently read in the physical memory belongs to an accessible area of a certain process. A process is detected in which the accessible area is accessible and the access protection attribute for the area is the same as the above process, and an address translation table for translating a virtual address to a physical address is shared between the processes. It is characterized by the following.
[0027]
In this virtual storage management method, attention is paid to an accessible area to which a page currently read in a physical memory belongs within an accessible area of a certain process, the accessible area is accessible, and access protection is performed. If there is another process having the same attribute, the address translation table is shared between the processes. Therefore, even if the accessible areas and the access protection attributes do not all match, if the access protection attributes match only for the area corresponding to the page currently read in the physical memory, the address translation table is shared. As a result, it is possible to sufficiently increase the possibility of sharing the address translation table between the processes while guaranteeing the access protection function of each process, thereby achieving high reliability, storage management resources, and process switching. Cost can be minimized.
[0028]
Further, when a page belonging to a new area in which consistency of access protection cannot be guaranteed between processes sharing the address translation table is read into the physical memory due to the occurrence of a page fault, the sharing of the address translation table is performed. It is preferable to release. As a result, consistency of area protection can be guaranteed.
[0033]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
[0034]
1 to 3 show configuration examples of a computer architecture to which a virtual storage management method according to an embodiment of the present invention is applied. The computer architecture of FIG. 1 is a uniprocessor computer, has one
[0035]
FIG. 2 shows a distributed memory type (loosely coupled type) multiprocessor system including a plurality of processors, each of which has one
[0036]
FIG. 3 is another configuration example of a distributed memory type (loosely coupled type) multiprocessor system including a plurality of processors. A distributed computer system in which a plurality of processors are coupled via a network such as a LAN or a WAN is illustrated. Is illustrated. The secondary storage device 14 of each processor is usually used as a swap backing storage. However, if the secondary storage resources on other computers can be used as the swap area in a network environment, the secondary storage device 14 is not necessarily used for each processor. There is no need to provide a separate secondary storage.
[0037]
FIG. 4 illustrates an example of a relationship between an execution process on the computer and data. By the process management mechanism and the virtual storage management mechanism of the OS provided in the computer environment, various areas such as all programs and data (hereinafter referred to as “memory section areas”) are illustrated on a single virtual storage space illustrated. Is realized, and a single virtual storage space can be shared from all running processes. That is, when data reference is made from a process to a specific virtual address, the same byte string is seen for all running processes. Further, since the same virtual storage space is shared by all the processes, a data change on a specific virtual address is immediately reflected on other processes other than the process that made the change.
[0038]
In FIG. 4, a
[0039]
FIG. 5 shows an example of the relationship between each process to be managed by the inter-process virtual storage and the access protection area range. A plurality of processes executed on a single virtual storage space are provided with an access protection mechanism capable of setting / changing a memory section area range that can be independently accessed. That is, each process is readable, writable, executable, etc. for each memory section area arranged on a single virtual storage space (hereinafter, these operations are collectively referred to as access or reference). By designating the access protection attribute, the range of accessible / inaccessible areas can be set freely for each process unit. The access protection mechanism enables the memory section area to be protected from intentional / inadvertent access from an unauthorized process.
[0040]
In FIG. 5, memory section areas A, B, and D are assigned as access protected areas for
[0041]
FIG. 6 shows a configuration example of an OS for realizing the inter-process virtual storage management mechanism of the present invention.
[0042]
As shown, the inter-process virtual storage management mechanism includes a
[0043]
The
[0044]
The page table management unit 23 is responsible for generating a page table associated with each process, setting a page table entry, and the like. The page table generation unit 231, the page table entry setting unit 232, and the page table entry
[0045]
The memory section
[0046]
The protection
[0047]
The respective management units are related to each other, and the respective components cooperate to perform processing necessary for realizing the inter-process virtual storage control mechanism.
[0048]
Next, a method of setting the protection attribute of the memory section area in the process (for the process) will be described.
[0049]
The memory section area is set for each process according to instructions of various programs. The OS holds a list of access permission attributes for each memory section area as “access protected area” information, and is managed by the access protected
[0050]
In the process structure, in addition to the priority, process attribute, register save information, jump destination in exception processing, etc., a page table head address (here, distinguished from register save information), access protection area list management A structure and an active protection area list management structure (described later) are recorded. The access / active protection area list management structure is a group of pointers that specify the information storage position of the access / active protection area of the corresponding process. Here, the access protection area indicates all memory sections accessible by the process. The active protection area indicates a memory section area to which a page currently read into the physical memory belongs in the access protection area.
[0051]
As shown in FIG. 8, the access protection area list management structure is composed of the first entry and the last entry of the memory section area structure linked in ascending order of the virtual address where the memory section area is located. Is done. Further, as shown in the figure, a hint for recording the position of the memory section area structure entry last referred to may be included. Similarly to the access protection area list management structure, the active protection area list management structure also includes the first entry of the active memory section area structure linked in ascending order of the virtual address where the memory section area is located. And the end entry, and a hint for recording the location of the last referenced memory section area structure entry.
[0052]
As shown in FIG. 9, each memory section area structure holds a forward / backward link, a memory section ID, and the like, and may include a protection attribute used as a cache of an access right to the memory section area. Good.
[0053]
Further, the access protection area information can be set not only for the process but also for each memory section area. This can be usually specified / set when the area is arranged in the virtual storage space. If necessary, the access permission / non-permission attribute can be dynamically changed after the arrangement. .
[0054]
In this case, the memory section area management data structure can be realized by a bidirectional list similar to that shown in FIG. As shown in FIG. 10, each memory section area structure entry includes a head / end virtual address of the memory section area, a forward / backward link, a protection attribute flag, a pair area permission / non-permission list, a pair Process permission / non-permission list.
[0055]
As a result, in each memory section area, access permission / non-permission can be set independently for the memory section area in which the program is stored and for each process. The entry contents maintained for this purpose are shown in FIGS. 11 (a) and 11 (b). In addition to the memory section ID / process ID, protection attributes such as read / write / execution are recorded. In addition, using the protection attribute flag in the memory section area structure entry, settings are made so that access (read / write / execution, etc.) can be permitted / prohibited from all processes (memory section area). It is possible.
[0056]
Hereinafter, embodiments using each of these will be described.
[0057]
In the first embodiment, the possibility of sharing the page table is determined and the sharing control is performed between the processes based on the inclusion relationship between the active protection area information and the access protection area information accompanying each process.
[0058]
There are several ways to determine the sharability of the page table and when to actually share the page table. The process can be explicitly specified by the programmer or implicitly performed by the OS or other system. Is automatically searched and shared.
[0059]
Here, an example will be described in which the program specifies another process to be a page table sharing partner when the process is generated.
[0060]
FIG. 12 shows a state where the
[0061]
Subsequently, it is assumed that the execution of the
[0062]
The active protection area is created one-to-one with respect to the page table, and is held by the active protection area management unit.
[0063]
Next, a case will be described in which, when a
[0064]
FIG. 14 shows that the access protection areas set in the
[0065]
Here, a description will be given, with reference to FIG. 16, of a processing procedure in a case where the
[0066]
After allocating and initializing the process structure, the process generation unit calls up the page table management unit and requests permission determination regarding page table sharing (S1501). The page table management unit extracts the active protection area list of the
[0067]
Next, the page table management unit compares these two pieces of information with the page table sharing determination unit based on the determination criterion information that is the sharing condition specified by the system or the user (S1504). As a specific example of the criterion information, when the access protection area range includes the active protection area range (the protection attribute is assumed to be the same), sharing is considered. . For example, in a situation as shown in FIG. 15, if the
[0068]
When the page table sharing is permitted by the page table sharing determination unit, the page table management unit calls the page table sharing execution unit, and actually, the active protection area list of the requesting process (process 2) and the top of the page table. A process for sharing the address information with the request destination process (process 1) is performed (S1506).
[0069]
Finally, after ending the page table allocation, the page table management unit shifts the control to the process generation unit, finishes the preparation necessary for executing the process, and returns (S1509). FIG. 17 shows the sharing state (data structure) at this time.
[0070]
If the sharing is not permitted in step S1505, the requesting process needs to maintain its own page table. Therefore, a new page table is created, associated with the process, and a page table entry is set and required. Is performed (S1507). A new active protection area list is set for the requesting process (S1508).
[0071]
As described above, in the present embodiment, by introducing the active protection area and permitting the sharing of the page table while maintaining the consistency at the present time, the sharing conditions are relaxed, and the opportunity for sharing is realized. Is increasing.
[0072]
If the condition is not satisfied, sharing is not permitted, and another page table is created as described above, and this is used by the
[0073]
In the inter-process virtual storage control mechanism, even for an area other than the area held in the access protection area information associated with the process, the process that attempts to refer to the area and the page table shared with the process are shared. As long as the access permission for the process is lowered, reference to the area is possible, and an entry corresponding to this area can be added to the active protection area information and the access protection area information of each process to ensure consistency. It is possible.
[0074]
Note that, here, a method of specifying a process that has already been created is used to specify the sharing target page table. However, a group is formed between processes requesting sharing, and sharing is performed by specifying this group identifier. Examples of the modification include a method of automatically finding a page table that can be shared by the system and a method of trying to share the page table for all processes to be generated.
Next, a second embodiment will be described.
[0075]
Overview of processing
The page table shared in the first embodiment can be continuously used as long as the page area range actually referenced from each process does not break the consistency of the access protection. However, in a case where access is permitted in a certain group of page table shared processes but access is not permitted in any of the other processes, access is permitted as it is and processing is performed. If continued, access protection of the area cannot be guaranteed.
[0076]
Therefore, when such an access occurs after sharing the page table, the sharing of the page table is canceled from the process that requests the access, and another page table is prepared and used by the process. Control provides a mechanism to ensure consistency of access protection.
[0077]
In addition to the method of separating a process from the page table sharing process group when a reference that does not maintain the consistency of access protection is actually performed (detected at the time of a page fault), there are several other methods. Can be.
[0078]
For example, besides this page fault, it is also conceivable to use the system according to a user's designation by a system call or the like, or according to each trigger.
[0079]
Here, first, a description will be given of a separation process in a case where the necessity of separation of a process from a page table sharing process group is determined at the time of a page fault. For example, as shown in FIG. 18, if a page fault occurs in
[0080]
Hereinafter, a specific procedure of the separation process when a page fault occurs will be described with reference to FIG.
[0081]
When a page fault occurs (S1801), the active protection list management unit is called from within the page fault handler, and an active protection area list accompanying the page reference source process (executing process) is extracted (S1802). This corresponds to the acquisition of an active protection area list management structure, which is an attribute in the process structure of the running process. It is checked from the extracted list whether the fault destination virtual address is included in the area range held by the list (S1803). This is because, from the head entry of the list, the area range information (area start / end address) in the memory section area structure identified by the memory section ID destination which is the entry internal attribute is sequentially compared with the fault destination virtual address. It is done by doing. The entries for the active protection area list may be linked in ascending order of the virtual address, and the entry selected immediately before may be maintained as hint information, and search efficiency may be improved such that sequential inspection is performed thereafter. . When it is detected that the fault destination virtual address is included in the range in the active protection area list, the protection attribute (the one cached from the memory section area structure member) of the corresponding active protection area list entry and the reference The access right is checked from the operation (read, write, execute, etc.) (S1804). If it is determined in step S1805 that access is permitted, page table entry settings (virtual / physical address translation / protection attribute settings, page-in processing as necessary) are performed (S1817), and the process returns (S1819). ). If it is determined in S1805 that the access is not permitted, an error such as a protection exception is returned (S1818), and the process returns (S1819). If it is detected in S1803 that the fault destination address is out of the range of the active protection area of the reference source process, an access protection area list accompanying the process is extracted (S1806), and the fault destination address is included in the access protection area list. It is checked whether a memory section area including a virtual address is included (S1807). If this is included, the protection attribute (cached from the memory section area structure member) of the entry for the access protection area list corresponding to the memory section area and the reference operation (read, write, execute, etc.) The access right is checked (S1808). If it is determined in S1809 that the access is permitted, it is checked whether the access protection area is shared by all the other page table sharing processes (S1810). If the page table is shared by all processes, the page table entry is set, etc., the memory section area corresponding entry including the page is added / set to the active protection area list of the process (S1817), and the process returns. (S1819). If not shared by all the page table sharing processes, consistency of access protection cannot be maintained if the page tables are shared, so the page table generation unit must be requested to create a new page table for the process, and If it is, copy the contents of the currently used shared page table, separate the process from the page table shared process group, attach the newly created page table to the process, set the page table entry, etc. (S1811), an entry corresponding to the memory section area including the page is added / set to the active protection area list of the process (S1812), and the process returns (S1819).
[0082]
If it is determined in step S1809 that the access is not permitted, an error such as a protection exception is returned (S1818) because the request is rejected by one of the combinations of read, write, and execute (S1819), and the process returns (S1819).
[0083]
In S1817, if the access destination area virtual address is not included in the access protection area list, a memory section area list for managing the memory section area information including the fault page is extracted (S1813). The access right of the process is acquired from the protection attribute flag, the area permission list, the area non-permission list, the process permission list, and the process non-permission list, which are the structure members (S1814). As a result, if the access right is recognized, the entry corresponding to the memory section area including the page is set in the access protection area list of the process, inserted in ascending order of the virtual address, and control is transferred to S1810 (S1816). If the access right is not recognized in S1815, an error such as a protection exception is returned (S1818). It returns (S1819). If it is determined in S1814 that the access right is undecided, the access is prohibited.
[0084]
It should be noted that, for the virtual / physical address conversion of the page table entry, the address conversion information is efficiently held by using a multi-stage table such as a “virtual / physical address conversion shared map” as shown in FIG. It is also possible. This is a method similar to the conventional multi-stage page table, in which the page identification part of the virtual address is divided into two, and the first half is used as an offset to an entry in the
[0085]
The entry in the page table associated with each process is when the address translation information of the corresponding entry of the above “virtual / physical address translation shared map” is valid (when the corresponding page is read in the physical page frame). In this case, the physical address position can be set at high speed by copying this entry. If the address translation information of the corresponding entry is invalid, an entry of the virtual / physical address translation sharing map is set after paging processing is performed, if necessary, and this is the corresponding entry in the process associated page table being executed. Will be copied within. After setting the address conversion information, the protection attribute in the page table entry is set based on the access right of the running process to the memory section area.
[0086]
In the present embodiment, an example is shown in which only one process that has caused an access escapes from the page table sharing process group. However, as a variation, there are some other processes that do not lose access protection due to the access. In such a case, it is conceivable to break away with them. In this case, one new page table is created and shared between the escaped process groups.
[0087]
Further, in the present embodiment, the necessity of departure from the page table sharing process group is determined by a page fault, but the release of the page table sharing is explicitly released by a programmer using a system call or the like. Requests can be easily realized. In this case, the difference from the processing at the time of page fault is that (A) the page fault occurrence and the page fault handler call at the time of the page fault are replaced with the system call request and the system call processing, and (B) the separation determination processing inside the OS. Is unnecessary, and the processing is performed so as to be always separated, so that the subsequent processing can be realized similarly.
[0088]
Next, a third embodiment will be described.
[0089]
Here, a scheduling method is adopted in which a group of processes sharing the address conversion table is continuously executed. As a result, the cost for switching between processes can be significantly reduced.
[0090]
That is, since there is no need to perform a page table switching operation between processes sharing the page table, the scheduler dispatch unit notifies the scheduler of the current page table associated with the next execution process selected from the process execution queue. Is determined, and if the values are the same, a process of not changing the page table is performed. FIG. 22 shows a simple flow from the saving of the execution context of the running process to the dispatch to the next execution process selected by the scheduling.
[0091]
At the time of process switching, first in S2002, the execution context such as register information is saved by the process information saving unit of the process management unit, and the next execution process is selected from the execution queue by the scheduler (process scheduling unit) according to the scheduling policy and the like. This is performed (S2003). Next, the page table top address information of the currently executing process and the selected process is compared, and it is determined whether or not they have the same value (S2004). If the values are the same, the execution context other than the page table top address information of the selection process is recovered (S2005), and the process returns (S2007). If it is determined in S2004 that the values are not the same, the page table start address of the selected process is set in a specific hardware register or TLB flashing is performed (S2006), and then the page table start address information of the selected process is removed. The execution context is recovered (S2005), and the process returns (S2007).
[0092]
By continuously using the page table, switching of the page table and TLB flush are not required at the time of dispatch. Further, after the process switching, when re-accessing the page referred to by the immediately preceding process, if re-accessing the page for which the page table entry is valid, the page table entry can be used as it is. The resetting cost of the entry becomes unnecessary.
[0093]
Further, this optimization policy can be applied at the time of switching between arbitrary processes, and is also applicable when the next execution process is selected between processes having different priorities.
[0094]
Also, if there are multiple processes with the same priority when selecting the next execution process, if there is a process with the same page table as the process executed immediately before, select the process as much as possible. It is preferable to control.
[0095]
Several variations of this policy are possible. (A) A format in which the scheduler sequentially searches the execution queue for a process having the same page table as the process executed immediately before the next execution process is selected. (B) The priority is set when a process is created or a blocked process is restarted. When there is a process sharing the page table in the same execution queue, a process entity is arranged immediately after the process, and the process entity is arranged as continuously as possible. (C) The target process when the running process wakes up the sleeping process. , If they share the same page table, there is a format to preferentially select as the next execution thread. These are shown in FIG.
[0096]
In the above control method, a system / programmer can specify / specify a page table head address associated with each process structure at a registration time of a process entity in an execution queue and a next execution process selection time. This can be realized by comparing / determining based on a control policy.
[0097]
However, if these scheduling policies are prioritized too much, it may cause process starvation or a bias toward the execution of some processes, so it is necessary to calculate for scheduling according to time factors. is there.
[0098]
Next, a fourth embodiment will be described.
[0099]
Here, in a distributed memory type (loosely coupled type) multiprocessor system environment, dispatching is performed so that processes capable of sharing the address conversion table can be executed on the same processor as much as possible.
[0100]
FIG. 24 shows a procedure for assigning processors when a process is generated according to the fourth embodiment.
[0101]
When the process management unit of the OS receives the process generation request (S2201), the process generation unit is called to generate a request to arrange the received process generation request on the processor having the sharable process of the address translation table. It is checked whether the process side has requested (S2202). This request can be made by instructing the OS from the process generation side, for example, by setting an attribute in an argument of the process generation system call.
[0102]
When the request specification is not detected, the process generation unit performs a process generation process on the process generation source processor (S2206, S2208).
[0103]
On the other hand, in the determination of S2202, when the designation of the sharing request for the table is detected, a search request message is transmitted to each processor in order to search for the process sharable process allocation destination processor (S2203). As a procedure for transmitting the message, first, a search may be performed on the processor that has generated the processor, and then, if the processor cannot be detected, a search request may be made with respect to another processor. Returning to the flow, the search request of S2203 is notified to each processor, and each processor receiving the message searches whether the table sharable process exists in its own processor. This search is performed by, for example, comparing the access protection area range on the generation process side with information on a plurality of active protection area ranges that can be stored in each processor, as in the address conversion table sharing determination procedure described in the first embodiment. Can be processed.
[0104]
Next, the search request source processor receives the search result returned from each processor, and determines whether or not the processor holding the address translation table sharable process has detected (S2204). As a result of this determination processing, if the processor is not detected, the process generation source processor is selected, and a request to allocate a generation process is transmitted to the process generation unit on this processor to the generation unit.
[0105]
When the processor holding the address translation table sharable process is detected in the process of S2204, it is checked whether or not the detected processor (group) includes the process generation source processor (S2205). If it is included, after selecting the generation process source processor (S2206), it transmits a generation process allocation request to the process generation unit of the generation process source processor (S2208). If no generation process source processor is included in S2205, an arbitrary processor is selected from the detected processors (group) (S2207), and a generation process allocation request is transmitted to the process generation unit on the processor (S2208). When there are multiple corresponding processors, the selection method can be any of the following.However, the system or programmer specifies the method based on the first response, or the processor usage rate and the available physical memory. It is conceivable to select an appropriate processor according to the selected selection criterion.
[0106]
After the above processing, the process of arranging the process information and the execution queue entry on the local memory associated with the selected processor of the generation process is performed as necessary.
[0107]
As described above, in a loosely-coupled multiprocessor system environment, by scheduling the processes that can share the address translation table so that they can be executed on the same processor as much as possible, it is possible to reduce storage management resources and improve cache efficiency. In addition, since the address translation table is shared using the information of the activated address translation table entry, there is a possibility that the page to be referred to is stored in the local memory associated with the processor in advance. There is also a feature of high.
[0108]
In the present embodiment, the method of allocating to the processor at the time of process generation has been described. As an application example, the system implicitly and periodically checks the active protection area information on each local memory and shares a certain address translation table. By detecting a state in which possible processes are arranged on a plurality of processors, these can be transferred to one local memory, and consequently a process migration can be performed based on the present embodiment. Can be easily realized.
[0109]
In the above description, the processor assignment processing of the address translation table sharable process in the loosely-coupled multiprocessor system environment has been described. However, this processing is performed as shown in FIG. 3 in which each computer host is interconnected on a network. Even when applied in a distributed system environment, the memory arrangement is basically equivalent to that of a loosely-coupled multiprocessor, and can be realized by the control mechanism of the fourth embodiment without loss of generality.
[0110]
As described above, according to the embodiment of the present invention, a single virtual storage space is created on a computer equipped with an MMU and a virtual storage management mechanism that uses a paging table for a paging address conversion method. Address associated with each process in a basic software configuration such as an OS that provides an access protection mechanism that can set an accessible area range for each process for a plurality of areas arranged in a single virtual storage space. By calculating the range of the valid page area based on the entry information validated in the translation table, and increasing the opportunity of sharing the address translation table that guarantees the consistency of the access protection to the area among a plurality of processes, Reduction of storage space management resources (page table, TLB, etc.) and the accompanying storage of physical memory Improvement of area size (cache ratio), reducing the change notification frequency for address conversion between table coherence controller according to the address conversion table number of reduction by the address conversion table sharing allows like.
[0111]
Further, until a reference is made to an area where the consistency of the access protection cannot be guaranteed if the address translation table is shared, the timing of creating a new separate address translation table / associating the new address table with the corresponding process is delayed. be able to.
[0112]
Further, by selecting the next process to be executed and arranging the process entities in the process execution queue as much as possible by detecting the group of processes sharing the address translation table and controlling the scheduling, the page table switching TLB generated at the time of process switching is performed. The number of flushes can be reduced, the cache rate can be improved by continuously using the shared address translation table, and resetting of the address translation table entry can be avoided.
[0113]
Furthermore, in a distributed memory type (loosely coupled type) multiprocessor system, by allocating processors focusing on the possibility of sharing an address conversion table of a generation process, resources for virtual memory space management can be reduced for each local memory of each processor. It is also possible to reduce the frequency of reporting consistency control between processors for virtual storage management information.
[0114]
The present invention is not limited to the above-described embodiments, and can be variously modified and implemented without departing from the gist thereof.
[0115]
【The invention's effect】
As described above, according to the present invention, in a system in which a single virtual memory space is shared by all processes, the address translation table can be shared between processes while guaranteeing the access protection function of each process. Therefore, it is possible to sufficiently improve the reliability, to achieve high reliability, and to minimize the cost for storage management resources and process switching.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a configuration example of a single processor system to which a virtual storage management method according to an embodiment of the present invention is applied.
FIG. 2 is a block diagram showing a first configuration example of a multiprocessor system to which a virtual storage management method according to an embodiment of the present invention is applied;
FIG. 3 is a block diagram showing a second configuration example of a multiprocessor system to which the virtual storage management method according to one embodiment of the present invention is applied;
FIG. 4 is an exemplary view showing an example of a relationship between an execution process and data in the embodiment.
FIG. 5 is an exemplary view showing an example of a relationship between each process and an access protection area range in the embodiment.
FIG. 6 is an exemplary block diagram showing a configuration example of an OS for realizing the virtual storage management method of the embodiment.
FIG. 7 is an exemplary view showing an example of a process structure used in the virtual storage management method according to the embodiment;
FIG. 8 is an exemplary view showing an example of an access / active protection area structure used in the virtual storage management method of the embodiment.
FIG. 9 is an exemplary view showing the configuration of an access / active protection area list entry used in the virtual storage management method according to the embodiment;
FIG. 10 is an exemplary view showing the configuration of a memory section area structure entry used in the virtual storage management method according to the embodiment;
FIG. 11 is an exemplary view showing a configuration of a permission / non-permission entry of a pair area and a process used in the virtual storage management method of the embodiment.
FIG. 12 is a view showing an arrangement of an access protection area in a
FIG. 13 is a view showing the arrangement of active protection areas during execution of
FIG. 14 is a view showing an arrangement of an access protection area in a
FIG. 15 is an exemplary view showing the relationship of an access / active protection area between
FIG. 16 is an exemplary flowchart illustrating the procedure of a process of sharing a page table by specifying a process in the embodiment.
FIG. 17 is an exemplary view showing an example of sharing the active protection area list and the page table of the
FIG. 18 is a diagram showing a state of the active protection area and each access protection area after the
FIG. 19 is an exemplary flowchart showing the processing procedure for determining the possibility of continuation of sharing of the page table and for separation when a page fault occurs in the embodiment.
FIG. 20 is an exemplary view showing the relationship between the virtual / physical address conversion sharing map and the page table of the currently executed process according to the embodiment;
FIG. 21 is a diagram showing a configuration of a page table entry in FIG. 20.
FIG. 22 is an exemplary flowchart showing the flow of scheduling corresponding to dispatch between page table sharing processes in the embodiment.
FIG. 23 is an exemplary view showing an example of selection / arrangement of a process entity related to the page table sharing process in the embodiment.
FIG. 24 is an exemplary flowchart showing the procedure of processor assignment processing during process generation in the embodiment.
FIG. 25 is a diagram showing an example of a conventional single virtual storage space management method.
FIG. 26 is a diagram showing another example of a conventional single virtual storage space management method.
[Explanation of symbols]
11 CPU, 12 MMU, 13 physical memory, 14 secondary storage, 21 process management unit, 22 virtual storage management unit, 23 page table management unit, 24 memory section area management unit, 25 protection Area management unit.
Claims (2)
前記単一仮想記憶空間に配置され得る複数の領域の各々について、前記プロセス毎にアクセス可能な領域とその領域に対するアクセス保護の属性とを規定し、
あるプロセスのアクセス可能領域の中で物理メモリ内に現在読み込まれているページが属しているアクセス可能領域がアクセス可能で、且つその領域に対するアクセス保護属性が前記プロセスと同一のプロセスを検出し、
それらプロセス間で、仮想アドレスを物理アドレスに変換するためのアドレス変換テーブルを共有化させることを特徴とする仮想記憶管理方法。A virtual storage management method for performing virtual storage management by paging using a single virtual storage space shared by a plurality of processes executed on a computer system,
For each of a plurality of areas that can be arranged in the single virtual storage space, define an area accessible for each process and an attribute of access protection for the area,
Detecting a process to which an accessible area to which a page currently read in the physical memory belongs in an accessible area of a process is accessible, and an access protection attribute for the area is the same as the process,
A virtual storage management method, characterized by sharing an address conversion table for converting a virtual address into a physical address between the processes.
前記単一仮想記憶空間に配置され得る複数の領域の各々について、前記プロセス毎にアクセス可能な領域とその領域に対するアクセス保護の属性とを規定し、
あるプロセスがアクセス可能な領域の中で現在物理メモリ内に読み込まれているページが属しているアクセス可能領域がアクセス可能で、且つその領域に対するアクセス保護属性が前記プロセスと同一のプロセスを検出し、
それらプロセス間で、仮想アドレスを物理アドレスに変換するためのアドレス変換テーブルを共有化させ、
ページフォルトの発生によって、前記アドレス変換テーブルを共有するプロセス間におけるアクセス保護の一貫性を保証できない新たな領域に属するページが前記物理メモリに読み込まれるとき、前記アドレス変換テーブルの共有化を解除することを特徴とする仮想記憶管理方法。A virtual storage management method for performing virtual storage management by paging using a single virtual storage space shared by a plurality of processes executed on a computer system,
For each of a plurality of areas that can be arranged in the single virtual storage space, define an area accessible for each process and an attribute of access protection for the area,
Detecting a process to which an accessible area to which a page currently being read in the physical memory belongs in an accessible area of a process is accessible, and an access protection attribute for the area is the same as the process;
An address translation table for translating a virtual address to a physical address is shared between the processes,
Canceling the sharing of the address translation table when a page belonging to a new area that cannot guarantee the consistency of access protection between processes sharing the address translation table is read into the physical memory due to the occurrence of a page fault. A virtual storage management method characterized by the following.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP00437296A JP3557026B2 (en) | 1996-01-12 | 1996-01-12 | Virtual memory management method |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP00437296A JP3557026B2 (en) | 1996-01-12 | 1996-01-12 | Virtual memory management method |
Related Child Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2004125674A Division JP3828553B2 (en) | 2004-04-21 | 2004-04-21 | Virtual memory management method |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPH09190380A JPH09190380A (en) | 1997-07-22 |
| JP3557026B2 true JP3557026B2 (en) | 2004-08-25 |
Family
ID=11582545
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP00437296A Expired - Fee Related JP3557026B2 (en) | 1996-01-12 | 1996-01-12 | Virtual memory management method |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP3557026B2 (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2011148447A1 (en) * | 2010-05-24 | 2011-12-01 | パナソニック株式会社 | Virtual computer system, area management method, and program |
Families Citing this family (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6981125B2 (en) * | 2003-04-22 | 2005-12-27 | International Business Machines Corporation | Method and apparatus for managing shared virtual storage in an information handling system |
| US7562179B2 (en) * | 2004-07-30 | 2009-07-14 | Intel Corporation | Maintaining processor resources during architectural events |
| US7490215B2 (en) * | 2004-12-22 | 2009-02-10 | Intel Corporation | Media memory system and method for providing concurrent memory access to a plurality of processors through separate translation table information |
| US7844781B2 (en) * | 2006-02-23 | 2010-11-30 | International Business Machines Corporation | Method, apparatus, and computer program product for accessing process local storage of another process |
-
1996
- 1996-01-12 JP JP00437296A patent/JP3557026B2/en not_active Expired - Fee Related
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2011148447A1 (en) * | 2010-05-24 | 2011-12-01 | パナソニック株式会社 | Virtual computer system, area management method, and program |
| US9063868B2 (en) | 2010-05-24 | 2015-06-23 | Panasonic Intellectual Property Corporation Of America | Virtual computer system, area management method, and program |
Also Published As
| Publication number | Publication date |
|---|---|
| JPH09190380A (en) | 1997-07-22 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US10552337B2 (en) | Memory management and device | |
| US10210092B1 (en) | Managing cache access and streaming data | |
| US5251308A (en) | Shared memory multiprocessor with data hiding and post-store | |
| JP4160255B2 (en) | Application programming interface that controls the allocation of physical memory in a virtual storage system by an application program | |
| JP3139392B2 (en) | Parallel processing system | |
| US7721068B2 (en) | Relocation of active DMA pages | |
| CN101189575B (en) | Sequencer address management | |
| US7827374B2 (en) | Relocating page tables | |
| WO2017190266A1 (en) | Method for managing translation lookaside buffer and multi-core processor | |
| JP4241921B2 (en) | Computer system and its resource allocation method | |
| US20070288720A1 (en) | Physical address mapping framework | |
| JP3557026B2 (en) | Virtual memory management method | |
| JP3828553B2 (en) | Virtual memory management method | |
| EP0404560B1 (en) | multiprocessor system and method | |
| JPH04123234A (en) | Multiprocessor process scheduling method and memory management method | |
| Kim | Combining hardware management with mixed-criticality provisioning in multicore real-time systems | |
| Krueger et al. | Stealth: A liberal approach to distributed scheduling for networks of workstations | |
| KR20260049252A (en) | Message Channel | |
| Appavoo et al. | Memory management in k42 | |
| Lindegger et al. | Systems Group, Department of Computer Science, ETH Zurich |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20040219 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20040224 |
|
| A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20040421 |
|
| 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: 20040511 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20040514 |
|
| LAPS | Cancellation because of no payment of annual fees |