Disclosure of Invention
The invention provides a Java virtual machine configuration method and a Java virtual machine configuration system, which can conveniently configure a virtual machine.
In view of this, an aspect of the present invention provides a Java virtual machine configuration method, the method including:
acquiring an environment description text of a virtual machine, and generating a virtual machine configuration file corresponding to the environment description text;
identifying a current operating system, and generating a target virtual machine matched with the type of the operating system according to the virtual machine configuration file;
Configuring memory parameters for the target virtual machine, and judging whether the idle memory of the current system meets the memory parameters when receiving a starting request pointing to the target virtual machine;
and if the idle memory of the current system meets the memory parameters, starting the target virtual machine.
In one embodiment, generating a target virtual machine that matches the type of the operating system includes:
generating a target virtual machine by using a Docker and KVM based virtualization technology aiming at a Windows operating system;
and generating a target virtual machine by using a Docker Stream technology aiming at the Linux operating system.
In one embodiment, generating the virtual machine configuration file corresponding to the environment description text includes:
Extracting text features corresponding to the environment description text, and generating configuration index information by taking the text features as priori conditions;
and fusing the configuration index information with the text features, and generating a virtual machine configuration file based on the fused feature data.
In one embodiment, generating configuration index information using the text feature as a priori condition includes:
acquiring an index coding table after training, and identifying a target index code with highest similarity with the text characteristics in the index coding table;
taking the target index code as an initial code of index information, and predicting a subsequent code after the initial code under the condition that the text characteristic is taken as a priori condition;
and continuously predicting undetermined subsequent codes based on the currently determined initial codes and the subsequent codes until complete coded data is generated, and taking the complete coded data as generated configuration index information.
In one embodiment, after starting the target virtual machine, the method further comprises:
After receiving an update instruction, sending a call request to a monitor of the target virtual machine, so that the monitor configures a target storage space for the target virtual machine;
and if the target storage space is configured, loading an updating program corresponding to the updating instruction into the target storage space, and updating the target virtual machine by utilizing the updating program.
The invention also provides a Java virtual machine configuration system, which comprises:
The configuration file generation unit is used for acquiring an environment description text of the virtual machine and generating a virtual machine configuration file corresponding to the environment description text;
The virtual machine generating unit is used for identifying the current operating system and generating a target virtual machine matched with the type of the operating system according to the virtual machine configuration file;
the judging unit is used for configuring memory parameters for the target virtual machine and judging whether the idle memory of the current system meets the memory parameters or not when receiving a starting request pointing to the target virtual machine;
And the starting unit is used for starting the target virtual machine if the idle memory of the current system meets the memory parameters.
In one embodiment, the virtual machine generating unit is specifically configured to generate, for a Windows operating system, a target virtual machine using a virtualization technology based on Docker and KVM; and generating a target virtual machine by using a Docker Stream technology aiming at the Linux operating system.
In one embodiment, the configuration file generating unit is specifically configured to extract a text feature corresponding to the environment description text, and generate configuration index information by using the text feature as a priori condition; and fusing the configuration index information with the text features, and generating a virtual machine configuration file based on the fused feature data.
In one embodiment, the configuration file generating unit is specifically further configured to obtain an index code table after training is completed, and identify a target index code with highest similarity to the text feature in the index code table; taking the target index code as an initial code of index information, and predicting a subsequent code after the initial code under the condition that the text characteristic is taken as a priori condition; and continuously predicting undetermined subsequent codes based on the currently determined initial codes and the subsequent codes until complete coded data is generated, and taking the complete coded data as generated configuration index information.
In one embodiment, the system further comprises:
The updating unit is used for sending a call request to a monitor of the target virtual machine after receiving an updating instruction so that the monitor configures a target storage space for the target virtual machine; and if the target storage space is configured, loading an updating program corresponding to the updating instruction into the target storage space, and updating the target virtual machine by utilizing the updating program.
According to the technical scheme provided by the invention, the corresponding virtual machine configuration file can be automatically generated based on the environment description text conforming to the natural language rule. In this way, the generation of the configuration file can be completed without having specialized virtual machine knowledge. Subsequently, for the generated virtual machine configuration file, a corresponding target virtual machine can be generated in different operating systems. In order to ensure that the target virtual machine can be started normally, the memory parameters can be verified in advance, and the target virtual machine can be started after the verification is passed. Obviously, the virtual machine configuration method greatly reduces the threshold of virtual machine configuration, thereby improving the efficiency of virtual machine configuration.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims thereof as well as the appended drawings.
The technical scheme of the invention is further described in detail through the drawings and the embodiments.
Detailed Description
The preferred embodiments of the present invention will be described below with reference to the accompanying drawings, it being understood that the preferred embodiments described herein are for illustration and explanation of the present invention only, and are not intended to limit the present invention.
Referring to fig. 1, one embodiment of the present application provides a Java virtual machine configuration method, which includes:
S1: acquiring an environment description text of a virtual machine, and generating a virtual machine configuration file corresponding to the environment description text;
s2: identifying a current operating system, and generating a target virtual machine matched with the type of the operating system according to the virtual machine configuration file;
S3: configuring memory parameters for the target virtual machine, and judging whether the idle memory of the current system meets the memory parameters when receiving a starting request pointing to the target virtual machine;
s4: and if the idle memory of the current system meets the memory parameters, starting the target virtual machine.
In one embodiment, generating a target virtual machine that matches the type of the operating system includes:
generating a target virtual machine by using a Docker and KVM based virtualization technology aiming at a Windows operating system;
and generating a target virtual machine by using a Docker Stream technology aiming at the Linux operating system.
In one embodiment, generating the virtual machine configuration file corresponding to the environment description text includes:
Extracting text features corresponding to the environment description text, and generating configuration index information by taking the text features as priori conditions;
and fusing the configuration index information with the text features, and generating a virtual machine configuration file based on the fused feature data.
In this embodiment, a transformer architecture may be used to process the environment description text to derive the virtual machine configuration file. The environment description text may be text conforming to a natural language rule, for example, may be a sentence provided by a user for describing a virtual machine. By identifying the environment description text, the characteristics required by the virtual machine to be created can be clarified, and the target virtual machine can be accurately created based on the characteristics.
The transducer architecture can provide a text sample and a configuration file matched with the text sample in the training process. In a transducer architecture, an initial index encoding table may be provided that characterizes the mapping between text features and index encodings. In the initial stage of training, the mapping relationship is often inaccurate, and the mapping relationship can be gradually corrected in the training process of the configuration file and the text sample, so that index codes in the index code table can correspond to text features. Wherein the index code may be part of the configuration index information. Each index code is predicted one by one according to the sequence, and the index codes can be formed into configuration index information.
In one embodiment, generating configuration index information using the text feature as a priori condition includes:
acquiring an index coding table after training, and identifying a target index code with highest similarity with the text characteristics in the index coding table;
taking the target index code as an initial code of index information, and predicting a subsequent code after the initial code under the condition that the text characteristic is taken as a priori condition;
and continuously predicting undetermined subsequent codes based on the currently determined initial codes and the subsequent codes until complete coded data is generated, and taking the complete coded data as generated configuration index information.
For example, the initial code predicted from the text feature may be a, for example, and then the text feature+a may be used as input data, so as to predict a subsequent code B after a; the text feature +a+b may then be taken as input data, continuing with the subsequent encoding C after prediction B, and so on, until the last encoding is predicted. Finally, each predicted code can be spliced, so that complete configuration index information is obtained.
After the configuration index information and the text features are fused, the features of the virtual machine to be created can be more accurately represented, and based on the fused feature data, a neural network model which is trained can be adopted to generate a corresponding virtual machine configuration file.
In one embodiment, after starting the target virtual machine, the method further comprises:
After receiving an update instruction, sending a call request to a monitor of the target virtual machine, so that the monitor configures a target storage space for the target virtual machine;
and if the target storage space is configured, loading an updating program corresponding to the updating instruction into the target storage space, and updating the target virtual machine by utilizing the updating program.
Updating the target virtual machine with the update program includes:
Step A1: before loading the update program corresponding to the update instruction into the target storage space, performing data decomposition on the update program corresponding to the update instruction, and performing data decomposition on the update program corresponding to the update instruction by using formula (1) to decompose the update program into a plurality of sub-program data
Wherein Z 16- a represents the 16-ary form of the broken-down a-th subroutine data; k 16 represents a 16-ary form of the update program corresponding to the update instruction; n represents the maximum number of data bits of the decomposed subroutine data; a represents an integer variable; len (), len [ ] each represent the total number of bits of the data in brackets; Representing a downward rounding; k 16 [ a×n+1 ] → (a+1) ×n ] represents 16-ary data on the a×n+1-th bit to (a+1) ×n-th bit of the data K 16; k 16[a×n+1→len(K16) ] represents 16-ary data on the a×n+1 th bit to the len (K 16) th bit of data K 16;
Step A2: performing data calibration on the plurality of subprogram data according to the positions of the plurality of subprogram data in the update program by using a formula (2)
Wherein B 16- a represents 16-ary form data after data calibration of the first sub-program data; () 16 denotes converting the value in brackets into a 16-ary number; Representing an upward rounding; representing a left shift;
loading the subroutine data into the target storage space in parallel;
Step A3: after the target storage space receives a plurality of data, carrying out data combination on the data according to the calibration data on each data by using a formula (3)
Wherein a_i represents the number of merging positions of the ith data received by the target storage space; b 16- i represents the 16 th form of the i-th data received by the target storage space;
the received data is first right shifted And then merging the bits according to the corresponding merging position number, thereby obtaining the original updating program corresponding to the updating instruction.
The beneficial effects of the technical scheme are as follows: utilizing the formula (1) in the step A1 to decompose the data of the update program corresponding to the update instruction into a plurality of subprogram data, thereby transmitting the data in parallel and improving the data transmission efficiency; and then carrying out data calibration on the plurality of subprogram data according to the positions of the plurality of subprogram data in the updating program by utilizing the formula (2) in the step A2, thereby ensuring the reliability of data merging after data transmission; and then, after receiving a plurality of data by utilizing the formula (3) in the step A3, carrying out data combination on the data by utilizing the formula (3) according to the calibration data on each data, thereby completely restoring the original data and ensuring the accuracy of the data.
Referring to fig. 2, the present invention further provides a Java virtual machine configuration system, which includes:
The configuration file generation unit is used for acquiring an environment description text of the virtual machine and generating a virtual machine configuration file corresponding to the environment description text;
The virtual machine generating unit is used for identifying the current operating system and generating a target virtual machine matched with the type of the operating system according to the virtual machine configuration file;
the judging unit is used for configuring memory parameters for the target virtual machine and judging whether the idle memory of the current system meets the memory parameters or not when receiving a starting request pointing to the target virtual machine;
And the starting unit is used for starting the target virtual machine if the idle memory of the current system meets the memory parameters.
In one embodiment, the virtual machine generating unit is specifically configured to generate, for a Windows operating system, a target virtual machine using a virtualization technology based on Docker and KVM; and generating a target virtual machine by using a Docker Stream technology aiming at the Linux operating system.
In one embodiment, the configuration file generating unit is specifically configured to extract a text feature corresponding to the environment description text, and generate configuration index information by using the text feature as a priori condition; and fusing the configuration index information with the text features, and generating a virtual machine configuration file based on the fused feature data.
In one embodiment, the configuration file generating unit is specifically further configured to obtain an index code table after training is completed, and identify a target index code with highest similarity to the text feature in the index code table; taking the target index code as an initial code of index information, and predicting a subsequent code after the initial code under the condition that the text characteristic is taken as a priori condition; and continuously predicting undetermined subsequent codes based on the currently determined initial codes and the subsequent codes until complete coded data is generated, and taking the complete coded data as generated configuration index information.
In one embodiment, the system further comprises:
The updating unit is used for sending a call request to a monitor of the target virtual machine after receiving an updating instruction so that the monitor configures a target storage space for the target virtual machine; and if the target storage space is configured, loading an updating program corresponding to the updating instruction into the target storage space, and updating the target virtual machine by utilizing the updating program.
According to the technical scheme provided by the invention, the corresponding virtual machine configuration file can be automatically generated based on the environment description text conforming to the natural language rule. In this way, the generation of the configuration file can be completed without having specialized virtual machine knowledge. Subsequently, for the generated virtual machine configuration file, a corresponding target virtual machine can be generated in different operating systems. In order to ensure that the target virtual machine can be started normally, the memory parameters can be verified in advance, and the target virtual machine can be started after the verification is passed. Obviously, the virtual machine configuration method greatly reduces the threshold of virtual machine configuration, thereby improving the efficiency of virtual machine configuration.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present invention without departing from the spirit or scope of the invention. Thus, it is intended that the present invention also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.