JP6423809B2 - Operating system, programming system, and memory allocation method - Google Patents

Operating system, programming system, and memory allocation method Download PDF

Info

Publication number
JP6423809B2
JP6423809B2 JP2016029795A JP2016029795A JP6423809B2 JP 6423809 B2 JP6423809 B2 JP 6423809B2 JP 2016029795 A JP2016029795 A JP 2016029795A JP 2016029795 A JP2016029795 A JP 2016029795A JP 6423809 B2 JP6423809 B2 JP 6423809B2
Authority
JP
Japan
Prior art keywords
memory
memory area
core
area
heap
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.)
Active
Application number
JP2016029795A
Other languages
Japanese (ja)
Other versions
JP2017146895A (en
Inventor
正樹 権藤
正樹 権藤
谷口 茂
茂 谷口
Original Assignee
イーソル株式会社
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by イーソル株式会社 filed Critical イーソル株式会社
Priority to JP2016029795A priority Critical patent/JP6423809B2/en
Publication of JP2017146895A publication Critical patent/JP2017146895A/en
Application granted granted Critical
Publication of JP6423809B2 publication Critical patent/JP6423809B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)

Description

この発明は、プロセッサコアを相互に接続したマルチコア環境において実行されるオペレーティングシステム、このオペレーティングシステムを使用してシステムを構築するためのプログラミングシステム、及び、メモリ割り当て方法に関する。   The present invention relates to an operating system executed in a multi-core environment in which processor cores are connected to each other, a programming system for constructing a system using the operating system, and a memory allocation method.

近年、組み込み製品などのシステムが複雑化しており、多機能を実現するために複数のプロセッサコアを備えたマルチコアプロセッサを採用するシステムが増加している。こうしたマルチコア環境においては、各プロセッサコア間でメモリを共有化することでリソースの効率良く使用するとともに、メモリ競合などを避けて処理速度を高めることが重要である。   In recent years, systems such as embedded products have become complex, and an increasing number of systems employ a multi-core processor having a plurality of processor cores in order to realize multiple functions. In such a multi-core environment, it is important to efficiently use resources by sharing a memory among processor cores and to increase processing speed by avoiding memory contention.

ところで、こうしたシステムは、複数の異なる種類のメモリを備えていることが多く、それぞれのメモリのアクセス速度にも差がある。よって、処理の内容によってどのメモリを使用するかを適切に振り分けることが重要となる。   By the way, such a system often includes a plurality of different types of memories, and there is a difference in the access speed of each memory. Therefore, it is important to appropriately allocate which memory is used depending on the contents of processing.

しかしながら、アプリケーションプログラムの開発者がメモリの種類まで把握しているとは限らないので、オペレーティングシステムが適切なメモリの割り当てを実行することが望ましい。例えば、アプリケーションプログラムがアクセス速度の速いメモリを要求している場合には、オペレーティングシステムがアクセス速度の速いメモリを選択し、そのメモリからメモリ割り当てを実行することが考えられる。   However, since the developer of the application program does not always know the type of memory, it is desirable for the operating system to execute appropriate memory allocation. For example, when the application program requests a memory having a high access speed, it is conceivable that the operating system selects a memory having a high access speed and performs memory allocation from the memory.

なお、特許文献1に記載されているように、それぞれのプロセッサコアに固有のメモリ(一次キャッシュ)を備えたシステムにおいては、あるプロセッサコアにとって最もアクセス速度の速いメモリはそのプロセッサコアに固有のメモリである。よって、実行時のプロセッサコアに依存して最もアクセス速度の早いメモリが変化することになる。   As described in Patent Document 1, in a system including a memory (primary cache) unique to each processor core, a memory having the fastest access speed for a certain processor core is a memory unique to the processor core. It is. Therefore, the memory with the fastest access speed changes depending on the processor core at the time of execution.

特開2012−53817号公報JP 2012-53817 A

上記したように、実行時のプロセッサコアに依存して最もアクセス速度の早いメモリがどれであるかが変化する場合、オペレーティングシステムがアクセス速度の早いメモリを動的に選択してメモリ割り当てを実行させることができれば、メモリリソースの効率化や処理速度の向上を図ることができる。   As described above, when the memory with the fastest access speed changes depending on the processor core at the time of execution, the operating system dynamically selects the memory with the fastest access speed to execute the memory allocation. If possible, it is possible to improve the efficiency of memory resources and the processing speed.

一方、アプリケーションプログラムの開発者がメモリの種類まで把握している場合には、特定のメモリからメモリを獲得したいという要求が存在する。この場合には、上記したようなオペレーティングシステムによる動的な選択を介さずに、アプリケーションプログラムが指定した特定のメモリからメモリ割り当てを実行させることができれば、システムを構築する上での自由度が向上する。   On the other hand, when the application program developer knows the type of memory, there is a demand for acquiring memory from a specific memory. In this case, if the memory allocation can be executed from the specific memory specified by the application program without going through the dynamic selection by the operating system as described above, the degree of freedom in constructing the system is improved. To do.

そして、上記したような「オペレーティングシステムがアクセス速度の速いメモリを動的に選択してメモリ割り当てを実行する方法」と「アプリケーションプログラムが指定した特定のメモリからメモリ割り当てを実行する方法」との切り替えを、アプリケーションプログラムを変更することなく実現できれば、ハードウェアリソースの異なる環境へアプリケーションプログラムを移植する作業が容易となる(例えばメモリの種類が異なる別環境へシステムを移植するときに、アプリケーションプログラムを変更することなく移植することも可能となる)。   Then, switching between the above-mentioned “method of dynamically selecting a memory having a high access speed by the operating system to execute memory allocation” and “method of executing memory allocation from a specific memory specified by the application program” as described above Can be realized without changing the application program, it becomes easy to port the application program to an environment with different hardware resources (for example, when the system is ported to another environment with a different memory type, the application program is changed). Can also be transplanted without doing this).

そこで、本発明は、プログラムの実行時にオペレーティングシステムがアクセス速度の速いメモリを動的に選択してメモリ割り当てを実行でき、かつ、アプリケーションプログラムが指定した特定のメモリからもメモリ割り当てを実行でき、しかも、この2つのメモリ割り当て方法の切り替えをアプリケーションプログラムを変更することなく実現することができるオペレーティングシステム、プログラミングシステム及びメモリ割り当て方法を提供することを課題とする。   Therefore, according to the present invention, at the time of executing a program, the operating system can dynamically select a memory having a high access speed and execute the memory allocation, and can also execute the memory allocation from a specific memory designated by the application program. It is an object of the present invention to provide an operating system, a programming system, and a memory allocation method capable of realizing switching between the two memory allocation methods without changing an application program.

本発明は、上記した課題を解決するためになされたものであり、以下を特徴とする。   The present invention has been made to solve the above-described problems, and is characterized by the following.

請求項1記載の発明は、それぞれローカルメモリを備えた複数のプロセッサコアを相互に接続したマルチコア環境において実行され、アプリケーションプログラムから呼び出し可能なメモリ獲得用APIを実装したオペレーティングシステムであって、予め設定された内部データに従って複数のメモリ領域を作成するメモリ領域作成部と、前記メモリ獲得用APIの引数として指定されたヒープIDを参照し、前記ヒープIDに関連付けられた前記メモリ領域からメモリ割り当てを実行させるメモリ割り当て部と、を備え、前記メモリ領域として、前記複数のプロセッサコアのローカルメモリに係るコアメモリ領域を含み、前記ヒープIDとして、前記メモリ領域を直接指定してメモリを割り当てるための実メモリIDと、前記コアメモリ領域を動的に選択してメモリを割り当てるための仮想コアIDと、を含み、前記ヒープIDの定義は、ユーザによって書き換え可能となっており、前記メモリ割り当て部は、前記実メモリIDが指定されて前記メモリ獲得用APIが呼び出されたときには、指定された実メモリIDに関連付けられた前記メモリ領域からメモリ割り当てを実行させ、前記仮想コアIDが指定されて前記メモリ獲得用APIが呼び出されたときには、前記メモリ獲得用APIを呼び出したアプリケーションプログラムが実行されているプロセッサコアのローカルメモリに係る前記コアメモリ領域からメモリ割り当てを実行させることを特徴とする。 The invention according to claim 1 is an operating system that is executed in a multi-core environment in which a plurality of processor cores each having a local memory are connected to each other, and in which a memory acquisition API that can be called from an application program is mounted. A memory area creation unit that creates a plurality of memory areas according to the internal data that has been set, and a heap ID specified as an argument of the memory acquisition API, and performs memory allocation from the memory area associated with the heap ID A real memory for allocating the memory by directly specifying the memory area as the heap ID, the memory area including a core memory area related to a local memory of the plurality of processor cores ID and the core memory area The selected dynamically includes a virtual core ID to allocate memory, the definition of the heap ID is a rewritable by a user, the memory allocation unit, said real memory ID is designated When the memory acquisition API is called, memory allocation is executed from the memory area associated with the specified real memory ID, and when the virtual core ID is specified and the memory acquisition API is called, Memory allocation is executed from the core memory area related to a local memory of a processor core in which an application program that calls the memory acquisition API is executed.

請求項2に記載の発明は、上記した請求項1に記載の発明の特徴点に加え、前記メモリ領域として、1以上の前記コアメモリ領域に紐付けられたクラスタメモリ領域を含み、前記ヒープIDとして、前記クラスタメモリ領域を動的に選択してメモリを割り当てるための仮想クラスタIDを含み、前記メモリ割り当て部は、前記仮想クラスタIDが指定されて前記メモリ獲得用APIが呼び出されたときには、前記メモリ獲得用APIを呼び出したアプリケーションプログラムが実行されているプロセッサコアのローカルメモリに係る前記コアメモリ領域を特定し、当該コアメモリ領域に紐付けられた前記クラスタメモリ領域からメモリ割り当てを実行させることを特徴とする。   The invention according to claim 2 includes a cluster memory area linked to one or more core memory areas as the memory area in addition to the feature of the invention according to claim 1, and the heap ID. Including a virtual cluster ID for dynamically selecting the cluster memory area and allocating memory, and the memory allocating unit is configured such that when the virtual cluster ID is specified and the memory acquisition API is called, Specifying the core memory area related to the local memory of the processor core in which the application program that called the memory acquisition API is being executed, and executing memory allocation from the cluster memory area linked to the core memory area Features.

請求項3に記載の発明は、上記した請求項2に記載の発明の特徴点に加え、前記メモリ領域として、1以上の前記クラスタメモリ領域に紐付けられたグローバルメモリ領域を含み、前記ヒープIDとして、前記グローバルメモリ領域を動的に選択してメモリを割り当てるための仮想グローバルIDを含み、前記メモリ割り当て部は、前記仮想グローバルIDが指定されて前記メモリ獲得用APIが呼び出されたときには、前記メモリ獲得用APIを呼び出したアプリケーションプログラムが実行されているプロセッサコアのローカルメモリに係る前記メモリ領域を特定し、当該メモリ領域に紐付けられた前記メモリ領域を再帰的に辿って発見した前記グローバルメモリ領域からメモリ割り当てを実行させることを特徴とする。   The invention according to claim 3 includes a global memory area linked to one or more of the cluster memory areas as the memory area in addition to the features of the invention according to claim 2 described above, and the heap ID Including a virtual global ID for dynamically selecting the global memory area and allocating memory, and the memory allocating unit is configured such that when the virtual global ID is specified and the memory acquisition API is called, The global memory found by identifying the memory area related to the local memory of the processor core in which the application program that called the memory acquisition API is executed, and recursively tracing the memory area linked to the memory area Memory allocation is executed from the area.

請求項4に記載の発明は、上記した請求項1〜3のいずれかに記載の発明の特徴点に加え、前記メモリ領域作成部は、前記メモリ領域でツリー構造を作成し、前記メモリ割り当て部は、前記ヒープIDで指定されたメモリ領域からのメモリ割り当てに失敗したときには、当該メモリ領域の上位のメモリ領域からメモリ割り当てを実行させることを特徴とする。   According to a fourth aspect of the present invention, in addition to the feature of the invention according to any one of the first to third aspects, the memory area creating unit creates a tree structure in the memory area, and the memory allocation unit When the memory allocation from the memory area specified by the heap ID fails, the memory allocation is executed from the upper memory area of the memory area.

請求項5に記載の発明は、請求項1〜4のいずれか1項に記載のオペレーティングシステムと、前記ヒープIDと前記メモリ領域との関係を記述したコンフィギュレーションファイルと、前記コンフィギュレーションファイルを読み込んで、請求項1記載のアプリケーションプログラム用のヘッダファイルと前記オペレーティングシステム用の内部データとを生成する情報生成手段と、前記ヘッダファイルを使用して前記アプリケーションプログラムのソースコードをコンパイルするコンパイラと、を備えることを特徴とする。 According to a fifth aspect of the present invention, the operating system according to any one of the first to fourth aspects, a configuration file describing a relationship between the heap ID and the memory area, and the configuration file are read. An information generating means for generating the header file for the application program and the internal data for the operating system according to claim 1 , and a compiler for compiling the source code of the application program using the header file. It is characterized by providing.

