CN113176928B - Running method and device of heterogeneous virtual machine - Google Patents

Running method and device of heterogeneous virtual machine Download PDF

Info

Publication number
CN113176928B
CN113176928B CN202110456938.4A CN202110456938A CN113176928B CN 113176928 B CN113176928 B CN 113176928B CN 202110456938 A CN202110456938 A CN 202110456938A CN 113176928 B CN113176928 B CN 113176928B
Authority
CN
China
Prior art keywords
operating system
host
slave
client operating
virtual machine
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
CN202110456938.4A
Other languages
Chinese (zh)
Other versions
CN113176928A (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.)
Shenzhen Yantang Technology Co ltd
Original Assignee
Shenzhen Yantang Technology Co 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 Shenzhen Yantang Technology Co ltd filed Critical Shenzhen Yantang Technology Co ltd
Priority to CN202110456938.4A priority Critical patent/CN113176928B/en
Publication of CN113176928A publication Critical patent/CN113176928A/en
Application granted granted Critical
Publication of CN113176928B publication Critical patent/CN113176928B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45516Runtime code conversion or optimisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a running method and a device of heterogeneous virtual machines, wherein a host and a slave host are erected, and two sets of operating systems of the virtual machines are respectively run, namely a host client operating system and a slave client operating system, and the method comprises the following steps: the slave client operating system makes the actual system calling parameter or the runtime calling parameter into a data packet, and sends the data packet to the master client operating system through the network; the main client operating system runs a daemon, receives a data packet sent from the client operating system, unpacks the data packet, calls a running library or a system, packs a running result and sends the running result to the client operating system through a network; and unpacking the operation result after receiving the operation result from the client operating system through the network and returning the operation result to the caller. By adopting the technical scheme of the invention, the problem of low operation efficiency when the client system and the host machine use different CPU instruction sets in the prior virtual machine technology is solved.

Description

