JP4935626B2 - Control program and method, and computer - Google Patents

Control program and method, and computer Download PDF

Info

Publication number
JP4935626B2
JP4935626B2 JP2007281089A JP2007281089A JP4935626B2 JP 4935626 B2 JP4935626 B2 JP 4935626B2 JP 2007281089 A JP2007281089 A JP 2007281089A JP 2007281089 A JP2007281089 A JP 2007281089A JP 4935626 B2 JP4935626 B2 JP 4935626B2
Authority
JP
Japan
Prior art keywords
function
memory
memory consumption
executed
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.)
Active
Application number
JP2007281089A
Other languages
Japanese (ja)
Other versions
JP2009110213A (en
Inventor
秀弥 池田
実 山本
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2007281089A priority Critical patent/JP4935626B2/en
Publication of JP2009110213A publication Critical patent/JP2009110213A/en
Application granted granted Critical
Publication of JP4935626B2 publication Critical patent/JP4935626B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

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号公報には、情報処理装置がメモリ不足でアプリケーションを起動できないエラーになる可能性を小さくし、新たなアプリケーションの起動やインストールができなくなるといった不都合を回避するための技術が開示されている。具体的には、複数のアプリケーションが使用するメモリ量を管理する情報処理装置は、アプリケーション毎の最大メモリ使用量を取得する取得手段と、取得手段により取得したアプリケーション毎の最大メモリ使用量の和を算出する算出手段と、アプリケーションの起動要求時に、算出手段により算出したアプリケーション毎の最大メモリ使用量の和が許容量を超えたか否かに基づいて、アプリケーションの起動の可否を判断する制御手段とを備える。
特開2006−285871号公報
Japanese Patent Application Laid-Open No. 2006-285871 discloses a technique for reducing the possibility that an information processing apparatus will not be able to start an application due to a memory shortage, and avoiding the inconvenience that a new application cannot be started or installed. Is disclosed. Specifically, an information processing apparatus that manages the amount of memory used by a plurality of applications includes an acquisition unit that acquires the maximum memory usage for each application, and a sum of the maximum memory usage for each application acquired by the acquisition unit. A calculating means for calculating, and a control means for determining whether or not the application can be started based on whether or not the sum of the maximum memory usage for each application calculated by the calculating means exceeds an allowable amount when the application is requested to start. Prepare.
JP 2006-285871 A

図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, processes 1 to n exist, each of which has a process 1 dedicated memory area, a process 2 dedicated memory area,. . . A process n dedicated memory area is secured. In this way, a dedicated memory area is allocated for each process, so that if the size of the memory area can be specified, the OS can easily specify the remaining memory capacity. The above publication is also described under such a premise.

しかしながら、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 thread 3 uses the shared data B alone, but the shared data A is shared by the threads 1 and 2, and the thread 2 uses the shared data A and C. Yes. Thus, the memory capacity used by one thread cannot be completely separated and specified.

より具体的に、図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 virtual machine 10 is executed as one process on the OS 1. The OS 1 allocates a dedicated memory area to the virtual machine 10, and the virtual machine 10 is executed using the dedicated memory area. Various threads are activated on the virtual machine 10. For example, a server program 11 that implements reception of a request, determination of a function to be executed, call of an execution function, and the like, which are called by the server program 11, for example, are memory consumption measurement targets and thread activation control targets. The measurement target program 12 is executed as a thread on the virtual machine 10. Furthermore, the memory management module 14 that is called from the measurement target program 12 and performs the main processing in the present embodiment, and various libraries 13 that are used by the measurement target program 12 are also executed on the virtual machine 10. Note that, as will be described below, a code for calling the memory management module 14 is automatically added to the measurement target program 12 at the time of compilation, and execution control is performed by the called memory management module 14. The memory management module 14 performs processing using the function-specific memory consumption table 141 and the executing thread table 142. Further, the function-specific average memory consumption table 143 may be used.

図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 measurement target program 12 is executed, one record is generated. In the example of FIG. 5, for each record, a serial number and a function ID (for example, Java (registered) In the case of trademark), the package name, class name # method name, in the case of C #, the name that uniquely represents a function or subroutine such as namespace name.class name # method name), time, and approximate memory consumption It comes to register.

図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 function 143, one record is registered for each function, the function ID, the average memory consumption (described in detail below), the last update time, Is to be registered. For records whose last update time is older than a predetermined reference, it is preferable to calculate the average memory consumption separately without using the records.

なお、仮想マシン上で動作するプログラム(例えばサーバ・プログラム11等)は、仮想マシン10に対して以下のような事項を命じることができる。
・プログラムは、仮想マシン10に命令することで、スレッドを生成、消滅させることができる。
・プログラムは、仮想マシン10に命令することで、実行中のスレッドを停止させることや、停止中のスレッドを再実行させることができる。
・プログラムは、仮想マシン10に命令して、メモリ領域を使用する(メモリ領域にデータを置く)ことができる。
・プログラムは、仮想マシン10に問い合わせることで、「メモリ領域のトータル」と「メモリ領域の使用量」を知ることができる。すなわち、メモリ残量を把握することができる。
・プログラムは、仮想マシン10に命令して、現在自スレッドが実行しているプログラムの手順を、他スレッドが実行しようとしたときに開始を待たせる(排他制御を行う)ことができる。
Note that a program (for example, the server program 11 or the like) operating on the virtual machine can command the virtual machine 10 as follows.
A program can generate and extinguish threads by instructing the virtual machine 10.
The program can stop the currently executing thread and re-execute the stopped thread by instructing the virtual machine 10.
The program can instruct the virtual machine 10 to use the memory area (place data in the memory area).
The program can know “total memory area” and “memory area usage” by making an inquiry to the virtual machine 10. That is, the remaining memory capacity can be grasped.
The program can instruct the virtual machine 10 to wait for the start of the procedure of the program currently being executed by the own thread when another thread tries to execute it (exclusive control is performed).

次に、図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 server program 11 receives a request, determines a function to be executed, and calls a function to be executed. In the example of FIG. 8, a function 21 called function ID: com.fuji.xxx.XClass # FunctionA and a function 22 called function ID: com.fuji.xxx.XClass # FunctionB are called in response to a request. Which function or subroutine is defined as a function is arbitrary, and is preferably set in a unit in which memory consumption is to be measured or a unit suitable for controlling the activation of a thread. However, in actuality, in application development, class names and method names are assigned according to certain rules, so that functions can be defined according to the rules.

機能21は、機能開始処理部211、本来の処理部212及び機能終了処理部213を含む。機能開始処理部211及び機能終了処理部213は、本実施の形態において、例えば本来の処理部212に対してアスペクト指向技術等によって自動的に埋め込まれる部分であり、メモリ管理モジュール14を呼び出す。本来の処理部212は、機能21の本来の処理を行う部分である。必要に応じて、共通処理モジュール23を呼び出す場合もある。   The function 21 includes a function start processing unit 211, an original processing unit 212, and a function end processing unit 213. In the present embodiment, the function start processing unit 211 and the function end processing unit 213 are portions that are automatically embedded in the original processing unit 212 by an aspect-oriented technique or the like, for example, and call the memory management module 14. The original processing unit 212 is a part that performs the original processing of the function 21. The common processing module 23 may be called as necessary.

同様に、機能22は、機能開始処理部221、本来の処理部222及び機能終了処理部223を含む。機能開始処理部221及び機能終了処理部223は、本実施の形態において、例えば本来の処理部222に対してアスペクト指向技術等によって自動的に埋め込まれる部分であり、メモリ管理モジュール14を呼び出す。本来の処理部222は、機能22の本来の処理を行う部分である。必要に応じて、共通処理モジュール23を呼び出す場合もある。   Similarly, the function 22 includes a function start processing unit 221, an original processing unit 222, and a function end processing unit 223. In the present embodiment, the function start processing unit 221 and the function end processing unit 223 are parts that are automatically embedded in the original processing unit 222 by aspect-oriented technology or the like, for example, and call the memory management module 14. The original processing unit 222 is a part that performs the original processing of the function 22. The common processing module 23 may be called as necessary.

次に、図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 server program 11 is started in the thread 1, and for example, a function execution request from an end user is awaited and stopped (server program procedure 1). Here, when a function execution request is received from the end user, the server program 11 resumes processing and performs function determination processing (server program procedure 2). When the function to be executed is specified, a new thread 2 is generated for the virtual machine 10 for parallel processing, and the function to be executed is executed (server program procedure 3). Thereafter, the thread 1 returns to the server program procedure 1. When the execution of the function in the thread 2 is completed, the server program 11 may also execute a termination process. However, the description is omitted here because it is not the main point of the present embodiment.

サーバ・プログラム11の命令によって仮想マシン10によって生成されるスレッド2では、例えば機能21が実行されるものとする。機能21では、最初に機能開始処理部211における、メモリ管理モジュール14の呼び出しコードが実行され、メモリ管理モジュール14の機能開始処理が実行される(プログラム手順M−1)。このメモリ管理モジュール14の機能開始処理については後に詳述する。このメモリ管理モジュール14の機能開始処理が終了すると、本来の処理部212による処理(手順A−1乃至A−4)を実行する。なお、図8に示したように、必要に応じて共通処理モジュール23を呼び出すようにしても良い。   For example, the function 21 is assumed to be executed in the thread 2 generated by the virtual machine 10 according to the instruction of the server program 11. In the function 21, the call code of the memory management module 14 is first executed in the function start processing unit 211, and the function start process of the memory management module 14 is executed (program procedure M-1). The function start processing of the memory management module 14 will be described in detail later. When the function start processing of the memory management module 14 is completed, processing (procedures A-1 to A-4) by the original processing unit 212 is executed. In addition, as shown in FIG. 8, you may make it call the common processing module 23 as needed.

そして、本来の処理部212の処理が完了すると、機能21の機能終了処理部213におけるメモリ管理モジュール14の呼び出しコードが実行され、メモリ管理モジュール14の機能終了処理が実行される(プログラム手順M−2)。このメモリ管理モジュール14の機能終了処理については後に詳述する。そして、スレッド2の実行を終了させ、仮想マシン10によりスレッド2を消滅させる。   When the processing of the original processing unit 212 is completed, the calling code of the memory management module 14 in the function end processing unit 213 of the function 21 is executed, and the function end processing of the memory management module 14 is executed (program procedure M- 2). The function end processing of the memory management module 14 will be described in detail later. Then, the execution of the thread 2 is terminated, and the thread 2 is extinguished by the virtual machine 10.

以下、図10乃至図16を用いて、メモリ管理モジュール14の機能開始処理について詳しく述べる。最初に、メモリ管理モジュール14は、他スレッド排他命令を仮想マシン10に出力する(ステップS1)。これによって、他のスレッドにおいてメモリ管理モジュール14を呼び出したとしても、他スレッド排他解除命令が出されるまで、本スレッド以外では、メモリ管理モジュール14の機能開始処理は実行されない。   Hereinafter, the function start processing of the memory management module 14 will be described in detail with reference to FIGS. First, the memory management module 14 outputs another thread exclusive instruction to the virtual machine 10 (step S1). Thus, even if the memory management module 14 is called in another thread, the function start processing of the memory management module 14 is not executed except for this thread until the other thread exclusion release command is issued.

次に、メモリ管理モジュール14は、メモリ残量を仮想マシン10から取得する(ステップS3)。仮想マシン10の既存機能を利用するものである。そして、メモリ管理モジュール14は、機能別メモリ消費予測値算出処理を実施する(ステップS5)。この機能別メモリ消費予測値算出処理については、図11乃至図16を用いて説明する。   Next, the memory management module 14 acquires the remaining memory capacity from the virtual machine 10 (step S3). The existing function of the virtual machine 10 is used. Then, the memory management module 14 performs a function-specific memory consumption predicted value calculation process (step S5). This function-specific memory consumption predicted value calculation processing will be described with reference to FIGS.

まず、メモリ管理モジュール14は、機能別メモリ消費量テーブル141を、本機能ID及び予測対象期間により検索し、該当レコードを抽出する(ステップS21)。機能IDについては、例えばメモリ管理モジュール14を呼び出した際に、機能21の機能開始処理部211から取得するようにする。また、予測対象期間は、図12に示すようなメモリ管理モジュール14の設定パラメータのうちの1つであり、例えば一週間(=604800秒)といった数値が設定される。ステップS21で抽出されるレコードの一例を、図13に示す。ここでは8レコードが抽出されたものとする。   First, the memory management module 14 searches the function-specific memory consumption table 141 based on the function ID and the prediction target period, and extracts a corresponding record (step S21). The function ID is acquired from the function start processing unit 211 of the function 21 when the memory management module 14 is called, for example. The prediction target period is one of the setting parameters of the memory management module 14 as shown in FIG. 12, and a numerical value such as one week (= 604800 seconds) is set. An example of the record extracted in step S21 is shown in FIG. Here, it is assumed that 8 records have been extracted.

そして、メモリ管理モジュール14は、停止判定閾値以上のレコードが抽出されたか判断する(ステップS23)。停止判定閾値は、図12に示すようなメモリ管理モジュール14の設定パラメータのうちの1つであり、例えば「5」といった数値が設定される。停止判定閾値以上のレコードが抽出されていない場合には、件数が少なく予測精度が低いので、スレッド停止不要として設定し、元の処理に戻る(ステップS25)。   Then, the memory management module 14 determines whether or not a record equal to or greater than the stop determination threshold is extracted (step S23). The stop determination threshold is one of the setting parameters of the memory management module 14 as shown in FIG. 12, and a numerical value such as “5” is set, for example. If no record equal to or greater than the stop determination threshold has been extracted, the number of cases is small and the prediction accuracy is low, so the thread stop is not required and the process returns to the original process (step S25).

一方、停止判定閾値以上のレコードが抽出できた場合には、メモリ管理モジュール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 memory management module 14 calculates an average memory consumption value from the extracted record and stores it in a predetermined memory area (step S27). In the example of FIG. 13, since the stop determination threshold is “5” and the number of extracted records is “8”, the average value of the memory consumption is calculated. In the example of FIG. 13, the memory consumption average value is calculated as “9750”. Note that the memory consumption average value calculated in this step may be registered in the function-specific average memory consumption table 143 and used later.

また、メモリ管理モジュール14は、抽出レコードにおける各メモリ消費量の上記メモリ消費量平均値からの差の絶対値の平均を算出し、所定のメモリ領域に格納する(ステップS29)。図13の例では、メモリ消費量平均値からの差の絶対値は、上から順に「2250」「2750」「250」「750」「250」「1250」「1750」「1250」となる。従って、この平均は、「1312.5」と算出される。   Further, the memory management module 14 calculates an average of absolute values of differences between the memory consumption average values of the memory consumption in the extracted record and stores the average in a predetermined memory area (step S29). In the example of FIG. 13, the absolute value of the difference from the memory consumption average value is “2250” “2750” “250” “750” “250” “1250” “1750” “1250” in order from the top. Therefore, this average is calculated as “1312.5”.

そして、メモリ管理モジュール14は、差の絶対値の平均と分散許容値との積によって分散リスク値を算出し、所定のメモリ領域に格納する(ステップS31)。分散許容値は、図12に示すようなメモリ管理モジュール14の設定パラメータのうちの1つであり、例えば「0.8」といった数値が設定される。分散リスク値は、メモリ消費量平均値からのマージンに相当する。図13の例では、1312.5×0.8=1050が分散リスク値として算出される。その後、メモリ管理モジュール14は、メモリ消費量平均値と分散リスク値との和により機能別メモリ消費予測値を算出し、所定のメモリ領域に格納する(ステップS33)。図13の例では、機能別メモリ消費予測値は9750+1050=10800と算出される。そして元の処理に戻る。   Then, the memory management module 14 calculates a dispersion risk value by the product of the average of the absolute value of the difference and the allowable dispersion value, and stores it in a predetermined memory area (step S31). The dispersion allowable value is one of the setting parameters of the memory management module 14 as shown in FIG. 12, and a numerical value such as “0.8” is set, for example. The variance risk value corresponds to a margin from the average memory consumption. In the example of FIG. 13, 1312.5 × 0.8 = 1050 is calculated as the variance risk value. After that, the memory management module 14 calculates a function-specific memory consumption predicted value based on the sum of the memory consumption average value and the variance risk value, and stores it in a predetermined memory area (step S33). In the example of FIG. 13, the memory consumption prediction value by function is calculated as 9750 + 1050 = 10800. Then, the process returns to the original process.

図10の説明に戻って、メモリ管理モジュール14は、本スレッド(スレッド2)の停止が必要であるか判断する(ステップS7)。本ステップでは、ステップS25でスレッド停止不要が設定されていれば、スレッド停止不要と判断し、それ以外の場合には、ステップS3で取得したメモリ残量とステップS33で算出された機能別メモリ消費予測値との差が、メモリ残量許容量より小さいか判断し、小さい場合には、メモリ不足が予測されるので、スレッド停止が必要と判断する。一方、メモリ残量と機能別メモリ消費予測値との差がメモリ残量許容量以上である場合には、スレッド停止は不要と判断する。メモリ残量許容量は、図12に示すようなメモリ管理モジュール14の設定パラメータの1つであり、例えば「1000」といった数値が設定される。例えば、メモリ残量が「20000」であったとすると、図13の例では、「20000」−「10800」=「9200」であり、メモリ残量許容量より多いので、スレッドの停止は不要と判断される。   Returning to the description of FIG. 10, the memory management module 14 determines whether it is necessary to stop this thread (thread 2) (step S7). In this step, if thread stop unnecessary is set in step S25, it is determined that thread stop is unnecessary. In other cases, the remaining memory capacity acquired in step S3 and the memory consumption by function calculated in step S33 are determined. It is determined whether or not the difference from the predicted value is smaller than the allowable amount of remaining memory, and if it is smaller, it is determined that the thread must be stopped because memory shortage is predicted. On the other hand, if the difference between the remaining amount of memory and the predicted memory consumption by function is equal to or larger than the allowable amount of remaining memory, it is determined that thread stop is unnecessary. The memory remaining capacity is one of the setting parameters of the memory management module 14 as shown in FIG. 12, and a numerical value such as “1000” is set, for example. For example, if the remaining memory capacity is “20000”, in the example of FIG. 13, “20000” − “10800” = “9200”, which is larger than the allowable memory remaining capacity, it is determined that it is not necessary to stop the thread. Is done.

なお、ステップS7でスレッド停止が必要と判断された場合には、メモリ管理モジュール14は、他スレッド排他解除命令及び本スレッド(スレッド2)の停止命令を仮想マシン10に出力する(ステップS9)。そしてステップS1に戻る。これにより、仮想マシン10は、メモリ管理モジュール14の排他状態を解除して、他スレッドによる実行を許可するようになる。さらに、スレッド2の実行を停止させる。   If it is determined in step S7 that the thread must be stopped, the memory management module 14 outputs the other thread exclusion release instruction and the stop instruction for this thread (thread 2) to the virtual machine 10 (step S9). Then, the process returns to step S1. As a result, the virtual machine 10 releases the exclusive state of the memory management module 14 and permits execution by other threads. Furthermore, the execution of the thread 2 is stopped.

一方、スレッド停止が不要と判断された場合には、メモリ管理モジュール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 memory management module 14 additionally registers this function ID in the simultaneous execution function of all the records in the executing thread table 142 (step S11). For example, when the executing thread table 142 as shown in FIG. 14 exists before execution of step S11, the execution thread table is changed to the executing thread table as shown in FIG. 15 by executing step S11. That is, assuming that the function being executed in the thread 2 is FuncA (or FunctionA), FuncA is additionally registered in the concurrent execution function name column of each record in the executing thread table (in bold).

さらに、メモリ管理モジュール14は、実行中スレッドテーブル142に、本スレッドについてのデータを登録する(ステップS13)。すなわち、図16に示すような状態となる。具体的には、3行目のスレッドID「3」、機能ID「FuncA」、開始時点メモリ残量「20000」、同時実行機能「FuncX,FuncY」が登録される(太字)。なお、同時実行機能の列については、既に登録済みの第1及び第2行目の機能IDが登録される。   Further, the memory management module 14 registers the data for this thread in the executing thread table 142 (step S13). That is, the state shown in FIG. 16 is obtained. Specifically, the thread ID “3”, the function ID “FuncA”, the remaining memory capacity “20000” at the start time, and the simultaneous execution functions “FuncX, FuncY” are registered (bold). Note that the function IDs in the first and second rows that have already been registered are registered for the column of simultaneous execution functions.

そして、メモリ管理モジュール14は、仮想スレッド排他解除命令を仮想マシン10に出力する(ステップS15)。これによって、他のスレッドにおいてメモリ管理モジュール14を呼び出すことができるようになる。そして、機能21の本来の処理を実行する。   Then, the memory management module 14 outputs a virtual thread exclusion release command to the virtual machine 10 (step S15). As a result, the memory management module 14 can be called in another thread. Then, the original processing of the function 21 is executed.

以上のような処理を実施することによって、十分メモリに余裕があると判断された場合にはスレッドの実行を継続し、メモリ不足が予測される場合にはスレッドの実行を停止させて、システム全体の稼働を安定化させることができるようになる。   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 memory management module 14 will be described with reference to FIGS. The memory management module 14 outputs another thread exclusive command to the virtual machine 10 (step S41). This is the same as step S1. Then, the memory management module 14 reads the remaining memory capacity at the start of this function from the executing thread table 142 (step S43). In the executing thread table 142 as shown in FIG. 16, data “20000” of the memory remaining at the start time is read from the third line.

そして、メモリ管理モジュール14は、現時点におけるメモリ残量を仮想マシン10から終了時点メモリ残量として取得する(ステップS45)。例えば、ここでは「4000」というデータが取得されたものとする。本実施の形態では、様々な機能によって仮想マシン10に割り当てられたメモリは消費されていって、メモリ残量が減少することを前提としている。しかし、仮想マシン10に含まれるメモリ管理部によってガベージコレクションが行われて、メモリ残量が増加する場合もある。そのような場合には、以下の処理で目安メモリ消費量を算出することはできないので、そのような場合にはステップS51に移行する。   Then, the memory management module 14 acquires the current memory remaining amount from the virtual machine 10 as the end-time memory remaining amount (step S45). For example, it is assumed here that data “4000” has been acquired. In this embodiment, it is assumed that the memory allocated to the virtual machine 10 by various functions is consumed and the remaining memory capacity is reduced. However, garbage collection may be performed by the memory management unit included in the virtual machine 10 to increase the remaining memory capacity. In such a case, the estimated memory consumption cannot be calculated by the following process. In such a case, the process proceeds to step S51.

そして、メモリ管理モジュール14は、目安メモリ消費量計算処理を実施する(ステップS47)。目安メモリ消費量計算処理については図18を用いて説明する。まず、メモリ管理モジュール14は、開始時点メモリ残量から終了時点メモリ残量を差し引き、純メモリ消費量を算出し、所定のメモリ領域に格納する(ステップS61)。上の例では「20000」−「4000」=「16000」と計算される。但し、純メモリ消費量は、他の機能が消費した分を含む。   Then, the memory management module 14 performs a standard memory consumption calculation process (step S47). The reference memory consumption calculation process will be described with reference to FIG. First, the memory management module 14 subtracts the end point memory remaining amount from the start point memory remaining amount, calculates the net memory consumption, and stores it in a predetermined memory area (step S61). In the above example, “20000” − “4000” = “16000” is calculated. However, the net memory consumption includes the amount consumed by other functions.

次に、メモリ管理モジュール14は、実行中スレッドテーブル142から全同時実行機能を特定する(ステップS63)。このスレッドで実行中の機能を含め、全ての同時実行機能を特定する。図15の例では3つの機能(FuncX、FuncY及びFuncA)が特定される。そして、全同時実行機能IDのうち未処理のものを1つ特定する(ステップS65)。さらに、機能別メモリ消費量テーブル141を、特定された機能ID及び予測対象期間(図12)で検索し、該当するレコードを特定する(ステップS67)。ステップS21と同様の処理を行う。そして、メモリ管理モジュール14は、停止判定閾値(図12)以上のレコードが抽出できたか判断する(ステップS69)。停止判定閾値以上のレコードが抽出できない場合には、メモリ消費量平均値を算出するのに不適切であるものとして、全同時実行機能のメモリ消費量を同一の値として、純メモリ消費量を按分することによって、目安メモリ消費量を算出する(ステップS71)。そして、元の処理に移行する。   Next, the memory management module 14 specifies all simultaneous execution functions from the executing thread table 142 (step S63). All concurrent execution functions are specified, including the function being executed in this thread. In the example of FIG. 15, three functions (FuncX, FuncY, and FuncA) are specified. And one unprocessed thing is specified among all simultaneous execution function ID (step S65). Further, the function-specific memory consumption table 141 is searched with the specified function ID and the prediction target period (FIG. 12), and the corresponding record is specified (step S67). Processing similar to that in step S21 is performed. Then, the memory management module 14 determines whether a record equal to or greater than the stop determination threshold value (FIG. 12) has been extracted (step S69). If records exceeding the stop judgment threshold cannot be extracted, it is considered inappropriate to calculate the average memory consumption, and the memory consumption of all the concurrent execution functions is assumed to be the same value, and the net memory consumption is prorated. As a result, the estimated memory consumption is calculated (step S71). Then, the process proceeds to the original process.

一方、停止判定閾値以上のレコードが抽出できた場合には、メモリ管理モジュール14は、抽出されたレコードにおけるメモリ消費量を平均することによって、メモリ消費量平均値を算出し、所定のメモリ領域に格納する(ステップS73)。   On the other hand, if a record equal to or greater than the stop determination threshold value can be extracted, the memory management module 14 calculates the memory consumption average value by averaging the memory consumption in the extracted records, and stores it in a predetermined memory area. Store (step S73).

そして、メモリ管理モジュール14は、全同時実行機能について処理を行ったか判断する(ステップS75)。未処理の機能が存在する場合には、ステップS65に戻る。   Then, the memory management module 14 determines whether processing has been performed for all simultaneous execution functions (step S75). If there is an unprocessed function, the process returns to step S65.

このようにして、上で述べた例では、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 function 143 is used, it is checked after step S65 whether a calculation result within a predetermined time (that is, an average value of memory consumption) is stored. Steps S67 to S73 may be skipped if they exist, and steps S67 to S73 described above may be executed if there are no calculation results within a predetermined time. In addition, when steps S67 to S73 are executed, the calculated memory consumption average value is registered in the function-specific average memory consumption table 143.

全同時実行機能について処理が完了した場合には、メモリ管理モジュール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 memory management module 14 virtually calculates the reference memory consumption by dividing the net memory consumption virtually by using the memory consumption average value of all the simultaneous execution functions. Calculate and store in a predetermined memory area (step S77). Specifically, pure memory consumption (16000) × memory consumption average value of this function (9750) / (memory consumption average value of this function (9750) + (memory of first simultaneous execution function (FuncX)) (Consumption average value (5000)) / 2+ (memory consumption average value of second concurrent execution function (FuncY) (6000)) / 2+...) = “10229”. The reason why the average memory consumption of the first and second simultaneous execution functions is divided by “2” is based on the assumption that the threads executing these functions are executing about 50%. Is. The reason for virtually allocating in this way is that it is impossible to completely discriminate how much the memory consumption of the concurrent execution function contributes to the net memory consumption. Accordingly, the estimated memory consumption is not an accurate value, but if it can be calculated with a certain degree of accuracy, the thread execution can be controlled with a certain degree of accuracy even in the function start processing. Further, by separately analyzing the memory consumption table for each function 141, for example, it is possible to extract a problem such as a particularly large amount of reference memory consumption for a specific function, and further to determine improvement of the program. become.

図17の処理に戻って、メモリ管理モジュール14は、機能別メモリ消費量テーブル141にレコードを追加する(ステップS49)。例えば図19の最終行(通番100)に示すようなレコードを追加する。さらに、メモリ管理モジュール14は、実行中スレッドテーブル142から本スレッドに対応するレコードを削除する(ステップS51)。例えば図20に示すように、最終行のレコードが削除される。   Returning to the processing of FIG. 17, the memory management module 14 adds a record to the function-specific memory consumption table 141 (step S49). For example, a record as shown in the last line (serial number 100) in FIG. 19 is added. Further, the memory management module 14 deletes the record corresponding to this thread from the executing thread table 142 (step S51). For example, as shown in FIG. 20, the record in the last line is deleted.

最後に、メモリ管理モジュール14は、他スレッド再起動命令を仮想マシン10に出力する(ステップS53)。これによって、例えばステップS9で停止していたスレッドが再起動される。さらに、メモリ管理モジュール14は、仮想スレッド排他解除命令を仮想マシン10に出力する(ステップS55)。   Finally, the memory management module 14 outputs another thread restart command to the virtual machine 10 (step S53). Thereby, for example, the thread that has been stopped in step S9 is restarted. Further, the memory management module 14 outputs a virtual thread exclusion release command to the virtual machine 10 (step S55).

以上のように機能終了処理を実施することによって、機能別メモリ消費量テーブル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 memory management module 14 as described above in the measurement target program 12. For example, as shown in FIG. 21, when the source code of the measurement target program 12 and the attachment location information of the memory management module 14 are input to an aspect-oriented compiler, the measurement target into which the calling code of the memory management module 14 is inserted. A program 12 (execution module) is generated. The attachment location information may be a list of “source code file name + function name”, for example. However, the attachment location is a function that becomes the start point and end point of the function for the purpose of this embodiment. In many cases, a source code file name or a function name having such a function is attached in accordance with a predetermined rule in consideration of maintenance in developing a program. Therefore, in reality, it is possible to specify the attachment location in the form of “all the“ execute ”functions of the source code file name“ ˜Function ”” ”.

以上本発明の一実施の形態を説明したが、本発明はこれに限定されるものではない。例えば、図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 memory management module 14, but as shown in FIG. For example, the database server 30 that manages the table may be provided on the virtual machine 10 as another thread, or may be provided on another computer.

その他、処理結果が変わらなければ、処理ステップの順番を入れ替えても良い場合もある。   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 server program 11 was shown, the server program 11 is not necessarily used.

なお、上で述べた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 display device 2509. The display control unit 2507, the drive device 2513 for the removable disk 2511, the input device 2515, and the communication control unit 2517 for connecting to the network are connected by a bus 2519. Application programs including the OS and the Web browser are stored in the HDD 2505, and are read from the HDD 2505 to the memory 2501 when executed by the CPU 2503. If necessary, the CPU 2503 controls the display control unit 2507, the communication control unit 2517, and the drive device 2513 to perform necessary operations. Further, data in the middle of processing is stored in the memory 2501 and stored in the HDD 2505 if necessary. Such a computer realizes various functions as described above by organically cooperating hardware such as the CPU 2503 and the memory 2501 described above with the OS and necessary application programs.

(付記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 appendix 1, for causing the processor to further execute

(付記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 appendix 1, including:

(付記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 appendix 2, including

(付記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 appendix 1, for further executing the step of registration.

(付記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.

OSとプロセスの関係を表す模式図である。It is a schematic diagram showing the relationship between OS and a process. 仮想マシンとスレッドの関係を表す模式図である。It is a schematic diagram showing the relationship between a virtual machine and a thread. スレッドで実行される機能のメモリ消費量を説明するための模式図である。It is a schematic diagram for demonstrating the memory consumption of the function performed with a thread | sled. 本発明の実施の形態におけるプログラム構成図である。It is a program block diagram in embodiment of this invention. 機能別メモリ消費量テーブルの一例を示す図である。It is a figure which shows an example of the memory consumption table classified by function. 実行中スレッドテーブルの一例を示す図である。It is a figure which shows an example of the executing thread table. 機能別平均メモリ消費量テーブルの一例を示す図である。It is a figure which shows an example of the average memory consumption table classified by function. 本発明の実施の形態におけるプログラム構成の詳細図である。It is a detailed diagram of the program configuration in the embodiment of the present invention. 本発明の実施の形態における処理の概要を示す図である。It is a figure which shows the outline | summary of the process in embodiment of this invention. メモリ管理モジュールの機能開始処理の処理フローを示す図である。It is a figure which shows the processing flow of the function start process of a memory management module. 機能別メモリ消費予測値算出処理の処理フローを示す図である。It is a figure which shows the processing flow of the memory consumption estimated value calculation process according to function. 設定パラメータの一例を示す図である。It is a figure which shows an example of a setting parameter. 機能別メモリ消費量テーブルから抽出されるデータの一例を示す図である。It is a figure which shows an example of the data extracted from the memory consumption table classified by function. 実行中スレッドテーブルに対する処理の第1段階の例を示す図である。It is a figure which shows the example of the 1st step of the process with respect to the executing thread table. 実行中スレッドテーブルに対する処理の第2段階の例を示す図である。It is a figure which shows the example of the 2nd step of the process with respect to the executing thread table. 実行中スレッドテーブルに対する処理の第3段階の例を示す図である。It is a figure which shows the example of the 3rd step of the process with respect to the executing thread table. メモリ管理モジュールの機能終了処理の処理フローを示す図である。It is a figure which shows the processing flow of the function end process of a memory management module. 目安メモリ消費量計算処理の処理フローを示す図である。It is a figure which shows the processing flow of a standard memory consumption calculation process. 機能別メモリ消費量テーブルへの登録を説明するための図である。It is a figure for demonstrating registration to the memory consumption table classified by function. 実行中スレッドテーブルに対する処理の第4段階の例を示す図である。It is a figure which shows the example of the 4th step of the process with respect to the executing thread table. メモリ管理モジュールへの呼び出しコードを含む測定対象プログラムを生成する方法を説明するための模式図である。It is a schematic diagram for demonstrating the method to produce | generate the measurement object program containing the call code to a memory management module. 本発明の実施の形態における他のプログラム構成図である。It is another program block diagram in embodiment of this invention. コンピュータの機能ブロック図である。It is a functional block diagram of a computer.

符号の説明Explanation of symbols

1 OS 10 仮想マシン
11 サーバ・プログラム 12 測定対象プログラム
13 各種ライブラリ 14 メモリ管理モジュール
141 機能別メモリ消費量テーブル
142 実行中スレッドテーブル
143 機能別平均メモリ消費量テーブル
DESCRIPTION OF SYMBOLS 1 OS 10 Virtual machine 11 Server program 12 Measurement object program 13 Various libraries 14 Memory management module 141 Memory consumption table 142 according to function Running thread table 143 Average memory consumption table according to function

Claims (7)

仮想マシン上で実行されるプログラムに含まれ複数の機能の実行を制御する処理をコンピュータのプロセッサに実行させるための制御プログラムであって、
前記複数の機能のうちスレッドとして実行される第1の機能の実行開始時における、前記仮想マシンに割り当てられたメモリの残量を、実行中の機能のスレッドに関するデータを格納する実行中スレッドテーブルから読み出すステップと、
前記仮想マシンから、前記第1の機能の実行終了時における、前記仮想マシンに割り当てられたメモリの残量を取得するステップと、
前記第1の機能の実行開始時におけるメモリの残量と前記第1の機能の実行終了時におけるメモリの残量との差である第1のメモリ消費量を算出するステップと、
過去に実行された各前記機能の目安のメモリ消費量である第2のメモリ消費量を実行毎に格納する第1のメモリ消費量テーブル又は過去に実行された各前記機能の前記第2のメモリ消費量の平均値を格納する第2のメモリ消費量テーブルを用いて、前記第1の機能と、前記実行中スレッドテーブルから特定される、前記第1の機能と同時実行されている他の機能とについて、前記第2のメモリ消費量の平均値を取得するステップと、
算出された前記第1のメモリ消費量を、前記第1の機能についての前記第2のメモリ消費量の平均値と前記第1の機能と同時実行されている他の機能についての前記第2のメモリ消費量の平均値とを基に按分することにより、前記第1の機能についての前記第2のメモリ消費量を算出する第1算出ステップと、
を実行させるための制御プログラム。
A control program for executing a process of controlling the execution of a plurality of functions that is part of the program executing on the virtual machine to a processor of a computer,
The remaining amount of memory allocated to the virtual machine at the start of execution of the first function executed as a thread among the plurality of functions is determined from an executing thread table that stores data relating to the thread of the function being executed. A reading step;
Acquiring from the virtual machine the remaining amount of memory allocated to the virtual machine at the end of execution of the first function;
Calculating a first memory consumption that is a difference between a remaining amount of memory at the start of execution of the first function and a remaining amount of memory at the end of execution of the first function;
A first memory consumption table that stores a second memory consumption, which is a rough memory consumption of each function executed in the past, or the second memory of each function executed in the past Using the second memory consumption table that stores the average value of consumption, the first function and another function that is specified from the running thread table and that is simultaneously executed with the first function Obtaining an average value of the second memory consumption for
The calculated first memory consumption is calculated based on the average value of the second memory consumption of the first function and the second of the other functions being executed simultaneously with the first function. A first calculation step of calculating the second memory consumption amount for the first function by prorated based on an average value of the memory consumption amount;
A control program to execute.
前記仮想マシンから、前記複数の機能のうちスレッドとして実行される第2の機能の実行開始時における、前記仮想マシンに割り当てられたメモリの残量を取得するステップと、
前記第1のメモリ消費量テーブルから、前記第2の機能についての前記第2のメモリ消費量を抽出し、当該第2のメモリ消費量から前記第2の機能のメモリ消費の予測値を算出する第2算出ステップと、
前記第2の機能の実行開始時におけるメモリの残量と前記予測値との差が予め定められた閾値未満である場合に、前記第2の機能のスレッドを前記仮想マシンに停止させるステップと、
をさらに前記プロセッサに実行させるための請求項1記載の制御プログラム。
Obtaining a remaining amount of memory allocated to the virtual machine at the start of execution of a second function executed as a thread among the plurality of functions from the virtual machine;
The second memory consumption amount for the second function is extracted from the first memory consumption table, and a predicted value of the memory consumption of the second function is calculated from the second memory consumption amount. A second calculation step;
When the difference between the remaining amount of memory at the start of execution of the second function and the predicted value is less than a predetermined threshold, causing the virtual machine to stop the thread of the second function;
The control program according to claim 1, further causing the processor to execute.
前記第2算出ステップが、
抽出された前記第2のメモリ消費量の平均値を算出するステップと、
抽出された前記第2のメモリ消費量と前記第2のメモリ消費量の平均値との差の絶対値の平均値を算出し、当該平均値に所定割合を乗じた値である分散リスク値算出するステップと、
前記第2のメモリ消費量の平均値と前記分散リスク値との和である前記予測値算出するステップと、
を含む請求項記載の制御プログラム。
The second calculating step includes
Calculating an average value of the extracted second memory consumption amounts;
The average value of the difference between the extracted second memory consumption amount and the average value of the second memory consumption amount is calculated, and a variance risk value that is a value obtained by multiplying the average value by a predetermined ratio is calculated. A calculating step;
And calculating the predicted value is the sum of the variance risk value and the average value of the second memory consumption,
The control program according to claim 2 , including:
前記第1算出ステップが、
第1の機能の前記第2のメモリ消費量の平均値と、前記第1の機能と同時に実行されている他の機能の前記第2のメモリ消費量の平均値所定割合を乗じた値とで、前記第1のメモリ消費量を按分して、前記第1の機能の前記第2のメモリ消費量を算出するステッ
を含む請求項記載の制御プログラム。
The first calculating step includes:
The average value of the second memory consumption before Symbol first function, multiplied by a predetermined ratio to the average value of the second memory consumption of the first function and other functions that are performed at the same time in the value, the first pro rata memory consumption, the first function according to claim 1, wherein the control program, including the second steps for calculating the memory consumption.
前記第2算出ステップが、
前記第1のメモリ消費量テーブルから、前記第2の機能についての前記第2のメモリ消費量を所定実行数分抽出できたか判断するステップ
を含み、
前記第2のメモリ消費量を所定実行数分抽出できない場合には、前記第2の機能の実行開始時におけるメモリの残量を含む、前記第2の機能のスレッドに関するデータを、前記実行中スレッドテーブルに登録するステップ
をさらに実行させるための請求項記載の制御プログラム。
The second calculating step includes
From the first memory consumption table including said second step of determining whether the memory consumption can be extracted predetermined run several minutes for the second function,
Wherein when the second memory consumption can not be extracted predetermined run for a few minutes, the includes a remaining amount of the memory in the execution start of the second function, the data about the thread of the second function, the running thread The control program according to claim 2 for further executing the step of registering in the table.
仮想マシン上で実行されるプログラムに含まれ複数の機能の実行を制御する制御部を有するコンピュータにより実行さる制御方法であって、
前記制御部が、前記複数の機能のうちスレッドとして実行される第1の機能の実行開始時における、前記仮想マシンに割り当てられたメモリの残量を、実行中の機能のスレッドに関するデータを格納する実行中スレッドテーブルから読み出すステップと、
前記制御部が、前記仮想マシンから、前記第1の機能の実行終了時における、前記仮想マシンに割り当てられたメモリの残量を取得するステップと、
前記制御部が、前記第1の機能の実行開始時におけるメモリの残量と前記第1の機能の実行終了時におけるメモリの残量との差である第1のメモリ消費量を算出するステップと、
前記制御部が、過去に実行された各前記機能の目安のメモリ消費量である第2のメモリ消費量を実行毎に格納する第1のメモリ消費量テーブル又は過去に実行された各前記機能の前記第2のメモリ消費量の平均値を格納する第2のメモリ消費量テーブルを用いて、前記第1の機能と、前記実行中スレッドテーブルから特定される、前記第1の機能と同時実行されている他の機能とについて、前記第2のメモリ消費量の平均値を取得するステップと、
前記制御部が、算出された前記第1のメモリ消費量を、前記第1の機能についての前記第2のメモリ消費量の平均値と前記第1の機能と同時実行されている他の機能についての前記第2のメモリ消費量の平均値とを基に按分することにより、前記第1の機能についての前記第2のメモリ消費量を算出するステップと、
を含む制御方法。
A control method that will be executed by a computer having a control unit for controlling the execution of a plurality of functions that is part of the program to be executed on the virtual machine,
The control unit stores the remaining amount of memory allocated to the virtual machine at the start of execution of the first function executed as a thread among the plurality of functions, and data related to the thread of the function being executed. Reading from the running thread table;
The control unit acquiring from the virtual machine the remaining amount of memory allocated to the virtual machine at the end of execution of the first function;
The control unit calculating a first memory consumption that is a difference between a remaining amount of memory at the start of execution of the first function and a remaining amount of memory at the end of execution of the first function; ,
The control unit stores a second memory consumption amount, which is a reference memory consumption amount of each function executed in the past, for each execution, or each function executed in the past. Using the second memory consumption table that stores the average value of the second memory consumption, the first function and the first function specified from the executing thread table are simultaneously executed. Obtaining an average value of the second memory consumption with respect to other functions that include:
The control unit uses the calculated first memory consumption amount as an average value of the second memory consumption amount for the first function and other functions executed simultaneously with the first function. Calculating the second memory consumption for the first function by allocating based on the average value of the second memory consumption of
Control method.
仮想マシン上で実行されるプログラムに含まれ複数の機能の実行を制御する制御部を有し、
前記制御部が、
前記複数の機能のうちスレッドとして実行される第1の機能の実行開始時における、前記仮想マシンに割り当てられたメモリの残量を、実行中の機能のスレッドに関するデータを格納する実行中スレッドテーブルから読み出す手段と、
前記仮想マシンから、前記第1の機能の実行終了時における、前記仮想マシンに割り当てられたメモリの残量を取得する手段と、
前記第1の機能の実行開始時におけるメモリの残量と前記第1の機能の実行終了時におけるメモリの残量との差である第1のメモリ消費量を算出する手段と、
過去に実行された各前記機能の目安のメモリ消費量である第2のメモリ消費量を実行毎に格納する第1のメモリ消費量テーブル又は過去に実行された各前記機能の前記第2のメモリ消費量の平均値を格納する第2のメモリ消費量テーブルを用いて、前記第1の機能と、前記実行中スレッドテーブルから特定される、前記第1の機能と同時実行されている他の機能とについて、前記第2のメモリ消費量の平均値を取得する手段と、
算出された前記第1のメモリ消費量を、前記第1の機能についての前記第2のメモリ消費量の平均値と前記第1の機能と同時実行されている他の機能についての前記第2のメモリ消費量の平均値とを基に按分することにより、前記第1の機能についての前記第2のメモリ消費量を算出する手段と、
を有するコンピュータ。
A control unit for controlling the execution of a plurality of functions that is part of the program to be executed on the virtual machine,
The control unit is
The remaining amount of memory allocated to the virtual machine at the start of execution of the first function executed as a thread among the plurality of functions is determined from an executing thread table that stores data relating to the thread of the function being executed. Means for reading;
Means for obtaining from the virtual machine the remaining amount of memory allocated to the virtual machine at the end of execution of the first function;
Means for calculating a first memory consumption that is a difference between a remaining amount of memory at the start of execution of the first function and a remaining amount of memory at the end of execution of the first function;
A first memory consumption table that stores a second memory consumption, which is a rough memory consumption of each function executed in the past, or the second memory of each function executed in the past Using the second memory consumption table that stores the average value of consumption, the first function and another function that is specified from the running thread table and that is simultaneously executed with the first function And means for obtaining an average value of the second memory consumption,
The calculated first memory consumption is calculated based on the average value of the second memory consumption of the first function and the second of the other functions being executed simultaneously with the first function. Means for calculating the second memory consumption for the first function by apportioning based on an average value of the memory consumption;
Having a computer.
JP2007281089A 2007-10-30 2007-10-30 Control program and method, and computer Active JP4935626B2 (en)

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 JP2009110213A (en) 2009-05-21
JP4935626B2 true 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 (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10203912B2 (en) 2015-07-22 2019-02-12 Samsung Electronics Co., Ltd. Storage device for supporting virtual machine, storage system including the storage device, and method of operating the same

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5478368B2 (en) * 2010-06-03 2014-04-23 日本電信電話株式会社 Memory consumption measuring method and memory consumption measuring program
WO2012172641A1 (en) 2011-06-14 2012-12-20 株式会社日立製作所 Computer, resource use quantity calculation method, and resource use quantity 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
US9213530B2 (en) * 2013-08-15 2015-12-15 Oracle International Corporation Runtime memory throttling
JP7158656B2 (en) * 2018-10-09 2022-10-24 京セラドキュメントソリューションズ株式会社 Image forming apparatus, image forming method and image forming program
CN117519956A (en) 2022-07-26 2024-02-06 北京穿杨科技有限公司 Resource quota determination method, device, computing equipment and medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2658531B2 (en) * 1990-08-20 1997-09-30 富士電機株式会社 Radiation measuring instrument
US6209066B1 (en) * 1998-06-30 2001-03-27 Sun Microsystems, Inc. Method and apparatus for memory allocation in a multi-threaded virtual machine
US6505275B1 (en) * 2000-07-24 2003-01-07 Sun Microsystems, Inc. Method for scalable memory efficient thread-local object allocation
JP2004005612A (en) * 2002-04-26 2004-01-08 Ricoh Co Ltd System and method for obtaining resource information
JP4407956B2 (en) * 2005-10-31 2010-02-03 株式会社ソニー・コンピュータエンタテインメント Information processing method and information processing apparatus

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10203912B2 (en) 2015-07-22 2019-02-12 Samsung Electronics Co., Ltd. Storage device for supporting virtual machine, storage system including the storage device, and method of operating the same

Also Published As

Publication number Publication date
JP2009110213A (en) 2009-05-21

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
JP4151977B2 (en) Prefetching device, prefetching method, and prefetching program
US9875141B2 (en) Managing pools of dynamic resources
US7979864B2 (en) Apparatus for setting used license of executing job into unused license state and allocating the set unused license to a to be executed job based on priority
US8443178B2 (en) Operating system image shrinking apparatus and method and computer readable tangible medium storing a program for operating system image shrinking
US8677501B2 (en) Privilege violation detecting program
JP5326374B2 (en) Processor, performance profiling apparatus, performance profiling program, and performance profiling method
US9697009B2 (en) Method for improving the performance of computers
JP2010160704A (en) Debug support device
US20090249333A1 (en) Recording medium having virtual machine managing program recorded therein and managing server device
WO2015040688A1 (en) Management system for managing computer system and management method thereof
JP2019125300A (en) Information processing device, information processing system and program
KR20210105036A (en) Method and System for Collecting Ultra-Low Latency Resource Usage Metrics in Cloud Platform
Fournier et al. Analyzing blocking to debug performance problems on multi-core systems
JP5281452B2 (en) Memory management method, computer, and memory management program
US20130339639A1 (en) Tracking ownership of memory in a data processing system through use of a memory monitor
WO2009123343A1 (en) Contention analysis device, contention analysis method, and program
US8245197B2 (en) Program monitoring method, computer, and abnormal monitoring program product
JP2009217617A (en) Method and device for identifying memory leak place
US20200394091A1 (en) Failure analysis support system, failure analysis support method, and computer readable recording medium
JP2004118367A (en) Computer device and program execution method
US10089136B1 (en) Monitoring performance of transient virtual volumes created for a virtual machine
JP2009134535A (en) Device for supporting software development, method of supporting software development, and program for supporting software development

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