請求項6記載の発明は、それぞれローカルメモリを備えた複数のプロセッサコアを相互に接続したマルチコア環境において、アプリケーションプログラムからメモリ獲得用APIが呼び出されたときに、メモリ割り当てを実行させるためのメモリ割り当て方法であって、予め設定された内部データに従って複数のメモリ領域を作成するステップと、前記メモリ獲得用APIの引数として指定されたヒープIDを参照し、前記ヒープIDに関連付けられた前記メモリ領域からメモリ割り当てを実行させるステップと、を備え、前記メモリ領域として、前記複数のプロセッサコアのローカルメモリに係るコアメモリ領域を含み、前記ヒープIDとして、前記メモリ領域を直接指定してメモリを割り当てるための実メモリIDと、前記コアメモリ領域を動的に選択してメモリを割り当てるための仮想コアIDと、を含み、前記ヒープIDの定義は、ユーザによって書き換え可能となっており、前記実メモリIDが指定されて前記メモリ獲得用APIが呼び出されたときには、指定された実メモリIDに関連付けられた前記メモリ領域からメモリ割り当てを実行させ、前記仮想コアIDが指定されて前記メモリ獲得用APIが呼び出されたときには、前記メモリ獲得用APIを呼び出したアプリケーションプログラムが実行されているプロセッサコアのローカルメモリに係る前記コアメモリ領域からメモリ割り当てを実行させることを特徴とする。 According to a sixth aspect of the present invention, in a multi-core environment in which a plurality of processor cores each having a local memory are connected to each other, memory allocation for causing memory allocation to be executed when a memory acquisition API is called from an application program A method of creating a plurality of memory areas according to preset internal data, and referring to a heap ID specified as an argument of the memory acquisition API, and from the memory area associated with the heap ID And a step of allocating memory, including a core memory area related to a local memory of the plurality of processor cores as the memory area, and specifying the memory area directly as the heap ID. Real memory ID and the core memory area The selected dynamically includes a virtual core ID to allocate memory, the definition of the heap ID is a rewritable by a user, the real memory ID is designated by the memory acquisition for the API When called, the memory allocation is executed from the memory area associated with the specified real memory ID. When the virtual core ID is specified and the memory acquisition API is called, the memory acquisition API is set. Memory allocation is executed from the core memory area related to the local memory of the processor core in which the called application program is executed.

請求項7に記載の発明は、上記した請求項6に記載の発明の特徴点に加え、前記メモリ領域として、1以上の前記コアメモリ領域に紐付けられたクラスタメモリ領域を含み、前記ヒープIDとして、前記クラスタメモリ領域を動的に選択してメモリを割り当てるための仮想クラスタIDを含み、前記仮想クラスタIDが指定されて前記メモリ獲得用APIが呼び出されたときには、前記メモリ獲得用APIを呼び出したアプリケーションプログラムが実行されているプロセッサコアのローカルメモリに係る前記コアメモリ領域を特定し、当該コアメモリ領域に紐付けられた前記クラスタメモリ領域からメモリ割り当てを実行させることを特徴とする。   The invention according to claim 7 includes, in addition to the feature of the invention according to claim 6, the memory area includes a cluster memory area linked to one or more core memory areas, and the heap ID Including a virtual cluster ID for dynamically selecting the cluster memory area and allocating memory. When the virtual cluster ID is specified and the memory acquisition API is called, the memory acquisition API is called. The core memory area related to the local memory of the processor core in which the application program is executed is specified, and memory allocation is executed from the cluster memory area linked to the core memory area.

請求項8に記載の発明は、上記した請求項7に記載の発明の特徴点に加え、前記メモリ領域として、1以上の前記クラスタメモリ領域に紐付けられたグローバルメモリ領域を含み、前記ヒープIDとして、前記グローバルメモリ領域を動的に選択してメモリを割り当てるための仮想グローバルIDを含み、前記仮想グローバルIDが指定されて前記メモリ獲得用APIが呼び出されたときには、前記メモリ獲得用APIを呼び出したアプリケーションプログラムが実行されているプロセッサコアのローカルメモリに係る前記メモリ領域を特定し、当該メモリ領域に紐付けられた前記メモリ領域を再帰的に辿って発見した前記グローバルメモリ領域からメモリ割り当てを実行させることを特徴とする。   The invention described in claim 8 includes, in addition to the feature of the invention described in claim 7, the memory area includes a global memory area linked to one or more cluster memory areas, and the heap ID Including a virtual global ID for dynamically selecting the global memory area and allocating memory, and when the virtual acquisition ID is specified and the memory acquisition API is called, the memory acquisition API is called The memory area related to the local memory of the processor core in which the application program is executed is identified, and memory allocation is executed from the global memory area found by recursively tracing the memory area linked to the memory area. It is characterized by making it.

請求項9に記載の発明は、上記した請求項6〜8のいずれかに記載の発明の特徴点に加え、前記メモリ領域でツリー構造を作成し、前記ヒープIDで指定されたメモリ領域からのメモリ割り当てに失敗したときには、当該メモリ領域の上位のメモリ領域からメモリ割り当てを実行させることを特徴とする。   In addition to the feature of the invention described in any of claims 6 to 8, the invention described in claim 9 creates a tree structure in the memory area, and starts from the memory area specified by the heap ID. When the memory allocation fails, the memory allocation is executed from the upper memory area of the memory area.

請求項1又は6に記載の発明は上記の通りであり、実メモリIDが指定されてメモリ獲得用APIが呼び出されたときには、指定された実メモリIDに関連付けられたメモリ領域からメモリ割り当てを実行させるようにしている。このため、アプリケーションプログラムが指定した特定のメモリからのメモリ割り当てを実行したい場合には、実メモリIDを指定してメモリ獲得用APIを呼び出せばよい。   The invention according to claim 1 or 6 is as described above, and when the real memory ID is specified and the memory acquisition API is called, the memory allocation is executed from the memory area associated with the specified real memory ID. I try to let them. For this reason, when it is desired to execute memory allocation from a specific memory designated by the application program, the memory acquisition API may be called by designating the real memory ID.

また、仮想コアIDが指定されてメモリ獲得用APIが呼び出されたときには、メモリ獲得用APIを呼び出したアプリケーションプログラムが実行されているプロセッサコアのローカルメモリに係るコアメモリ領域からメモリ割り当てを実行させるようにしている。このため、アクセス速度の速いメモリ(プロセッサコア固有のメモリ)をオペレーティングシステムに動的に選択させてメモリ割り当てを実行したい場合には、仮想コアIDを指定してメモリ獲得用APIを呼び出せばよい。   When the virtual core ID is specified and the memory acquisition API is called, the memory allocation is executed from the core memory area related to the local memory of the processor core in which the application program that called the memory acquisition API is executed. I have to. For this reason, if the operating system wants to dynamically select a memory with high access speed (memory unique to the processor core) and execute memory allocation, the virtual core ID may be specified to call the memory acquisition API.

しかも、上記した2つのメモリ割り当てが同じメモリ獲得用APIで実現されているため、アプリケーションプログラムを変更しなくても、ヒープIDの定義を変更するだけでメモリ割り当て方法を切り替えることができる。例えば、コンフィギュレーションファイルを書き換えることでヒープIDの定義を変更し、仮想コアIDに割り当てられていたヒープIDを実メモリIDに割り当てるようにすれば、当該ヒープIDを使用してメモリ獲得用APIを呼び出していたアプリケーションプログラムを変更することなく、メモリ割り当ての方法を切り替えることができる。この場合には、ヒープIDの定義を変更する前は、プログラム実行時のプロセッサコアに固有のメモリ領域からメモリ割り当てが実行され、ヒープIDの定義を変更した後は、ヒープIDによって指定された特定のメモリ領域からのメモリ割り当てが実行される。   In addition, since the two memory allocations described above are realized by the same memory acquisition API, the memory allocation method can be switched only by changing the definition of the heap ID without changing the application program. For example, if the definition of the heap ID is changed by rewriting the configuration file and the heap ID assigned to the virtual core ID is assigned to the real memory ID, the memory acquisition API is changed using the heap ID. The memory allocation method can be switched without changing the calling application program. In this case, before changing the definition of the heap ID, memory allocation is executed from the memory area unique to the processor core at the time of program execution. After changing the definition of the heap ID, the specific specified by the heap ID is performed. Memory allocation from the memory area is executed.

また、請求項2又は7に記載の発明は上記の通りであり、仮想クラスタIDが指定されてメモリ獲得用APIが呼び出されたときには、メモリ獲得用APIを呼び出したアプリケーションプログラムが実行されているプロセッサコアのローカルメモリに係るコアメモリ領域を特定し、当該コアメモリ領域に紐付けられたクラスタメモリ領域からメモリ割り当てを実行させるようにしている。このため、例えばマルチコア環境の管理効率を高めるためにプロセッサコアをいくつかのグループ(クラスタ)に分割し、そのクラスタにメモリ領域を割り当てた場合、このクラスタ用のメモリ領域をクラスタメモリ領域として定義することで、プログラムの実行時にオペレーティングシステムが動的に判断してクラスタメモリ領域からメモリ割り当てを実行させることができる。   The invention according to claim 2 or 7 is as described above, and when a virtual cluster ID is specified and a memory acquisition API is called, a processor that executes an application program that calls the memory acquisition API A core memory area related to the local memory of the core is specified, and memory allocation is executed from the cluster memory area linked to the core memory area. For this reason, for example, when a processor core is divided into several groups (clusters) to increase the management efficiency of a multi-core environment and a memory area is allocated to the cluster, the memory area for the cluster is defined as a cluster memory area Thus, the operating system can dynamically determine the memory allocation from the cluster memory area when the program is executed.

また、請求項3又は8に記載の発明は上記の通りであり、仮想グローバルIDが指定されてメモリ獲得用APIが呼び出されたときには、メモリ獲得用APIを呼び出したアプリケーションプログラムが実行されているプロセッサコアのローカルメモリに係るメモリ領域を特定し、当該メモリ領域に紐付けられたメモリ領域を再帰的に辿って発見したグローバルメモリ領域からメモリ割り当てを実行させるようにしている。このため、例えばすべてのプロセッサコアからアクセスできるメモリをグローバルメモリ領域とすることで、プログラムの実行時にオペレーティングシステムが動的に判断してこのグローバルメモリ領域からメモリ割り当てを実行させることができる。   The invention according to claim 3 or 8 is as described above, and when a virtual global ID is specified and a memory acquisition API is called, a processor that executes an application program that calls the memory acquisition API A memory area related to the local memory of the core is specified, and memory allocation is executed from the global memory area found by recursively tracing the memory area linked to the memory area. For this reason, for example, by making the memory accessible from all the processor cores the global memory area, the operating system can dynamically determine the memory allocation from the global memory area when executing the program.

また、請求項4又は9に記載の発明は上記の通りであり、前記メモリ領域でツリー構造を作成し、ヒープIDで指定されたメモリ領域からのメモリ割り当てに失敗したときには、当該メモリ領域の上位のメモリ領域からメモリ割り当てを実行させるようにしている。このため、例えばアクセス速度の速いメモリリソースが枯渇してしまった場合でも、次の候補のメモリ領域からメモリ割り当てを実行させることができる。よって、できるだけアクセス速度の速いメモリ領域を検索してメモリ割り当てを実行させることができる。   The invention according to claim 4 or 9 is as described above, and when a tree structure is created in the memory area and memory allocation from the memory area specified by the heap ID fails, a higher rank of the memory area is determined. Memory allocation is executed from the memory area. For this reason, for example, even when memory resources with high access speed are exhausted, memory allocation can be executed from the next candidate memory area. Therefore, memory allocation can be executed by searching a memory area having the fastest access speed.

また、請求項5に記載の発明は上記の通りであり、前記ヒープIDと前記メモリ領域との関係を記述したコンフィギュレーションファイルと、前記コンフィギュレーションファイルを読み込んで、アプリケーションプログラム用のヘッダファイルとオペレーティングシステム用の内部データとを生成する情報生成手段と、を備える。このような構成によれば、コンフィギュレーションファイルを書き換えて情報生成手段を実行するだけで、アプリケーションプログラムやオペレーティングシステムを変更することなく、メモリ領域の定義やヒープIDの定義を変更することができる。例えば、異なる物理メモリやプロセッサコアを備えたハードウェア環境へプログラムを移植する場合でも、コンフィギュレーションファイルを書き換えて情報生成手段を実行するだけで、アプリケーションプログラムやオペレーティングシステムを変更することなく、適切なメモリ割り当てを実現することができる。   The invention according to claim 5 is as described above, wherein a configuration file describing a relationship between the heap ID and the memory area, a header file for an application program and an operating program are read by reading the configuration file. Information generating means for generating internal data for the system. According to such a configuration, it is possible to change the definition of the memory area and the definition of the heap ID without changing the application program or the operating system simply by rewriting the configuration file and executing the information generation unit. For example, even when a program is ported to a hardware environment with different physical memory or processor cores, it is possible to rewrite the configuration file and execute the information generation means without changing the application program or operating system. Memory allocation can be realized.