Running method and device of heterogeneous virtual machine
Technical Field
The invention belongs to the technical field of computers, and particularly relates to a method and a device for operating a heterogeneous virtual machine.
Background
When a traditional virtual machine runs, a CPU instruction of the virtual machine needs to be translated into a CPU instruction of a host machine (the host machine running the virtual machine is called the host machine), if the CPU instruction set of the virtual machine is the same as the CPU instruction set of the host machine, the instruction can be directly run without the process of CPU instruction translation, and the running performance is close to the physical CPU performance; when the CPU instruction set of the virtual machine is different from the CPU instruction set of the host machine, for example, if the host machine is an x86 architecture CPU and the virtual machine uses an ARM architecture CPU, the CPU instruction translation may cause a serious performance degradation. Moreover, when the CPU instruction set of the virtual machine is different from the CPU instruction set of the host machine, the hardware-assisted virtualization technology cannot be used, resulting in further performance degradation.
Disclosure of Invention
The technical problem to be solved by the present invention is to provide a method and an apparatus for operating a heterogeneous virtual machine, which solve the problem of low operating efficiency when a client system and a host machine use different CPU instruction sets in the existing virtual machine technology.
In order to achieve the purpose, the invention adopts the following technical scheme:
a running method of heterogeneous virtual machines is characterized in that a host machine and a slave host machine are erected, and two sets of operating systems of the virtual machines are respectively run, namely a host client operating system and a slave client operating system, and the method comprises the following steps:
the slave client operating system makes the actual system calling parameter or the runtime calling parameter into a data packet, and sends the data packet to the master client operating system through the network;
the main client operating system runs a daemon, receives a data packet sent from the client operating system, unpacks the data packet, calls a running library or a system, packs a running result and sends the running result to the client operating system through a network;
and unpacking the operation result after receiving the operation result from the client operating system through the network and returning the operation result to the caller.
Preferably, the slave guest operating system has the same system call interface and runtime call interface as the master guest operating system.
Preferably, a plurality of host machines are erected, only one slave host machine is erected, and the plurality of host machines are communicated with one slave host machine at the same time; a slave host runs multiple sets of slave client operating systems, and simultaneously runs application programs for multiple master client operating systems.
Preferably, a plurality of host machines and a plurality of slave host machines are simultaneously erected, and the slave host machines are used as public resources and are called by any host machine; a host runs a plurality of sets of host guest operating systems, and simultaneously communicates with a plurality of sets of slave guest operating systems in a plurality of hosts to form a plurality of virtual machine instances.
Preferably, the data packet sent from the guest operating system to the host guest operating system comprises:
1. a process number of the calling process;
2. the calling type is as follows: library calls or system calls;
3. the called object: library names, function names, or system call numbers;
4. calling parameters;
5. if the parameter type is a pointer, the parameter type also contains the memory data pointed by the pointer.
6. The method for operating a heterogeneous virtual machine according to claim 1, wherein the step of sending the operation result to the slave guest operating system for the master guest operating system comprises:
1. a process number of the calling process;
2. the calling type is as follows: library calls or system calls;
3. the called object: library names, function names, or system call numbers;
4. if the return value is a pointer, the return value also contains memory data pointed by the pointer;
5. and outputting the data of the parameters, and if the parameter type is a pointer, simultaneously including the memory data pointed by the pointer.
The invention provides a running device of a heterogeneous virtual machine, which is characterized in that a host machine and a slave host machine are erected, and two sets of operating systems of the virtual machine are respectively run, namely a host client operating system and a slave client operating system, and the running device comprises:
the first processing module is used for making actual system calling parameters or runtime calling parameters into data packets from the client operating system and sending the data packets to the main client operating system through a network;
the second processing module is used for operating the daemon program in the main client operating system, receiving the data packet sent from the client operating system, unpacking the data packet, then calling the runtime library or calling the system, packing the operation result and sending the operation result to the slave client operating system through the network;
and the return module is used for unpacking and returning the operation result to the caller after receiving the operation result from the client operating system through the network.
Preferably, the slave guest operating system has the same system call interface and runtime call interface as the master guest operating system.
Preferably, a plurality of host machines are erected, only one slave host machine is erected, and the plurality of host machines are communicated with one slave host machine at the same time; a slave host runs multiple sets of slave client operating systems, and simultaneously runs application programs for multiple master client operating systems.
Preferably, a plurality of host machines and a plurality of slave host machines are simultaneously erected, and the slave host machines are used as public resources and are called by any host machine; a host runs a plurality of sets of host guest operating systems, and simultaneously communicates with a plurality of sets of slave guest operating systems in a plurality of hosts to form a plurality of virtual machine instances.
The invention relates to an operation method and a device of a heterogeneous virtual machine.A master client operating system and a slave client operating system are designed, and the two client operating systems have the same system calling or library calling interface and operate different CPU instruction sets; the main client operating system has complete system functions and a running library; the slave client operating system runs the client application program and forwards the system call and the running library call to the master client operating system for execution; two sets of client operating systems run in two host machines, and the two host machines use CPUs with different instruction sets; the two hosts communicate through a network. The problem of among the current virtual machine technique, when customer system and host computer use different CPU instruction sets running inefficiency is solved.
Drawings
FIG. 1 is a diagram of a system operating network architecture;
FIG. 2 is a schematic diagram of the operation of the process of the present invention;
FIG. 3 is a schematic diagram of a Linux virtual machine implementation;
FIG. 4 is a block diagram of the apparatus of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
The invention provides a running method of a heterogeneous virtual machine, which is characterized in that a guest operating system and an application program in the virtual machine are distinguished (the operating system running in the virtual machine is called as a guest operating system), and only a good running environment is required to be provided for the application program in the virtual machine for the running of the virtual machine; and because the function of the operating system is realized mainly by C language and basically independent of CPU, the function of the client operating system can be transferred to another host machine for execution.
The general idea of the invention is as follows: two host machines are erected, namely a master host machine and a slave host machine, and operating systems of two sets of virtual machines are respectively operated, namely a master client operating system and a slave client operating system. And when the application program of the virtual machine calls the operating system function, transferring the function call to a host guest operating system of the host machine for execution. The transfer of the call and the reception of the call result are realized through a network. The CPU instruction sets of the host and the slave host are different, the host guest operating systems and the slave guest operating systems of the virtual machines are the same as the CPU instruction sets of the host machines of the virtual machines, and the application programs of the virtual machines are also the same as the CPU instruction sets of the host machines of the virtual machines, so that the operating systems and the application programs in the virtual machines can directly give CPU instructions to the CPU for execution, and CPU instruction translation is not needed.
As an implementation, a plurality of hosts may be installed and only one slave host is installed, as shown in fig. 1, the plurality of hosts simultaneously communicate with one slave host. A slave host runs multiple sets of slave client operating systems, and simultaneously runs application programs for multiple master client operating systems. Furthermore, in specific implementation, a plurality of host machines and a plurality of slave host machines can be simultaneously erected, and the slave host machines can be used as public resources to be called by any host machine. Furthermore, a host runs a plurality of sets of host guest operating systems, and simultaneously communicates with a plurality of sets of slave guest operating systems in a plurality of hosts to form a plurality of virtual machine instances.
To achieve the above object, as shown in fig. 2, the present invention provides a method for operating a heterogeneous virtual machine, including:
designing a host client operating system, running on a host computer, wherein a CPU (central processing unit) of the host computer completely supports a CPU instruction set of the host client operating system; the design of the main client operating system is that a daemon is added on a standard operating system, the daemon receives a data packet from a slave client operating system, actual library calling or system calling is carried out after parameters of the library calling or system calling are analyzed, then calling results are packaged, and the calling results are sent to the slave client operating system through a network.
Designing a slave client operating system, running on a slave host machine, and completely supporting a CPU instruction set of the slave client operating system by a CPU of the slave host machine; the design of the secondary client operating system is to modify the interface function of the system call and the running library on the standard operating system, and change the actual running function into: packing the parameters, sending the parameters to a main client operating system through a network, receiving a result data packet from the main client operating system, unpacking the result data packet, and returning the operation result to a caller of an interface;
the application program runs within the slave guest operating system, the same as the slave guest operating system's CPU instruction set.
For library calls and system calls, the calls are all calls at the C language level. From the code perspective, the method for modifying the slave guest operating system is as follows: and modifying C language source codes of the library and the kernel, and recompiling to generate a customized binary file.
For a data packet sent from the guest operating system to the host guest operating system, the following information is contained:
1. a process number of the calling process;
2. the calling type is as follows: library calls or system calls;
3. the called object: library names, function names, or system call numbers;
4. each parameter;
5. if the parameter type is a pointer, the memory data pointed by the pointer is required to be included.
The running result sent by the main client operating system to the auxiliary client operating system contains the following information:
1. a process number of the calling process;
2. the calling type is as follows: library calls or system calls;
3. the called object: library names, function names, or system call numbers;
4. if the return value is a pointer, the memory data pointed by the pointer is required to be included;
5. if the parameter type of the data of each output parameter is a pointer, the data of the memory pointed by the pointer needs to be included at the same time.
For each application process of the slave guest operating system, the master guest operating system has a process corresponding thereto for executing a library call or system call of the application process. Thus requiring modification of the functionality of the create process within the guest operating system. In the slave guest operating system, besides executing the normal creation process, a notification needs to be sent to the master guest operating system, and a new daemon process is created in the master guest operating system for receiving the data packet of the new process of the slave guest operating system. For example, for a Linux system, the kernel do _ fork () code of the slave guest operating system may be modified to send the ID number of the new process to the master guest operating system in addition to performing the original do _ fork () function.
Example 1:
as shown in fig. 3, the implementation process when the guest operating system is a Linux system includes:
the primary client operating system and the secondary client operating system both use the same version of Linux system;
modifying Linux Kernel from the client operating system, changing a system calling function into packing calling parameters, and sending the packed calling parameters to the main client operating system for execution through a network;
and the slave client operating system modifies the LibC library, changes the interface function into a calling parameter package, and sends the calling parameter package to the master client operating system for execution through the network.
The main client operating system runs a daemon program, receives a data packet sent by the client operation, unpacks and executes actual execution, and returns an execution result to the auxiliary client operating system;
the application runs in the slave guest operating system and the actual runtime and system calls occur in the master guest operating system.
As shown in fig. 4, the present invention further provides a running apparatus for heterogeneous virtual machines, which implements the running method for heterogeneous virtual machines, and establishes a host and a slave host, and runs two sets of operating systems of the virtual machines, which are called a host client operating system and a slave client operating system, respectively, including:
the first processing module is used for making actual system calling parameters or runtime calling parameters into data packets through the slave guest operating system and sending the data packets to the master guest operating system through a network;
the second processing module is used for running a daemon program in the main client operating system, receiving the data packet sent from the client operating system, unpacking the data packet, then calling a running library or a system, packing a running result and sending the packed running result to the slave client operating system through a network;
and the return module is used for unpacking and returning the operation result to the caller after the operation result is received from the client operating system through the network.
Further, the slave guest operating system has the same system call interface and runtime call interface as the master guest operating system.
The above-described embodiments are merely illustrative of the preferred embodiments of the present invention, and do not limit the scope of the present invention, and various modifications and improvements of the technical solutions of the present invention can be made by those skilled in the art without departing from the spirit of the present invention, and the technical solutions of the present invention are within the scope of the present invention defined by the claims.

