JP2011257973A - Memory management method and memory management device - Google Patents
Memory management method and memory management device Download PDFInfo
- Publication number
- JP2011257973A JP2011257973A JP2010131638A JP2010131638A JP2011257973A JP 2011257973 A JP2011257973 A JP 2011257973A JP 2010131638 A JP2010131638 A JP 2010131638A JP 2010131638 A JP2010131638 A JP 2010131638A JP 2011257973 A JP2011257973 A JP 2011257973A
- Authority
- JP
- Japan
- Prior art keywords
- memory
- operating system
- memory management
- time
- real
- 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.)
- Pending
Links
Images
Abstract
Description
本発明はメモリ管理方法及びメモリ管理装置に係り、特に一台のコンピュータ上でリアルタイムOS(オペレーティングシステム)と汎用OSとが動作するハイブリッドOSを持つシステムにおける、各OSによるメモリ管理方法及びメモリ管理装置に関する。 The present invention relates to a memory management method and a memory management device, and more particularly to a memory management method and a memory management device by each OS in a system having a hybrid OS in which a real-time OS (operating system) and a general-purpose OS operate on one computer. About.
近年、一台のコンピュータ上で複数のオペレーティングシステム(OS)が動作するハイブリッドOSが各分野で利用されるようになってきている。ハイブリッドOSの中でも、リアルタイムOSと汎用OSとが動作するシステムでは、リアルタイムOSのリアルタイム性を生かしつつ、汎用OSが持つ豊富なリソースが利用可能となり、ロボット制御や通信端末等、機器制御分野で広く利用されるようになってきている。 In recent years, a hybrid OS in which a plurality of operating systems (OS) operate on one computer has been used in various fields. Among hybrid OSes, systems that run real-time OSs and general-purpose OSs can use the rich resources of general-purpose OSs while taking advantage of the real-time characteristics of real-time OSs. It is getting used.
このハイブリッドOSシステムでは、リアルタイムOSをベースOSとし、汎用OSをリアルタイムOSの1つのタスクとして実装することにより、リアルタイム性の確保を目指しているものが多い。このハイブリッドOSシステムでは、汎用OSはリアルタイムOSの制御下にあるリアルタイムタスクの一つとして実行される。 In many of these hybrid OS systems, a real-time OS is used as a base OS, and a general-purpose OS is implemented as one task of the real-time OS, so as to ensure real-time performance. In this hybrid OS system, the general-purpose OS is executed as one of real-time tasks under the control of the real-time OS.
しかし、このハイブリッドOSシステムでは、汎用OSの制御下で実行されるプロセスがリアルタイムタスクと協調して動作するためにリアルタイムタスクの有する高い優先度を継承させる場合に、協調して動作するプロセス以外のプロセスも高い優先度で実行されることに起因してリアルタイムタスクの実行が妨げられることがある。 However, in this hybrid OS system, when the process executed under the control of the general-purpose OS operates in cooperation with the real-time task, when the high priority of the real-time task is inherited, other than the processes operating in cooperation with each other The execution of real-time tasks may be hindered because processes are also executed with high priority.
そこで、特許文献1記載のタスク管理装置では、汎用OSの制御下で実行されるプロセスと協調して動作するオペレーティングシステムタスク以外の他のタスクが、協調動作をオペレーティングシステムタスクに要求して待ち状態になる際に、待ち状態にある他のタスクの優先度よりも高いか否かを判定し、待ち状態にある他のタスクの優先度よりも高いと判定したときに、オペレーティングシステムタスク及び待ち状態になる他のタスクと協調して動作するプロセスに、待ち状態になるタスクの優先度を継承させることで、リアルタイムタスクと協調して汎用OSの制御下で動作するプロセス以外の他のプロセスが高い優先度で実行されることを防ぐようにしている。
Therefore, in the task management device described in
しかしながら、特許文献1記載のタスク管理装置では、メモリ管理に関しては、一般的にハイブリッドOSのブート(起動)時に、リアルタイムOSが使用するメモリと汎用OSが使用するメモリとが完全に切り分けられ、メモリの有効利用ができない。このことについて、図8と共に説明する。
However, in the task management device described in
図8は、ハイブリッドOSにおける実行中のメモリマップの一例を示す。同図において、ハイブリッドOSのブート(起動)時に、汎用OSが管理するメモリエリア801と、リアルタイムOSが管理するメモリエリア803とが完全に切り分けられている。また、汎用OSが管理するメモリエリア801は、主記憶であり、ここにはページ単位のメモリ空きエリア802が存在するものとする。一方、リアルタイムOSが管理するメモリ803は、主記憶の一部とI/O(入出力)エリアとからなる。また、リアルタイムOSが管理するメモリ803のうち、ブート時フリーメモリプール804は既に全て利用されているものとする。
FIG. 8 shows an example of a memory map being executed in the hybrid OS. In the figure, when the hybrid OS is booted (started up), the
このとき、リアルタイムOSでメモリ確保の要求が発生した場合、リアルタイムOSが管理するメモリエリア803には利用されていないメモリエリアが存在するにもかかわらず要求は失敗で終わり、メモリの有効利用ができない。
At this time, if a memory allocation request occurs in the real-time OS, the request ends in failure even though there is a memory area that is not used in the
また、従来のメモリ管理方法では、例えば、汎用OSはMMU(Memory Management Unit;記憶管理装置)を利用したメモリ管理を行うのに対し、リアルタイムOSのメモリ管理ではMMUを用いないため、メモリの確保と解放を繰り返していくとメモリフラグメンテーション(断片化)が起き、メモリ利用効率が大きく低下する。このことについて、図9と共に説明する。 In the conventional memory management method, for example, the general-purpose OS performs memory management using an MMU (Memory Management Unit), whereas the memory management of the real-time OS does not use the MMU. If the release is repeated, memory fragmentation occurs, and the memory utilization efficiency is greatly reduced. This will be described with reference to FIG.
図9は、従来のメモリ管理方法による、リアルタイムOS実行時のフラグメンテーションを示す。同図において、リアルタイムOSが管理するメモリエリア900は、ブート時に割り付けられるブート時割り付けメモリ901と、ブート時フリーメモリプール902とからなる。リアルタイムOSは、実行時に発生するメモリ確保・解放要求を処理する。そのメモリ確保要求は、ブート時フリーメモリプール902より割り付けられる。ここで、メモリ確保とメモリ解放とが繰り返されると、ブート時フリーメモリプール902のメモリ空きエリア903はフラグメンテーションが発生し、利用効率が大きく低下する。
FIG. 9 shows fragmentation when a real-time OS is executed by a conventional memory management method. In the figure, a memory area 900 managed by the real-time OS is composed of a boot-time allocation memory 901 allocated at boot time and a boot-time free memory pool 902. The real-time OS processes memory allocation / release requests that occur during execution. The memory allocation request is allocated from the free memory pool 902 at boot time. Here, if memory allocation and memory release are repeated, fragmentation occurs in the
本発明は以上の点に鑑みなされたもので、MMUを有するアーキテクチャ上でリアルタイムOSと汎用OSの両方が動作するハイブリッドOSにおいて、MMUをサポートしていないリアルタイムOSのメモリ管理を、MMUで管理されている汎用OSの管理下のメモリを利用可能にすることで、リアルタイムOSのリアルタイム性を失うことなく、メモリの有効利用を可能とすると共に、メモリの利用効率を向上させるメモリ管理方法及びメモリ管理装置を提供することを目的とする。 The present invention has been made in view of the above points. In a hybrid OS in which both a real-time OS and a general-purpose OS operate on an architecture having an MMU, the memory management of the real-time OS that does not support the MMU is managed by the MMU. Memory management method and memory management that enable effective use of the memory without losing the real-time property of the real-time OS by making the memory under the management of the general-purpose OS available. An object is to provide an apparatus.
上記の目的を達成するため、本発明のメモリ管理方法は、スケジューリングの管理手段を有する、メモリ管理装置をサポートしない1つ以上の第1のオペレーティングシステムをベースオペレーティングシステムとして、第1のオペレーティングシステムと共に動作すると共に、メモリ管理装置を利用してメモリ管理を行う1つ以上の第2のオペレーティングシステムのブート後に、第2のオペレーティングシステムが第1のオペレーティングシステムの論理空間を作成する第1のステップと、第2のオペレーティングシステムが、作成した第1のオペレーティングシステムの論理空間の物理的なメモリエリアを確保する第2のステップと、第2のステップで確保された物理的なメモリエリアに、第1のオペレーティングシステムをブートして、メモリ管理装置を作動させてから制御を第1のオペレーティングシステムに渡す第3のステップと、第3のステップで制御が渡された第1のオペレーティングシステムが、自身を初期化後に第2のオペレーティングシステムを第1のオペレーティングシステムの一つのタスクとして登録する第4のステップと、第1のオペレーティングシステムがスケジューラをスタートする第5のステップと、一次割り込み処理手段により、割り込みがメモリ管理例外かその他の割り込み・例外かを判断し、メモリ管理例外のときは第2のオペレーティングシステムにメモリ管理例外の処理をさせ、その他の割り込み・例外のときには第1のオペレーティングシステムにその他の割り込み・例外の処理をさせるように振り分ける第6のステップと、第1のオペレーティングシステムにおいてメモリの確保・解放要求が発生した場合、そのメモリの確保・解放要求を第2のオペレーティングシステムに供給して、第2のオペレーティングシステムによりメモリ管理装置の管理下でメモリの確保・解放の処理を行わせる第7のステップと、を含むことを特徴とする。 In order to achieve the above object, a memory management method of the present invention includes a scheduling management unit and one or more first operating systems that do not support a memory management device as a base operating system, together with the first operating system. A first step in which the second operating system creates a logical space of the first operating system after booting one or more second operating systems that operate and perform memory management using the memory management device; The second operating system secures a physical memory area in the logical space of the created first operating system, and the physical memory area secured in the second step includes the first Boot the operating system A third step of operating the memory management device and then passing control to the first operating system; and a first operating system to which control is passed in the third step initializes the second operating system A fourth step of registering the system as a task of the first operating system; a fifth step of starting the scheduler by the first operating system; and a primary interrupt processing means for determining whether the interrupt is a memory management exception or other It is determined whether it is an interrupt / exception. If it is a memory management exception, the second operating system processes the memory management exception, and if it is any other interrupt / exception, it causes the first operating system to process the other interrupt / exception. The sixth step of sorting and the first When a memory allocation / release request is generated in the operating system, the memory allocation / release request is supplied to the second operating system, and the memory is allocated / released under the management of the memory management device by the second operating system. And a seventh step for performing the process.
また、上記の目的を達成するため、本発明のメモリ管理方法は、上記の第2のステップは、メモリ管理装置により第1のオペレーティングシステムのメモリエリアを作成する際、第1のオペレーティングシステムの論理空間に対応するメモリページをアクセス可能な実空間のメモリエリアでのみ構成することを特徴とする。 In order to achieve the above object, according to the memory management method of the present invention, in the second step, when the memory area of the first operating system is created by the memory management device, the logic of the first operating system is The memory page corresponding to the space is configured only by an accessible real space memory area.
また、上記の目的を達成するため、本発明のメモリ管理装置は、スケジューリングの管理手段を有する、メモリ管理装置をサポートしない1つ以上の第1のオペレーティングシステムと、第1のオペレーティングシステムをベースオペレーティングシステムとし、第1のオペレーティングシステムの一つのタスクとして実装されて第1のオペレーティングシステムと共に動作すると共に、メモリ管理装置を利用して自身と第1のオペレーティングシステムのメモリ管理をそれぞれ行う1つ以上の第2のオペレーティングシステムと、割り込みがメモリ管理例外かその他の割り込み・例外かを判断し、メモリ管理例外のときは第2のオペレーティングシステムにメモリ管理例外の処理をさせ、その他の割り込み・例外のときには第1のオペレーティングシステムにその他の割り込み・例外の処理をさせるように振り分ける一次割り込み処理手段と、第1のオペレーティングシステムにおいてメモリの確保・解放要求が発生した場合、そのメモリの確保・解放要求を第2のオペレーティングシステムに供給して、第2のオペレーティングシステムによりメモリ管理装置の管理下でメモリの確保・解放の処理を行わせるメモリ確保・解放要求処理手段と、を有することを特徴とする。 In order to achieve the above object, a memory management device of the present invention includes a scheduling management unit, one or more first operating systems that do not support the memory management device, and a base operating system based on the first operating system. One or more systems that are implemented as a task of the first operating system and operate together with the first operating system, and that manage the memory of itself and the first operating system using the memory management device, respectively. The second operating system determines whether the interrupt is a memory management exception or another interrupt / exception, and if it is a memory management exception, causes the second operating system to process the memory management exception, and if it is another interrupt / exception, First operation Primary interrupt processing means for distributing other interrupts / exceptions to the operating system, and when a memory allocation / release request occurs in the first operating system, the memory allocation / release request is issued to the second operating system. And a memory securing / release request processing means for supplying the system and performing memory securing / release processing under the control of the memory management device by the second operating system.
また、上記の目的を達成するため、本発明のメモリ管理装置は、上記の第2のオペレーティングシステムは、メモリ管理装置により第1のオペレーティングシステムのメモリエリアを作成する際、第1のオペレーティングシステムの論理空間に対応するメモリページをアクセス可能な実空間のメモリエリアでのみ構成することを特徴とする。 In order to achieve the above object, the memory management device of the present invention is configured such that when the second operating system creates a memory area of the first operating system by the memory management device, The memory page corresponding to the logical space is configured only by an accessible real space memory area.
本発明によれば、スケジューリングは第1のオペレーティングシステムが管理し、メモリ管理は第2のオペレーティングシステムが管理することで、第1のオペレーティングシステムであるリアルタイムOSのメモリ管理を、MMUで管理されている第2のオペレーティングシステムである汎用OSの管理下のメモリを利用可能にすることで、リアルタイムOSのリアルタイム性を失うことなく、メモリの有効利用ができる。 According to the present invention, the scheduling is managed by the first operating system and the memory management is managed by the second operating system, so that the memory management of the real-time OS that is the first operating system is managed by the MMU. By making the memory under the management of the general-purpose OS that is the second operating system available, the memory can be effectively used without losing the real-time property of the real-time OS.
また、本発明によれば、メモリ確保・解放要求は汎用OSカーネル論理空間のメモリ管理マネージャで処理され、メモリはMMU管理下のページ単位となるため、フラグメンテーションは発生せず、また、不連続な空きページエリアも、連続した論理空間として割り付けることが可能になるため、メモリの利用効率を大幅に向上することができる。 In addition, according to the present invention, the memory allocation / release request is processed by the memory management manager in the general-purpose OS kernel logical space, and the memory is in units of pages under MMU management. Since empty page areas can also be allocated as continuous logical spaces, the memory utilization efficiency can be greatly improved.
次に、本発明の実施の形態について図面を参照して説明する。 Next, embodiments of the present invention will be described with reference to the drawings.
図1は、本発明になるメモリ管理装置の一実施の形態の構成を示す。同図に示すように、メモリ管理装置100は、ハイブリッドOSシステム論理的なメモリ空間として、リアルタイムOS論理空間101、汎用OSカーネル論理空間102、汎用OSプロセス論理空間103から構成されている。また、ハードウェア割り込み、例外処理の一次処理を行い、割り込みがメモリ管理例外であるかどうかの判断を行う一次割り込み処理マネージャ104を有する。一次割り込み処理マネージャ104は、メモリ管理例外は汎用OSカーネルに処理させ、その他の割り込み・例外はリアルタイムOSカーネル105に処理させるように振り分ける。一次割り込み処理マネージャ104は、本発明の一次割り込み処理手段を構成する。
FIG. 1 shows the configuration of an embodiment of a memory management device according to the present invention. As shown in the figure, the
リアルタイムOS論理空間101は、リアルタイムOSカーネル105がベースOSとなり、リアルタイムOSタスク107がリアルタイムOSスケジューラ108のスケジューリング管理下におかれた構成である。また、リアルタイムOS論理空間101には、リアルタイムOSカーネル105は、メモリ管理例外以外の例外・割り込み時にリアルタイム処理の割り込み・例外処理を行うためにリアルタイムOS割り込みハンドラ106が設けられている。リアルタイムOS論理空間101は、MMU(Memory Management Unit;記憶管理装置)をサポートしないリアルタイムOSのメモリ空間である。
The real-time OS
一方、汎用OSカーネル論理空間102内には、メモリ管理マネージャ110が設けられている。メモリ管理マネージャ110は、ハードウェアであるMMUを制御するプログラムで、メモリ管理例外の例外・割り込み時にメモリ管理例外処理を行い、また、リアルタイムOSからのメモリ確保・解放リクエスト111の入力時にMMU管理下でリアルタイムOS論理空間101の割り付け・削除を行う。メモリ管理マネージャ110の上記のリアルタイムOS論理空間101の割り付け・削除機能は、本発明のメモリ確保・開放要求処理手段を構成する。
On the other hand, a
汎用OSカーネル論理空間102と、汎用OSプロセス論理空間103とはリアルタイムOSタスク109を構成している。従って、このリアルタイムOSタスク109は、リアルタイムOSタスク107のような通常のネイティブタスクとは異なる構成であるが、リアルタイムOSカーネル105から見たときには、リアルタイムOSタスク107と同じリアルタイムOSタスクである。すなわち、汎用OSカーネル論理空間102と、汎用OSプロセス論理空間103とは、リアルタイムOS論理空間101の一つのタスクとして取り扱われる。リアルタイムOSタスク109のメモリ空間は、MMUをサポートする汎用OSのメモリ空間である。スケジューリング機能に関しては、本実施の形態ではリアルタイムOSカーネル105が管理する。
The general-purpose OS kernel
ここで、一般的なハイブリッドOSの構成について、図2及び図3を用いて説明する。図2は、一般的なハイブリッドOSの一例の構成を示す図であり、図3は、従来のメモリ管理方法によるメモリマップと、本発明のメモリ管理方法及びメモリ管理装置によるメモリマップとを示す図である。 Here, the configuration of a general hybrid OS will be described with reference to FIGS. FIG. 2 is a diagram showing a configuration of an example of a general hybrid OS, and FIG. 3 is a diagram showing a memory map by a conventional memory management method, and a memory map by a memory management method and a memory management device of the present invention. It is.
図2に示すように、一般的なハイブリッドOS200は、リアルタイムOSカーネル201がベースOSとなり、リアルタイムOSタスク202と、汎用OSカーネル204及び汎用OSプロセス205がリアルタイムOSタスク203としてリアルタイムOSカーネル201のスケジューリング管理下に置かれている。
As shown in FIG. 2, a general
このときのメモリマップは図3(A)に示すように、リアルタイムOSが管理するメモリエリア301と汎用OSが管理するメモリエリア302とからなり、汎用OSが管理するメモリエリア302は主記憶305にあるのに対し、リアルタイムOSが管理するメモリエリア301はI/Oエリア303と主記憶の一部304にある。すなわち、主記憶がリアルタイムOSが管理する主記憶部分304と汎用OSが管理する主記憶部分305とに完全に切り分けられている。一般的にはブート時それぞれのOSが管理する主記憶部分304及び305を切り分け、各OSをブートする。
As shown in FIG. 3A, the memory map at this time includes a memory area 301 managed by the real-time OS and a
また、リアルタイムOS実行時は、MMUなどによるメモリ管理は行われておらず、すべて実メモリで管理される。リアルタイムOSタスクやリアルタイムOSカーネルがメモリ確保要求を出した場合、リアルタイムOSは管理下のメモリエリア301からメモリを割り当てる。そのため、図8と共に説明したように、上記の場合に汎用OSが管理するメモリエリア302に空きメモリ(図8の802)が存在していても利用できない。また、MMUを用いていないため、メモリの確保と解放を繰り返していくと、図9と共に説明したようにメモリのフラグメンテーションが発生し、メモリの利用効率が著しく低下する。
Further, when the real-time OS is executed, memory management by the MMU or the like is not performed, and everything is managed by real memory. When the real-time OS task or the real-time OS kernel issues a memory reservation request, the real-time OS allocates memory from the managed memory area 301. For this reason, as described with reference to FIG. 8, even if there is an empty memory (802 in FIG. 8) in the
そこで、本実施の形態では、上記の課題を解決するために、MMUをサポートしていないリアルタイムOSのメモリ管理を、MMUで管理されている汎用OSの管理下のメモリを利用可能にすることで、リアルタイムOSのリアルタイム性を失うことなく、メモリの有効利用を可能とすると共に、メモリの利用効率を向上させる。この概要について、図1及び図3を用いて説明する。 Therefore, in this embodiment, in order to solve the above-described problem, the memory under the management of the general-purpose OS managed by the MMU can be used for the memory management of the real-time OS that does not support the MMU. The memory can be effectively used without losing the real-time property of the real-time OS, and the memory utilization efficiency is improved. This outline will be described with reference to FIGS.
本実施の形態での実行単位としてのタスクは、一般的なハイブリッドOSと同様に、実装されている。しかし、本実施の形態ではリアルタイムOS及び汎用OSの実行時は、MMUによるメモリ管理が行われており、図1に示すように、論理的なメモリ空間は、リアルタイムOS論理空間101、汎用OSカーネル論理空間102、及び汎用OSプロセス論理空間103から構成されている。
The task as the execution unit in the present embodiment is implemented in the same manner as a general hybrid OS. However, in this embodiment, memory management is performed by the MMU during execution of the real-time OS and the general-purpose OS. As shown in FIG. 1, the logical memory space includes the real-time OS
また、本実施の形態ではメモリマップは、図3(B)に示すように、汎用OSとリアルタイムOSが管理するメモリエリア306として主記憶308を共用し、汎用OSとリアルタイムOSで動的に管理する。また、I/Oエリア309に関しては、リアルタイムOSが管理するメモリエリア307とし、リアルタイムOSが管理する。
In this embodiment, as shown in FIG. 3B, the memory map shares the
次に、本実施の形態のメモリ管理の詳細について、図4を用いて説明する。図4は、本発明になるメモリ管理方法の一実施の形態を説明する図を示す。 Next, details of the memory management of the present embodiment will be described with reference to FIG. FIG. 4 is a diagram for explaining an embodiment of a memory management method according to the present invention.
図4において、汎用OSプロセス論理空間401(図1の汎用OSプロセス論理空間103に相当)は、汎用OSカーネルによって、プログラム、データ、スタック等のセグメントにより構成されたセグメント管理テーブル403が割り付けられる。セグメント管理テーブル403の各セグメントは、ページ管理テーブル405により物理アドレスとの対応がとられており、実際のメモリエリア407(図3(B)の汎用OSとリアルタイムOSが管理するメモリエリア306に相当)内のどのページを参照しているか示されている。
In FIG. 4, a general-purpose OS process logical space 401 (corresponding to the general-purpose OS process
一方、リアルタイムOS論理空間402(図1のリアルタイムOS論理空間101に相当)は、リアルタイムOSのカーネル、各タスク及びI/Oエリアが割り付けられ、更にそれぞれについてカーネル、タスク・フリーエリア、I/Oエリアなどのセグメントにより構成されるセグメント管理テーブル404が割り付けられる。
On the other hand, the real-time OS logical space 402 (corresponding to the real-time OS
セグメント管理テーブル404の各セグメントは、ページ管理テーブル406により物理アドレスとの対応がとられており、実際のメモリエリア407内のどのページを参照しているか、あるいはメモリエリア408(図3(B)のリアルタイムOSが管理するメモリエリア307のI/Oエリアに相当)内のどのページを参照しているか示されている。
Each segment of the segment management table 404 is associated with a physical address by the page management table 406, which page in the
このリアルタイムOS論理空間402に対するメモリ管理は、メモリに必ず論理空間に対応する物理空間が存在することで、ページ違反などのメモリ例外が起きないようなメモリ管理構成となっている点で汎用OSプロセス論理空間401に対するメモリ管理と相違する。
The memory management for the real-time OS logical space 402 is a general-purpose OS process in that a memory management configuration in which a memory exception such as a page violation does not occur because a physical space corresponding to the logical space always exists in the memory. This is different from the memory management for the
次に、本実施の形態におけるメモリ管理方法の動作について説明する。 Next, the operation of the memory management method in this embodiment will be described.
最初にブート時の動作について図5等と共に説明する。図5は、本発明になるメモリ管理方法の一実施の形態のブート時の動作説明用フローチャートを示す。 First, the boot operation will be described with reference to FIG. FIG. 5 shows a flowchart for explaining the operation at the time of booting of an embodiment of the memory management method according to the present invention.
まず、ブートローダが汎用OSカーネル204をブートする(ステップS101)。汎用OSカーネル204は、図1に102で示したようにその論理空間にメモリ管理マネージャ110を含んでおり、上記のブートにより汎用OSカーネル204はメモリ管理マネージャにより自身の初期化を行う(ステップS102)。この初期化により、汎用OSカーネル論理空間102内のメモリ管理マネージャ110は、物理メモリに対応するページ管理テーブル405を作成し、フリーリストに登録する。
First, the boot loader boots the general-purpose OS kernel 204 (step S101). The general-
次に、汎用OSカーネル204がリアルタイムOS論理空間101(402)を作成する(ステップS103)。具体的には汎用OSカーネル204は、リアルタイムOS論理空間402のカーネル、タスク・フリーエリア、I/Oエリアの各セグメントからなるセグメント管理テーブル404を作成し、更に、そのセグメント管理テーブル404内の各セグメントに対応するページ管理テーブル406を作成する。
Next, the general-
次に、汎用OSカーネル論理空間102にロードされてくる汎用OSカーネルプログラムが、先に作成したページフリーリストより、リアルタイムOS論理空間101(402)に必要とする物理的なメモリエリア407、408を確保し(ステップS104)、ページ管理テーブルにそのメモリエリアの物理アドレスを登録する。このとき、リアルタイムOSが必要とするリアルタイムOS論理空間101(402)は実際の物理メモリであるメモリエリア407にすべて割り付けられたものとなる。
Next, the general-purpose OS kernel program loaded into the general-purpose OS kernel
すなわち、ステップS103及びS104により、汎用OSのメモリ管理マネージャ110によりリアルタイムOS論理空間101(402)のメモリエリアを作成する際、リアルタイムOS論理空間101(402)に対応するメモリページをアクセス可能な実空間のメモリエリア407でのみ構成することにより、リアルタイムOS実行時のメモリ例外発生をなくすようにしている。
That is, in steps S103 and S104, when the memory area of the real-time OS logical space 101 (402) is created by the general-purpose OS
また、割り込み処理に関しては、図1の一次割り込み処理マネージャ104が全ての割り込みを処理するよう、割り込みベクトルなどの設定を行う。割り込み処理マネージャ104は汎用OSの一部としてロードされ、システムアーキテクチャに合わせ、割り込み処理の実行が可能な空間に配置される。
As for interrupt processing, an interrupt vector and the like are set so that the primary interrupt
続いて、汎用OSカーネルプログラムは、確保したリアルタイムOS論理空間101(402)のメモリエリア407、408にリアルタイムOSをブートした後(ステップS105)、MMUの機能を作動させる(ステップS106)。その後、汎用OSカーネルプログラムは、リアルタイムOSへ制御を渡す(ステップS107)。これにより、リアルタイムOSは用意されたリアルタイムOS論理空間101(402)にてプログラムの実行を開始する。
Subsequently, the general-purpose OS kernel program boots the real-time OS in the
すなわち、リアルタイムOS論理空間101(402)にロードされているプログラムであるリアルタイムOSカーネル105は、まず自身の初期化を行い、汎用OS(汎用OSカーネル論理空間102及び汎用OSプロセス論理空間103)を自身の1タスク(すなわち、リアルタイムOSタスク109,203)として登録し(ステップS108)。続いて、リアルタイムOSカーネル105は、リアルタイムOSスケジューラ108をスタートさせる(ステップS109)。
That is, the real-
リアルタイムOSスケジューラ108がスタートすると、リアルタイムOSタスク109(203)に制御が渡り、これにより汎用OSカーネル論理空間102の汎用OSカーネル204は決められた手順にのっとり、初期化プロセス等の汎用OSプロセス205を生成し実行する。
When the real-
次に、本実施の形態の割り込み・例外処理の動作について図6等と共に説明する。図6は、本発明になるメモリ管理方法の一実施の形態の割り込み・例外処理時の動作説明用フローチャートを示す。 Next, the interrupt / exception processing operation of this embodiment will be described with reference to FIG. FIG. 6 is a flowchart for explaining the operation at the time of interrupt / exception processing according to an embodiment of the memory management method of the present invention.
割り込み・例外が発生すると、登録された割り込みベクトルなどに従って、まず、一次割り込み処理マネージャ104に処理が渡る。これにより、一次割り込み処理マネージャ104は、システムアーキテクチャに必要な共通の割り込み処理を行う(ステップS201)。次に、一次割り込み処理マネージャ104は、割り込みがメモリ管理例外かどうかの判断を行う(ステップS202)。
When an interrupt / exception occurs, processing is first passed to the primary interrupt
メモリ管理例外であれば(ステップS202のyes)、一次割り込み処理マネージャ104は、汎用OSのメモリ管理例外処理を呼び出し(ステップS203)、汎用OSカーネル内にあるメモリ管理マネージャ110がメモリ管理例外処理を行う(ステップS204)。ここでのメモリ管理例外処理は、ページ違反など許可のない処理への対応や、汎用OSサイドのデマンド・ページングシステムによる、汎用OSプロセス103のメモリ確保などの処理である。リアルタイムOS実行時は、ブート初期化時に全ての論理空間が物理空間に割り当てられているため、基本的にはメモリ管理例外は発生しない。
If it is a memory management exception (yes in step S202), the primary interrupt
メモリ管理例外でない場合は(ステップS202のNo)、一次割り込み処理マネージャ104は、リアルタイムOSの割り込み・例外処理を呼び出す(ステップS205)。このリアルタイムOSの割り込み・例外処理の呼び出しにより、割り込みハンドラ106に制御が渡る。ステップS204又はS205の処理の後、最後に一次割り込み処理マネージャ104は、共通の割り込み終了処理を行い(ステップS206)、割り込みを終了する。
If it is not a memory management exception (No in step S202), the primary interrupt
最後に、本実施の形態のリアルタイムOSの実行中のメモリ確保・解放動作について図7等と共に説明する。図7は、本発明になるメモリ管理方法の一実施の形態のメモリ確保・解放時の動作説明用フローチャートを示す。 Finally, a memory securing / releasing operation during execution of the real-time OS according to the present embodiment will be described with reference to FIG. FIG. 7 is a flowchart for explaining the operation at the time of memory reservation / release in one embodiment of the memory management method according to the present invention.
リアルタイムOS(すなわち、リアルタイムOSタスク203やリアルタイムOSカーネル204)がメモリの確保・解放要求を発生すると(ステップS301)、リアルタイムOSカーネル203がメモリ確保・解放要求リクエストを生成し(ステップS302)、汎用OSカーネル論理空間102のメモリ管理マネージャ110にメモリ確保・解放リクエスト111を転送する(ステップS303)。この転送には、リアルタイムOSカーネル105と汎用OSカーネル102の共通メモリなどが使われる。
When the real-time OS (that is, the real-
メモリ管理マネージャ110は、メモリ確保・解放要求リクエストに基づき、リアルタイムOS論理空間101(402)の割り付け、削除を行う(ステップS304)。次に、メモリ管理マネージャ110は、メモリ確保・解放要求リクエストがメモリ確保要求かどうかの判断を行う(ステップS305)。削除の場合は(ステップS305の「削除」)、メモリ管理マネージャ110は、使用していたページ管理テーブル406の無効化と、対応するメモリエリア407をフリーメモリリストに追加する(ステップS306)。
The
一方、メモリ確保要求の場合は(ステップS305の「確保」)、メモリ管理マネージャ110は、管理している主記憶のフリーメモリリストに、メモリ確保要求された物理メモリ量の空きがあるか否かにより、メモリの確保が可能か否かの判断を行う(ステップS307)。フリーメモリリストに空きがなく、メモリの確保が不可能な場合は(ステップS307のNo)、エラー終了処理を行い終了する(ステップS309)。
On the other hand, in the case of a memory reservation request (“Reserve” in step S305), the
一方、フリーメモリリストに空きがありメモリ確保可能な場合は(ステップS307のyes)、メモリ管理マネージャ110は、物理メモリをリアルタイムOS論理空間101に割り付ける(ステップS308)。具体的には、対応セグメントのページ管理テーブル406を作成し、確保した物理アドレスをメモリエリア407に書き込み、処理を終了する。
On the other hand, if the free memory list is free and the memory can be secured (yes in step S307), the
以上説明した本実施の形態のメモリ管理方法及びメモリ管理装置によれば、リアルタイムOSをベースシステムとし、汎用OSがリアルタイムOSの一つのタスクとして実装されてリアルタイムOSと汎用OSとが共に動作するハイブリッドOSにおいて、リアルタイムOSタスク203やリアルタイムOSカーネル204からメモリ確保要求があった場合、汎用OSカーネル論理空間102のメモリ管理マネージャ110がメモリの確保が可能か否かの判断を行い、空きエリアがある場合にリアルタイムOS論理空間101に割り付けるようにしたため、メモリの有効利用が可能になる。すなわち、本実施の形態では、リアルタイムOSのメモリ管理を、MMUで管理されている汎用OSの管理下のメモリを利用可能にすることで、図3(B)に示したように、汎用OSとリアルタイムOSが管理するメモリエリア306として物理メモリである主記憶308を共用し、必要に応じてメモリの確保・解放が可能となるため、メモリの有効利用ができる。
According to the memory management method and memory management device of the present embodiment described above, a hybrid in which a real-time OS is used as a base system, the general-purpose OS is implemented as a task of the real-time OS, and the real-time OS and the general-purpose OS operate together. In the OS, when there is a memory allocation request from the real-
また、本実施の形態のメモリ管理方法によれば、メモリ確保・解放要求は汎用OSカーネル論理空間102のメモリ管理マネージャ110で処理され、メモリはMMU管理下のページ単位となるため、図9に示したようなフラグメンテーションは発生しない。また、不連続な空きページエリアも、連続した論理空間として割り付けることが可能になるため、メモリの利用効率を大幅に向上することができる。
Further, according to the memory management method of the present embodiment, the memory allocation / release request is processed by the
更に、本実施形態では、リアルタイムOS論理空間101には常に物理メモリが割り当てられているため、メモリ管理例外処理などによるリアルタイム性の低下も防ぐことができる。
Furthermore, in this embodiment, since physical memory is always allocated to the real-time OS
なお、本発明は上記の実施の形態に限定されるものではなく、例えば、上記の実施の形態ではMMUを持つアーキテクチャ上で、MMUをサポートしない一つのリアルタイムOS(リアルタイムOSカーネル及びリアルタイムOSタスク)と、MMUをサポートする一つの汎用OS(汎用OSカーネル及び汎用OSプロセス)とが同時に動作可能なハイブリッドOSに適用するものとして説明したが、一つ以上のリアルタイムOSと一つ以上の汎用OSとが同時に動作可能なハイブリッドOSであれば、本発明を適用することができる。 The present invention is not limited to the above-described embodiment. For example, in the above-described embodiment, one real-time OS (real-time OS kernel and real-time OS task) that does not support the MMU on the architecture having the MMU. And one general-purpose OS that supports MMU (general-purpose OS kernel and general-purpose OS process) are described as being applied to a hybrid OS. The present invention can be applied to any hybrid OS that can operate simultaneously.
また、本発明は、図5〜図7に示したフローチャートの各ステップの処理をコンピュータにより動作させるメモリ管理プログラムも包含するものである。この場合、メモリ管理プログラムは、記録されている記録媒体からコンピュータにロードしてもよいし、通信ネットワークを介して配信されてコンピュータにロードしてもよい。 The present invention also includes a memory management program that causes a computer to execute the processing of each step in the flowcharts shown in FIGS. In this case, the memory management program may be loaded from a recorded recording medium into the computer, or may be distributed via a communication network and loaded into the computer.
100 メモリ管理装置
101、402 リアルタイムOS論理空間
102 汎用OSカーネル論理空間
103、401 汎用OSプロセス論理空間
104 一次割り込み処理マネージャ
105、201 リアルタイムOSカーネル
106 リアルタイムOS割り込みハンドラ
107、202 リアルタイムOSタスク
108 リアルタイムOSスケジューラ
109、203 リアルタイムOSタスク
110 メモリ管理マネージャ
111 メモリ確保・解放リクエスト
200 一般的なハイブリッドOS
204 汎用OSカーネル
205 汎用OSプロセス
301、307 リアルタイムOSが管理するメモリエリア
302 汎用OSが管理するメモリエリア
306 汎用OSとリアルタイムOSとが管理するメモリエリア
403、404 セグメント管理テーブル
405、406 ページ管理テーブル
407 メモリエリア(汎用OSとリアルタイムOSとが管理するメモリエリア)
408 メモリエリア(I/Oエリア)
100
204 General-
408 Memory area (I / O area)
Claims (4)
前記第2のオペレーティングシステムが、作成した前記第1のオペレーティングシステムの論理空間の物理的なメモリエリアを確保する第2のステップと、
前記第2のステップで確保された前記物理的なメモリエリアに、前記第1のオペレーティングシステムをブートして、前記メモリ管理装置を作動させてから制御を前記第1のオペレーティングシステムに渡す第3のステップと、
前記第3のステップで制御が渡された前記第1のオペレーティングシステムが、自身を初期化後に前記第2のオペレーティングシステムを前記第1のオペレーティングシステムの一つのタスクとして登録する第4のステップと、
前記第1のオペレーティングシステムがスケジューラをスタートする第5のステップと、
一次割り込み処理手段により、割り込みがメモリ管理例外かその他の割り込み・例外かを判断し、前記メモリ管理例外のときは前記第2のオペレーティングシステムに前記メモリ管理例外の処理をさせ、前記その他の割り込み・例外のときには前記第1のオペレーティングシステムに前記その他の割り込み・例外の処理をさせるように振り分ける第6のステップと、
前記第1のオペレーティングシステムにおいてメモリの確保・解放要求が発生した場合、そのメモリの確保・解放要求を前記第2のオペレーティングシステムに供給して、前記第2のオペレーティングシステムにより前記メモリ管理装置の管理下でメモリの確保・解放の処理を行わせる第7のステップと、
を含むことを特徴とするメモリ管理方法。 One or more first operating systems that have scheduling management means and that do not support the memory management device operate as the base operating system together with the first operating system, and perform memory management using the memory management device. A first step of creating a logical space of the first operating system after the booting of the one or more second operating systems to perform;
A second step in which the second operating system secures a physical memory area in the logical space of the created first operating system;
Booting the first operating system into the physical memory area reserved in the second step, operating the memory management device, and then passing control to the first operating system Steps,
A fourth step in which the first operating system to which control is passed in the third step registers the second operating system as one task of the first operating system after initializing itself;
A fifth step in which the first operating system starts a scheduler;
The primary interrupt processing means determines whether the interrupt is a memory management exception or another interrupt / exception, and when the interrupt is the memory management exception, causes the second operating system to process the memory management exception, and A sixth step of allocating the first operating system to handle the other interrupt / exception when an exception occurs;
When a memory allocation / release request is generated in the first operating system, the memory allocation / release request is supplied to the second operating system, and the management of the memory management device is performed by the second operating system. A seventh step for performing memory allocation / release processing below;
A memory management method.
前記第1のオペレーティングシステムをベースオペレーティングシステムとし、前記第1のオペレーティングシステムの一つのタスクとして実装されて前記第1のオペレーティングシステムと共に動作すると共に、前記メモリ管理装置を利用して自身と前記第1のオペレーティングシステムのメモリ管理をそれぞれ行う1つ以上の第2のオペレーティングシステムと、
割り込みがメモリ管理例外かその他の割り込み・例外かを判断し、前記メモリ管理例外のときは前記第2のオペレーティングシステムに前記メモリ管理例外の処理をさせ、前記その他の割り込み・例外のときには前記第1のオペレーティングシステムに前記その他の割り込み・例外の処理をさせるように振り分ける一次割り込み処理手段と、
前記第1のオペレーティングシステムにおいてメモリの確保・解放要求が発生した場合、そのメモリの確保・解放要求を前記第2のオペレーティングシステムに供給して、前記第2のオペレーティングシステムにより前記メモリ管理装置の管理下でメモリの確保・解放の処理を行わせるメモリ確保・解放要求処理手段と、
を有することを特徴とするメモリ管理装置。 One or more first operating systems having scheduling management means and not supporting a memory management device;
The first operating system is a base operating system, is implemented as a task of the first operating system, operates together with the first operating system, and uses the memory management device to identify itself and the first operating system. One or more second operating systems each performing memory management of the operating systems of
It is determined whether the interrupt is a memory management exception or another interrupt / exception. If the interrupt is the memory management exception, the second operating system is caused to process the memory management exception. If the interrupt is another interrupt / exception, the first interrupt is detected. Primary interrupt processing means for distributing the operating system to the other interrupt / exception processing;
When a memory allocation / release request is generated in the first operating system, the memory allocation / release request is supplied to the second operating system, and the management of the memory management device is performed by the second operating system. Memory allocation / release request processing means for performing memory allocation / release processing below,
A memory management device comprising:
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2010131638A JP2011257973A (en) | 2010-06-09 | 2010-06-09 | Memory management method and memory management device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2010131638A JP2011257973A (en) | 2010-06-09 | 2010-06-09 | Memory management method and memory management device |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2011257973A true JP2011257973A (en) | 2011-12-22 |
Family
ID=45474088
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2010131638A Pending JP2011257973A (en) | 2010-06-09 | 2010-06-09 | Memory management method and memory management device |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2011257973A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110471759A (en) * | 2019-07-04 | 2019-11-19 | 中科晶上(苏州)信息技术有限公司 | A kind of real-time dynamic management approach of multicore embeded processor memory |
-
2010
- 2010-06-09 JP JP2010131638A patent/JP2011257973A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110471759A (en) * | 2019-07-04 | 2019-11-19 | 中科晶上(苏州)信息技术有限公司 | A kind of real-time dynamic management approach of multicore embeded processor memory |
CN110471759B (en) * | 2019-07-04 | 2023-09-01 | 中科晶上(苏州)信息技术有限公司 | Method for dynamically managing memory of multi-core embedded processor in real time |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10901802B2 (en) | Method and apparatus for implementing virtual GPU and system | |
CN106371894B (en) | Configuration method and device and data processing server | |
JP6294586B2 (en) | Execution management system combining instruction threads and management method | |
US9798595B2 (en) | Transparent user mode scheduling on traditional threading systems | |
EP3425502A1 (en) | Task scheduling method and device | |
JP4345630B2 (en) | Information processing apparatus, interrupt processing control method, and computer program | |
US7979861B2 (en) | Multi-processor system and program for causing computer to execute controlling method of multi-processor system | |
JP4769308B2 (en) | Virtual computer management mechanism, virtual computer system having the management mechanism, and paging processing method in the system | |
US20150277993A1 (en) | Task Processing Method and Virtual Machine | |
WO2019218708A1 (en) | Task processing method and device, and computer system | |
US8539499B1 (en) | Symmetric multiprocessing with virtual CPU and VSMP technology | |
US10248456B2 (en) | Method and system for providing stack memory management in real-time operating systems | |
US10459773B2 (en) | PLD management method and PLD management system | |
US7770177B2 (en) | System for memory reclamation based on thread entry and release request times | |
EP2375324A2 (en) | Virtualization apparatus for providing a transactional input/output interface | |
KR20210095690A (en) | Resource management method and apparatus, electronic device and recording medium | |
KR20070090649A (en) | Apparatus and method for providing cooperative scheduling on multi-core system | |
EP3208709B1 (en) | Batch processing method and device for system invocation commands | |
JP2006099332A (en) | Information processor, process control method and computer program | |
JP2008107966A (en) | Computer system | |
EP1693743A2 (en) | System, method and medium for using and/or providing operating system information to acquire a hybrid user/operating system lock | |
US8010963B2 (en) | Method, apparatus and program storage device for providing light weight system calls to improve user mode performance | |
WO2017012339A1 (en) | Resource management method and apparatus | |
US20230015852A1 (en) | Opportunistic exclusive affinity for threads in a virtualized computing system | |
JP2011257973A (en) | Memory management method and memory management device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A711 | Notification of change in applicant |
Free format text: JAPANESE INTERMEDIATE CODE: A712 Effective date: 20111012 |