本発明の実施形態に係るプロセッサとメモリの構成を示す図である。It is a figure which shows the structure of the processor and memory which concern on embodiment of this invention. メモリ管理に係るオペレーティングシステムの構成を示す図である。It is a figure which shows the structure of the operating system which concerns on memory management. コンパイル処理に係る流れを示す図である。It is a figure which shows the flow which concerns on a compilation process. コンフィギュレーションファイルにメモリの定義を記述するための書式を説明する図である。It is a figure explaining the format for describing the definition of a memory in a configuration file. コンフィギュレーションファイルにメモリ領域の定義を記述するための書式を説明する図である。It is a figure explaining the format for describing the definition of a memory area in a configuration file. コンフィギュレーションファイルにヒープIDの定義を記述するための書式を説明する図である。It is a figure explaining the format for describing the definition of heap ID in a configuration file. コンフィギュレーションファイルの記述例を示す図である。It is a figure which shows the example of a description of a configuration file. メモリ領域のツリー構造を示す図である。It is a figure which shows the tree structure of a memory area. メモリ獲得用APIの仕様を説明する図である。It is a figure explaining the specification of API for memory acquisition. メモリ割り当て処理のメインフロー図である。It is a main flowchart of a memory allocation process. グローバルメモリ割り当て処理のフロー図である。It is a flowchart of a global memory allocation process. クラスタメモリ割り当て処理のフロー図である。It is a flowchart of a cluster memory allocation process. コアメモリ割り当て処理のフロー図である。It is a flowchart of a core memory allocation process. 実メモリ割り当て処理のフロー図である。It is a flowchart of a real memory allocation process.

本発明の実施形態について、図を参照しながら説明する。   Embodiments of the present invention will be described with reference to the drawings.

本実施形態に係るオペレーティングシステム10は、例えば図1に示すような複数のプロセッサコアを相互に接続したマルチコア環境において実行されるプログラムである。このオペレーティングシステム10は、ハードウェアリソースを管理するとともに、ハードウェアリソースを抽象化した各種のサービスをアプリケーションプログラム40に提供する。例えば、アプリケーションプログラム40から呼び出し可能なメモリ獲得用APIを実装しており、これによりアプリケーションプログラム40がメモリリソースを安全に使用できるサービスを提供している。なお、このメモリ獲得用APIがアプリケーションプログラム40から呼び出されると、オペレーティングシステム10は物理メモリからメモリ割り当てを実行し、割り当てたメモリの先頭アドレスを示すポインタをアプリケーションプログラム40に返す。アプリケーションプログラム40は、このポインタを参照することでメモリを使用した各種の処理を実行することができる。   The operating system 10 according to the present embodiment is a program executed in a multi-core environment in which a plurality of processor cores are connected to each other as shown in FIG. The operating system 10 manages hardware resources and provides the application program 40 with various services that abstract the hardware resources. For example, a memory acquisition API that can be called from the application program 40 is implemented, thereby providing a service that allows the application program 40 to safely use memory resources. When this memory acquisition API is called from the application program 40, the operating system 10 executes memory allocation from the physical memory and returns a pointer indicating the start address of the allocated memory to the application program 40. The application program 40 can execute various processes using the memory by referring to the pointer.

本実施形態に係るマルチコアプロセッサは、複数のプロセッサコアを備えている。本実施形態においては、図1に示すように、第1のプロセッサコア30aと、第2のプロセッサコア30bと、第3のプロセッサコア30cと、第4のプロセッサコア30dと、の4つのプロセッサコアを備えている。また、これらの4つのプロセッサコアは、それぞれ固有のローカルメモリ(1次キャッシュなど)を備えている。すなわち、第1のプロセッサコアのローカルメモリ31aと、第2のプロセッサコアのローカルメモリ31bと、第3のプロセッサコアのローカルメモリ31cと、第4のプロセッサコアのローカルメモリ31dと、が存在する。   The multi-core processor according to the present embodiment includes a plurality of processor cores. In the present embodiment, as shown in FIG. 1, four processor cores, that is, a first processor core 30a, a second processor core 30b, a third processor core 30c, and a fourth processor core 30d. It has. Each of these four processor cores has its own local memory (such as a primary cache). That is, the local memory 31a of the first processor core, the local memory 31b of the second processor core, the local memory 31c of the third processor core, and the local memory 31d of the fourth processor core exist.

なお、本実施形態においては4つのプロセッサコアを備えたマルチコアプロセッサを例に説明しているが、これに限らず、プロセッサコアの数は3つ以下や5つ以上であってもよい。また、複数のプロセッサコアを備えたチップを複数使用してマルチコア環境を構成してもよい。   In the present embodiment, a multi-core processor having four processor cores is described as an example. However, the present invention is not limited to this, and the number of processor cores may be three or less, or five or more. A multi-core environment may be configured by using a plurality of chips each having a plurality of processor cores.

また、本実施形態に係る実行環境は、プロセッサコア固有のメモリ以外にも、例えばSDRAMなどの共有メモリを備えている。これらの共有メモリは、特定のクラスタによる使用を想定したクラスタメモリと、すべてのプロセッサコアからアクセスできるグローバルメモリ34と、に割り振られている。なお、クラスタとは、例えばマルチコア環境の管理効率を高めるためにプロセッサコアをいくつかのグループに分割したものである。本実施形態においては、第1のプロセッサコア30aと第2のプロセッサコア30bとで第1のクラスタ32aを構成し、第3のプロセッサコア30cと第4のプロセッサコア30dとで第2のクラスタ32bを構成している。そして、これらのクラスタには、それぞれクラスタメモリが割り当てられている。すなわち、第1のクラスタメモリ33aと、第2のクラスタメモリ33bと、である。   Further, the execution environment according to the present embodiment includes a shared memory such as an SDRAM in addition to the memory unique to the processor core. These shared memories are allocated to a cluster memory that is assumed to be used by a specific cluster and a global memory 34 that can be accessed from all processor cores. Note that a cluster is obtained by dividing processor cores into several groups, for example, in order to increase the management efficiency of a multi-core environment. In the present embodiment, the first processor core 30a and the second processor core 30b constitute a first cluster 32a, and the third processor core 30c and the fourth processor core 30d constitute a second cluster 32b. Is configured. A cluster memory is assigned to each of these clusters. That is, the first cluster memory 33a and the second cluster memory 33b.

なお、本実施形態においては特に説明しないが、クラスタ構造を階層化してもよい。すなわち、複数のクラスタの親となる上位のクラスタを設定していくことで、クラスタをツリー構造で管理してもよい。   Although not specifically described in the present embodiment, the cluster structure may be hierarchized. In other words, the clusters may be managed in a tree structure by setting an upper cluster that is a parent of a plurality of clusters.

本実施形態においては、この図1が示すように、特定のプロセッサコアにとって最もアクセス速度の速いメモリはそのプロセッサコアに固有のメモリである(例えば第1のプロセッサコア30aにとって最もアクセス速度の速いメモリは第1のプロセッサコアのローカルメモリ31aである)。また、その次にアクセス速度の早い(または優先される)メモリは、自分が属するクラスタのメモリである(例えば第1のプロセッサコア30aにとっては、第1のクラスタメモリ33aである)。更に、その次にアクセス速度の早い(または優先される)メモリは、そのクラスタの親のメモリ(例えば第1のプロセッサコア30aにとっては、グローバルメモリ34である)。   In this embodiment, as shown in FIG. 1, the memory having the fastest access speed for a specific processor core is a memory specific to the processor core (for example, the memory having the fastest access speed for the first processor core 30a). Is the local memory 31a of the first processor core). The memory with the next highest access speed (or priority) is the memory of the cluster to which it belongs (for example, the first cluster memory 33a for the first processor core 30a). Further, the memory with the next highest access speed (or priority) is the parent memory of the cluster (for example, the global memory 34 for the first processor core 30a).

このため、アプリケーションプログラム40がどのプロセッサコアで実行されているかによって、アクセス速度の早いメモリや優先して割り当てるべきメモリが変化する環境となっている。例えば、アプリケーションプログラム40が第1のプロセッサコア30aで実行されている場合、アクセス速度の最も早いメモリは第1のプロセッサコアのローカルメモリ31aである。一方、アプリケーションプログラム40が第2のプロセッサコア30bで実行されている場合、アクセス速度の最も早いメモリは第2のプロセッサコアのローカルメモリ31bである。   For this reason, depending on which processor core the application program 40 is executed on, an environment in which a memory having a high access speed or a memory to be preferentially allocated changes. For example, when the application program 40 is executed by the first processor core 30a, the memory having the fastest access speed is the local memory 31a of the first processor core. On the other hand, when the application program 40 is executed by the second processor core 30b, the memory having the fastest access speed is the local memory 31b of the second processor core.

このような環境下で適切なメモリ割り当てを実行するために、本実施形態に係るオペレーティングシステム10は、図2に示すように、メモリ領域作成部12と、メモリ割り当て部14と、を備える。   In order to execute appropriate memory allocation under such an environment, the operating system 10 according to the present embodiment includes a memory area creation unit 12 and a memory allocation unit 14, as shown in FIG.

メモリ領域作成部12は、システムの初期化時に後述する内部データ43を読み込み、内部データ43の内容に従って複数のメモリ領域20を作成するためのものである。メモリ領域20は、オペレーティングシステム10がメモリリソースを管理するための単位である。メモリ領域作成部12は、メモリをアドレスとサイズで分割して複数のメモリ領域20を作成するとともに、これらのメモリ領域20でツリー構造を作成する(図8参照)。このツリー構造については後ほど詳述する。   The memory area creation unit 12 reads internal data 43 (to be described later) when the system is initialized, and creates a plurality of memory areas 20 according to the contents of the internal data 43. The memory area 20 is a unit for the operating system 10 to manage memory resources. The memory area creation unit 12 creates a plurality of memory areas 20 by dividing the memory into addresses and sizes, and creates a tree structure with these memory areas 20 (see FIG. 8). This tree structure will be described in detail later.

メモリ割り当て部14は、メモリ獲得用APIが呼び出されたときに、メモリ獲得用APIの引数として指定されたヒープIDを参照し、ヒープIDに関連付けられたメモリ領域20からメモリ割り当てを実行させるものである。ヒープIDは後述するコンフィギュレーションファイル41において定義され、ユーザによって書き換え可能となっている。このヒープIDについては後ほど詳述する。   The memory allocation unit 14 refers to a heap ID specified as an argument of the memory acquisition API when the memory acquisition API is called, and executes memory allocation from the memory area 20 associated with the heap ID. is there. The heap ID is defined in a configuration file 41, which will be described later, and can be rewritten by the user. This heap ID will be described in detail later.

このメモリ割り当て部14は、本実施形態においては、マイクロカーネル16と、ヒープマネージャ15と、を備えて構成されている。   In this embodiment, the memory allocation unit 14 includes a microkernel 16 and a heap manager 15.

マイクロカーネル16は、各プロセッサコアにおけるプログラムの実行制御を行うプログラムであり、各プロセッサコアにおいて1つずつ実行されている。よって、本実施形態のように4つのプロセッサコアが存在する場合には、それぞれのプロセッサコアに対応した4つのマイクロカーネル16が実行される。なお、アプリケーションプログラム40がメモリ獲得用APIを呼び出すと、当該アプリケーションプログラム40を実行しているプロセッサコアを制御するマイクロカーネル16に命令が通知される。命令を受け取ったマイクロカーネル16は、メモリ獲得用APIの引数(ヒープID)を基に、メモリ割り当てを実行するメモリ領域20を特定し、当該メモリ領域20を管理するヒープマネージャ15に依頼してメモリ割り当てを実行する。   The microkernel 16 is a program for performing program execution control in each processor core, and is executed one by one in each processor core. Therefore, when there are four processor cores as in the present embodiment, four microkernels 16 corresponding to the respective processor cores are executed. Note that when the application program 40 calls the memory acquisition API, an instruction is notified to the microkernel 16 that controls the processor core that is executing the application program 40. The microkernel 16 that has received the instruction specifies the memory area 20 for executing the memory allocation based on the argument (heap ID) of the memory acquisition API, and requests the heap manager 15 that manages the memory area 20 to execute the memory allocation. Perform the assignment.

ヒープマネージャ15は、各メモリ領域20を制御するプログラムであり、メモリ領域20ごとに1つずつ実行されている。例えば図8に示すように7つのメモリ領域20が存在する場合には、それぞれのメモリ領域20に対応した7つのヒープマネージャ15が実行される。このヒープマネージャ15は、上述したように、メモリ獲得用APIが呼び出されたときにマイクロカーネル16によって呼び出され、自らが管理するメモリ領域20からのメモリ割り当てを実行する。具体的には、ヒープマネージャ15は、マイクロカーネル16からメモリ割り当ての要求があったときには、マイクロカーネル16によって指定されたサイズのメモリを確保してマイクロカーネル16にアドレスを通知するとともに、当該メモリが明示的に開放されるまでは再びメモリ割り当てに使用されることがないように管理する。   The heap manager 15 is a program that controls each memory area 20, and is executed for each memory area 20. For example, as shown in FIG. 8, when seven memory areas 20 exist, seven heap managers 15 corresponding to the respective memory areas 20 are executed. As described above, the heap manager 15 is called by the microkernel 16 when the memory acquisition API is called, and executes memory allocation from the memory area 20 managed by itself. Specifically, when there is a memory allocation request from the microkernel 16, the heap manager 15 secures the memory of the size specified by the microkernel 16 and notifies the microkernel 16 of the address, and the memory It is managed so that it is not used again for memory allocation until it is explicitly released.

なお、ヒープマネージャ15が管理するメモリ領域20は、図8に示すように、大きく3つの種類に分類することができる。すなわち、コアメモリ領域と、クラスタメモリ領域と、グローバルメモリ領域23と、である。   The memory area 20 managed by the heap manager 15 can be roughly classified into three types as shown in FIG. That is, a core memory area, a cluster memory area, and a global memory area 23.