Claims (6)

1. A running method of a heterogeneous virtual machine is characterized in that a host machine and a slave host machine are erected, and two sets of operating systems of the virtual machine are respectively run, namely a host client operating system and a slave client operating system, and the method comprises the following steps:
the slave client operating system makes the actual system calling parameter or the runtime calling parameter into a data packet, and sends the data packet to the master client operating system through the network;
the main client operating system runs a daemon, receives a data packet sent from the client operating system, unpacks the data packet, calls a running library or a system, packs a running result and sends the running result to the client operating system through a network;
unpacking and returning to a caller after receiving an operation result from the client operating system through the network;
wherein, a plurality of host machines are erected and only one slave host machine is erected, and the host machines are communicated with the slave host machine at the same time; one slave host machine runs a plurality of sets of slave client operating systems, and simultaneously runs application programs for a plurality of host client operating systems;
or a plurality of host machines and a plurality of slave host machines are simultaneously erected, and the slave host machines are used as public resources and are called by any host machine; a host runs a plurality of sets of host guest operating systems, and simultaneously communicates with a plurality of sets of slave guest operating systems in a plurality of slave hosts to form a plurality of virtual machine instances;
when the application program of the virtual machine calls the function of the operating system, transferring the function call to a host client operating system of the host machine for execution; the CPU instruction sets of the host and the slave host machines are different, the host and the slave client operating systems of the virtual machine are the same as the CPU instruction sets of the respective host machines, the application program of the virtual machine is the same as the CPU instruction set of the host machine, the operating system and the application program in the virtual machine directly give the CPU instruction to the CPU for execution, and the CPU instruction translation is not needed any more.
2. A method of operating a heterogeneous virtual machine according to claim 1, wherein the slave guest operating system has the same system call interface and runtime call interface as the master guest operating system.
3. The method of claim 1, wherein the packet sent from the guest operating system to the host guest operating system comprises:
A. a process number of the calling process;
B. the calling type is as follows: library calls or system calls;
C. the called object: library names, function names, or system call numbers;
D. calling parameters;
E. if the parameter type is a pointer, the parameter type also contains the memory data pointed by the pointer.
4. The method for operating a heterogeneous virtual machine according to claim 1, wherein the step of sending the operation result to the slave guest operating system for the master guest operating system comprises:
A. a process number of the calling process;
B. the calling type is as follows: library calls or system calls;
C. the called object: library names, function names, or system call numbers;
D. if the return value is a pointer, the return value also contains memory data pointed by the pointer;
E. and outputting the data of the parameters, and if the parameter type is a pointer, simultaneously containing the memory data pointed by the pointer.
5. An operating device for heterogeneous virtual machines, wherein a host and a slave host are erected, and two sets of operating systems of the virtual machines are respectively operated, namely a host client operating system and a slave client operating system, comprises:
the first processing module is used for making actual system calling parameters or runtime calling parameters into data packets through the slave guest operating system and sending the data packets to the master guest operating system through a network;
the second processing module is used for operating the daemon program in the main client operating system, receiving the data packet sent from the client operating system, unpacking the data packet, then calling the runtime library or calling the system, packing the operation result and sending the operation result to the slave client operating system through the network;
the return module is used for unpacking and returning the operation result to the caller after the operation result is received from the client operating system through the network;
wherein, a plurality of host machines are erected and only one slave host machine is erected, and the host machines are communicated with one slave host machine at the same time; a slave host computer runs a plurality of sets of slave client operating systems and simultaneously runs application programs for a plurality of host client operating systems;
or a plurality of host machines and a plurality of slave host machines are simultaneously erected, and the slave host machines are used as public resources and are called by any host machine; running a plurality of sets of master guest operating systems in one host machine, and simultaneously communicating with a plurality of sets of slave guest operating systems in a plurality of host machines to form a plurality of virtual machine instances;
when the application program of the virtual machine calls the function of the operating system, transferring the function call to a host client operating system of the host machine for execution; the CPU instruction sets of the host machine and the slave host machine are different, the host client operating system and the slave client operating system of the virtual machine are the same as the CPU instruction sets of the host machines of the virtual machine, the application program of the virtual machine is the same as the CPU instruction sets of the host machines of the virtual machine, the operating system and the application program in the virtual machine directly send the CPU instructions to the CPU to be executed, and CPU instruction translation is not needed any more.
6. An apparatus for operating a heterogeneous virtual machine according to claim 5, wherein the slave guest operating system has the same system call interface and runtime call interface as the master guest operating system.
CN202110456938.4A 2021-04-27 2021-04-27 Running method and device of heterogeneous virtual machine Active CN113176928B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110456938.4A CN113176928B (en) 2021-04-27 2021-04-27 Running method and device of heterogeneous virtual machine

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110456938.4A CN113176928B (en) 2021-04-27 2021-04-27 Running method and device of heterogeneous virtual machine

