JP2009110213A - Control program and method, and computer - Google Patents
Control program and method, and computer Download PDFInfo
- Publication number
- JP2009110213A JP2009110213A JP2007281089A JP2007281089A JP2009110213A JP 2009110213 A JP2009110213 A JP 2009110213A JP 2007281089 A JP2007281089 A JP 2007281089A JP 2007281089 A JP2007281089 A JP 2007281089A JP 2009110213 A JP2009110213 A JP 2009110213A
- Authority
- JP
- Japan
- Prior art keywords
- memory consumption
- memory
- function
- virtual machine
- thread
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
Description
本発明は、仮想マシン上で実行されるプログラムに含まれ、スレッドとして実行される複数の機能の実行を制御する技術に関する。 The present invention relates to a technique for controlling execution of a plurality of functions included in a program executed on a virtual machine and executed as a thread.
仮想マシン上で動作する言語処理系(Java(登録商標)や.NET)が一般的になり、メモリ取得、解放が自動化され、開発容易性、メモリリーク防止に効果を発揮している。一方、アプリケーション側が仮想マシンが管理するメモリ領域を制御するAPI(Application Program Interface)セットは存在せず、運用中にメモリ消費に関する問題が発生しても、原因を特定し、同時実行制御、機能改善などを実施する体系的な方法は存在していない。 Language processing systems (Java (registered trademark) and .NET) that operate on virtual machines are common, memory acquisition and release are automated, and are effective in development and memory leak prevention. On the other hand, there is no API (Application Program Interface) set that controls the memory area managed by the virtual machine on the application side. Even if a memory consumption problem occurs during operation, the cause is identified, concurrent execution control, and function improvement There is no systematic way to implement these.
開発中であれば、プロファイラなどの既存製品を使用して単一機能毎にメモリ消費量を測定し、原因を特定することは可能であるが、実際の運用中では複数機能が同時並行で実行されるためメモリ消費量を特定することは不可能である。また、プロファイラのようにオーバーヘッドの大きい機能を実際の運用中に使用することは現実的ではない。 If it is under development, it is possible to measure the memory consumption for each single function using an existing product such as a profiler and identify the cause, but multiple functions are executed in parallel during actual operation. Therefore, it is impossible to specify the memory consumption. Moreover, it is not realistic to use a function with a large overhead like a profiler during actual operation.
また、特開2006−285871号公報には、情報処理装置がメモリ不足でアプリケーションを起動できないエラーになる可能性を小さくし、新たなアプリケーションの起動やインストールができなくなるといった不都合を回避するための技術が開示されている。具体的には、複数のアプリケーションが使用するメモリ量を管理する情報処理装置は、アプリケーション毎の最大メモリ使用量を取得する取得手段と、取得手段により取得したアプリケーション毎の最大メモリ使用量の和を算出する算出手段と、アプリケーションの起動要求時に、算出手段により算出したアプリケーション毎の最大メモリ使用量の和が許容量を超えたか否かに基づいて、アプリケーションの起動の可否を判断する制御手段とを備える。
図1にOS(Operating System)のメモリ管理を模式的に示す。OSは、OS上で実行されるアプリケーションなどのプロセス(仮想マシンの場合も含む)毎に、OSが管理するメモリ領域において専用のメモリ領域を割り当てる。図1の例では、プロセス1乃至nが存在しており、それぞれにプロセス1専用メモリ領域、プロセス2専用メモリ領域、...プロセスn専用メモリ領域が確保される。このように、プロセス毎に専用のメモリ領域が割り当てられるので、当該メモリ領域のサイズが特定できれば、OSが残余のメモリ容量を特定することも容易である。上記公報も、このような前提の下で述べられている。
FIG. 1 schematically shows OS (Operating System) memory management. The OS allocates a dedicated memory area in the memory area managed by the OS for each process (including a virtual machine) such as an application executed on the OS. In the example of FIG. 1,
しかしながら、OS上の仮想マシン上で実行されるプログラムに含まれ、スレッドとして実行される各機能については、図1に示したOSの場合とは異なり、簡単にメモリ消費量を特定できない。具体的には、仮想マシンは、OSから割り当てられたメモリ領域を各スレッドが使用できるように提供するが、各スレッド専用のスタック領域とは別に、共有メモリ領域(ヒープ領域)を提供する。各スレッドは、この共有メモリ領域を必要なときに必要なだけ使用する。図2の例では、スレッド3は単独で共有データBを使用しているが、共有データAについては、スレッド1及び2で共有しており、スレッド2は、共有データA及びCを使用している。このように、1つのスレッドが使用しているメモリ容量を完全には分別して特定できない。
However, for each function included in a program executed on a virtual machine on the OS and executed as a thread, unlike the OS shown in FIG. 1, the memory consumption cannot be easily specified. Specifically, the virtual machine provides a memory area allocated from the OS so that each thread can use it, but provides a shared memory area (heap area) separately from a stack area dedicated to each thread. Each thread uses this shared memory area as needed when necessary. In the example of FIG. 2, the
より具体的に、図3(a)に示す第1のスレッドと、図3(b)に示す第2のスレッドとが同時に実行される場合を想定する。ここで、第1のスレッドの開始時(MA−1)と第2のスレッドの開始時(MB−1)とにおけるメモリ残量(仮想マシンが管理するメモリ領域のメモリ残量)が「10000」であり、第1のスレッドの終了時(MA−2)と第2のスレッドの終了時(MB−2)とにおけるメモリ残量が「8950」であるものとする。これらのメモリ残量については、仮想マシンから取得できる。一方、実際には、第1のスレッドのA−1乃至A−3でのメモリ消費量が、「100」「200」「300」でトータル「600」あり、第2のスレッドのB−1乃至B−3でのメモリ消費量が「250」「50」「150」でトータル「450」であった場合にも、OSや仮想マシンを改変することなく上記のようなメモリ残量しか特定できない場合には、第1のスレッドのメモリ消費量も第2のスレッドのメモリ消費量も「10000」−「8950」=「1050」としか計算できない。 More specifically, a case is assumed in which the first thread shown in FIG. 3A and the second thread shown in FIG. Here, the remaining amount of memory (the remaining amount of memory in the memory area managed by the virtual machine) at the start of the first thread (MA-1) and the start of the second thread (MB-1) is “10000”. It is assumed that the remaining memory capacity at the end of the first thread (MA-2) and the end of the second thread (MB-2) is “8950”. The remaining memory capacity can be acquired from the virtual machine. On the other hand, in reality, the memory consumption of the first thread A-1 to A-3 is “100”, “200”, “300” and the total “600”, and the second thread B-1 to Even when the memory consumption in B-3 is “250”, “50”, “150” and the total is “450”, only the remaining memory amount as described above can be specified without modifying the OS or the virtual machine The memory consumption amount of the first thread and the memory consumption amount of the second thread can be calculated only as “10000” − “8950” = “1050”.
このように、従来においては、仮想マシン上で実行されるプログラムに含まれ、スレッドとして実行される各機能のメモリ消費量を特定するという着想自体が存在せず、また目安となる妥当な値さえも算出することができなかった。従って、新たにスレッドを実行する際に、当該スレッドを実行して問題がないのか否かについても適切に判断できなかった。また、OSや仮想マシンを改変することができれば、可能かもしれないが、改変には大きな手間が掛かり、汎用的なOSや仮想マシンを使用することが多い現状においては現実的ではない。 Thus, conventionally, there is no idea of specifying the memory consumption of each function that is included in a program executed on a virtual machine and executed as a thread, and even an appropriate reasonable value Could not be calculated. Therefore, when a new thread is executed, it has not been possible to appropriately determine whether or not there is no problem in executing the thread. Further, it may be possible if the OS and the virtual machine can be modified, but the modification takes a lot of time and is not realistic in the current situation where a general-purpose OS or virtual machine is often used.
従って、本発明の目的は、OSや仮想マシンを改変することなく、仮想マシン上で実行されるプログラムに含まれ、スレッドとして実行される各機能の実行を適切に制御するための技術を提供することである。 Therefore, an object of the present invention is to provide a technique for appropriately controlling the execution of each function that is included in a program executed on a virtual machine and executed as a thread without modifying the OS or the virtual machine. That is.
また、本発明の他の目的は、OSや仮想マシンを改変することなく、仮想マシン上で実行されるプログラムに含まれ、スレッドとして実行される各機能のメモリ消費量の適切な目安を与えることができるようにするための技術を提供することである。 Another object of the present invention is to provide an appropriate measure of the memory consumption of each function that is included in a program executed on a virtual machine and is executed as a thread without modifying the OS or the virtual machine. It is to provide a technology for making it possible.
本発明に係る制御プログラムは、仮想マシン上で実行されるプログラムに含まれ、スレッドとして実行される複数の機能の実行を制御する制御プログラムであって、コンピュータのプロセッサに、仮想マシンから、特定の機能の実行開始時における、当該仮想マシンに割り当てられたメモリの残量を取得するステップと、過去に実行された各機能の目安メモリ消費量を実行毎に格納する機能別メモリ消費量テーブルから、特定の機能についての目安メモリ消費量を抽出し、抽出された目安メモリ消費量から特定の機能のメモリ消費予測値を算出するメモリ消費予測値算出ステップと、メモリの残量とメモリ消費予測値との差が予め定められた閾値未満である場合に、特定の機能のスレッドを仮想マシンに停止させるステップとを実行させる。 A control program according to the present invention is a control program that is included in a program executed on a virtual machine and controls the execution of a plurality of functions that are executed as threads, and is transmitted from a virtual machine to a specific processor. From the step of acquiring the remaining amount of memory allocated to the virtual machine at the start of function execution and the memory consumption table by function that stores the estimated memory consumption of each function executed in the past, Extracting the estimated memory consumption for a specific function, calculating a predicted memory consumption value for the specific function from the extracted estimated memory consumption, a remaining memory amount and a predicted memory consumption value, If the difference is less than a predetermined threshold value, a step of causing the virtual machine to stop a thread having a specific function is executed.
OSや仮想マシンとは別の制御プログラムにより、特定の機能のメモリ消費予測値を算出して、メモリの残量と上記メモリ消費予測値との差に基づき適切に特定の機能の実行制御を行うことができるようになる。 A memory consumption prediction value of a specific function is calculated by a control program different from the OS and the virtual machine, and execution control of the specific function is appropriately performed based on the difference between the remaining amount of memory and the memory consumption prediction value. Will be able to.
なお、上記制御プログラムは、メモリの残量とメモリ消費予測値との差が予め定められた閾値以上である場合には、メモリの残量を含む、特定の機能のスレッドに関するデータを、実行中の機能のスレッドに関するデータを格納する実行中スレッドテーブルに登録するステップと、仮想マシンから、特定の機能の実行終了時における、仮想マシンに割り当てられたメモリの残量である当該メモリの第2の残量を取得するステップと、実行中スレッドテーブルから特定の機能のメモリの残量を取得するステップと、メモリの第2の残量とメモリの残量との差である純メモリ消費量を、特定の機能と、実行中スレッドテーブルから特定される、特定の機能と同時実行されている他の機能とで按分して、特定の機能についての目安メモリ消費量を算出する目安メモリ消費量算出ステップと、特定の機能についての目安メモリ消費量を機能別メモリ消費量テーブルに登録するステップとをさらに実行させる。 When the difference between the remaining amount of memory and the predicted memory consumption value is equal to or greater than a predetermined threshold, the control program is executing data related to a thread with a specific function, including the remaining amount of memory. A step of registering in the executing thread table storing data relating to the thread of the function of the second, and a second of the memory that is the remaining amount of memory allocated to the virtual machine at the end of execution of the specific function from the virtual machine A step of obtaining a remaining amount, a step of obtaining a remaining amount of memory of a specific function from an executing thread table, and a net memory consumption which is a difference between a second remaining amount of memory and a remaining amount of memory, The estimated memory consumption for a specific function is calculated by apportioning it between the specific function and the other function that is specified from the executing thread table and is being executed at the same time. And Estimated memory consumption calculating step of, further to execute a measure memory consumption and registering by function memory consumption table for a particular function.
このように特定の機能の目安メモリ消費量を算出することができるので、例えば、機能別メモリ消費量テーブルを解析して、問題のある機能を抽出して、改善などを行うことができるようになる。 In this way, the estimated memory consumption of a specific function can be calculated. For example, it is possible to analyze a memory consumption table for each function, extract problematic functions, and make improvements. Become.
さらに、上で述べたメモリ消費予測値算出ステップが、抽出された目安メモリ消費量の平均値を算出するステップと、抽出された目安メモリ消費量と目安メモリ消費量の平均値との差の絶対値の平均値の所定割合を分散リスク値として算出するステップと、目安メモリ消費量の平均値と分散リスク値との和をメモリ消費予測値として算出するステップとを含むようにしてもよい。分散リスク値を加算することなく、その分閾値を調整するような構成も可能である。 Further, the memory consumption prediction value calculating step described above calculates the average value of the extracted standard memory consumption, and the absolute difference between the extracted standard memory consumption and the average value of the standard memory consumption. You may make it include the step which calculates the predetermined ratio of the average value of a value as a dispersion | distribution risk value, and the step which calculates the sum of the average value of standard memory consumption, and a dispersion | distribution risk value as a memory consumption prediction value. A configuration in which the threshold value is adjusted by that amount without adding the variance risk value is also possible.
また、上で述べた目安メモリ消費量算出ステップが、特定の機能の目安メモリ消費量の平均値を取得(例えば機能別メモリ消費量テーブルから計算する場合もあれば、キャッシュに保持しているデータを読み出す場合もある)するステップと、実行中スレッドテーブルから特定される、特定の機能と同時実行されている他の機能の各々について、目安メモリ消費量の平均値を取得(例えば機能別メモリ消費量テーブルから計算する場合もあれば、キャッシュに保持しているデータを読み出す場合もある)するステップと、特定の機能の目安メモリ消費量の平均値と、他の機能の各々の目安メモリ消費量の平均値の所定割合とで、純メモリ消費量を按分して、特定の機能の目安メモリ消費量を算出するステップとを含むようにしてもよい。所定割合は、例えば同時実行スレッドの同時実行度合いに応じて設定される。 In addition, the reference memory consumption calculation step described above obtains the average value of the reference memory consumption of a specific function (for example, it may be calculated from the memory consumption table by function, or the data held in the cache) The average memory consumption is acquired for each of the other functions that are specified from the executing thread table and other functions that are executed simultaneously with the specific function (for example, memory consumption by function) (It may be calculated from the amount table or the data held in the cache may be read out), the average value of the estimated memory consumption of a specific function, and the estimated memory consumption of each of the other functions And calculating a reference memory consumption amount of a specific function by apportioning the pure memory consumption amount with a predetermined ratio of the average value. The predetermined ratio is set according to, for example, the degree of simultaneous execution of simultaneous execution threads.
さらに、上で述べたメモリ消費予測値算出ステップが、過去に実行された各機能の目安メモリ消費量を実行毎に格納する機能別メモリ消費量テーブルから、特定の機能についての目安メモリ消費量を所定実行数分抽出できたか判断するステップを含むようにしてもよい。そして、目安メモリ消費量を所定実行数分抽出できない場合には、メモリの残量を含む、特定の機能のスレッドに関するデータを、実行中の機能のスレッドに関するデータを格納する実行中スレッドテーブルに登録するステップをさらに実行させるようにしてもよい。機能別メモリ消費量テーブルにデータが十分蓄積されていない場合の処理を規定するものである。 In addition, the memory consumption prediction value calculation step described above calculates the estimated memory consumption for a specific function from the memory consumption table for each function that stores the estimated memory consumption for each function executed in the past. A step of determining whether a predetermined number of executions have been extracted may be included. If the target memory consumption cannot be extracted for the predetermined number of executions, the data related to the thread of the specific function including the remaining memory capacity is registered in the executing thread table that stores the data related to the thread of the function being executed. This step may be further executed. This defines the processing when data is not sufficiently stored in the function-specific memory consumption table.
なお、本プログラムは、例えばフレキシブルディスク、CD−ROM、光磁気ディスク、半導体メモリ、ハードディスク等の記憶媒体又は記憶装置に格納される。また、ネットワークなどを介してデジタル信号として配信される場合もある。尚、中間的な処理結果はメインメモリ等の記憶装置に一時保管される。 The program is stored in a storage medium or storage device such as a flexible disk, CD-ROM, magneto-optical disk, semiconductor memory, or hard disk. Moreover, it may be distributed as a digital signal via a network or the like. The intermediate processing result is temporarily stored in a storage device such as a main memory.
本発明によれば、OSや仮想マシンを改変することなく、仮想マシン上で実行されるプログラムに含まれ、スレッドとして実行される各機能の実行を適切に制御することができるようになる。 According to the present invention, it is possible to appropriately control the execution of each function that is included in a program executed on a virtual machine and executed as a thread without modifying the OS or the virtual machine.
また、本発明の他の側面によれば、OSや仮想マシンを改変することなく、仮想マシン上で実行されるプログラムに含まれ、スレッドとして実行される各機能のメモリ消費量の適切な目安を与えることができるようになる。 In addition, according to another aspect of the present invention, an appropriate measure of the memory consumption of each function that is included in a program executed on a virtual machine and executed as a thread without modifying the OS or the virtual machine. Will be able to give.
図4に、本発明の一実施の形態に係るプログラム構成を示す。図4に示すように、OS1上、1つのプロセスとして仮想マシン10が実行される。OS1は、仮想マシン10に専用のメモリ領域を割り当て、仮想マシン10はその専用メモリ領域を利用して実行される。また、仮想マシン10上、様々なスレッドが起動される。例えば、リクエストの受け付け、実行すべき機能の判定、実行機能の呼び出しなどを実施するサーバ・プログラム11と、例えばサーバ・プログラム11によって呼び出され且つメモリ消費量の測定対象及びスレッド起動の制御対象となる測定対象プログラム12とが仮想マシン10上スレッドとして実行される。さらに、測定対象プログラム12から呼び出され且つ本実施の形態における主要な処理を実施するメモリ管理モジュール14や、測定対象プログラム12によって利用される各種ライブラリ13も、仮想マシン10上で実行される。なお、測定対象プログラム12には、以下で述べるように、コンパイル時にメモリ管理モジュール14を呼び出すコードが自動的に追加され、呼び出されたメモリ管理モジュール14によって実行制御が行われるようになる。メモリ管理モジュール14は、機能別メモリ消費量テーブル141及び実行中スレッドテーブル142を用いて処理を実施する。また、機能別平均メモリ消費量テーブル143を用いる場合もある。
FIG. 4 shows a program configuration according to an embodiment of the present invention. As shown in FIG. 4, the
図5に、機能別メモリ消費量テーブル141の一例を示す。測定対象プログラム12の、スレッドとして実行される、予め定められた機能が実行される毎に、1レコードが生成され、図5の例では、各レコードにつき、通番、機能ID(例えば、Java(登録商標)の場合には、パッケージ名.クラス名#メソッド名、C#の場合には、ネームスペース名.クラス名#メソッド名といった関数又はサブルーチンを一意に表す名前)、時刻、目安メモリ消費量を登録するようになっている。
FIG. 5 shows an example of the function-specific memory consumption table 141. Each time a predetermined function executed as a thread of the
図6に、実行中スレッドテーブル142の一例を示す。実行中スレッドテーブル142には、現在実行中のスレッドが列挙されるようになっており、図6の例では、実行中の各スレッドにつき、スレッドID、機能ID、開始時点メモリ残量、同時実行機能名とが登録されるようになっている。 FIG. 6 shows an example of the executing thread table 142. The currently executing thread table 142 is listed in the executing thread table 142. In the example of FIG. 6, the thread ID, the function ID, the start memory remaining amount, and the simultaneous execution are executed for each thread being executed. Function names are registered.
図7に、機能別平均メモリ消費量テーブル143の一例を示す。本テーブルについては使用しない方法もあるが、使用すれば処理が高速化される。機能別平均メモリ消費量テーブル143には、1つの機能につき1つのレコードが登録されるようになっており、機能IDと、平均メモリ消費量(以下で詳細に説明する)と、最終更新時刻とを登録するようになっている。なお、最終更新時刻が、所定の基準より古いレコードについては、そのレコードを用いることなく、別途平均メモリ消費量を算出することが好ましい。
FIG. 7 shows an example of the average memory consumption table 143 classified by function. Although there is a method that does not use this table, the use of this table speeds up the processing. In the average memory consumption table by
なお、仮想マシン上で動作するプログラム(例えばサーバ・プログラム11等)は、仮想マシン10に対して以下のような事項を命じることができる。
・プログラムは、仮想マシン10に命令することで、スレッドを生成、消滅させることができる。
・プログラムは、仮想マシン10に命令することで、実行中のスレッドを停止させることや、停止中のスレッドを再実行させることができる。
・プログラムは、仮想マシン10に命令して、メモリ領域を使用する(メモリ領域にデータを置く)ことができる。
・プログラムは、仮想マシン10に問い合わせることで、「メモリ領域のトータル」と「メモリ領域の使用量」を知ることができる。すなわち、メモリ残量を把握することができる。
・プログラムは、仮想マシン10に命令して、現在自スレッドが実行しているプログラムの手順を、他スレッドが実行しようとしたときに開始を待たせる(排他制御を行う)ことができる。
Note that a program (for example, the
A program can generate and extinguish threads by instructing the
The program can stop the currently executing thread and re-execute the stopped thread by instructing the
The program can instruct the
The program can know “total memory area” and “memory area usage” by making an inquiry to the
The program can instruct the
次に、図4に示したプログラム構成の詳細を図8を用いて説明する。サーバ・プログラム11は、リクエストの受け付け、実行すべき機能を判定し、実行すべき機能の呼び出しを行う。図8の例では、機能ID:com.fuji.xxx.XClass#FunctionAという機能21と、機能ID:com.fuji.xxx.XClass#FunctionBという機能22とを、リクエストに応じて呼び出す。どの関数やサブルーチンを機能と定義するかは任意であって、メモリ消費量を測定したい単位又はスレッドの起動を制御するのに適切な単位で設定することが好ましい。但し、実際には、アプリケーションの開発においては、一定のルールに従ってクラス名やメソッド名を付与するので、当該ルールに従って機能を定義することも可能である。
Next, details of the program configuration shown in FIG. 4 will be described with reference to FIG. The
機能21は、機能開始処理部211、本来の処理部212及び機能終了処理部213を含む。機能開始処理部211及び機能終了処理部213は、本実施の形態において、例えば本来の処理部212に対してアスペクト指向技術等によって自動的に埋め込まれる部分であり、メモリ管理モジュール14を呼び出す。本来の処理部212は、機能21の本来の処理を行う部分である。必要に応じて、共通処理モジュール23を呼び出す場合もある。
The
同様に、機能22は、機能開始処理部221、本来の処理部222及び機能終了処理部223を含む。機能開始処理部221及び機能終了処理部223は、本実施の形態において、例えば本来の処理部222に対してアスペクト指向技術等によって自動的に埋め込まれる部分であり、メモリ管理モジュール14を呼び出す。本来の処理部222は、機能22の本来の処理を行う部分である。必要に応じて、共通処理モジュール23を呼び出す場合もある。
Similarly, the
次に、図8に示したプログラムの処理の概要を図9を用いて説明する。まず、スレッド1で、サーバ・プログラム11の実行が開始され、例えばエンドユーザからの機能実行リクエストの待ち受け状態となり、停止する(サーバ・プログラム手順1)。ここで、エンドユーザから機能実行リクエストを受け取ると、サーバ・プログラム11は処理を再開し、機能判定処理を実施する(サーバ・プログラム手順2)。実行すべき機能が特定されると、並列処理のため仮想マシン10に対して新たなスレッド2を生成させ、実行すべき機能の実行を行わせる(サーバ・プログラム手順3)。その後、スレッド1では、サーバ・プログラム手順1に戻る。なお、スレッド2における機能の実行が終了すると、サーバ・プログラム11においても終了処理を実施する場合もあるが、ここでは本実施の形態の主旨とははずれるため、説明を省略する。
Next, the outline of the processing of the program shown in FIG. 8 will be described with reference to FIG. First, the execution of the
サーバ・プログラム11の命令によって仮想マシン10によって生成されるスレッド2では、例えば機能21が実行されるものとする。機能21では、最初に機能開始処理部211における、メモリ管理モジュール14の呼び出しコードが実行され、メモリ管理モジュール14の機能開始処理が実行される(プログラム手順M−1)。このメモリ管理モジュール14の機能開始処理については後に詳述する。このメモリ管理モジュール14の機能開始処理が終了すると、本来の処理部212による処理(手順A−1乃至A−4)を実行する。なお、図8に示したように、必要に応じて共通処理モジュール23を呼び出すようにしても良い。
For example, the
そして、本来の処理部212の処理が完了すると、機能21の機能終了処理部213におけるメモリ管理モジュール14の呼び出しコードが実行され、メモリ管理モジュール14の機能終了処理が実行される(プログラム手順M−2)。このメモリ管理モジュール14の機能終了処理については後に詳述する。そして、スレッド2の実行を終了させ、仮想マシン10によりスレッド2を消滅させる。
When the processing of the
以下、図10乃至図16を用いて、メモリ管理モジュール14の機能開始処理について詳しく述べる。最初に、メモリ管理モジュール14は、他スレッド排他命令を仮想マシン10に出力する(ステップS1)。これによって、他のスレッドにおいてメモリ管理モジュール14を呼び出したとしても、他スレッド排他解除命令が出されるまで、本スレッド以外では、メモリ管理モジュール14の機能開始処理は実行されない。
Hereinafter, the function start processing of the
次に、メモリ管理モジュール14は、メモリ残量を仮想マシン10から取得する(ステップS3)。仮想マシン10の既存機能を利用するものである。そして、メモリ管理モジュール14は、機能別メモリ消費予測値算出処理を実施する(ステップS5)。この機能別メモリ消費予測値算出処理については、図11乃至図16を用いて説明する。
Next, the
まず、メモリ管理モジュール14は、機能別メモリ消費量テーブル141を、本機能ID及び予測対象期間により検索し、該当レコードを抽出する(ステップS21)。機能IDについては、例えばメモリ管理モジュール14を呼び出した際に、機能21の機能開始処理部211から取得するようにする。また、予測対象期間は、図12に示すようなメモリ管理モジュール14の設定パラメータのうちの1つであり、例えば一週間(=604800秒)といった数値が設定される。ステップS21で抽出されるレコードの一例を、図13に示す。ここでは8レコードが抽出されたものとする。
First, the
そして、メモリ管理モジュール14は、停止判定閾値以上のレコードが抽出されたか判断する(ステップS23)。停止判定閾値は、図12に示すようなメモリ管理モジュール14の設定パラメータのうちの1つであり、例えば「5」といった数値が設定される。停止判定閾値以上のレコードが抽出されていない場合には、件数が少なく予測精度が低いので、スレッド停止不要として設定し、元の処理に戻る(ステップS25)。
Then, the
一方、停止判定閾値以上のレコードが抽出できた場合には、メモリ管理モジュール14は、抽出レコードからメモリ消費量平均値を算出し、所定のメモリ領域に格納する(ステップS27)。図13の例では、停止判定閾値が「5」で抽出レコード数が「8」であるから、メモリ消費量の平均値を算出する。図13の例では、メモリ消費量平均値は「9750」と算出される。なお、本ステップにおいて算出されたメモリ消費量平均値については、機能別平均メモリ消費量テーブル143に登録して、後に用いるようにしても良い。
On the other hand, if a record equal to or greater than the stop determination threshold value can be extracted, the
また、メモリ管理モジュール14は、抽出レコードにおける各メモリ消費量の上記メモリ消費量平均値からの差の絶対値の平均を算出し、所定のメモリ領域に格納する(ステップS29)。図13の例では、メモリ消費量平均値からの差の絶対値は、上から順に「2250」「2750」「250」「750」「250」「1250」「1750」「1250」となる。従って、この平均は、「1312.5」と算出される。
In addition, the
そして、メモリ管理モジュール14は、差の絶対値の平均と分散許容値との積によって分散リスク値を算出し、所定のメモリ領域に格納する(ステップS31)。分散許容値は、図12に示すようなメモリ管理モジュール14の設定パラメータのうちの1つであり、例えば「0.8」といった数値が設定される。分散リスク値は、メモリ消費量平均値からのマージンに相当する。図13の例では、1312.5×0.8=1050が分散リスク値として算出される。その後、メモリ管理モジュール14は、メモリ消費量平均値と分散リスク値との和により機能別メモリ消費予測値を算出し、所定のメモリ領域に格納する(ステップS33)。図13の例では、機能別メモリ消費予測値は9750+1050=10800と算出される。そして元の処理に戻る。
Then, the
図10の説明に戻って、メモリ管理モジュール14は、本スレッド(スレッド2)の停止が必要であるか判断する(ステップS7)。本ステップでは、ステップS25でスレッド停止不要が設定されていれば、スレッド停止不要と判断し、それ以外の場合には、ステップS3で取得したメモリ残量とステップS33で算出された機能別メモリ消費予測値との差が、メモリ残量許容量より小さいか判断し、小さい場合には、メモリ不足が予測されるので、スレッド停止が必要と判断する。一方、メモリ残量と機能別メモリ消費予測値との差がメモリ残量許容量以上である場合には、スレッド停止は不要と判断する。メモリ残量許容量は、図12に示すようなメモリ管理モジュール14の設定パラメータの1つであり、例えば「1000」といった数値が設定される。例えば、メモリ残量が「20000」であったとすると、図13の例では、「20000」−「10800」=「9200」であり、メモリ残量許容量より多いので、スレッドの停止は不要と判断される。
Returning to the description of FIG. 10, the
なお、ステップS7でスレッド停止が必要と判断された場合には、メモリ管理モジュール14は、他スレッド排他解除命令及び本スレッド(スレッド2)の停止命令を仮想マシン10に出力する(ステップS9)。そしてステップS1に戻る。これにより、仮想マシン10は、メモリ管理モジュール14の排他状態を解除して、他スレッドによる実行を許可するようになる。さらに、スレッド2の実行を停止させる。
If it is determined in step S7 that the thread must be stopped, the
一方、スレッド停止が不要と判断された場合には、メモリ管理モジュール14は、実行中スレッドテーブル142の全レコードの同時実行機能に、本機能IDを追加登録する(ステップS11)。例えばステップS11実行前に図14のような実行中スレッドテーブル142が存在している場合には、ステップS11実行によって図15に示すような実行中スレッドテーブルに変化する。すなわち、スレッド2で実行中の機能がFuncA(又はFunctionA)だとすると、FuncAが、実行中スレッドテーブルの各レコードの同時実行機能名の列に追加登録される(太字)。
On the other hand, if it is determined that thread stop is unnecessary, the
さらに、メモリ管理モジュール14は、実行中スレッドテーブル142に、本スレッドについてのデータを登録する(ステップS13)。すなわち、図16に示すような状態となる。具体的には、3行目のスレッドID「3」、機能ID「FuncA」、開始時点メモリ残量「20000」、同時実行機能「FuncX,FuncY」が登録される(太字)。なお、同時実行機能の列については、既に登録済みの第1及び第2行目の機能IDが登録される。
Further, the
そして、メモリ管理モジュール14は、仮想スレッド排他解除命令を仮想マシン10に出力する(ステップS15)。これによって、他のスレッドにおいてメモリ管理モジュール14を呼び出すことができるようになる。そして、機能21の本来の処理を実行する。
Then, the
以上のような処理を実施することによって、十分メモリに余裕があると判断された場合にはスレッドの実行を継続し、メモリ不足が予測される場合にはスレッドの実行を停止させて、システム全体の稼働を安定化させることができるようになる。 By executing the above process, if it is determined that there is sufficient memory, the thread will continue to be executed. If memory shortage is predicted, the thread will be stopped and the entire system will be stopped. The operation of can be stabilized.
なお、本実施の形態では、機能別メモリ消費予測値を算出する際に、分散リスク値を算出してメモリ消費量平均値に加算する方法を採用しているが、簡易的には分散リスク値を採用せずメモリ残量許容値に適当なメモリ容量を上乗せして判断するような方法でも可能である。さらに、設定パラメータは、実行環境に応じて適切に設定する必要があり、図12の例は一例である。 In this embodiment, when calculating the memory consumption predicted value by function, a method of calculating the variance risk value and adding it to the memory consumption average value is adopted. It is also possible to use a method in which the determination is made by adding an appropriate memory capacity to the memory remaining capacity allowable value without adopting. Furthermore, the setting parameters need to be set appropriately according to the execution environment, and the example of FIG. 12 is an example.
次に、メモリ管理モジュール14の機能終了処理について図17乃至図20を用いて説明する。メモリ管理モジュール14は、他スレッド排他命令を仮想マシン10に出力する(ステップS41)。ステップS1と同様である。そして、メモリ管理モジュール14は、実行中スレッドテーブル142から本機能の開始時点メモリ残量を読み出す(ステップS43)。図16のような実行中スレッドテーブル142であれば、3行目から開始時点メモリ残量の「20000」というデータを読み出す。
Next, the function end process of the
そして、メモリ管理モジュール14は、現時点におけるメモリ残量を仮想マシン10から終了時点メモリ残量として取得する(ステップS45)。例えば、ここでは「4000」というデータが取得されたものとする。本実施の形態では、様々な機能によって仮想マシン10に割り当てられたメモリは消費されていって、メモリ残量が減少することを前提としている。しかし、仮想マシン10に含まれるメモリ管理部によってガベージコレクションが行われて、メモリ残量が増加する場合もある。そのような場合には、以下の処理で目安メモリ消費量を算出することはできないので、そのような場合にはステップS51に移行する。
Then, the
そして、メモリ管理モジュール14は、目安メモリ消費量計算処理を実施する(ステップS47)。目安メモリ消費量計算処理については図18を用いて説明する。まず、メモリ管理モジュール14は、開始時点メモリ残量から終了時点メモリ残量を差し引き、純メモリ消費量を算出し、所定のメモリ領域に格納する(ステップS61)。上の例では「20000」−「4000」=「16000」と計算される。但し、純メモリ消費量は、他の機能が消費した分を含む。
Then, the
次に、メモリ管理モジュール14は、実行中スレッドテーブル142から全同時実行機能を特定する(ステップS63)。このスレッドで実行中の機能を含め、全ての同時実行機能を特定する。図15の例では3つの機能(FuncX、FuncY及びFuncA)が特定される。そして、全同時実行機能IDのうち未処理のものを1つ特定する(ステップS65)。さらに、機能別メモリ消費量テーブル141を、特定された機能ID及び予測対象期間(図12)で検索し、該当するレコードを特定する(ステップS67)。ステップS21と同様の処理を行う。そして、メモリ管理モジュール14は、停止判定閾値(図12)以上のレコードが抽出できたか判断する(ステップS69)。停止判定閾値以上のレコードが抽出できない場合には、メモリ消費量平均値を算出するのに不適切であるものとして、全同時実行機能のメモリ消費量を同一の値として、純メモリ消費量を按分することによって、目安メモリ消費量を算出する(ステップS71)。そして、元の処理に移行する。
Next, the
一方、停止判定閾値以上のレコードが抽出できた場合には、メモリ管理モジュール14は、抽出されたレコードにおけるメモリ消費量を平均することによって、メモリ消費量平均値を算出し、所定のメモリ領域に格納する(ステップS73)。
On the other hand, if a record equal to or greater than the stop determination threshold value can be extracted, the
そして、メモリ管理モジュール14は、全同時実行機能について処理を行ったか判断する(ステップS75)。未処理の機能が存在する場合には、ステップS65に戻る。
Then, the
このようにして、上で述べた例では、FuncXのメモリ消費量平均値(例えば「5000」)、FuncYのメモリ消費量平均値(例えば「6000」)及びFuncAのメモリ消費量平均値(例えば「9750」)が算出される。なお、機能別平均メモリ消費量テーブル143を用いる場合には、所定時間以内の計算結果(すなわちメモリ消費量平均値)が格納されているかをステップS65の後に確認し、所定時間以内の計算結果が存在する場合にはステップS67乃至S73をスキップし、所定時間以内の計算結果が存在しない場合には上で述べたステップS67乃至S73を実行するようにしても良い。また、ステップS67乃至S73を実行した場合には、計算されたメモリ消費量平均値を、機能別平均メモリ消費量テーブル143に登録しておく。
Thus, in the example described above, the memory consumption average value of FuncX (for example, “5000”), the memory consumption average value of FuncY (for example, “6000”), and the memory consumption average value of FuncA (for example, “ 9750 ") is calculated. When the average memory consumption table by
全同時実行機能について処理が完了した場合には、メモリ管理モジュール14は、純メモリ消費量を全同時実行機能のメモリ消費量平均値を用いて仮想的に按分することによって、目安メモリ消費量を算出し、所定のメモリ領域に格納する(ステップS77)。具体的には、純メモリ消費量(16000)×本機能のメモリ消費量平均値(9750)/(本機能のメモリ消費量平均値(9750)+(第1の同時実行機能(FuncX)のメモリ消費量平均値(5000))/2+(第2の同時実行機能(FuncY)のメモリ消費量平均値(6000))/2+....)=「10229」という計算を行う。第1及び第2の同時実行機能のメモリ消費量平均値を「2」で割っているのは、これらの機能を実行しているスレッドが、50%程度実行が進んでいることを前提としているものである。このように仮想的に按分するのは、純メモリ消費量における同時実行機能のメモリ消費の寄与がどの程度かについては完全に分別することができないためである。従って、目安メモリ消費量は正確な値ではないが、ある程度の精度でも計算できれば、機能開始処理でもスレッド実行の制御をある程度の精度で実行することができる。また、別途機能別メモリ消費量テーブル141を解析して、例えば特定の機能の目安メモリ消費量が特別に大きいなどの問題を抽出することができ、さらにプログラムの改善などを判断することができるようになる。
When the processing for all the simultaneous execution functions is completed, the
図17の処理に戻って、メモリ管理モジュール14は、機能別メモリ消費量テーブル141にレコードを追加する(ステップS49)。例えば図19の最終行(通番100)に示すようなレコードを追加する。さらに、メモリ管理モジュール14は、実行中スレッドテーブル142から本スレッドに対応するレコードを削除する(ステップS51)。例えば図20に示すように、最終行のレコードが削除される。
Returning to the processing of FIG. 17, the
最後に、メモリ管理モジュール14は、他スレッド再起動命令を仮想マシン10に出力する(ステップS53)。これによって、例えばステップS9で停止していたスレッドが再起動される。さらに、メモリ管理モジュール14は、仮想スレッド排他解除命令を仮想マシン10に出力する(ステップS55)。
Finally, the
以上のように機能終了処理を実施することによって、機能別メモリ消費量テーブル141が更新され、後の機能開始処理でより適切なスレッド実行制御を行うことができるようになる。また、別途解析することによって、問題のある機能を特定して改修するなどの処置を行うことができるようになる。 By performing the function end process as described above, the function-specific memory consumption table 141 is updated, and more appropriate thread execution control can be performed in the subsequent function start process. Further, by separately analyzing, it becomes possible to take measures such as identifying and repairing the problematic function.
また、図3の例を、本実施の形態で処理した場合(第1のスレッドで実行された機能のメモリ消費量平均値が「550」で第2のスレッドで実行された機能のメモリ消費量平均値が「500」。)には、第1のスレッドで実行された機能については、(10000−8950)×550/(550+500/2)=722となり、第2のスレッドで実行された機能については、(10000−8950)×500/(500+550/2)=677となる。このように、図3の例で示した想定のメモリ消費量とは差はあるが、開始時点のメモリ残量と終了時点のメモリ残量との差(=1050)を用いるよりは、より適切な目安メモリ消費量を得ることができている。なお、実際の運用中に、上記のような想定のメモリ消費量を把握することは困難である。 Further, when the example of FIG. 3 is processed according to the present embodiment (the memory consumption average value of functions executed in the first thread is “550”, the memory consumption of functions executed in the second thread) For the function executed in the first thread, the average value is “500”. (10000-8950) × 550 / (550 + 500/2) = 722, and the function executed in the second thread Is (10000-8950) × 500 / (500 + 550/2) = 677. Thus, although there is a difference from the assumed memory consumption shown in the example of FIG. 3, it is more appropriate than using the difference (= 1050) between the memory remaining amount at the start time and the memory remaining amount at the end time. A reasonable amount of memory consumption can be obtained. Note that it is difficult to grasp the estimated memory consumption as described above during actual operation.
なお、測定対象プログラム12に、上で述べたようなメモリ管理モジュール14に対する呼び出し関係を設定するには、既存のアスペクト指向に基づくコンパイラを用いればよい。例えば図21に示すように、測定対象プログラム12のソースコードと、メモリ管理モジュール14の取り付け箇所情報とを、アスペクト指向に基づくコンパイラに入力すると、メモリ管理モジュール14の呼び出しコードが挿入された測定対象プログラム12(実行モジュール)が生成される。なお、取り付け箇所情報は、例えば「ソースコードファイル名+関数名」の一覧表であってもよい。但し、取り付け箇所は、本実施の形態の目的からして、機能の開始地点及び終了地点となる関数である。このような関数があるソースコードファイル名や関数名は、プログラム開発をする上で保守を考慮して、所定のルールに則って付される場合が多い。従って、現実的には、「ソースコードファイル名「〜Function」の「execute」関数の全て」といった形で、取り付け箇所を指定することが可能である。
Note that an existing aspect-oriented compiler may be used to set the call relationship to the
以上本発明の一実施の形態を説明したが、本発明はこれに限定されるものではない。例えば、図4において、メモリ管理モジュール14内に、機能別メモリ消費量テーブル141、実行中スレッドテーブル142、機能別平均メモリ消費量テーブル143を設ける例を示したが、図22に示すように、例えば上記テーブルを管理するようなデータベースサーバ30を、別のスレッドとして仮想マシン10上に設けたり、さらに他のコンピュータ上に設けるような構成であっても良い。
Although one embodiment of the present invention has been described above, the present invention is not limited to this. For example, FIG. 4 shows an example in which the function-specific memory consumption table 141, the executing thread table 142, and the function-specific average memory consumption table 143 are provided in the
その他、処理結果が変わらなければ、処理ステップの順番を入れ替えても良い場合もある。 In addition, if the processing result does not change, the order of the processing steps may be changed.
また、サーバ・プログラム11を用いる例を示したが、必ずサーバ・プログラム11を用いなければならないわけではない。
Moreover, although the example using the
なお、上で述べたOS等のプログラムを実行するコンピュータにおいては、図23に示すように、メモリ2501(記憶部)とCPU2503(処理部)とハードディスク・ドライブ(HDD)2505と表示装置2509に接続される表示制御部2507とリムーバブル・ディスク2511用のドライブ装置2513と入力装置2515とネットワークに接続するための通信制御部2517とがバス2519で接続されている。OS及びWebブラウザを含むアプリケーション・プログラムは、HDD2505に格納されており、CPU2503により実行される際にはHDD2505からメモリ2501に読み出される。必要に応じてCPU2503は、表示制御部2507、通信制御部2517、ドライブ装置2513を制御して、必要な動作を行わせる。また、処理途中のデータについては、メモリ2501に格納され、必要があればHDD2505に格納される。このようなコンピュータは、上で述べたCPU2503、メモリ2501などのハードウエアとOS及び必要なアプリケーション・プログラムとが有機的に協働することにより、上で述べたような各種機能を実現する。
As shown in FIG. 23, the computer executing the program such as the OS described above is connected to a memory 2501 (storage unit), a CPU 2503 (processing unit), a hard disk drive (HDD) 2505, and a
(付記1)
仮想マシン上で実行されるプログラムに含まれ、スレッドとして実行される複数の機能の実行を制御する制御プログラムであって、
コンピュータのプロセッサに、
前記仮想マシンから、特定の機能の実行開始時における、当該仮想マシンに割り当てられたメモリの残量を取得するステップと、
過去に実行された各前記機能の目安メモリ消費量を実行毎に格納する機能別メモリ消費量テーブルから、前記特定の機能についての前記目安メモリ消費量を抽出し、抽出された前記目安メモリ消費量から前記特定の機能のメモリ消費予測値を算出するメモリ消費予測値算出ステップと、
前記メモリの残量と前記メモリ消費予測値との差が予め定められた閾値未満である場合に、前記特定の機能のスレッドを前記仮想マシンに停止させるステップと、
を実行させるための制御プログラム。
(Appendix 1)
A control program that is included in a program executed on a virtual machine and controls execution of a plurality of functions executed as threads,
Computer processor,
Obtaining from the virtual machine the remaining amount of memory allocated to the virtual machine at the start of execution of a specific function;
The reference memory consumption for each specific function is extracted from the memory consumption table for each function that stores the reference memory consumption for each function executed in the past, and the extracted reference memory consumption is extracted. A memory consumption prediction value calculating step for calculating a memory consumption prediction value of the specific function from:
When the difference between the remaining amount of memory and the memory consumption prediction value is less than a predetermined threshold, causing the virtual machine to stop the thread of the specific function;
A control program to execute.
(付記2)
前記メモリの残量と前記メモリ消費予測値との差が前記予め定められた閾値以上である場合には、前記メモリの残量を含む、前記特定の機能のスレッドに関するデータを、実行中の機能のスレッドに関するデータを格納する実行中スレッドテーブルに登録するステップと、
前記仮想マシンから、前記特定の機能の実行終了時における、前記仮想マシンに割り当てられたメモリの残量である当該メモリの第2の残量を取得するステップと、
前記実行中スレッドテーブルから前記特定の機能の前記メモリの残量を取得するステップと、
前記メモリの第2の残量と前記メモリの残量との差である純メモリ消費量を、前記特定の機能と、前記実行中スレッドテーブルから特定される、前記特定の機能と同時実行されている他の機能とで按分して、前記特定の機能についての前記目安メモリ消費量を算出する目安メモリ消費量算出ステップと、
前記特定の機能についての前記目安メモリ消費量を前記機能別メモリ消費量テーブルに登録するステップと、
をさらに前記プロセッサに実行させるための付記1記載の制御プログラム。
(Appendix 2)
When the difference between the remaining amount of the memory and the predicted memory consumption value is equal to or greater than the predetermined threshold, the data regarding the thread of the specific function including the remaining amount of the memory is being executed. Registering in the running thread table to store data about threads of
Obtaining from the virtual machine a second remaining amount of the memory that is the remaining amount of memory allocated to the virtual machine at the end of execution of the specific function;
Obtaining the remaining amount of the memory of the specific function from the executing thread table;
The net memory consumption, which is the difference between the second remaining amount of the memory and the remaining amount of the memory, is simultaneously executed with the specific function and the specific function specified from the executing thread table. An estimated memory consumption calculating step for calculating the estimated memory consumption for the specific function by dividing with other functions
Registering the estimated memory consumption for the specific function in the function-specific memory consumption table;
The control program according to
(付記3)
前記メモリ消費予測値算出ステップが、
抽出された前記目安メモリ消費量の平均値を算出するステップと、
抽出された前記目安メモリ消費量と前記目安メモリ消費量の平均値との差の絶対値の平均値の所定割合を分散リスク値として算出するステップと、
前記目安メモリ消費量の平均値と前記分散リスク値との和を前記メモリ消費予測値として算出するステップと、
を含む付記1記載の制御プログラム。
(Appendix 3)
The memory consumption predicted value calculation step includes:
Calculating an average value of the extracted approximate memory consumption;
Calculating a predetermined ratio of the average value of the absolute values of the differences between the extracted estimated memory consumption and the average value of the estimated memory consumption as a variance risk value;
Calculating the sum of the average value of the estimated memory consumption and the variance risk value as the memory consumption prediction value;
The control program according to
(付記4)
前記目安メモリ消費量算出ステップが、
前記特定の機能の前記目安メモリ消費量の平均値を取得するステップと、
前記実行中スレッドテーブルから特定される、前記特定の機能と同時実行されている他の機能の各々について、前記目安メモリ消費量の平均値を取得するステップと、
前記特定の機能の前記目安メモリ消費量の平均値と、前記他の機能の各々の前記目安メモリ消費量の平均値の所定割合とで、前記純メモリ消費量を按分して、前記特定の機能の前記目安メモリ消費量を算出するステップと、
を含む付記2記載の制御プログラム。
(Appendix 4)
The reference memory consumption calculation step includes:
Obtaining an average value of the estimated memory consumption of the specific function;
Obtaining an average value of the estimated memory consumption for each of the other functions that are specified from the executing thread table and are simultaneously executed with the specific function;
The net memory consumption is prorated by the average value of the standard memory consumption of the specific function and a predetermined ratio of the average value of the standard memory consumption of each of the other functions, and the specific function Calculating the estimated memory consumption of
The control program according to
(付記5)
前記メモリ消費予測値算出ステップが、
過去に実行された各前記機能の目安メモリ消費量を実行毎に格納する機能別メモリ消費量テーブルから、前記特定の機能についての前記目安メモリ消費量を所定実行数分抽出できたか判断するステップ
を含み、
前記目安メモリ消費量を所定実行数分抽出できない場合には、前記メモリの残量を含む、前記特定の機能のスレッドに関するデータを、実行中の機能のスレッドに関するデータを格納する実行中スレッドテーブルに登録するステップ
をさらに実行させるための付記1記載の制御プログラム。
(Appendix 5)
The memory consumption predicted value calculation step includes:
Determining whether the reference memory consumption amount for the specific function has been extracted by a predetermined number of executions from a memory consumption table for each function that stores the reference memory consumption amount of each function executed in the past for each execution. Including
When the reference memory consumption amount cannot be extracted by the predetermined number of executions, the data regarding the thread of the specific function including the remaining amount of the memory is stored in the executing thread table storing data regarding the thread of the function being executed. The control program according to
(付記6)
仮想マシン上で実行されるプログラムに含まれ、スレッドとして実行される複数の機能の実行を制御する制御部を有するコンピュータにより実行させる制御方法であって、
前記制御部が、前記仮想マシンから、特定の機能の実行開始時における、当該仮想マシンに割り当てられたメモリの残量を取得するステップと、
前記制御部が、過去に実行された各前記機能の目安メモリ消費量を実行毎に格納する機能別メモリ消費量テーブルから、前記特定の機能についての前記目安メモリ消費量を抽出し、抽出された前記目安メモリ消費量から前記特定の機能のメモリ消費予測値を算出するメモリ消費予測値算出ステップと、
前記メモリの残量と前記メモリ消費予測値との差が予め定められた閾値未満である場合に、前記制御部が、前記特定の機能のスレッドを前記仮想マシンに停止させるステップと、
を含む制御方法。
(Appendix 6)
A control method included in a program executed on a virtual machine and executed by a computer having a control unit that controls execution of a plurality of functions executed as threads,
The control unit obtaining from the virtual machine the remaining amount of memory allocated to the virtual machine at the start of execution of a specific function;
The control unit extracts the reference memory consumption amount for the specific function from the memory consumption table for each function that stores the reference memory consumption amount of each function executed in the past for each execution. A predicted memory consumption value calculating step of calculating a predicted memory consumption value of the specific function from the estimated memory consumption;
When the difference between the remaining amount of memory and the predicted memory consumption is less than a predetermined threshold, the control unit causes the virtual machine to stop the thread of the specific function;
Control method.
(付記7)
仮想マシン上で実行されるプログラムに含まれ、スレッドとして実行される複数の機能の実行を制御する制御部を有し、
前記制御部が、
前記仮想マシンから、特定の機能の実行開始時における、当該仮想マシンに割り当てられたメモリの残量を取得する手段と、
過去に実行された各前記機能の目安メモリ消費量を実行毎に格納する機能別メモリ消費量テーブルから、前記特定の機能についての前記目安メモリ消費量を抽出し、抽出された前記目安メモリ消費量から前記特定の機能のメモリ消費予測値を算出するメモリ消費予測値算出手段と、
前記メモリの残量と前記メモリ消費予測値との差が予め定められた閾値未満である場合に、前記特定の機能のスレッドを前記仮想マシンに停止させる手段と、
を有するコンピュータ。
(Appendix 7)
A control unit that controls execution of a plurality of functions that are included in a program executed on a virtual machine and executed as a thread;
The control unit is
Means for acquiring from the virtual machine the remaining amount of memory allocated to the virtual machine at the start of execution of a specific function;
The reference memory consumption for each specific function is extracted from the memory consumption table for each function that stores the reference memory consumption for each function executed in the past, and the extracted reference memory consumption is extracted. A memory consumption predicted value calculating means for calculating a memory consumption predicted value of the specific function from:
Means for causing the virtual machine to stop the thread of the specific function when the difference between the remaining amount of memory and the memory consumption predicted value is less than a predetermined threshold;
Having a computer.
1 OS 10 仮想マシン
11 サーバ・プログラム 12 測定対象プログラム
13 各種ライブラリ 14 メモリ管理モジュール
141 機能別メモリ消費量テーブル
142 実行中スレッドテーブル
143 機能別平均メモリ消費量テーブル
DESCRIPTION OF
Claims (7)
コンピュータのプロセッサに、
前記仮想マシンから、特定の機能の実行開始時における、当該仮想マシンに割り当てられたメモリの残量を取得するステップと、
過去に実行された各前記機能の目安メモリ消費量を実行毎に格納する機能別メモリ消費量テーブルから、前記特定の機能についての前記目安メモリ消費量を抽出し、抽出された前記目安メモリ消費量から前記特定の機能のメモリ消費予測値を算出するメモリ消費予測値算出ステップと、
前記メモリの残量と前記メモリ消費予測値との差が予め定められた閾値未満である場合に、前記特定の機能のスレッドを前記仮想マシンに停止させるステップと、
を実行させるための制御プログラム。 A control program that is included in a program executed on a virtual machine and controls execution of a plurality of functions executed as threads,
Computer processor,
Obtaining from the virtual machine the remaining amount of memory allocated to the virtual machine at the start of execution of a specific function;
The reference memory consumption amount for the specific function is extracted from the function-specific memory consumption table storing the reference memory consumption amount of each function executed in the past for each execution, and the extracted reference memory consumption amount is extracted. A memory consumption prediction value calculating step for calculating a memory consumption prediction value of the specific function from:
If the difference between the remaining amount of memory and the predicted memory consumption is less than a predetermined threshold, causing the virtual machine to stop the thread of the specific function;
A control program to execute.
前記仮想マシンから、前記特定の機能の実行終了時における、前記仮想マシンに割り当てられたメモリの残量である当該メモリの第2の残量を取得するステップと、
前記実行中スレッドテーブルから前記特定の機能の前記メモリの残量を取得するステップと、
前記メモリの第2の残量と前記メモリの残量との差である純メモリ消費量を、前記特定の機能と、前記実行中スレッドテーブルから特定される、前記特定の機能と同時実行されている他の機能とで按分して、前記特定の機能についての前記目安メモリ消費量を算出する目安メモリ消費量算出ステップと、
前記特定の機能についての前記目安メモリ消費量を前記機能別メモリ消費量テーブルに登録するステップと、
をさらに前記プロセッサに実行させるための請求項1記載の制御プログラム。 When the difference between the remaining amount of the memory and the predicted memory consumption value is equal to or greater than the predetermined threshold, the data regarding the thread of the specific function including the remaining amount of the memory is being executed. Registering in the running thread table to store data about threads of
Obtaining from the virtual machine a second remaining amount of the memory that is the remaining amount of memory allocated to the virtual machine at the end of execution of the specific function;
Obtaining the remaining amount of the memory of the specific function from the executing thread table;
The net memory consumption, which is the difference between the second remaining amount of the memory and the remaining amount of the memory, is simultaneously executed with the specific function and the specific function specified from the executing thread table. An estimated memory consumption calculating step for calculating the estimated memory consumption for the specific function by dividing with other functions
Registering the estimated memory consumption for the specific function in the function-specific memory consumption table;
The control program according to claim 1, further causing the processor to execute.
抽出された前記目安メモリ消費量の平均値を算出するステップと、
抽出された前記目安メモリ消費量と前記目安メモリ消費量の平均値との差の絶対値の平均値の所定割合を分散リスク値として算出するステップと、
前記目安メモリ消費量の平均値と前記分散リスク値との和を前記メモリ消費予測値として算出するステップと、
を含む請求項1記載の制御プログラム。 The memory consumption predicted value calculation step includes:
Calculating an average value of the extracted approximate memory consumption;
Calculating a predetermined ratio of the average value of the absolute values of the differences between the extracted estimated memory consumption and the average value of the estimated memory consumption as a variance risk value;
Calculating the sum of the average value of the estimated memory consumption and the variance risk value as the memory consumption prediction value;
The control program according to claim 1, comprising:
前記特定の機能の前記目安メモリ消費量の平均値を取得するステップと、
前記実行中スレッドテーブルから特定される、前記特定の機能と同時実行されている他の機能の各々について、前記目安メモリ消費量の平均値を取得するステップと、
前記特定の機能の前記目安メモリ消費量の平均値と、前記他の機能の各々の前記目安メモリ消費量の平均値の所定割合とで、前記純メモリ消費量を按分して、前記特定の機能の前記目安メモリ消費量を算出するステップと、
を含む請求項2記載の制御プログラム。 The reference memory consumption calculation step includes:
Obtaining an average value of the estimated memory consumption of the specific function;
Obtaining an average value of the estimated memory consumption for each of the other functions that are specified from the executing thread table and are simultaneously executed with the specific function;
The net memory consumption is prorated by the average value of the standard memory consumption of the specific function and a predetermined ratio of the average value of the standard memory consumption of each of the other functions, and the specific function Calculating the estimated memory consumption of
The control program according to claim 2, including:
過去に実行された各前記機能の目安メモリ消費量を実行毎に格納する機能別メモリ消費量テーブルから、前記特定の機能についての前記目安メモリ消費量を所定実行数分抽出できたか判断するステップ
を含み、
前記目安メモリ消費量を所定実行数分抽出できない場合には、前記メモリの残量を含む、前記特定の機能のスレッドに関するデータを、実行中の機能のスレッドに関するデータを格納する実行中スレッドテーブルに登録するステップ
をさらに実行させるための請求項1記載の制御プログラム。 The memory consumption predicted value calculation step includes:
Determining whether the reference memory consumption amount for the specific function has been extracted by a predetermined number of executions from a memory consumption table for each function that stores the reference memory consumption amount of each function executed in the past for each execution. Including
When the reference memory consumption amount cannot be extracted by the predetermined number of executions, the data regarding the thread of the specific function including the remaining amount of the memory is stored in the executing thread table storing data regarding the thread of the function being executed. The control program according to claim 1 for further executing the step of registering.
前記制御部が、前記仮想マシンから、特定の機能の実行開始時における、当該仮想マシンに割り当てられたメモリの残量を取得するステップと、
前記制御部が、過去に実行された各前記機能の目安メモリ消費量を実行毎に格納する機能別メモリ消費量テーブルから、前記特定の機能についての前記目安メモリ消費量を抽出し、抽出された前記目安メモリ消費量から前記特定の機能のメモリ消費予測値を算出するメモリ消費予測値算出ステップと、
前記メモリの残量と前記メモリ消費予測値との差が予め定められた閾値未満である場合に、前記制御部が、前記特定の機能のスレッドを前記仮想マシンに停止させるステップと、
を含む制御方法。 A control method included in a program executed on a virtual machine and executed by a computer having a control unit that controls execution of a plurality of functions executed as threads,
The control unit obtaining from the virtual machine the remaining amount of memory allocated to the virtual machine at the start of execution of a specific function;
The control unit extracts the reference memory consumption amount for the specific function from the memory consumption table for each function that stores the reference memory consumption amount of each function executed in the past for each execution. A predicted memory consumption value calculating step of calculating a predicted memory consumption value of the specific function from the estimated memory consumption;
When the difference between the remaining amount of memory and the predicted memory consumption is less than a predetermined threshold, the control unit causes the virtual machine to stop the thread of the specific function;
Control method.
前記制御部が、
前記仮想マシンから、特定の機能の実行開始時における、当該仮想マシンに割り当てられたメモリの残量を取得する手段と、
過去に実行された各前記機能の目安メモリ消費量を実行毎に格納する機能別メモリ消費量テーブルから、前記特定の機能についての前記目安メモリ消費量を抽出し、抽出された前記目安メモリ消費量から前記特定の機能のメモリ消費予測値を算出するメモリ消費予測値算出手段と、
前記メモリの残量と前記メモリ消費予測値との差が予め定められた閾値未満である場合に、前記特定の機能のスレッドを前記仮想マシンに停止させる手段と、
を有するコンピュータ。 A control unit that controls execution of a plurality of functions that are included in a program executed on a virtual machine and executed as a thread;
The control unit is
Means for acquiring from the virtual machine the remaining amount of memory allocated to the virtual machine at the start of execution of a specific function;
The reference memory consumption for each specific function is extracted from the memory consumption table for each function that stores the reference memory consumption for each function executed in the past, and the extracted reference memory consumption is extracted. A memory consumption predicted value calculating means for calculating a memory consumption predicted value of the specific function from:
Means for causing the virtual machine to stop the thread of the specific function when the difference between the remaining amount of memory and the memory consumption predicted value is less than a predetermined threshold;
Having a computer.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2007281089A JP4935626B2 (en) | 2007-10-30 | 2007-10-30 | Control program and method, and computer |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2007281089A JP4935626B2 (en) | 2007-10-30 | 2007-10-30 | Control program and method, and computer |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2009110213A true JP2009110213A (en) | 2009-05-21 |
JP4935626B2 JP4935626B2 (en) | 2012-05-23 |
Family
ID=40778652
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2007281089A Active JP4935626B2 (en) | 2007-10-30 | 2007-10-30 | Control program and method, and computer |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP4935626B2 (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2011253426A (en) * | 2010-06-03 | 2011-12-15 | Nippon Telegr & Teleph Corp <Ntt> | Memory consumption amount measurement method and memory consumption amount measurement program |
WO2013051154A1 (en) * | 2011-10-07 | 2013-04-11 | 富士通株式会社 | Memory allocation control method, program and information processing device |
JP5525658B2 (en) * | 2011-06-14 | 2014-06-18 | 株式会社日立製作所 | Computer, resource usage calculation method, and resource usage calculation program |
JPWO2013051154A1 (en) * | 2011-10-07 | 2015-03-30 | 富士通株式会社 | Memory allocation control method, program, and information processing apparatus |
JP2016528638A (en) * | 2013-08-15 | 2016-09-15 | オラクル・インターナショナル・コーポレイション | Runtime memory throttling |
JP2020061637A (en) * | 2018-10-09 | 2020-04-16 | 京セラドキュメントソリューションズ株式会社 | Image forming apparatus, image forming method, and image forming program |
JP7214287B1 (en) | 2022-07-26 | 2023-01-30 | 北京穿楊科技有限公司 | Resource allocation determination method, device, computing device and computer program |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR102371916B1 (en) | 2015-07-22 | 2022-03-07 | 삼성전자주식회사 | Storage device for supporting virtual machines, storage system including the storage device, and method of the same |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH0499985A (en) * | 1990-08-20 | 1992-03-31 | Fuji Electric Co Ltd | Radiation meter |
JP2000222281A (en) * | 1998-06-30 | 2000-08-11 | Sun Microsyst Inc | Method and device for memory allocation in multithread virtual machine |
JP2004005612A (en) * | 2002-04-26 | 2004-01-08 | Ricoh Co Ltd | System and method for obtaining resource information |
JP2004515838A (en) * | 2000-07-24 | 2004-05-27 | サン マイクロシステムズ インコーポレーテッド | Efficient Thread-Local Object Allocation for Scalable Memory |
JP2007122663A (en) * | 2005-10-31 | 2007-05-17 | Sony Computer Entertainment Inc | Information processing method and information processor |
-
2007
- 2007-10-30 JP JP2007281089A patent/JP4935626B2/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH0499985A (en) * | 1990-08-20 | 1992-03-31 | Fuji Electric Co Ltd | Radiation meter |
JP2000222281A (en) * | 1998-06-30 | 2000-08-11 | Sun Microsyst Inc | Method and device for memory allocation in multithread virtual machine |
JP2004515838A (en) * | 2000-07-24 | 2004-05-27 | サン マイクロシステムズ インコーポレーテッド | Efficient Thread-Local Object Allocation for Scalable Memory |
JP2004005612A (en) * | 2002-04-26 | 2004-01-08 | Ricoh Co Ltd | System and method for obtaining resource information |
JP2007122663A (en) * | 2005-10-31 | 2007-05-17 | Sony Computer Entertainment Inc | Information processing method and information processor |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2011253426A (en) * | 2010-06-03 | 2011-12-15 | Nippon Telegr & Teleph Corp <Ntt> | Memory consumption amount measurement method and memory consumption amount measurement program |
JP5525658B2 (en) * | 2011-06-14 | 2014-06-18 | 株式会社日立製作所 | Computer, resource usage calculation method, and resource usage calculation program |
US9634912B2 (en) | 2011-06-14 | 2017-04-25 | Hitachi, Ltd. | Computer, resource usage calculation method, and resource usage calculation program |
WO2013051154A1 (en) * | 2011-10-07 | 2013-04-11 | 富士通株式会社 | Memory allocation control method, program and information processing device |
JPWO2013051154A1 (en) * | 2011-10-07 | 2015-03-30 | 富士通株式会社 | Memory allocation control method, program, and information processing apparatus |
JP2016528638A (en) * | 2013-08-15 | 2016-09-15 | オラクル・インターナショナル・コーポレイション | Runtime memory throttling |
JP2020061637A (en) * | 2018-10-09 | 2020-04-16 | 京セラドキュメントソリューションズ株式会社 | Image forming apparatus, image forming method, and image forming program |
JP7158656B2 (en) | 2018-10-09 | 2022-10-24 | 京セラドキュメントソリューションズ株式会社 | Image forming apparatus, image forming method and image forming program |
JP7214287B1 (en) | 2022-07-26 | 2023-01-30 | 北京穿楊科技有限公司 | Resource allocation determination method, device, computing device and computer program |
JP2024016782A (en) * | 2022-07-26 | 2024-02-07 | 北京穿楊科技有限公司 | Resource allocation determination method, apparatus, computing apparatus, and computer program |
Also Published As
Publication number | Publication date |
---|---|
JP4935626B2 (en) | 2012-05-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP4935626B2 (en) | Control program and method, and computer | |
JP5971420B2 (en) | State restoration program, apparatus, and support method | |
US8132162B2 (en) | Runtime machine analysis of applications to select methods suitable for method level caching | |
US9875141B2 (en) | Managing pools of dynamic resources | |
US20120222029A1 (en) | Method of monitoring performance of virtual computer and apparatus using the method | |
US8443178B2 (en) | Operating system image shrinking apparatus and method and computer readable tangible medium storing a program for operating system image shrinking | |
JP5618796B2 (en) | Computer, computer control method and program | |
JP2010003057A (en) | Processor, performance profiling device, performance profiling program, and performance profiling method | |
US8448168B2 (en) | Recording medium having virtual machine managing program recorded therein and managing server device | |
KR20130031860A (en) | System testing method | |
WO2015040688A1 (en) | Management system for managing computer system and management method thereof | |
GB2458005A (en) | Shutting down unnecessary programs in a computer system | |
JP2008210011A (en) | Profiling device and profiling program | |
Fournier et al. | Analyzing blocking to debug performance problems on multi-core systems | |
JP5281452B2 (en) | Memory management method, computer, and memory management program | |
US20150089167A1 (en) | Tracking ownership of memory in a data processing system through use of a memory monitor | |
JP2008217721A (en) | Program profiling system, program profiling method, and program | |
WO2009123343A1 (en) | Contention analysis device, contention analysis method, and program | |
US8245197B2 (en) | Program monitoring method, computer, and abnormal monitoring program product | |
CN102105847A (en) | Method and system for power management using tracing data | |
CN106844148B (en) | Virtual machine starting progress monitoring method and device | |
CN102792275A (en) | Software control device, software control method, and software control program | |
US20200394091A1 (en) | Failure analysis support system, failure analysis support method, and computer readable recording medium | |
US10089136B1 (en) | Monitoring performance of transient virtual volumes created for a virtual machine | |
JP2009157441A (en) | Information processor, file rearrangement method, and program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20100616 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20111013 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20111025 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20111222 |
|
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: 20120124 |
|
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20120206 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20150302 Year of fee payment: 3 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 4935626 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 Free format text: JAPANESE INTERMEDIATE CODE: R150 |