コアメモリ領域は、複数のプロセッサコアのローカルメモリに係るメモリ領域20であり、これらのメモリ領域20をオペレーティングシステム10で管理するために作成される。このコアメモリ領域は、複数のプロセッサコアと同じ数だけ作成される。本実施形態においては、第1のプロセッサコアのローカルメモリ31aに対応した第1のコアメモリ領域21aと、第2のプロセッサコアのローカルメモリ31bに対応した第2のコアメモリ領域21bと、第3のプロセッサコアのローカルメモリ31cに対応した第3のコアメモリ領域21cと、第4のプロセッサコアのローカルメモリ31dに対応した第4のコアメモリ領域21dと、が作成される。   The core memory area is a memory area 20 related to local memories of a plurality of processor cores, and is created in order to manage these memory areas 20 by the operating system 10. As many core memory areas as the plurality of processor cores are created. In the present embodiment, the first core memory area 21a corresponding to the local memory 31a of the first processor core, the second core memory area 21b corresponding to the local memory 31b of the second processor core, and the third A third core memory area 21c corresponding to the local memory 31c of the processor core and a fourth core memory area 21d corresponding to the local memory 31d of the fourth processor core are created.

クラスタメモリ領域は、1以上のコアメモリ領域に紐付けられたメモリ領域20であり、これらのメモリ領域20をオペレーティングシステム10で管理するために作成される。このクラスタメモリ領域は、本実施形態においてはクラスタと同じ数だけ作成される。すなわち、第1のクラスタメモリ33aに対応した第1のクラスタメモリ領域22aと、第2のクラスタメモリ33bに対応した第2のクラスタメモリ領域22bと、が作成される。   The cluster memory area is a memory area 20 associated with one or more core memory areas, and is created for managing these memory areas 20 by the operating system 10. In this embodiment, the same number of cluster memory areas as the number of clusters are created. That is, a first cluster memory area 22a corresponding to the first cluster memory 33a and a second cluster memory area 22b corresponding to the second cluster memory 33b are created.

グローバルメモリ領域23は、1以上のクラスタメモリ領域に紐付けられたメモリ領域20であり、これらのメモリ領域20をオペレーティングシステム10で管理するために作成される。本実施形態においては、グローバルメモリ領域23を1つだけ作成している。しかしながら、複数のグローバルメモリ領域23を設けてもよい。   The global memory area 23 is a memory area 20 associated with one or more cluster memory areas, and is created for managing these memory areas 20 by the operating system 10. In the present embodiment, only one global memory area 23 is created. However, a plurality of global memory areas 23 may be provided.

これらコアメモリ領域、クラスタメモリ領域、グローバルメモリ領域23は、図8に示すような階層構造を形成する。すなわち、コアメモリ領域が最下層であり、クラスタメモリ領域が中間層であり、グローバルメモリ領域23が最上層であるツリー構造を形成する。なお、図8に示す例ではクラスタメモリ領域が1階層であるが、クラスタメモリ領域は複数の階層を形成してもよい。   These core memory area, cluster memory area, and global memory area 23 form a hierarchical structure as shown in FIG. That is, a tree structure is formed in which the core memory area is the lowermost layer, the cluster memory area is the intermediate layer, and the global memory area 23 is the uppermost layer. In the example shown in FIG. 8, the cluster memory area has one hierarchy, but the cluster memory area may form a plurality of hierarchies.

これらのメモリ領域20は、図7に示すようなコンフィギュレーションファイル41の記載によって、アドレス、サイズ、ツリー構造、その他の属性が決定される。よって、コンフィギュレーションファイル41の記述を書き換えることで、メモリ領域20の設定を変更することができる。例えば、物理メモリの構成やプロセッサコアの数等に応じたメモリ領域20となるように設定を変更し、オペレーティングシステム10の制御に使用することができる。   These memory areas 20 have addresses, sizes, tree structures, and other attributes determined by the description of the configuration file 41 as shown in FIG. Therefore, the setting of the memory area 20 can be changed by rewriting the description of the configuration file 41. For example, the setting can be changed so that the memory area 20 corresponds to the configuration of the physical memory, the number of processor cores, and the like, and can be used for controlling the operating system 10.

また、このコンフィギュレーションファイル41には、メモリ領域20とヒープIDとの関係を自由に記述し、設定することができる。これにより、アプリケーションプログラム40がヒープIDを使用して所望のメモリ領域20にアクセスできるようにしている。   In the configuration file 41, the relationship between the memory area 20 and the heap ID can be freely described and set. Thus, the application program 40 can access the desired memory area 20 using the heap ID.

このコンフィギュレーションファイル41は、図3に示すように、情報生成手段42によって読み込まれて使用される。情報生成手段42は、単独で実行可能なコンフィギュレーションツール(例えばコンピュータ上で実行可能な実行可能形式のファイル)であり、コンフィギュレーションファイル41に記載された内容を読み込んで、アプリケーションプログラム40用のヘッダファイル44とオペレーティングシステム10用の内部データ43とを生成する。   The configuration file 41 is read and used by the information generating means 42 as shown in FIG. The information generating means 42 is a configuration tool that can be executed independently (for example, a file in an executable format that can be executed on a computer), reads the contents described in the configuration file 41, and is a header for the application program 40. A file 44 and internal data 43 for the operating system 10 are generated.

このうち、内部データ43は、上述したメモリ領域作成部12がシステムの初期化時に読み込んでメモリ領域20を作成するために使用される。   Among these, the internal data 43 is used by the above-described memory area creation unit 12 to read and create the memory area 20 when the system is initialized.

一方、ヘッダファイル44は、アプリケーションプログラム40のソースコード45をコンパイルする際に使用される。具体的には、コンパイラ46によってアプリケーションプログラム40のソースコード45をコンパイルする際にヘッダファイル44が使用され、これによりオブジェクトファイル47が生成される。ヘッダファイル44にはヒープIDが定義されているため、アプリケーションプログラム40がヘッダファイル44を参照することで、メモリ獲得用APIの呼び出しにヒープIDを使用することができる。   On the other hand, the header file 44 is used when the source code 45 of the application program 40 is compiled. More specifically, the header file 44 is used when the compiler 46 compiles the source code 45 of the application program 40, thereby generating an object file 47. Since the heap ID is defined in the header file 44, the application program 40 can use the heap ID for calling the memory acquisition API by referring to the header file 44.

(コンフィギュレーションファイル41の記述例)
次に、コンフィギュレーションファイル41の記述例について説明する。なお、図7がコンフィギュレーションファイル41の具体的な記述例である。この図7に示すコンフィギュレーションファイル41では、DEF_MEM(メモリの定義)と、DEF_MEMOBJ(メモリ領域20の定義)と、DEF_HEAP(ヒープIDの定義)と、の3つの定義を記述することができる。
(Description example of the configuration file 41)
Next, a description example of the configuration file 41 will be described. FIG. 7 shows a specific description example of the configuration file 41. In the configuration file 41 shown in FIG. 7, three definitions of DEF_MEM (memory definition), DEF_MEMOBJ (memory area 20 definition), and DEF_HEAP (heap ID definition) can be described.

図4は、コンフィギュレーションファイル41においてメモリの定義(DEF_MEM)を記述するための書式である。この書式を使用することにより、メモリ空間をアドレスとサイズで分割し、その分割したメモリにメモリID(コンフィギュレーションファイル41内で使用する一意の文字列)を付与することができる。具体的には、startaddrに記載されたアドレスからmemszで指定されたサイズのメモリに対して、memidで指定されたメモリIDが付与される。   FIG. 4 shows a format for describing the memory definition (DEF_MEM) in the configuration file 41. By using this format, the memory space can be divided by address and size, and a memory ID (unique character string used in the configuration file 41) can be assigned to the divided memory. Specifically, the memory ID specified by memid is assigned to the memory having the size specified by memsz from the address described in startaddr.

例えば、図7の(1)で示す例では、0xc0000000を開始アドレスとして0x8000000のメモリに(つまり0xc0000000〜0xc7ffffffの範囲のメモリに)MEM_SDRAM1というメモリIDが付与される。   For example, in the example shown in (1) of FIG. 7, a memory ID of MEM_SDRAM1 is assigned to a memory of 0x8000000 (that is, a memory in a range of 0xc000000 to 0xc7ffffff) with 0xc0000000 as a start address.

図5は、コンフィギュレーションファイル41においてメモリ領域20の定義(DEF
_MEMOBJ)を記述するための書式である。この書式を使用することにより、名前、位置、属性、親子関係、プロセッサコアとの関係を指定してメモリ領域20を作成することができる。
FIG. 5 shows the definition (DEF) of the memory area 20 in the configuration file 41.
_MEMOBJ). By using this format, the memory area 20 can be created by specifying the name, position, attribute, parent-child relationship, and relationship with the processor core.

図5に示す書式において、memobjidには「メモリ領域20の名前(コンフィギュレーションファイル41内で使用する一意の文字列)」を指定する。   In the format shown in FIG. 5, “name of the memory area 20 (unique character string used in the configuration file 41)” is specified for memobjid.

memobjatrには「メモリ領域20の属性」を指定する。指定可能な属性は、グローバルメモリ領域23を意味する「MOA_GLOBAL」、クラスタメモリ領域を意味する「MOA_CLUSTER」、コアメモリ領域を意味する「MOA_CORE」のいずれかである。   The “attribute of the memory area 20” is specified for membojatr. The specifiable attributes are “MOA_GLLOBAL” meaning the global memory area 23, “MOA_CLUSTER” meaning the cluster memory area, and “MOA_CORE” meaning the core memory area.

ownercoreidには「このメモリ領域20を管理しているプロセッサコアの番号」を指定する。具体的には、メモリ領域20がコアメモリ領域である場合に、そのコアメモリ領域がどのプロセッサコアのローカルメモリに関連付けられているかを指定する。例えば、第1のプロセッサコアのローカルメモリ31aに関連付けられたコアメモリ領域(図8に示す第1のコアメモリ領域21a)であれば「1」を指定する。なお、メモリ領域20がコアメモリ領域ではない場合、当該メモリ領域20を管理するヒープマネージャ15が実行されているプロセッサコアの番号を指定する。   “ownercoreid” specifies “the number of the processor core that manages this memory area 20”. Specifically, when the memory area 20 is a core memory area, it is specified which processor core's local memory the core memory area is associated with. For example, “1” is designated if the core memory area is associated with the local memory 31a of the first processor core (the first core memory area 21a shown in FIG. 8). When the memory area 20 is not a core memory area, the processor core number in which the heap manager 15 that manages the memory area 20 is executed is designated.

parentidには「このメモリ領域20の親となるメモリ領域20の名前」を指定する。具体的には、コアメモリ領域の場合には、親となるクラスタメモリ領域の名前を指定する。クラスタメモリ領域の場合には、親となるクラスタメモリ領域またはグローバルメモリ領域23の名前を指定する。グローバルメモリ領域23の場合は、親がいないことを示す規定値「MEMOBJ_ROOT」を指定する。   In parentid, “name of the memory area 20 that is the parent of this memory area 20” is designated. Specifically, in the case of the core memory area, the name of the parent cluster memory area is designated. In the case of a cluster memory area, the name of the parent cluster memory area or global memory area 23 is designated. In the case of the global memory area 23, a specified value “MEMOBJ_ROOT” indicating that there is no parent is designated.

memlistには「このメモリ領域20に属するメモリIDのリスト」を指定する。すなわち、図4で説明した記述方法により定義されたメモリIDのリストを指定する。   “List of memory IDs belonging to this memory area 20” is specified for memlist. That is, a list of memory IDs defined by the description method described with reference to FIG. 4 is designated.

例えば、図7の(2)で示す例では、MEM_SDRAM1(0xc0000000〜0xc7ffffffの範囲のメモリ)とMEM_SDRAM2(0xcc000000
〜0xcfffffffの範囲のメモリ)に対して、「MEMOBJ_GLOBAL1」という名前で、グローバルメモリ領域23が作成される。
For example, in the example shown in (2) of FIG. 7, MEM_SDRAM1 (memory in the range of 0xc0000000 to 0xc7ffffff) and MEM_SDRAM2 (0xcc000000).
Global memory area 23 is created with the name “MEMOBJ_GLOBAL1” for memory in a range of ˜0xcfffffff.

また、図7の(3)で示す例では、MEM_CLUSTER1(0x81200000
〜0x8127efffの範囲のメモリ)に対して、「MEMOBJ_CLUSTER1
」という名前で、クラスタメモリ領域が作成される。なお、このクラスタメモリ領域の親のメモリ領域20は「MEMOBJ_GLOBAL1」である。
In the example shown in (3) of FIG. 7, MEM_CLUSTER1 (0x81200000)
~ 0x8127efff range memory) for "MEMOBJ_CLUSTER1
", A cluster memory area is created. The parent memory area 20 of this cluster memory area is “MEMOBJ_GLOBAL1”.

また、図7の(4)で示す例では、MEM_CORE1(0x81000000〜0x81007fffの範囲のメモリ)に対して、「MEMOBJ_CORE1」という名前で、コアメモリ領域が作成される。なお、このコアメモリ領域は、番号「1」のプロセッサコアのローカルメモリを使用するものであり、このコアメモリ領域の親のメモリ領域20は「MEMOBJ_CLUSTER1」である。
このように、メモリ領域20が定義されることで、図8に示すようなツリー構造が作成される。
In the example shown in (4) of FIG. 7, a core memory area is created with the name “MEMOBJ_CORE1” for MEM_CORE1 (memory in the range of 0x8100000 to 0x81007fff). This core memory area uses the local memory of the processor core with the number “1”, and the parent memory area 20 of this core memory area is “MEMOBJ_CLUSTER1”.
Thus, by defining the memory area 20, a tree structure as shown in FIG. 8 is created.

図6は、コンフィギュレーションファイル41においてヒープIDの定義(DEF_HEAP)を記述するための書式である。この書式を使用することにより、ヒープIDとメモリ領域20との関係を記述することができる。   FIG. 6 shows a format for describing a heap ID definition (DEF_HEAP) in the configuration file 41. By using this format, the relationship between the heap ID and the memory area 20 can be described.

図6に示す書式において、heapidには「ヒープID(アプリケーションプログラム40で使用可能な一意の文字列)」を指定する。
memobjidには「予め決められた仮想属性」または「ヒープIDに関連付けるメモリ領域20の名前」を指定する。
In the format shown in FIG. 6, “heap ID (a unique character string that can be used by the application program 40)” is specified for heapid.
For memobjid, “predetermined virtual attribute” or “name of memory area 20 associated with heap ID” is designated.

なお、memobjidに指定可能な「予め決められた仮想属性」としては、このヒープIDが仮想グローバルIDであることを示す「MEMOBJ_GLOBAL」、このヒープIDが仮想クラスタIDであることを示す「MEMOBJ_CLUSTER」、このヒープIDが仮想コアIDであることを示す「MEMOBJ_CORE」のいずれかを指定することができる。   Note that “predetermined virtual attributes” that can be specified in memobjid are “MEMOBJ_GLOBAL” indicating that this heap ID is a virtual global ID, “MEMOBJ_CLUSTER” indicating that this heap ID is a virtual cluster ID, Any one of “MEMOBJ_CORE” indicating that the heap ID is a virtual core ID can be designated.

例えば、図7の(5)で示す例では、「HEAP_GLOBAL」というヒープIDで、仮想グローバルIDが作成される。仮想グローバルIDは、グローバルメモリ領域23を参照するためのヒープIDである。仮想グローバルIDを使用してアプリケーションプログラム40がメモリ獲得用APIを呼び出すと、オペレーティングシステム10が使用可能なグローバルメモリ領域23を検索し、このグローバルメモリ領域23からメモリ割り当てを実行する。   For example, in the example shown in (5) of FIG. 7, a virtual global ID is created with a heap ID of “HEAP_GLOBAL”. The virtual global ID is a heap ID for referring to the global memory area 23. When the application program 40 calls the memory acquisition API using the virtual global ID, the operating system 10 searches the usable global memory area 23 and executes memory allocation from the global memory area 23.

また、図7の(6)で示す例では、「HEAP_CLUSTER」というヒープIDで、仮想クラスタIDが作成される。仮想クラスタIDは、クラスタメモリ領域を動的に割り当てるためのヒープIDである。仮想クラスタIDを使用してアプリケーションプログラム40がメモリ獲得用APIを呼び出すと、オペレーティングシステム10が使用可能なクラスタメモリ領域を検索し、このクラスタメモリ領域からメモリ割り当てを実行する。   In the example shown in (6) of FIG. 7, a virtual cluster ID is created with a heap ID “HEAP_CLUSTER”. The virtual cluster ID is a heap ID for dynamically allocating a cluster memory area. When the application program 40 calls the memory acquisition API using the virtual cluster ID, the operating system 10 searches for a usable cluster memory area and executes memory allocation from this cluster memory area.

また、図7の(7)で示す例では、「HEAP_CORE」というヒープIDで、仮想コアIDが作成される。仮想コアIDは、コアメモリ領域を動的に割り当てるためのヒープIDである。仮想コアIDを使用してアプリケーションプログラム40がメモリ獲得用APIを呼び出すと、オペレーティングシステム10が使用可能なコアメモリ領域を検索し、このコアメモリ領域からメモリ割り当てを実行する。   In the example shown in (7) of FIG. 7, a virtual core ID is created with a heap ID of “HEAP_CORE”. The virtual core ID is a heap ID for dynamically allocating a core memory area. When the application program 40 calls the memory acquisition API using the virtual core ID, the operating system 10 searches for a usable core memory area, and executes memory allocation from the core memory area.

また、memobjidに指定可能な「ヒープIDに関連付けるメモリ領域20の名前
」としては、図5で説明した記述方法により定義されたメモリ領域20の名前を指定することができる。なお、このように直接的にメモリ領域20の名前を指定した場合、ヒープIDとメモリ領域20とが直接的に関連付けられる。このようなヒープIDを使用してアプリケーションプログラム40がメモリ獲得用APIを呼び出すと、オペレーティングシステム10が指定されたメモリ領域20からメモリを直接割り当てる。このようなヒープIDを実メモリIDと呼ぶ。
Further, as the “name of the memory area 20 associated with the heap ID” that can be specified for memobjid, the name of the memory area 20 defined by the description method described with reference to FIG. 5 can be specified. When the name of the memory area 20 is directly specified in this way, the heap ID and the memory area 20 are directly associated with each other. When the application program 40 calls the memory acquisition API using such a heap ID, the operating system 10 directly allocates memory from the designated memory area 20. Such a heap ID is called a real memory ID.

例えば、図7の(8)で示す例では、「HEAP_CLUSTER1」というヒープIDで、実メモリIDが作成される。この実メモリIDは、「MEMOBJ_CLUSTER1」という名前で定義されたメモリ領域20と直接的に関連付けられている。   For example, in the example shown in (8) of FIG. 7, a real memory ID is created with a heap ID of “HEAP_CLUSTER1”. This real memory ID is directly associated with the memory area 20 defined by the name “MEMOBJ_CLUSTER1”.

また、図7の(9)で示す例では、「HEAP_CORE1」というヒープIDで、実メモリIDが作成される。この実メモリIDは、「MEMOBJ_CORE4」という名前で定義されたメモリ領域20と直接的に関連付けられている。   In the example shown in (9) of FIG. 7, the real memory ID is created with the heap ID “HEAP_CORE1”. This real memory ID is directly associated with the memory area 20 defined by the name “MEMOBJ_CORE4”.

askparentには、指定されたメモリ領域20からのメモリ割り当てに失敗した場合に、親のメモリ領域20を参照するか否かを指定する。「true」が指定された場合には、図8に示すようなツリー構造の親のメモリ領域20を再帰的に参照してメモリ割り当てを行う。例えば、第1のコアメモリ領域21aからのメモリ割り当てに失敗した場合には、第1のクラスタメモリ領域22aからのメモリ割り当てを試行する。この第1のクラスタメモリ領域22aからのメモリ割り当てにも失敗した場合には、グローバルメモリ領域23からのメモリ割り当てを試行する。一方、「false」が指定された場合には、指定されたメモリ領域20からのメモリ割り当てに失敗した場合でも親のメモリ領域20からのメモリ割り当てを行わない。   askparent specifies whether or not to refer to the parent memory area 20 when memory allocation from the specified memory area 20 fails. When “true” is designated, memory allocation is performed by recursively referring to the parent memory area 20 having a tree structure as shown in FIG. For example, when memory allocation from the first core memory area 21a fails, memory allocation from the first cluster memory area 22a is tried. If the memory allocation from the first cluster memory area 22a also fails, the memory allocation from the global memory area 23 is tried. On the other hand, when “false” is specified, memory allocation from the parent memory area 20 is not performed even if memory allocation from the specified memory area 20 fails.

(メモリ獲得用API)
次に、メモリ獲得用APIの仕様について説明する。本実施形態に係るオペレーティングシステム10は、例えば図9に示すようなメモリ獲得用APIを備えており、このメモリ獲得用APIをアプリケーションプログラム40から呼び出し可能となっている。このメモリ獲得用APIには、引数として「heapid」「size」「addr」を指定可能である。
(Memory acquisition API)
Next, specifications of the memory acquisition API will be described. The operating system 10 according to the present embodiment includes a memory acquisition API as shown in FIG. 9, for example, and the memory acquisition API can be called from the application program 40. In this memory acquisition API, “heapid”, “size”, and “addr” can be specified as arguments.

heapidには「ヒープID」を指定する。オペレーティングシステム10は、ここで指定されたヒープIDで特定されるメモリ領域20からのメモリ割り当てを試行する。ヒープIDには、すでに説明したような仮想グローバルID、仮想クラスタID、仮想コアID、実メモリIDのいずれかを指定することができる。なお、アプリケーションプログラム40がヒープIDを使用する場合には、情報生成手段42が出力したヘッダファイル44を参照する。このヘッダファイル44には、アプリケーションプログラム40が使用可能な形でヒープIDが定義されている。なお、ヘッダファイル44に定義されるヒープIDは、コンフィギュレーションファイル41で定義したものに限らず、情報生成手段42が自動的に追加するようにしてもよい。例えば、仮想グローバルID、仮想クラスタID、仮想コアIDの少なくともいずれかを、コンフィギュレーションファイル41で定義されていなくても、情報生成手段42が自動的にヘッダファイル44に出力するようにしてもよい。
sizeには「獲得したいメモリのサイズ」を指定する。
A “heap ID” is designated for the heapid. The operating system 10 tries to allocate memory from the memory area 20 specified by the heap ID specified here. As the heap ID, any one of the virtual global ID, the virtual cluster ID, the virtual core ID, and the real memory ID as described above can be designated. When the application program 40 uses a heap ID, the header file 44 output by the information generation unit 42 is referred to. The header file 44 defines a heap ID that can be used by the application program 40. Note that the heap ID defined in the header file 44 is not limited to the one defined in the configuration file 41, and the information generation means 42 may automatically add it. For example, even if at least one of the virtual global ID, the virtual cluster ID, and the virtual core ID is not defined in the configuration file 41, the information generation unit 42 may automatically output the header file 44. .
In “size”, “size of memory to be acquired” is designated.

addrには「獲得したメモリの先頭アドレスを返す領域へのポインタ」を指定する。メモリ獲得に成功した場合には、アプリケーションプログラム40がこのポインタの中身を参照することで、獲得したメモリの先頭アドレスを得ることができる。   In addr, “pointer to an area for returning the start address of the acquired memory” is designated. When the memory acquisition is successful, the application program 40 can obtain the start address of the acquired memory by referring to the contents of this pointer.

なお、このAPIの戻り値はエラーコードである。具体的には、メモリ獲得に成功した場合には「EOK(定数)」を返却し、sizeやaddrが不正な場合には「EPAR(定数)」を返却し、ヒープIDが不正な場合には「ENOEXS(定数)」を返却し、メモリ枯渇等によりメモリ獲得に失敗した場合には「ENOMEM(定数)」を返却する。   Note that the return value of this API is an error code. Specifically, “EOK (constant)” is returned when memory acquisition is successful, “EPAR (constant)” is returned when size and addr are invalid, and heap ID is invalid. “ENOEXS (constant)” is returned, and “ENOMEM (constant)” is returned when memory acquisition fails due to memory exhaustion or the like.

(メモリ割り当て処理)
次に、上記したメモリ獲得用APIが呼び出されたときのオペレーティングシステム10の処理について説明する。図10は、メモリ割り当て処理のメインフロー図である。
(Memory allocation process)
Next, processing of the operating system 10 when the above-described memory acquisition API is called will be described. FIG. 10 is a main flowchart of the memory allocation process.

まず、図10に示すステップS100において、アプリケーションプログラム40がメモリ獲得用APIの呼び出しを実行し、このAPI呼び出しに起因するメモリ獲得要求をマイクロカーネル16が受信する。このとき、メモリ獲得要求を受信するマイクロカーネル16は、アプリケーションプログラム40が実行されているプロセッサコアにおいて実行されているマイクロカーネル16である。マイクロカーネル16は、メモリ獲得用APIで指定されたヒープIDを取得し、このヒープIDを基に内部データ43を参照し、ヒープIDの属性をチェックする。そして、ステップS101に進む。   First, in step S100 shown in FIG. 10, the application program 40 calls a memory acquisition API, and the microkernel 16 receives a memory acquisition request resulting from the API call. At this time, the microkernel 16 that receives the memory acquisition request is the microkernel 16 that is executed in the processor core in which the application program 40 is executed. The microkernel 16 acquires the heap ID specified by the memory acquisition API, refers to the internal data 43 based on the heap ID, and checks the attribute of the heap ID. Then, the process proceeds to step S101.

ステップS101では、ヒープIDが仮想グローバルIDであるか(すなわちコンフィギュレーションファイル41においてMEMOBJ_GLOBAL属性を付与されて定義されたヒープIDであるか)がチェックされる。仮想グローバルIDである場合には、ステップS102へ進み、グローバルメモリ割り当て処理(図11参照)を実行する。一方、仮想グローバルIDでない場合には、ステップS103に進む。   In step S101, it is checked whether the heap ID is a virtual global ID (that is, whether the heap ID is defined with the MEMOBJ_GLOBAL attribute in the configuration file 41). If it is a virtual global ID, the process proceeds to step S102, and a global memory allocation process (see FIG. 11) is executed. On the other hand, if it is not a virtual global ID, the process proceeds to step S103.

ステップS103では、ヒープIDが仮想クラスタIDであるか(すなわちコンフィギュレーションファイル41においてMEMOBJ_CLUSTER属性を付与されて定義されたヒープIDであるか)がチェックされる。仮想クラスタIDである場合には、ステップS104へ進み、クラスタメモリ割り当て処理(図12参照)を実行する。一方、仮想クラスタIDでない場合には、ステップS105に進む。   In step S103, it is checked whether the heap ID is a virtual cluster ID (that is, a heap ID defined with the MEMOBJ_CLUSTER attribute in the configuration file 41). If it is a virtual cluster ID, the process proceeds to step S104, and a cluster memory allocation process (see FIG. 12) is executed. On the other hand, if it is not a virtual cluster ID, the process proceeds to step S105.

ステップS105では、ヒープIDが仮想コアIDであるか(すなわちコンフィギュレーションファイル41においてMEMOBJ_CORE属性を付与されて定義されたヒープIDであるか)がチェックされる。仮想コアIDである場合には、ステップS106へ進み、コアメモリ割り当て処理(図13参照)を実行する。一方、仮想コアIDでない場合には、このヒープIDは実メモリIDであるので、ステップS107に進み、実メモリ割り当て処理(図14参照)を実行する。   In step S105, it is checked whether the heap ID is a virtual core ID (that is, whether the heap ID is defined with the MEMOBJ_CORE attribute added in the configuration file 41). If it is a virtual core ID, the process advances to step S106 to execute a core memory allocation process (see FIG. 13). On the other hand, if it is not a virtual core ID, this heap ID is a real memory ID, so the process proceeds to step S107, and a real memory allocation process (see FIG. 14) is executed.

(グローバルメモリ割り当て処理)
グローバルメモリ割り当て処理について、図11を参照しつつ説明する。
まず、図11に示すステップS200において、マイクロカーネル16は、メモリ獲得用APIの呼び出し元のプロセッサコアの番号(本実施形態においてはマイクロカーネル16が実行されているプロセッサコアの番号)を取得する。そして、ステップS201に進む。
(Global memory allocation processing)
The global memory allocation process will be described with reference to FIG.
First, in step S200 shown in FIG. 11, the microkernel 16 obtains the number of the processor core from which the memory acquisition API is called (in this embodiment, the number of the processor core in which the microkernel 16 is executed). Then, the process proceeds to step S201.

ステップS201では、マイクロカーネル16は、ステップS200で取得したプロセッサコアの番号を基に、メモリ領域20のツリー構造を参照し、当該番号に関連付けられたコアメモリ領域を取得する。例えば、プロセッサコアの番号が「1」の場合、コンフィギュレーションファイル41においてownercoreidに「1」を指定したコアメモリ領域(図7の(4)の記述によって定義されるコアメモリ領域)を取得する。そして、ステップS202に進む。   In step S201, the microkernel 16 refers to the tree structure of the memory area 20 based on the processor core number acquired in step S200, and acquires the core memory area associated with the number. For example, when the processor core number is “1”, the core memory area (the core memory area defined by the description in (4) of FIG. 7) in which “1” is specified as the ownercore in the configuration file 41 is acquired. Then, the process proceeds to step S202.

ステップS202では、取得したメモリ領域20が「MOA_GLOBAL」属性であるか、すなわち、グローバルメモリ領域23であるかがチェックされる。グローバルメモリ領域23である場合には、当該メモリ領域20をメモリ割り当ての対象に選択して、ステップS204へ進む。一方、グローバルメモリ領域23でない場合には、ステップS203に進む。   In step S202, it is checked whether the acquired memory area 20 has the “MOA_GLOBAL” attribute, that is, the global memory area 23. If it is the global memory area 23, the memory area 20 is selected as a memory allocation target, and the process proceeds to step S204. On the other hand, if it is not the global memory area 23, the process proceeds to step S203.

ステップS203に進んだ場合、取得したメモリ領域20の親のメモリ領域20が取得される。すなわち、図8に示すようなツリー構造において、現在取得しているメモリ領域20の親のメモリ領域20を取得する。そして、ステップS203に戻り、この新しく取得したメモリ領域20がグローバルメモリ領域23であるかがチェックされる。そして、グローバルメモリ領域23である場合には、当該メモリ領域20をメモリ割り当ての対象に選択して、ステップS204へ進む。一方、グローバルメモリ領域23でない場合には、ステップS203に進んで上記と同様の処理を行う。このように、グローバルメモリ領域23が見つかるまで、親のメモリ領域20を再帰的に取得する。   When the process proceeds to step S203, the parent memory area 20 of the acquired memory area 20 is acquired. That is, in the tree structure as shown in FIG. 8, the parent memory area 20 of the currently acquired memory area 20 is acquired. Then, the process returns to step S203 to check whether the newly acquired memory area 20 is the global memory area 23. If it is the global memory area 23, the memory area 20 is selected as a memory allocation target, and the process proceeds to step S204. On the other hand, if it is not the global memory area 23, the process proceeds to step S203 and the same processing as described above is performed. In this way, the parent memory area 20 is recursively acquired until the global memory area 23 is found.

ステップS204では、マイクロカーネル16は、メモリ割り当ての対象に選択したメモリ領域20を管理するヒープマネージャ15を呼び出し、ヒープマネージャ15にメモリ割り当てを依頼する。そして、ステップS205に進む。   In step S204, the microkernel 16 calls the heap manager 15 that manages the memory area 20 selected as a memory allocation target, and requests the heap manager 15 to allocate the memory. Then, the process proceeds to step S205.

ステップS205では、ヒープマネージャ15によるメモリ割り当てが成功したかがチェックされる。メモリ割り当てが成功した場合には、ステップS206へ進む。一方、メモリリソースが枯渇するなどしてメモリ割り当てに失敗した場合には、ステップS207に進む。   In step S205, it is checked whether the memory allocation by the heap manager 15 is successful. If the memory allocation is successful, the process proceeds to step S206. On the other hand, if memory allocation has failed due to exhaustion of memory resources, the process proceeds to step S207.

ステップS206へ進んだ場合、獲得したメモリのメモリポインタをアプリケーションプログラム40に返却する。このメモリポインタを使用することで、アプリケーションプログラム40は安全にメモリを使用することができる。そして処理が終了する。   When the process proceeds to step S206, the memory pointer of the acquired memory is returned to the application program 40. By using this memory pointer, the application program 40 can use the memory safely. Then, the process ends.

一方、ステップS207へ進んだ場合、親のメモリ領域20を取得するかがチェックされる。親のメモリ領域20が存在しない場合、または、メモリ獲得用APIの引数で指定されたヒープIDが親のメモリ領域20を参照しない設定である場合(コンフィギュレーションファイル41におけるヒープIDの定義でaskparentがfalseの場合)には、ステップS209へ進む。それ以外の場合には、図8に示すようなツリー構造を参照し、メモリ割り当てに失敗したメモリ領域20の親のメモリ領域20をメモリ割り当ての対象に選択して、ステップS208へ進む。
ステップS209へ進んだ場合、エラーコードをアプリケーションプログラム40に返却する。そして処理が終了する。
On the other hand, when the process proceeds to step S207, it is checked whether the parent memory area 20 is acquired. When the parent memory area 20 does not exist or when the heap ID specified by the argument of the memory acquisition API is a setting that does not refer to the parent memory area 20 (in the definition of the heap ID in the configuration file 41, askparent is In the case of false), the process proceeds to step S209. In other cases, the tree structure as shown in FIG. 8 is referred to, and the parent memory area 20 of the memory area 20 in which memory allocation has failed is selected as a memory allocation target, and the process proceeds to step S208.
When the process proceeds to step S209, the error code is returned to the application program 40. Then, the process ends.

一方、ステップS208へ進んだ場合、メモリ割り当ての対象に選択した親のメモリ領域20を管理するヒープマネージャ15を呼び出し、ヒープマネージャ15にメモリ割り当てを依頼する。そして、上記したステップS205に進み、既に説明した手順を繰り返す。このとき、親のメモリ領域20においてもメモリ割り当てが失敗した場合には、更に親のメモリ領域20からのメモリ割り当てが再帰的に試行される。   On the other hand, when the process proceeds to step S208, the heap manager 15 that manages the parent memory area 20 selected as the memory allocation target is called, and the heap manager 15 is requested to allocate the memory. Then, the process proceeds to step S205 described above, and the already described procedure is repeated. At this time, if memory allocation fails in the parent memory area 20 as well, memory allocation from the parent memory area 20 is recursively attempted.

このように、グローバルメモリ割り当て処理においては、アプリケーションプログラム40が実行されているプロセッサコアのローカルメモリに係るメモリ領域20(コアメモリ領域)を特定し、当該メモリ領域20に紐付けられたメモリ領域20を再帰的に辿って発見したグローバルメモリ領域23からメモリ割り当てを実行させる。   As described above, in the global memory allocation process, the memory area 20 (core memory area) related to the local memory of the processor core in which the application program 40 is executed is specified, and the memory area 20 associated with the memory area 20 is specified. The memory allocation is executed from the global memory area 23 found by recursively tracing.

(クラスタメモリ割り当て処理)
クラスタメモリ割り当て処理について、図12を参照しつつ説明する。
まず、図12に示すステップS300において、マイクロカーネル16は、メモリ獲得用APIの呼び出し元のプロセッサコアの番号(本実施形態においてはマイクロカーネル16が実行されているプロセッサコアの番号)を取得する。そして、ステップS301に進む。
(Cluster memory allocation process)
The cluster memory allocation process will be described with reference to FIG.
First, in step S300 shown in FIG. 12, the microkernel 16 obtains the number of the processor core that called the memory acquisition API (in this embodiment, the number of the processor core in which the microkernel 16 is executed). Then, the process proceeds to step S301.

ステップS301では、マイクロカーネル16は、ステップS300で取得したプロセッサコアの番号を基に、メモリ領域20のツリー構造を参照し、当該番号に関連付けられたコアメモリ領域を取得する。そして、ステップS303に進む。   In step S301, the microkernel 16 refers to the tree structure of the memory area 20 based on the processor core number acquired in step S300, and acquires the core memory area associated with the number. Then, the process proceeds to step S303.

ステップS303では、取得したコアメモリ領域の親のメモリ領域20をメモリ割り当ての対象に選択する。このコアメモリ領域の親のメモリ領域20は、「MOA_CLUSTER」属性を有するクラスタメモリ領域である。そして、ステップS304に進む。   In step S303, the parent memory area 20 of the acquired core memory area is selected as a memory allocation target. The parent memory area 20 of this core memory area is a cluster memory area having the “MOA_CLUSTER” attribute. Then, the process proceeds to step S304.

なお、ステップS304〜S309における処理は、上述したグローバルメモリ割り当て処理のステップS204〜S209における処理と同様であるので、説明を省略する。   Note that the processing in steps S304 to S309 is the same as the processing in steps S204 to S209 of the global memory allocation processing described above, and thus description thereof is omitted.

このように、クラスタメモリ割り当て処理においては、アプリケーションプログラム40が実行されているプロセッサコアのローカルメモリに係るコアメモリ領域を特定し、当該コアメモリ領域に紐付けられたクラスタメモリ領域からメモリ割り当てを実行させる。   As described above, in the cluster memory allocation process, the core memory area related to the local memory of the processor core in which the application program 40 is executed is specified, and the memory allocation is executed from the cluster memory area linked to the core memory area. Let

(コアメモリ割り当て処理)
コアメモリ割り当て処理について、図13を参照しつつ説明する。
まず、図13に示すステップS400において、マイクロカーネル16は、メモリ獲得用APIの呼び出し元のプロセッサコアの番号(本実施形態においてはマイクロカーネル16が実行されているプロセッサコアの番号)を取得する。そして、ステップS401に進む。
(Core memory allocation processing)
The core memory allocation process will be described with reference to FIG.
First, in step S400 shown in FIG. 13, the microkernel 16 obtains the number of the processor core that called the memory acquisition API (in this embodiment, the number of the processor core in which the microkernel 16 is executed). Then, the process proceeds to step S401.

ステップS401では、マイクロカーネル16は、ステップS400で取得したプロセッサコアの番号を基に、メモリ領域20のツリー構造を参照し、当該番号に関連付けられたコアメモリ領域20をメモリ割り当ての対象として選択する。そして、ステップS402に進む。   In step S401, the microkernel 16 refers to the tree structure of the memory area 20 based on the number of the processor core acquired in step S400, and selects the core memory area 20 associated with the number as a memory allocation target. . Then, the process proceeds to step S402.

ステップS402では、マイクロカーネル16が、メモリ割り当ての対象として選択したコアメモリ領域を管理するヒープマネージャ15を呼び出し、ヒープマネージャ15によってメモリ割り当てが実行される。そして、ステップS403に進む。   In step S402, the microkernel 16 calls the heap manager 15 that manages the core memory area selected as a memory allocation target, and the heap manager 15 executes the memory allocation. Then, the process proceeds to step S403.

なお、ステップS403〜S407における処理は、上述したグローバルメモリ割り当て処理のステップS205〜S209における処理と同様であるので、説明を省略する。   Note that the processing in steps S403 to S407 is the same as the processing in steps S205 to S209 of the global memory allocation processing described above, and thus the description thereof is omitted.

このように、クラスタメモリ割り当て処理においては、アプリケーションプログラム40が実行されているプロセッサコアのローカルメモリに係るコアメモリ領域からメモリ割り当てを実行させる。   As described above, in the cluster memory allocation process, the memory allocation is executed from the core memory area related to the local memory of the processor core in which the application program 40 is executed.

(実メモリ割り当て処理)
実メモリ割り当て処理について、図14を参照しつつ説明する。
まず、図14に示すステップS500において、マイクロカーネル16は、メモリ獲得用APIの引数で指定されたヒープID(実メモリID)を基に、そのヒープIDに関連付けられたメモリ領域20をメモリ割り当ての対象として選択する。例えば、図7の(9)で定義された「HEAP_CORE4」というヒープIDがメモリ獲得用APIの引数で指定されている場合、このヒープIDに関連付けられた「MEMOBJ_CORE4」という名前のメモリ領域20をメモリ割り当ての対象として選択する。そして、ステップS501に進む。
(Real memory allocation processing)
The real memory allocation process will be described with reference to FIG.
First, in step S500 shown in FIG. 14, the microkernel 16 allocates the memory area 20 associated with the heap ID based on the heap ID (real memory ID) specified by the argument of the memory acquisition API. Select as target. For example, when the heap ID “HEAP_CORE4” defined in (9) of FIG. 7 is specified by an argument of the memory acquisition API, the memory area 20 named “MEMOBJ_CORE4” associated with this heap ID is stored in the memory. Select for assignment. Then, the process proceeds to step S501.

ステップS501では、マイクロカーネル16が、メモリ割り当ての対象として選択したメモリ領域20を管理するヒープマネージャ15を呼び出し、ヒープマネージャ15にメモリ割り当てを依頼する。そして、ステップS502に進む。   In step S501, the microkernel 16 calls the heap manager 15 that manages the memory area 20 selected as the memory allocation target, and requests the heap manager 15 to allocate the memory. Then, the process proceeds to step S502.

なお、ステップS502〜S506における処理は、上述したグローバルメモリ割り当て処理のステップS205〜S209における処理と同様であるので、説明を省略する。   Note that the processing in steps S502 to S506 is the same as the processing in steps S205 to S209 of the global memory allocation processing described above, and a description thereof will be omitted.

このように、実メモリ割り当て処理においては、指定された実メモリIDに関連付けられたメモリ領域20からメモリ割り当てを実行させる。   In this way, in the real memory allocation process, memory allocation is executed from the memory area 20 associated with the designated real memory ID.

(まとめ)
以上説明したように、本実施形態によれば、実メモリIDが指定されてメモリ獲得用APIが呼び出されたときには、指定された実メモリIDに関連付けられたメモリ領域20からメモリ割り当てを実行させるようにしている。このため、アプリケーションプログラム40が指定した特定のメモリからのメモリ割り当てを実行したい場合には、実メモリIDを指定してメモリ獲得用APIを呼び出せばよい。
(Summary)
As described above, according to the present embodiment, when the real memory ID is specified and the memory acquisition API is called, the memory allocation is executed from the memory area 20 associated with the specified real memory ID. I have to. For this reason, when it is desired to execute memory allocation from a specific memory designated by the application program 40, the memory acquisition API may be called by designating the real memory ID.

また、仮想コアIDが指定されてメモリ獲得用APIが呼び出されたときには、メモリ獲得用APIを呼び出したアプリケーションプログラム40が実行されているプロセッサコアのローカルメモリに係るコアメモリ領域からメモリ割り当てを実行させるようにしている。このため、アクセス速度の速いメモリ(プロセッサコア固有のメモリ)をオペレーティングシステム10に動的に選択させてメモリ割り当てを実行したい場合には、仮想コアIDを指定してメモリ獲得用APIを呼び出せばよい。   When the virtual core ID is specified and the memory acquisition API is called, the memory allocation is executed from the core memory area related to the local memory of the processor core in which the application program 40 that called the memory acquisition API is executed. I am doing so. For this reason, if the operating system 10 is to dynamically select a memory with high access speed (memory unique to the processor core) and execute memory allocation, the virtual core ID is specified and the memory acquisition API is called. .

また、仮想クラスタIDが指定されてメモリ獲得用APIが呼び出されたときには、メモリ獲得用APIを呼び出したアプリケーションプログラム40が実行されているプロセッサコアのローカルメモリに係るコアメモリ領域を特定し、当該コアメモリ領域に紐付けられたクラスタメモリ領域からメモリ割り当てを実行させるようにしている。このため、例えばマルチコア環境の管理効率を高めるためにプロセッサコアをいくつかのグループ(クラスタ)に分割し、そのクラスタにメモリ領域20を割り当てた場合、このクラスタ用のメモリ領域20をクラスタメモリ領域として定義することで、プログラムの実行時にオペレーティングシステム10が動的に判断してクラスタメモリ領域からメモリ割り当てを実行させることができる。   Also, when the virtual cluster ID is specified and the memory acquisition API is called, the core memory area related to the local memory of the processor core in which the application program 40 that called the memory acquisition API is executed is specified, and the core Memory allocation is executed from the cluster memory area linked to the memory area. For this reason, for example, when the processor core is divided into several groups (clusters) in order to increase the management efficiency of the multi-core environment and the memory area 20 is allocated to the cluster, the memory area 20 for the cluster is used as the cluster memory area By defining, the operating system 10 can dynamically determine the memory allocation from the cluster memory area when the program is executed.

また、仮想グローバルIDが指定されてメモリ獲得用APIが呼び出されたときには、メモリ獲得用APIを呼び出したアプリケーションプログラム40が実行されているプロセッサコアのローカルメモリに係るメモリ領域20を特定し、当該メモリ領域20に紐付けられたメモリ領域20を再帰的に辿って発見したグローバルメモリ領域23からメモリ割り当てを実行させるようにしている。このため、例えばすべてのプロセッサコアからアクセスできるメモリをグローバルメモリ領域23とすることで、プログラムの実行時にオペレーティングシステム10が動的に判断してこのグローバルメモリ領域23からメモリ割り当てを実行させることができる。   When the virtual global ID is specified and the memory acquisition API is called, the memory area 20 related to the local memory of the processor core in which the application program 40 that called the memory acquisition API is executed is specified, and the memory Memory allocation is executed from the global memory area 23 found by recursively tracing the memory area 20 associated with the area 20. For this reason, for example, by making the memory accessible from all the processor cores the global memory area 23, the operating system 10 can dynamically determine the memory allocation from the global memory area 23 when executing the program. .

しかも、上記したような複数のメモリ割り当て方法が同じメモリ獲得用APIで実現されているため、アプリケーションプログラム40を変更しなくても、ヒープIDの定義を変更するだけでメモリ割り当て方法を切り替えることができる。例えば、コンフィギュレーションファイル41を書き換えることでヒープIDの定義を変更し、仮想コアIDに割り当てられていたヒープIDを実メモリIDに割り当てるようにすれば、当該ヒープIDを使用してメモリ獲得用APIを呼び出していたアプリケーションプログラム40を変更することなく、メモリ割り当ての方法を切り替えることができる。仮想コアIDを実メモリIDに変更した場合には、ヒープIDの定義を変更する前は、プログラム実行時のプロセッサコアに固有のメモリ領域20からメモリ割り当てが実行され、ヒープIDの定義を変更した後は、ヒープIDによって指定された特定のメモリ領域20からのメモリ割り当てが実行される。   In addition, since a plurality of memory allocation methods as described above are realized by the same memory acquisition API, the memory allocation method can be switched only by changing the definition of the heap ID without changing the application program 40. it can. For example, if the definition of the heap ID is changed by rewriting the configuration file 41 and the heap ID assigned to the virtual core ID is assigned to the real memory ID, the memory acquisition API is used using the heap ID. It is possible to switch the memory allocation method without changing the application program 40 that called. When the virtual core ID is changed to the real memory ID, before the heap ID definition is changed, the memory allocation is executed from the memory area 20 specific to the processor core at the time of program execution, and the heap ID definition is changed. After that, memory allocation from the specific memory area 20 designated by the heap ID is executed.

また、メモリ領域20でツリー構造を作成し、ヒープIDで指定されたメモリ領域20からのメモリ割り当てに失敗したときには、当該メモリ領域20の上位のメモリ領域20からメモリ割り当てを実行させるようにしている。このため、例えばアクセス速度の速いメモリリソースが枯渇してしまった場合でも、次の候補のメモリ領域20からメモリ割り当てを実行させることができる。よって、できるだけアクセス速度の速いメモリ領域20を検索してメモリ割り当てを実行させることができる。   Also, a tree structure is created in the memory area 20, and when memory allocation from the memory area 20 specified by the heap ID fails, memory allocation is executed from the upper memory area 20 of the memory area 20. . For this reason, for example, even when memory resources with high access speed are exhausted, memory allocation can be executed from the next candidate memory area 20. Therefore, memory allocation can be executed by searching the memory area 20 having the fastest access speed.

また、ヒープIDとメモリ領域20との関係を記述したコンフィギュレーションファイル41と、コンフィギュレーションファイル41を読み込んで、アプリケーションプログラム40用のヘッダファイル44とオペレーティングシステム10用の内部データ43とを生成する情報生成手段42と、を備える。このような構成によれば、コンフィギュレーションファイル41を書き換えて情報生成手段42を実行するだけで、アプリケーションプログラム40やオペレーティングシステム10を変更することなく、メモリ領域20の定義やヒープIDの定義を変更することができる。例えば、異なる物理メモリやプロセッサコアを備えたハードウェア環境へプログラムを移植する場合でも、コンフィギュレーションファイル41を書き換えて情報生成手段42を実行するだけで、アプリケーションプログラム40やオペレーティングシステム10を変更することなく、適切なメモリ割り当てを実現することができる。   Also, a configuration file 41 describing the relationship between the heap ID and the memory area 20, and information for reading the configuration file 41 and generating the header file 44 for the application program 40 and the internal data 43 for the operating system 10 Generating means 42. According to such a configuration, the definition of the memory area 20 and the definition of the heap ID can be changed without changing the application program 40 or the operating system 10 simply by rewriting the configuration file 41 and executing the information generation unit 42. can do. For example, even when a program is ported to a hardware environment having a different physical memory or processor core, the application program 40 or the operating system 10 can be changed only by rewriting the configuration file 41 and executing the information generating means 42. And appropriate memory allocation can be realized.

10 オペレーティングシステム
12 メモリ領域作成部
14 メモリ割り当て部
15 ヒープマネージャ
16 マイクロカーネル
20 メモリ領域
21a 第1のコアメモリ領域
21b 第2のコアメモリ領域
21c 第3のコアメモリ領域
21d 第4のコアメモリ領域
22a 第1のクラスタメモリ領域
22b 第2のクラスタメモリ領域
23 グローバルメモリ領域
30a 第1のプロセッサコア
30b 第2のプロセッサコア
30c 第3のプロセッサコア
30d 第4のプロセッサコア
31a 第1のプロセッサコアのローカルメモリ
31b 第2のプロセッサコアのローカルメモリ
31c 第3のプロセッサコアのローカルメモリ
31d 第4のプロセッサコアのローカルメモリ
32a 第1のクラスタ
32b 第2のクラスタ
33a 第1のクラスタメモリ
33b 第2のクラスタメモリ
34 グローバルメモリ
40 アプリケーションプログラム
41 コンフィギュレーションファイル
42 情報生成手段
43 内部データ
44 ヘッダファイル
45 アプリケーションプログラムのソースコード
46 コンパイラ
47 オブジェクトファイル
DESCRIPTION OF SYMBOLS 10 Operating system 12 Memory area creation part 14 Memory allocation part 15 Heap manager 16 Microkernel 20 Memory area 21a 1st core memory area 21b 2nd core memory area 21c 3rd core memory area 21d 4th core memory area 22a First cluster memory area 22b Second cluster memory area 23 Global memory area 30a First processor core 30b Second processor core 30c Third processor core 30d Fourth processor core 31a Local memory of the first processor core 31b Local memory of the second processor core 31c Local memory of the third processor core 31d Local memory of the fourth processor core 32a First cluster 32b Second cluster 33a First Raster memory 33b second cluster memory 34 global memory 40 the application programs 41 configuration file 42 information generating means 43 internal data 44 header file 45 source code 46 compiler 47 object file of an application program

Claims (9)

それぞれローカルメモリを備えた複数のプロセッサコアを相互に接続したマルチコア環境において実行され、アプリケーションプログラムから呼び出し可能なメモリ獲得用APIを実装したオペレーティングシステムであって、
予め設定された内部データに従って複数のメモリ領域を作成するメモリ領域作成部と、
前記メモリ獲得用APIの引数として指定されたヒープIDを参照し、前記ヒープIDに関連付けられた前記メモリ領域からメモリ割り当てを実行させるメモリ割り当て部と、
を備え、
前記メモリ領域として、前記複数のプロセッサコアのローカルメモリに係るコアメモリ領域を含み、
前記ヒープIDとして、前記メモリ領域を直接指定してメモリを割り当てるための実メモリIDと、前記コアメモリ領域を動的に選択してメモリを割り当てるための仮想コアIDと、を含み、
前記ヒープIDの定義は、ユーザによって書き換え可能となっており、
前記メモリ割り当て部は、
前記実メモリIDが指定されて前記メモリ獲得用APIが呼び出されたときには、指定された実メモリIDに関連付けられた前記メモリ領域からメモリ割り当てを実行させ、
前記仮想コアIDが指定されて前記メモリ獲得用APIが呼び出されたときには、前記メモリ獲得用APIを呼び出したアプリケーションプログラムが実行されているプロセッサコアのローカルメモリに係る前記コアメモリ領域からメモリ割り当てを実行させることを特徴とする、オペレーティングシステム。
An operating system that is executed in a multi-core environment in which a plurality of processor cores each having a local memory are connected to each other, and that implements a memory acquisition API that can be called from an application program,
A memory area creation unit for creating a plurality of memory areas according to preset internal data;
A memory allocation unit that refers to a heap ID specified as an argument of the memory acquisition API and executes memory allocation from the memory area associated with the heap ID;
With
The memory area includes a core memory area related to a local memory of the plurality of processor cores,
The heap ID includes a real memory ID for directly specifying the memory area and allocating the memory, and a virtual core ID for dynamically selecting the core memory area and allocating the memory,
The definition of the heap ID can be rewritten by the user,
The memory allocation unit
When the real memory ID is specified and the memory acquisition API is called, memory allocation is executed from the memory area associated with the specified real memory ID,
When the virtual core ID is specified and the memory acquisition API is called, memory allocation is executed from the core memory area related to the local memory of the processor core in which the application program that calls the memory acquisition API is executed An operating system characterized by causing
前記メモリ領域として、1以上の前記コアメモリ領域に紐付けられたクラスタメモリ領域を含み、
前記ヒープIDとして、前記クラスタメモリ領域を動的に選択してメモリを割り当てるための仮想クラスタIDを含み、
前記メモリ割り当て部は、
前記仮想クラスタIDが指定されて前記メモリ獲得用APIが呼び出されたときには、前記メモリ獲得用APIを呼び出したアプリケーションプログラムが実行されているプロセッサコアのローカルメモリに係る前記コアメモリ領域を特定し、当該コアメモリ領域に紐付けられた前記クラスタメモリ領域からメモリ割り当てを実行させることを特徴とする、請求項1記載のオペレーティングシステム。
The memory area includes a cluster memory area linked to one or more core memory areas,
The heap ID includes a virtual cluster ID for dynamically selecting the cluster memory area and allocating memory,
The memory allocation unit
When the virtual cluster ID is specified and the memory acquisition API is called, the core memory area related to the local memory of the processor core in which the application program that called the memory acquisition API is executed is specified, and 2. The operating system according to claim 1, wherein memory allocation is executed from the cluster memory area linked to the core memory area.
前記メモリ領域として、1以上の前記クラスタメモリ領域に紐付けられたグローバルメモリ領域を含み、
前記ヒープIDとして、前記グローバルメモリ領域を動的に選択してメモリを割り当てるための仮想グローバルIDを含み、
前記メモリ割り当て部は、
前記仮想グローバルIDが指定されて前記メモリ獲得用APIが呼び出されたときには、前記メモリ獲得用APIを呼び出したアプリケーションプログラムが実行されているプロセッサコアのローカルメモリに係る前記メモリ領域を特定し、当該メモリ領域に紐付けられた前記メモリ領域を再帰的に辿って発見した前記グローバルメモリ領域からメモリ割り当てを実行させることを特徴とする、請求項2記載のオペレーティングシステム。
The memory area includes a global memory area linked to one or more cluster memory areas,
The heap ID includes a virtual global ID for dynamically selecting the global memory area and allocating memory,
The memory allocation unit
When the virtual global ID is designated and the memory acquisition API is called, the memory area related to the local memory of the processor core in which the application program that called the memory acquisition API is executed is specified, and the memory 3. The operating system according to claim 2, wherein memory allocation is executed from the global memory area found by recursively tracing the memory area associated with the area.
前記メモリ領域作成部は、前記メモリ領域でツリー構造を作成し、
前記メモリ割り当て部は、
前記ヒープIDで指定されたメモリ領域からのメモリ割り当てに失敗したときには、当該メモリ領域の上位のメモリ領域からメモリ割り当てを実行させることを特徴とする、請求項1〜3のいずれか1項に記載のオペレーティングシステム。
The memory area creation unit creates a tree structure in the memory area,
The memory allocation unit
The memory allocation is executed from a memory area higher than the memory area when the memory allocation from the memory area specified by the heap ID fails. Operating system.
請求項1〜4のいずれか1項に記載のオペレーティングシステムと、
前記ヒープIDと前記メモリ領域との関係を記述したコンフィギュレーションファイルと、
前記コンフィギュレーションファイルを読み込んで、請求項1記載のアプリケーションプログラム用のヘッダファイルと前記オペレーティングシステム用の内部データとを生成する情報生成手段と、
前記ヘッダファイルを使用して前記アプリケーションプログラムのソースコードをコンパイルするコンパイラと、
を備えることを特徴とする、プログラミングシステム。
An operating system according to any one of claims 1 to 4,
A configuration file describing the relationship between the heap ID and the memory area;
Information generating means for reading the configuration file and generating a header file for the application program according to claim 1 and internal data for the operating system;
A compiler that compiles the source code of the application program using the header file;
A programming system comprising:
それぞれローカルメモリを備えた複数のプロセッサコアを相互に接続したマルチコア環境において、アプリケーションプログラムからメモリ獲得用APIが呼び出されたときに、メモリ割り当てを実行させるためのメモリ割り当て方法であって、
予め設定された内部データに従って複数のメモリ領域を作成するステップと、
前記メモリ獲得用APIの引数として指定されたヒープIDを参照し、前記ヒープIDに関連付けられた前記メモリ領域からメモリ割り当てを実行させるステップと、
を備え、
前記メモリ領域として、前記複数のプロセッサコアのローカルメモリに係るコアメモリ領域を含み、
前記ヒープIDとして、前記メモリ領域を直接指定してメモリを割り当てるための実メモリIDと、前記コアメモリ領域を動的に選択してメモリを割り当てるための仮想コアIDと、を含み、
前記ヒープIDの定義は、ユーザによって書き換え可能となっており、
前記実メモリIDが指定されて前記メモリ獲得用APIが呼び出されたときには、指定された実メモリIDに関連付けられた前記メモリ領域からメモリ割り当てを実行させ、
前記仮想コアIDが指定されて前記メモリ獲得用APIが呼び出されたときには、前記メモリ獲得用APIを呼び出したアプリケーションプログラムが実行されているプロセッサコアのローカルメモリに係る前記コアメモリ領域からメモリ割り当てを実行させることを特徴とする、メモリ割り当て方法。
A memory allocation method for executing memory allocation when a memory acquisition API is called from an application program in a multi-core environment in which a plurality of processor cores each having a local memory are connected to each other.
Creating a plurality of memory areas according to preset internal data;
Referring to a heap ID specified as an argument of the memory acquisition API and executing memory allocation from the memory area associated with the heap ID;
With
The memory area includes a core memory area related to a local memory of the plurality of processor cores,
The heap ID includes a real memory ID for directly specifying the memory area and allocating the memory, and a virtual core ID for dynamically selecting the core memory area and allocating the memory,
The definition of the heap ID can be rewritten by the user,
When the real memory ID is specified and the memory acquisition API is called, memory allocation is executed from the memory area associated with the specified real memory ID,
When the virtual core ID is specified and the memory acquisition API is called, memory allocation is executed from the core memory area related to the local memory of the processor core in which the application program that calls the memory acquisition API is executed A method of allocating memory.
前記メモリ領域として、1以上の前記コアメモリ領域に紐付けられたクラスタメモリ領域を含み、
前記ヒープIDとして、前記クラスタメモリ領域を動的に選択してメモリを割り当てるための仮想クラスタIDを含み、
前記仮想クラスタIDが指定されて前記メモリ獲得用APIが呼び出されたときには、前記メモリ獲得用APIを呼び出したアプリケーションプログラムが実行されているプロセッサコアのローカルメモリに係る前記コアメモリ領域を特定し、当該コアメモリ領域に紐付けられた前記クラスタメモリ領域からメモリ割り当てを実行させることを特徴とする、請求項6記載のメモリ割り当て方法。
The memory area includes a cluster memory area linked to one or more core memory areas,
The heap ID includes a virtual cluster ID for dynamically selecting the cluster memory area and allocating memory,
When the virtual cluster ID is specified and the memory acquisition API is called, the core memory area related to the local memory of the processor core in which the application program that called the memory acquisition API is executed is specified, and The memory allocation method according to claim 6, wherein the memory allocation is executed from the cluster memory area linked to the core memory area.
前記メモリ領域として、1以上の前記クラスタメモリ領域に紐付けられたグローバルメモリ領域を含み、
前記ヒープIDとして、前記グローバルメモリ領域を動的に選択してメモリを割り当てるための仮想グローバルIDを含み、
前記仮想グローバルIDが指定されて前記メモリ獲得用APIが呼び出されたときには、前記メモリ獲得用APIを呼び出したアプリケーションプログラムが実行されているプロセッサコアのローカルメモリに係る前記メモリ領域を特定し、当該メモリ領域に紐付けられた前記メモリ領域を再帰的に辿って発見した前記グローバルメモリ領域からメモリ割り当てを実行させることを特徴とする、請求項7記載のメモリ割り当て方法。
The memory area includes a global memory area linked to one or more cluster memory areas,
The heap ID includes a virtual global ID for dynamically selecting the global memory area and allocating memory,
When the virtual global ID is designated and the memory acquisition API is called, the memory area related to the local memory of the processor core in which the application program that called the memory acquisition API is executed is specified, and the memory 8. The memory allocation method according to claim 7, wherein memory allocation is executed from the global memory area found by recursively tracing the memory area associated with the area.
前記メモリ領域でツリー構造を作成し、
前記ヒープIDで指定されたメモリ領域からのメモリ割り当てに失敗したときには、当該メモリ領域の上位のメモリ領域からメモリ割り当てを実行させることを特徴とする、請求項6〜8のいずれか1項に記載のメモリ割り当て方法。
Create a tree structure in the memory area,
9. The memory allocation according to claim 6, wherein when memory allocation from the memory area specified by the heap ID fails, memory allocation is executed from a memory area higher than the memory area. Memory allocation method.
JP2016029795A 2016-02-19 2016-02-19 Operating system, programming system, and memory allocation method Active JP6423809B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2016029795A JP6423809B2 (en) 2016-02-19 2016-02-19 Operating system, programming system, and memory allocation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2016029795A JP6423809B2 (en) 2016-02-19 2016-02-19 Operating system, programming system, and memory allocation method

Related Child Applications (1)

Application Number Title Priority Date Filing Date
JP2018197732A Division JP6682599B2 (en) 2018-10-19 2018-10-19 Operating system and memory allocation method

Publications (2)

Publication Number Publication Date
JP2017146895A JP2017146895A (en) 2017-08-24
JP6423809B2 true JP6423809B2 (en) 2018-11-14

Family

ID=59681644

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2016029795A Active JP6423809B2 (en) 2016-02-19 2016-02-19 Operating system, programming system, and memory allocation method

Country Status (1)

Country Link
JP (1) JP6423809B2 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10963396B1 (en) 2019-09-17 2021-03-30 Micron Technology, Inc. Memory system for binding data to a memory namespace
US11494311B2 (en) * 2019-09-17 2022-11-08 Micron Technology, Inc. Page table hooks to memory types
US11269780B2 (en) 2019-09-17 2022-03-08 Micron Technology, Inc. Mapping non-typed memory access to typed memory access
US11650742B2 (en) 2019-09-17 2023-05-16 Micron Technology, Inc. Accessing stored metadata to identify memory devices in which data is stored

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04245344A (en) * 1991-01-31 1992-09-01 Hitachi Ltd Memory control method for multiprocessor system
US6105053A (en) * 1995-06-23 2000-08-15 Emc Corporation Operating system for a non-uniform memory access multiprocessor system
JP5707265B2 (en) * 2011-07-20 2015-04-22 ルネサスエレクトロニクス株式会社 Arithmetic control device, arithmetic control method, program, and parallel processor
US9377954B2 (en) * 2014-05-09 2016-06-28 Advanced Micro Devices, Inc. System and method for memory allocation in a multiclass memory system
TWI710899B (en) * 2015-10-14 2020-11-21 南韓商三星電子股份有限公司 Computing system and operation method thereof

Also Published As

Publication number Publication date
JP2017146895A (en) 2017-08-24

Similar Documents

Publication Publication Date Title
US20210397551A1 (en) Numa-aware garbage collection
US9965324B2 (en) Process grouping for improved cache and memory affinity
JP6423809B2 (en) Operating system, programming system, and memory allocation method
US8726257B2 (en) File attributes for flexible linking
RU2569805C2 (en) Virtual non-uniform memory architecture for virtual machines
US7380086B2 (en) Scalable runtime system for global address space languages on shared and distributed memory machines
US20160335121A1 (en) Support of non-trivial scheduling policies along with topological properties
US6505286B1 (en) User specifiable allocation of memory for processes in a multiprocessor computer having a non-uniform memory architecture
US20120254267A1 (en) Numa-aware garbage collection
JPH02188833A (en) Interface for computer system
JP2007026094A (en) Execution device and application program
KR20130011961A (en) Arithmetic and control unit, arithmetic and control method, program and parallel processor
Virouleau et al. Using data dependencies to improve task-based scheduling strategies on NUMA architectures
CN1140500A (en) Distributed data base system
WO2010097312A1 (en) Non-uniform memory access (numa) enhancements for shared logical partitions
JP2019049843A (en) Execution node selection program and execution node selection method and information processor
JP2007188523A (en) Task execution method and multiprocessor system
JP5307228B2 (en) Sharing multiple operating system subprocesses across multiple tasks
US20140289739A1 (en) Allocating and sharing a data object among program instances
JP6932755B2 (en) Operating system and memory allocation method
US7386702B2 (en) Systems and methods for accessing thread private data
JP6682599B2 (en) Operating system and memory allocation method
WO2017142525A1 (en) Allocating a zone of a shared memory region
KR101140522B1 (en) System and Method for Managing Object
JP3019317B2 (en) Process scheduling method

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20180214

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20180313

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20180423

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: 20180925

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20181019

R150 Certificate of patent or registration of utility model

Ref document number: 6423809

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250