Publications (2)

Publication Number Publication Date
CN113176928A CN113176928A (en) 2021-07-27
CN113176928B true CN113176928B (en) 2022-08-30

Family

ID=76926369

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110456938.4A Active CN113176928B (en) 2021-04-27 2021-04-27 Running method and device of heterogeneous virtual machine

Country Status (1)

Country Link
CN (1) CN113176928B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103038749A (en) * 2010-07-01 2013-04-10 纽戴纳公司 A system and method for virtualization and cloud security

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2997521B1 (en) * 2012-10-26 2016-01-01 European Aeronautic Defence & Space Co Eads France METHOD AND SYSTEM FOR INTERACTING VIRTUAL MACHINES HOSTED BY HETEROGENEOUS VIRTUALIZATION SOLUTIONS
US10437591B2 (en) * 2013-02-26 2019-10-08 Qualcomm Incorporated Executing an operating system on processors having different instruction set architectures
US9197551B2 (en) * 2013-03-15 2015-11-24 International Business Machines Corporation Heterogeneous overlay network translation for domain unification
CN107770064A (en) * 2016-08-19 2018-03-06 华为技术有限公司 A kind of method of internetwork communication, equipment
CN111143054B (en) * 2019-12-10 2024-01-30 北京计算机技术及应用研究所 Heterogeneous domestic CPU resource fusion management method
CN112464595A (en) * 2020-12-14 2021-03-09 中国电子科技集团公司第十四研究所 Cross-platform communication middleware visual modeling method

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103038749A (en) * 2010-07-01 2013-04-10 纽戴纳公司 A system and method for virtualization and cloud security

Also Published As

Publication number Publication date
CN113176928A (en) 2021-07-27

Similar Documents

Publication Publication Date Title
CN111745651B (en) Intelligent robot operating system structure and operating method thereof
EP0657047B1 (en) Method and system for implementing remote procedure calls in a distributed computer system
KR20170094136A (en) System and method for execution of application code compiled according to two instruction set architectures
US10885247B2 (en) Just-in-time hardware for field programmable gate arrays
KR20230084300A (en) Chip system, virtual interrupt processing method and corresponding device
CN112905472A (en) Kernel debugging system and method
US9772951B2 (en) Preemptive guest merging for virtualization hypervisors
CN113806006A (en) Method and device for processing exception or interrupt under heterogeneous instruction set architecture
GB2431023A (en) Method for sending database calls from an originating program in a first logical partition to a database in a second partition.
WO2019001276A1 (en) Microkernel scheduling method and apparatus
CN109918054B (en) Service bus microkernel framework design method based on formalization specification
EP2828747A1 (en) Hybrid emulation and kernel function processing systems and methods
CN106550026B (en) Network communication device and method
CN113176928B (en) Running method and device of heterogeneous virtual machine
US7296187B1 (en) Hardware debug device having script-based host interface
CN117221050A (en) Storage gateway, chip and electronic equipment
CN115033348B (en) Method, system, equipment and medium for unified management of virtual machine and container
CN109460280B (en) Method and terminal for running program
CN113849277B (en) Network card testing method and device, computer equipment and computer readable storage medium
CN113986466A (en) Cloud computing-oriented GPU virtualization system and method
US11429358B2 (en) Representing asynchronous state machine in intermediate code
CN113791870A (en) Fine-grained migration method and system for distributed system of WebAssembly virtual machine
CN114281529A (en) Distributed virtualized client operating system scheduling optimization method, system and terminal
CN113805911A (en) Multi-version program management method, device and system of server side
CN115658330B (en) WebAssembly-oriented cross-platform GPU virtualization method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant