CN106796530A - A kind of virtual method, device and electronic equipment, computer program product - Google Patents

A kind of virtual method, device and electronic equipment, computer program product Download PDF

Info

Publication number
CN106796530A
CN106796530A CN201680002851.7A CN201680002851A CN106796530A CN 106796530 A CN106796530 A CN 106796530A CN 201680002851 A CN201680002851 A CN 201680002851A CN 106796530 A CN106796530 A CN 106796530A
Authority
CN
China
Prior art keywords
end thread
cpu
virtual cpu
thread
operating system
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201680002851.7A
Other languages
Chinese (zh)
Other versions
CN106796530B (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.)
Cloudminds Inc
Original Assignee
Cloudminds Inc
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 Cloudminds Inc filed Critical Cloudminds Inc
Publication of CN106796530A publication Critical patent/CN106796530A/en
Application granted granted Critical
Publication of CN106796530B publication Critical patent/CN106796530B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects

Abstract

A kind of virtual method, device and electronic equipment, computer program product are provided in the embodiment of the present application, polycaryon processor is applied to, the method includes:Front end thread and rear end thread are tied to Same Physical central processor CPU;Wherein, the front end thread is used to, according to the application interface call instruction received at the first operating system, determine the corresponding process instruction of application interface call instruction, and the respective rear ends thread process instruction sent to the second operating system;The rear end thread, at the second operating system, receiving and performing the process instruction, and using result is as the response of the application interface call instruction or returns to front end thread.Using the scheme of the embodiment of the present application, system switching time can be shortened, reduce the response time to the instruction of application interface interchange, lift Consumer's Experience.

Description

A kind of virtual method, device and electronic equipment, computer program product
Technical field
The application is related to computer technology, in particular it relates to a kind of virtual method, device and electronic equipment, computer Program product.
Background technology
Shown in Fig. 1 based on Qemu/KVM (Kernel-based Virtual Machine, based on the virtual of kernel Machine) technology virtualization architecture.
As shown in figure 1, the virtualization architecture based on Qemu/KVM technologies is by a main Host operating systems, several are virtual Objective Guest operating systems composition out.Host operating systems are included in multiple Host user space programs, Host Linux Core.Each objective Guest operating system includes user's space, Guest linux kernels and analog processor Qemu respectively.These Operating system on same set of hardware processor chip, shared processor and peripheral hardware resource.Support the ARM of virtualization architecture Processor comprises at least EL2, and EL1, EL0 Three models run virtual machine manager Hypervisor programs under EL2 patterns;EL1 Linux kernel program is run under pattern, i.e. Linux kernel programs;User space program is run under EL0 patterns. The hardware resources such as Hypervisor layer-managements CPU, internal memory, timer, interruption, and by CPU, internal memory, timer, interrupt void Planization resource, different operating system time-sharings can be loaded on concurrent physical processor and run, so as to realize system virtualization Function.
KVM/Hypervisor crosses over Host Linux kernel and Hypervisor two-layers, on the one hand for Qemu is provided Driving node, i.e. allow Qemu to create virtual cpu by KVM nodes, and manage virtual resources;Another aspect KVM/ Hypervisor can also switch out Host linux systems from physical cpu, and then Guest linux systems are loaded Run on to concurrent physical processor, and process the subsequent transaction that Guest linux systems are exited extremely.
Qemu sets as an application operation of Host Linux for the operation of Guest Linux provides virtual hardware Standby resource, by the equipment KVM nodes of KVM/Hypervisor modules, creates virtual cpu, distributes physical hardware resources, realizes One unmodified Guest Linux is loaded into physical hardware treatment to run up.
Above-mentioned virtualization architecture is realized on the terminal device such as mobile phone or flat board, it is necessary to solve the virtual of all hardware equipment Change, it is allowed to fictionalize the operating system come and could be used that real hardware device.
In the virtualization scheme of prior art, use is typically being received by the front end thread in Guest operating systems When family operates, corresponding API (Application Program Interface, application interface) is called, produce corresponding treatment Instruction;Then the process instruction is transferred to the background server corresponding with the API run in Host operating systems In Backend Server, the corresponding rear end thread of the front end thread, and by rear end thread drive corresponding hardware device or Module perform corresponding operating then using implementing result as application interface call instruction response.
It is long for response process that API Calls are instructed using virtualization scheme of the prior art, thus cause it is right The response of user's operation is time-consuming more long, influences Consumer's Experience.
The content of the invention
A kind of virtual method, device and electronic equipment, computer program product are provided in the embodiment of the present application, it is main It is used to shorten the response process instructed for API Calls in virtualization system.
According to the one side of the embodiment of the present application, there is provided a kind of virtual method, polycaryon processor is applied to, wrapped Include:Front end thread and rear end thread are tied to Same Physical central processor CPU;Wherein, the front end thread exists for basis The application interface call instruction received at first operating system, determines the corresponding process instruction of application interface call instruction, And the respective rear ends thread sent the process instruction to the second operating system;The rear end thread, in the second operation system At system, the process instruction is received and performs, and using result is as the response of the application interface call instruction or returns to Front end thread.
A kind of second aspect according to the embodiment of the present application, there is provided virtualization apparatus, is applied to polycaryon processor, bag Include:Binding module, for front end thread and rear end thread to be tied into Same Physical central processor CPU;Wherein, the front end of line Journey is used for according to the application interface call instruction received at the first operating system, determines application interface call instruction correspondence Process instruction, and the respective rear ends thread process instruction sent to the second operating system;The rear end thread, for At second operating system, receive and perform the process instruction, and using result as the application interface call instruction response Or return to front end thread.
The 3rd aspect according to the embodiment of the present application, there is provided a kind of electronic equipment, the electronic equipment includes:Display Device, memory, one or more processors;And one or more modules, one or more modules are stored in the storage In device, and it is configured to be performed by the one or more processors, one or more modules are included for performing the application reality The instruction of each step in the virtual method of the one side for applying example.
According to the 4th aspect of the embodiment of the present application, there is provided a kind of computer program product, the computer program product To being encoded for performing a kind of instruction of process, the process includes the virtual side of the one side of the embodiment of the present application Method.
Using the virtual method according to the embodiment of the present application, device and electronic equipment, computer program product, will be preceding End line journey and corresponding rear end thread are tied to Same Physical CPU, so that in virtualization process, Guest operating systems And switching and the switching of front end thread and rear end thread between Host operating systems, can be held on Same Physical CPU OK, so as to shorten switching time, the response time to the instruction of application interface interchange is reduced, lifts Consumer's Experience.
Brief description of the drawings
Accompanying drawing described herein is used for providing further understanding of the present application, constitutes the part of the application, this Shen Schematic description and description please does not constitute the improper restriction to the application for explaining the application.In the accompanying drawings:
The virtualization architecture schematic diagram based on Qemu/KVM technologies is shown in Fig. 1;
Fig. 2 shows a kind of system architecture for implementing the virtual method in the embodiment of the present application;
Fig. 3 shows the flow chart of the virtual method according to the embodiment of the present application one;
Fig. 4 shows the flow chart of the virtual method according to the embodiment of the present application two;
Fig. 5 shows the flow chart of the virtual method according to the embodiment of the present application three;
Fig. 6 shows the structural representation of the virtualization apparatus according to the embodiment of the present application four;
Fig. 7 shows the structural representation of the electronic equipment according to the embodiment of the present application five.
Specific embodiment
During the application is realized, inventor has found, in the virtualization scheme of prior art, in polycaryon processor During a certain thread of middle establishment, the virtual cpu of thread operation, example are dispatched according to the strategy for pre-setting by Linux kernel Such as, according to the scheduling of load balancing principle, according to poll principle scheduling etc.;Therefore, it is not which virtual cpu a certain thread runs on Determine;Meanwhile, Qemu, when virtual cpu is created, is also according to the tactful schedule virtual for pre-setting by Linux kernel CPU operation physical cpu, for example, according to load balancing principle or according to poll principle scheduling etc., therefore, virtual cpu with Corresponding relation between physical cpu is also uncertain.Therefore, it is uncertain which physical cpu the thread in system runs on.
It has been recognised by the inventors that during the scheduling strategy of above-mentioned thread and virtual cpu can cause virtualization scheme of the prior art, The back end of line corresponding with the front end thread run in the front end thread and Host operating systems that are run in Guest operating systems Journey would generally be run on different physical cpus, so that during virtualization is realized, front end thread and rear end thread Between when switching over, while being also, it is necessary in difference when being switched between Guest operating systems and Host operating systems Switch between physical cpu, so as to cause the response to the instruction of application interface interchange time-consuming more long, so grasped when for some users The corresponding time made also can be long, influences Consumer's Experience.
Regarding to the issue above, in the embodiment of the present application provide a kind of virtual method, device, system and electronic equipment, Computer program product, is tied to Same Physical CPU, so that virtualizing by front end thread and corresponding rear end thread The switching of switching and front end thread and rear end thread between Cheng Zhong, Guest operating system and Host operating systems, can Performed on Same Physical CPU, so as to shorten switching time, reduce the response time to the instruction of application interface interchange, lifting is used Experience at family.
Scheme in the embodiment of the present application can apply in various scenes, for example, using based on Qemu/KVM technologies Virtualization architecture, multiple operating system multinuclear intelligent terminal, Android simulator etc..
Scheme in the embodiment of the present application can be realized using various computer languages, for example, the program of object-oriented sets Meter language Java etc..
In order that the technical scheme and advantage in the embodiment of the present application become more apparent, below in conjunction with accompanying drawing to the application Exemplary embodiment be described in more detail, it is clear that described embodiment be only the application a part implementation Example, rather than the exhaustion of all embodiments.It should be noted that in the case where not conflicting, embodiment and reality in the application Applying the feature in example can be mutually combined.
Embodiment one
Fig. 2 shows a kind of system architecture for implementing the virtual method in the embodiment of the present application.
As shown in Fig. 2 the virtualization system according to the embodiment of the present application be applied to include multiple physical cpu 201a, 201b, In the electronic equipment of 201c and 201d, and in the electronic equipment, create multiple virtual cpu 202a, 202b, 202c and 202d;And the first operating system 203 and the second operating system 204 are had based on the establishment of Qemu/KVM technologies.
Specifically, first operating system can be Guest operating systems;Second operating system can be Host operations System.It should be appreciated that in the specific implementation, first operating system can also be Host operating systems, second operating system Can also be Guest operating systems, the application is not restricted to this.
For illustrative purposes, be illustrate only in Fig. 2 four core processors, correspond respectively to four of four core processors it is virtual The situation of CPU.It is to be understood that, in the specific implementation, or such as 2,3,5,8 etc. other any plural number numbers physics CPU, the quantity of virtual cpu can also be such as 5,6,8,10 etc. other any plural number numbers.In the specific number for setting virtual cpu Can be 1 with the quantity of physical cpu during amount:1, it is also possible to be set to 2:1 etc.;The quantity that virtual cpu can generally be set is more than Equal to the quantity of physical cpu;The application is not restricted to this.
For illustrative purposes, a Guest operating systems, the situation of Host operating system are illustrate only in Fig. 2. It is to be understood that, in the specific implementation, or one or more Guest operating systems, or one or more Host operating systems;That is, for Guest operating systems, Host operating systems can be arbitrary quantity, the application to this not It is restricted.
Next, will be 4 with physical cpu, virtual cpu and the quantity of physical cpu to be created be 1:1;While first Operating system be Guest operating systems, the second operating system be Host operating systems as a example by, to the specific embodiment of the application Describe in detail.
Specifically, user's space 2031, Guest Linux Kernel can be included in Guest operating systems 203 2032 and Qemu 2033;Virtual multiple hardwares equipment or mould can be provided with the user's space of Guest operating systems The interface of block, specifically, the multiple interfaces can be including graphic package interface, Multimedia Program interface, encoding and decoding interface etc.;More Specifically, for example, the graphic package interface can be OpenGL (Open Graphics Library, open graph experiment room) The graphic package interfaces such as api interface, Direct 3D, Quick Draw 3D, the multimedia/video program's interface can be OpenMAX (Open Media Acceleration, open multimedia acceleration layer) interface etc., the application is not restricted to this.
Specifically, user's space 2041 and Host Linux Kernel 2042 can be included in Host operating systems 204; The back-end server of each interface in being provided corresponding to Guest operating systems in the user's space of Host operating systems Backend Server.For example, when the graphic package interface in Guest operating systems is OpenGL API, back-end server can Being OpenGL Backend Server;Back-end server can be by the GPU driver in Host Linux Kernel Go to operate GPU equipment;When multimedia/video program's interface in Guest operating systems is OpenMAX API, back-end server Can be OpenMAX Backend Server;Back-end server can be by the multimedia in Host Linux Kernel/regard Frequency driver goes to operate corresponding multimedia/video equipment.
Next, will be described to the virtual method according to the embodiment of the present application with reference to system shown in Figure 2 framework.
Fig. 3 shows the flow chart of the virtual method according to the embodiment of the present application one.In the embodiment of the present application one, retouch The step of having stated the virtual method using Guest operating systems as executive agent.As shown in figure 3, according to the embodiment of the present application The virtual method of GPU comprise the following steps:
S301, when virtual cpu is created, sets up the corresponding relation of each virtual cpu and each physical cpu at Qemu.
In the specific implementation, each thread for safeguarding each virtual cpu can respectively be tied up when Qemu creates virtual cpu Determine to corresponding physical cpu.For example, first virtual cpu for creating is tied to physical cpu 201a, second for creating Virtual cpu is tied to physical cpu 201b, and the 3rd virtual cpu for creating is tied into physical cpu 201c, and the 4th virtual CPU is tied to physical cpu 201d etc..Specifically, the specific implementation for virtual cpu being tied into a certain physical cpu can be using this The common technology means of art personnel, the application is not repeated this.
S302, receives the application interface call instruction performed at the first operating system, according to user's operation calls correspondence Front end thread, and determine process instruction.
In the specific implementation, a certain thread that user can be directed in Guest operating systems performs user's operation, for example, User can perform and open a new window in the threads such as wechat, QQ, makes a call to new page etc., plays multimedia/video etc. Operation.
In the specific implementation, when user's operation is received, thread can produce an API Calls instruction according to user's operation Call corresponding front end thread, for example, when user perform be open a new window, when plaing the operation of a new page etc., Corresponding graphics process interface can be called, when user's execution is that when playing the operation such as multimedia/video, can call correspondence Multimedia/video interface etc..
When specific, after corresponding front end thread is called, concrete operations content that can further according to user, it is determined that Process instruction;Specifically, the process instruction can be newly-built window, a page;One section of instruction of video of coding, specifically, The process instruction can include one or more of following codes:Treatment function, parameter, synchronizing information, content-data etc., this Shen Please this is not restricted.
S303, a virtual cpu is tied to by front end thread.
In the specific implementation, can be virtual what front end thread to be tied to the thread that calls the front end thread run CPU.For example, the thread for calling the front end thread is wechat, then front end thread can be tied into wechat run is virtual CPU。
Specifically, can be when the front end thread starts, i.e. can calling in Guest operating system initializations API When, obtain the mark of the virtual cpu for calling the thread of the API to be run.Specifically, the mark of the virtual cpu can be virtual The numbering of CPU.And by the front end thread, i.e. API is tied to corresponding virtual cpu.Specifically, the thread for calling the API is obtained The numbering of virtual cpu can be using the common technology means of those skilled in the art, for example, can be by calling the line of the API Journey detects the numbering of the virtual cpu for itself being run, and therefore not to repeat here for the application.
So far, because virtual cpu and physical cpu have fixed corresponding relation, by S301-S303, can be by before one End line journey is tied to one and specifies physical cpu.
S304, the mark of the virtual cpu is sent to the second operating system.
In the specific implementation, the mark of virtual cpu can be individually sent to the second operating system, it is also possible to will be virtual The mark of CPU is carried and sent in other message to the second operating system.
Specifically, when front end thread is called, it will usually trigger Host operating systems and create corresponding with the front end thread Rear end thread.In order that rear end thread is tied to Same Physical CPU with front end thread, can be in front end thread and rear end thread Between passage initialization information in, carry virtual cpu mark, and by passage initialization information send to Host operate be System.To allow that Host operating systems create the back end of line corresponding with front end thread in the background server of the corresponding interface Journey, and the rear end thread further can be tied to the virtual cpu.
So far, by S301-S304, front end thread rear end thread corresponding with its can be tied to same specified thing Reason CPU.
If it should be appreciated that before S302, having been built up being called corresponding to the application interface in the first operating system The front end thread of instruction, and the front end thread has been bound to corresponding virtual cpu, then calling the front end thread again When, can be not repeated to perform step S303 and S304.
S305, process instruction is sent to rear end thread;So that rear end thread performs the process instruction, and obtain treatment knot Really.
In the specific implementation, the transmission of process instruction can use the conventional sending method of various those skilled in the art, The application will not be described here.
In the specific implementation, from front end of line journey to the switching of rear end thread, and the first operating system and the second operation system Using the common technology means of those skilled in the art, the application is not repeated this for switching between system.
In the specific implementation, rear end thread drives corresponding hardware device/module to perform corresponding process instruction, and obtains Result.
It should be appreciated that step S304 and S305 do not have strict sequential relationship, S304 can be first carried out, then perform S305, it is also possible to first carry out S305, then perform S304;Synchronous S304 and S305 can also be performed, the application is not limited this System.
In the specific implementation, rear end thread can be anti-directly as the response of application interface call instruction by the result Fed user, it is also possible to which the result is returned into front end thread, and by front end thread, response user operates.
So far, far call of the user program to hardware device/module in Guest operating systems is realized;That is, realize Front end thread runs on the virtualization scheme of Same Physical CPU with rear end thread.
Using the virtual method in the embodiment of the present application, front end thread and corresponding rear end thread are tied to same thing Reason CPU, so that in virtualization process, switching and front end of line between Guest operating systems and Host operating systems The switching of journey and rear end thread, can perform on Same Physical CPU, so as to shorten switching time, reduce and application interface is adjusted With the response time of instruction, Consumer's Experience is lifted.
Embodiment two
Fig. 4 shows the flow chart of the virtual method according to the embodiment of the present application two.In the embodiment of the present application two, retouch The step of having stated the virtual method using Host operating systems as executive agent.The reality of the system architecture in the embodiment of the present application The system architecture that may refer in embodiment one shown in Fig. 2 is applied, part is repeated and is repeated no more.
As shown in figure 4, the virtual method according to the embodiment of the present application is comprised the following steps:
S401, the second operating system determines the virtual cpu of front end thread binding, and it is virtual that rear end thread is tied into this CPU, wherein, there is corresponding relation with physical cpu in the virtual cpu.
In the specific implementation, during the foundation of the corresponding relation of virtual cpu and physical cpu may be referred to the embodiment of the present application one The implementation of S301, repeats part and repeats no more.
In the specific implementation, when Host operating systems can create corresponding rear end thread in background server, it is determined that The virtual cpu of preceding thread binding, and rear end thread is tied to the virtual cpu.Specifically, if Guest operating systems will be preceding End line journey binding virtual cpu mark, for example, numbering, carrying sent in the passage initialization information of front and back end thread to Host operating systems, then Host operating systems can extract the numbering of corresponding virtual cpu from passage initialization information, and After creating rear end thread, rear end thread is tied to the virtual cpu.
So far, front end thread and rear end thread are tied to Same Physical CPU.
S402, the rear end thread at the second operating system obtains the treatment from the front end thread at the first operating system Instruction;
In the specific implementation, from front end of line journey to the switching of rear end thread, and the first operating system and the second operation system Using the common technology means of those skilled in the art, the application is not repeated this for switching between system.
In the specific implementation, specifically, the process instruction can be newly-built window, a page;One section of video of coding Instruction, specifically, the process instruction can include one or more of following codes:It is treatment function, parameter, synchronizing information, interior Hold data etc., the application is not restricted to this.
In the specific implementation, the acquisition of process instruction can use the conventional acquisition modes of various those skilled in the art, The application will not be described here.
S403, performs process instruction, and obtain result at the thread of rear end;Using result as treatment operation Response, wherein, treatment operation is corresponding with process instruction.
In the specific implementation, the rear end thread in back-end server drives corresponding hardware device/module to perform the treatment Instruction, and meet with a response in the result for the treatment of operation.
If it should be appreciated that before S402, the rear end corresponding with front end thread is had built up in the second operating system Thread, and the rear end thread has been bound to corresponding virtual cpu, then when the rear end thread is called again, can be no longer Step S401 is repeated, but directly performs S402 and S403.
So far, realize in Host operating systems, coordinate Guest operating systems in user program to hardware device/ The far call of module;That is, realize front end thread and run on the virtualization scheme of Same Physical CPU with rear end thread.
Using the virtual method in the embodiment of the present application, front end thread and corresponding rear end thread are tied to same thing Reason CPU, so that in virtualization process, switching and front end of line between Guest operating systems and Host operating systems The switching of journey and rear end thread, can perform on Same Physical CPU, so as to shorten switching time, reduce and application interface is adjusted With the response time of instruction, Consumer's Experience is lifted.
Embodiment three
Fig. 5 shows the flow chart of the virtual method according to the embodiment of the present application three.In the embodiment of the present application three, retouch State Guest operating systems and coordinate the step of realizing virtual method with Host operating systems.System in the embodiment of the present application The implementation of framework may refer to the system architecture shown in Fig. 2 in embodiment one, repeats part and repeats no more.
In the embodiment of the present application, the initiator of api function far call is Guest operating systems, and function execution side is Host operating systems, from Guest operating systems to the down-going synchronous process of Host operating systems experience Guest Linux Kernel, Qemu reach Backend Server;From Host operating systems to the uplink synchronous process of Guest operating systems from Backend Server are initiated, and emulator API are reached by Qemu, Guest Linux kernel.
Next, will be described in detail to the implementation process of the virtual method based on above-mentioned application scenarios.
As shown in figure 5, the virtual method according to the embodiment of the present application three is comprised the following steps:
S501, when virtual cpu is created, Qemu will safeguard that each thread of virtual cpu is tied to fixed physics respectively CPU。
For example, realizing virtualization in the processor chips of 4 cores, and 4 virtual cpus are created, then Qemu can be created The thread of virtual cpu 0 is tied on physical cpu 0, and by that analogy, the thread for creating virtual cpu 3 is tied on physical cpu 3.
S502, Guest operating system receive application interface call instruction.
In the specific implementation, Guest operating systems can be by operating system, it is also possible to by a certain in operating system Thread receives user's operation.For example, a certain thread that user can be directed in Guest operating systems performs user's operation, for example, In the threads such as wechat, QQ, perform and open a new window, make a call to new page etc., play the operation of multimedia/video etc.. These threads are after user's operation is received, it will usually produce API Calls to instruct.
When S503, Guest operating system create front end thread, the virtual cpu where detecting the thread for calling front end thread Numbering.
In the specific implementation, the thread of front end thread is called, that is, the thread of initiation API far calls can be received The thread of user's operation.For example, it may be the user program such as wechat, QQ.
In the specific implementation, the thread of the API can be called using the common technology means of those skilled in the art, detection Virtual cpu numbering, therefore not to repeat here for the application.
Be bundled in front end thread on this virtual cpu and run by S504, Guest operating system, and virtual cpu numbering is transmitted to Corresponding Backend Server in Host operating systems.
In the specific implementation, virtual cpu numbering can be individually sent to Backend Server, it is also possible to will be virtual The numbering of CPU is carried in other message, for example, being sent in passage initial message to Backend Server.
It should be appreciated that the Backend Server can be background server corresponding with front end thread, if for example, preceding End line journey is graphic package interface, then corresponding Backend Server are graphic package background servers, if front end thread It is multimedia/video interface, then corresponding Backend Server are multimedia/video background servers.
S505, Backend Server after creation end line journey when, rear end thread is tied to Guest operating systems and is specified Virtual cpu.
In the specific implementation, if Guest operating systems individually send to Backend Server virtual cpu numbering; When then Backend Server continue thread after creation, virtual cpu numbering is obtained;If Guest operating systems are by virtual cpu Numbering carry and sent in passage initial message to Backend Server, then Backend Server are initialized from passage The CPU number is extracted in message, and is bound.
It should be appreciated that for improve efficiency, when front end of line journey and corresponding rear end thread be bound to Same Physical CPU it Afterwards, in ensuing virtualization process, the far call of API can be directly carried out, without repeating to bind again;That is, Front end thread can no longer be performed and the step of rear end thread is tied to Same Physical CPU, i.e. S503-S505.
Process instruction is sent to rear end thread by S506, front end thread.
In the specific implementation, the implementation of this step may be referred to the S305 and the embodiment of the present application two of the embodiment of the present application one S402, repeat part repeat no more.
S507, performs process instruction, and obtain result at the thread of rear end;Adjusted result as application interface With the response of instruction, or front end thread is returned to.
In the specific implementation, the implementation of this step, may be referred to the implementation of step S403 in the embodiment of the present application two, repeat Part is repeated no more.
So far, realize in polycaryon processor, user program is to the remote of hardware device/module between multiple operating systems Journey is called;That is, realize front end thread and run on the virtualization scheme of Same Physical CPU with rear end thread.
Using the virtual method in the embodiment of the present application, front end thread and corresponding rear end thread are tied to same thing Reason CPU, so that in virtualization process, switching and front end of line between Guest operating systems and Host operating systems The switching of journey and rear end thread, can perform on Same Physical CPU, so as to shorten switching time, reduce and application interface is adjusted With the response time of instruction, Consumer's Experience is lifted.
A kind of virtualization apparatus are additionally provided based on same inventive concept, in the embodiment of the present application, multinuclear treatment is applied to Device, by the principle of the device solve problem is similar to the virtual method that the embodiment of the present application one is provided, therefore the dress The implementation put may refer to the implementation of method, repeats part and repeats no more.
Example IV
Fig. 6 shows the structural representation of the virtualization apparatus according to the embodiment of the present application four.
As shown in fig. 6, the virtualization apparatus 600 according to the embodiment of the present application four include:Binding module 601, for will be preceding End line journey is tied to Same Physical central processor CPU with rear end thread;Wherein, the front end thread is used for according in the first operation The application interface call instruction received at system, determines the corresponding process instruction of application interface call instruction, and by this Reason instruction is sent to the respective rear ends thread at the second operating system;The rear end thread, at the second operating system, receiving With perform the process instruction, and using result is as the response of the application interface call instruction or returns to front end thread.
Specifically, binding module, specifically includes:Corresponding relation setting up submodule, for being built at analog processor Qemu Found the corresponding relation of each virtual cpu and each physical cpu;First binding submodule, at the first operating system, by the front end Thread is tied to a virtual cpu;And send to the second operating system the mark of bound virtual cpu;Second binding submodule Block, in the second operating system, the mark of the virtual cpu being received from first operating system, the rear end thread is tied up Determine to the virtual cpu.
Specifically, corresponding relation setting up submodule, specifically for:When Qemu creates virtual cpu, will safeguard each virtual Each thread of CPU is tied to corresponding physical cpu respectively.
Specifically, the first binding submodule, specifically for:It is virtual that acquisition calls that the thread of the front end thread run The mark of CPU, the mark is used to identify the virtual cpu;The front end thread is tied to virtual cpu mark corresponding virtual CPU;The mark of bound virtual cpu is sent to the second operating system.
Specifically, the first binding submodule, specifically for:When the front end thread starts, the front end thread is called in acquisition The mark of virtual cpu run of thread;In passage initialization information between the front end thread and the rear end thread, take Mark with the virtual cpu, and the passage initialization information is sent to second operating system;Second binding submodule, tool Body is used for:The passage initialization information between the front end thread and the rear end thread is received from first operating system, wherein, The mark of the virtual cpu is carried in the passage initialization information;The mark of the virtual cpu is extracted from the passage initialization information Know, the rear end thread is tied to the virtual cpu.
Using the virtualization apparatus in the embodiment of the present application, front end thread and corresponding rear end thread are tied to same thing Reason CPU, so that in virtualization process, switching and front end of line between Guest operating systems and Host operating systems The switching of journey and rear end thread, can perform on Same Physical CPU, so as to shorten switching time, reduce and application interface is adjusted With the response time of instruction, Consumer's Experience is lifted.
Embodiment five
Based on same inventive concept, a kind of electronic equipment 700 as shown in Figure 7 is additionally provided in the embodiment of the present application.
As shown in fig. 7, the electronic equipment 700 according to the embodiment of the present application five includes:Display 701, memory 702, one Individual or multiple processors 703;Bus 704;And one or more modules, one or more modules are stored in the memory In, and be configured to be performed by the one or more processors, one or more modules are included for performing according to the application The instruction of each step in any one of embodiment one to three.
A kind of computer program product is additionally provided based on same inventive concept, in the embodiment of the present application, the computer journey To being encoded for performing a kind of instruction of process, the process includes each in the embodiment of the present application one to sequence product The virtual method of step.
In the specific implementation, the computer program product can be used in combination with electronic equipment 700.
It should be understood by those skilled in the art that, embodiments herein can be provided as method, system or computer program Product.Therefore, the application can be using the reality in terms of complete hardware embodiment, complete software embodiment or combination software and hardware Apply the form of example.And, the application can be used and wherein include the computer of computer usable program code at one or more The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) is produced The form of product.
The application is the flow with reference to method, equipment (system) and computer program product according to the embodiment of the present application Figure and/or block diagram are described.It should be understood that every first-class during flow chart and/or block diagram can be realized by computer program instructions The combination of flow and/or square frame in journey and/or square frame and flow chart and/or block diagram.These computer programs can be provided The processor of all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing devices is instructed to produce A raw machine so that produced for reality by the instruction of computer or the computing device of other programmable data processing devices The device of the function of being specified in present one flow of flow chart or multiple one square frame of flow and/or block diagram or multiple square frames.
These computer program instructions may be alternatively stored in can guide computer or other programmable data processing devices with spy In determining the computer-readable memory that mode works so that instruction of the storage in the computer-readable memory is produced and include finger Make the manufacture of device, the command device realize in one flow of flow chart or multiple one square frame of flow and/or block diagram or The function of being specified in multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that in meter Series of operation steps is performed on calculation machine or other programmable devices to produce computer implemented treatment, so as in computer or The instruction performed on other programmable devices is provided for realizing in one flow of flow chart or multiple flows and/or block diagram one The step of function of being specified in individual square frame or multiple square frames.
Although having been described for the preferred embodiment of the application, those skilled in the art once know basic creation Property concept, then can make other change and modification to these embodiments.So, appended claims are intended to be construed to include excellent Select embodiment and fall into having altered and changing for the application scope.
Obviously, those skilled in the art can carry out the essence of various changes and modification without deviating from the application to the application God and scope.So, if these modifications of the application and modification belong to the scope of the application claim and its equivalent technologies Within, then the application is also intended to comprising these changes and modification.

Claims (11)

1. a kind of virtual method, is applied to polycaryon processor, it is characterised in that including:
Front end thread and rear end thread are tied to Same Physical central processor CPU;Wherein,
The front end thread is used to, according to the application interface call instruction received at the first operating system, determine the application Interface interchange instructs corresponding process instruction, and the respective rear ends line process instruction sent to the second operating system Journey;
The rear end thread, at the second operating system, receiving and performing the process instruction, and using result as The response of the application interface call instruction returns to front end thread.
2. method according to claim 1, it is characterised in that front end thread and rear end thread are tied in Same Physical Central processor CPU, specifically includes:
The corresponding relation of each virtual cpu and each physical cpu is set up at analog processor Qemu;
At the first operating system, the front end thread is tied to a virtual cpu;And by the mark of bound virtual cpu Send to the second operating system;
In the second operating system, the mark of the virtual cpu is received from first operating system, by the rear end thread It is tied to the virtual cpu.
3. method according to claim 2, it is characterised in that each virtual cpu is set up at Qemu right with each physical cpu Should be related to, specifically include:
When Qemu creates virtual cpu, each thread for safeguarding each virtual cpu is tied to corresponding physical cpu respectively.
4. method according to claim 2, it is characterised in that front end thread is tied to a virtual cpu, is specifically included:
The mark of the virtual cpu for calling the thread of the front end thread to be run is obtained, the mark is described virtual for identifying CPU;
The front end thread is tied to the virtual cpu and identifies corresponding virtual cpu.
5. method according to claim 4, it is characterised in that obtain the void for calling the thread of the front end thread to be run Intend the mark of CPU, specifically include:
When the front end thread starts, the mark of the virtual cpu for calling the thread of the front end thread to be run is obtained;
And send to the second operating system the mark of bound virtual cpu, specifically include:In the front end thread and described In passage initialization information between the thread of rear end, the mark of the virtual cpu is carried, and the passage initialization information is sent out Deliver to second operating system;
The mark of the virtual cpu is received from first operating system, is specifically included:
The passage initialization information between the front end thread and the rear end thread is received from first operating system, its In, the mark of the virtual cpu is carried in the passage initialization information;
The mark of the virtual cpu is extracted from the passage initialization information.
6. a kind of virtualization apparatus, are applied to polycaryon processor, it is characterised in that including:
Binding module, for front end thread and rear end thread to be tied into Same Physical central processor CPU;Wherein,
The front end thread is used to, according to the application interface call instruction received at the first operating system, determine the application Interface interchange instructs corresponding process instruction, and the respective rear ends line process instruction sent to the second operating system Journey;
The rear end thread, at the second operating system, receiving and performing the process instruction, and using result as The response of the application interface call instruction returns to front end thread.
7. device according to claim 6, it is characterised in that binding module, specifically includes:
Corresponding relation setting up submodule, for being set up at analog processor Qemu, each virtual cpu is corresponding with each physical cpu to close System;
First binding submodule, at the first operating system, the front end thread being tied into a virtual cpu;And by institute The mark of the virtual cpu of binding is sent to the second operating system;
Second binding submodule, in the second operating system, the virtual cpu being received from first operating system Mark, the virtual cpu is tied to by the rear end thread.
8. device according to claim 7, it is characterised in that corresponding relation setting up submodule, specifically for:
When Qemu creates virtual cpu, each thread for safeguarding each virtual cpu is tied to corresponding physical cpu respectively.
9. device according to claim 7, it is characterised in that the first binding submodule, specifically for:
The mark of the virtual cpu for calling the thread of the front end thread to be run is obtained, the mark is described virtual for identifying CPU;
The front end thread is tied to the virtual cpu and identifies corresponding virtual cpu;
The mark of bound virtual cpu is sent to the second operating system.
10. device according to claim 9, it is characterised in that the first binding submodule, specifically for:
When the front end thread starts, the mark of the virtual cpu for calling the thread of the front end thread to be run is obtained;Institute State in the passage initialization information between front end thread and the rear end thread, carry the mark of the virtual cpu, and will be described Passage initialization information is sent to second operating system;
Second binding submodule, specifically for:
The passage initialization information between the front end thread and the rear end thread is received from first operating system, its In, the mark of the virtual cpu is carried in the passage initialization information;
The mark of the virtual cpu is extracted from the passage initialization information, the rear end thread is tied to described virtual CPU。
11. a kind of electronic equipment, it is characterised in that the electronic equipment includes:Display, memory, one or more treatment Device;And one or more modules, one or more of modules are stored in the memory, and are configured to by described One or more processors are performed, and one or more of modules are included for any methods described in perform claim requirement 1-5 In each step instruction.
A kind of computer program product, the computer program product to being encoded for performing a kind of instruction of process, institute Stating process includes the method according to any one of claim 1-5.
CN201680002851.7A 2016-12-22 2016-12-22 A kind of virtual method, device and electronic equipment, computer program product Active CN106796530B (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2016/111590 WO2018112855A1 (en) 2016-12-22 2016-12-22 Virtualisation method and device, electronic device, and computer program product

Publications (2)

Publication Number Publication Date
CN106796530A true CN106796530A (en) 2017-05-31
CN106796530B CN106796530B (en) 2019-01-25

Family

ID=58952282

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201680002851.7A Active CN106796530B (en) 2016-12-22 2016-12-22 A kind of virtual method, device and electronic equipment, computer program product

Country Status (2)

Country Link
CN (1) CN106796530B (en)
WO (1) WO2018112855A1 (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110489212A (en) * 2019-08-20 2019-11-22 东软集团股份有限公司 A kind of method, apparatus and vehicle device of universal input/output port virtualization
CN110673928A (en) * 2019-09-29 2020-01-10 天津卓朗科技发展有限公司 Thread binding method, thread binding device, storage medium and server
CN110764901A (en) * 2019-09-17 2020-02-07 阿里巴巴集团控股有限公司 Data processing method based on GPU (graphics processing Unit) resources, electronic equipment and system
CN111930425A (en) * 2020-06-23 2020-11-13 联宝(合肥)电子科技有限公司 Data control method and device and computer readable storage medium
CN113032108A (en) * 2021-05-26 2021-06-25 武汉深之度科技有限公司 Application program running method, computing device and storage medium
WO2022247698A1 (en) * 2021-05-25 2022-12-01 阿里巴巴(中国)有限公司 Resource configuration method and apparatus, electronic device, and computer-readable storage medium
WO2023173896A1 (en) * 2022-03-15 2023-09-21 华为技术有限公司 Communication method, electronic device and readable storage medium

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114553753B (en) * 2022-01-07 2024-03-15 中信科移动通信技术股份有限公司 Method, device and system for adjusting and measuring communication module with serial communication interface

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090100424A1 (en) * 2007-10-12 2009-04-16 International Business Machines Corporation Interrupt avoidance in virtualized environments
CN102279766A (en) * 2011-08-30 2011-12-14 华为技术有限公司 Method and system for concurrently simulating processors and scheduler
CN103092675A (en) * 2012-12-24 2013-05-08 北京伸得纬科技有限公司 Virtual environment construction method
CN104461735A (en) * 2014-11-28 2015-03-25 杭州华为数字技术有限公司 Method and device for distributing CPU resources in virtual scene
CN104778075A (en) * 2015-04-03 2015-07-15 北京奇虎科技有限公司 Method and device for calling Java layer API (Application Program Interface) by native layer in Android system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090100424A1 (en) * 2007-10-12 2009-04-16 International Business Machines Corporation Interrupt avoidance in virtualized environments
CN102279766A (en) * 2011-08-30 2011-12-14 华为技术有限公司 Method and system for concurrently simulating processors and scheduler
CN103092675A (en) * 2012-12-24 2013-05-08 北京伸得纬科技有限公司 Virtual environment construction method
CN104461735A (en) * 2014-11-28 2015-03-25 杭州华为数字技术有限公司 Method and device for distributing CPU resources in virtual scene
CN104778075A (en) * 2015-04-03 2015-07-15 北京奇虎科技有限公司 Method and device for calling Java layer API (Application Program Interface) by native layer in Android system

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110489212A (en) * 2019-08-20 2019-11-22 东软集团股份有限公司 A kind of method, apparatus and vehicle device of universal input/output port virtualization
CN110764901A (en) * 2019-09-17 2020-02-07 阿里巴巴集团控股有限公司 Data processing method based on GPU (graphics processing Unit) resources, electronic equipment and system
CN110673928A (en) * 2019-09-29 2020-01-10 天津卓朗科技发展有限公司 Thread binding method, thread binding device, storage medium and server
CN110673928B (en) * 2019-09-29 2021-12-14 天津卓朗科技发展有限公司 Thread binding method, thread binding device, storage medium and server
CN111930425A (en) * 2020-06-23 2020-11-13 联宝(合肥)电子科技有限公司 Data control method and device and computer readable storage medium
WO2022247698A1 (en) * 2021-05-25 2022-12-01 阿里巴巴(中国)有限公司 Resource configuration method and apparatus, electronic device, and computer-readable storage medium
CN113032108A (en) * 2021-05-26 2021-06-25 武汉深之度科技有限公司 Application program running method, computing device and storage medium
CN113032108B (en) * 2021-05-26 2021-08-20 武汉深之度科技有限公司 Application program running method, computing device and storage medium
WO2022247106A1 (en) * 2021-05-26 2022-12-01 统信软件技术有限公司 Method for running application program, and computing device and storage medium
WO2023173896A1 (en) * 2022-03-15 2023-09-21 华为技术有限公司 Communication method, electronic device and readable storage medium

Also Published As

Publication number Publication date
WO2018112855A1 (en) 2018-06-28
CN106796530B (en) 2019-01-25

Similar Documents

Publication Publication Date Title
CN106796530A (en) A kind of virtual method, device and electronic equipment, computer program product
CN107077377B (en) Equipment virtualization method, device and system, electronic equipment and computer program product
EP2888662B1 (en) Specialized virtual machine to virtualize hardware resource for guest virtual machines
CN107003892A (en) GPU vitualization method, device, system and electronic equipment, computer program product
CN102707986B (en) Shared storage between child partition and father's subregion
CN106797388B (en) Cross-system multimedia data encoding and decoding method and device, electronic equipment and computer program product
CN111450524B (en) Information processing method and device in cloud game, cloud game server and medium
CN104866372B (en) The efficient physical machine that a kind of service-oriented device is integrated is to virtual machine conversion method
CN109213607B (en) Multithreading rendering method and device
US9542715B2 (en) Memory space mapping techniques for server based graphics processing
JP7323948B2 (en) Method and system for rendering game screens based on multiple video cards
US20130293557A1 (en) Server based graphics processing techniques
US20090083753A1 (en) Dynamic thread generation and management for improved computer program performance
US9805439B2 (en) Memory space mapping techniques for server based graphics processing
CN104094224A (en) Para-virtualized asymmetric gpu processors
CN111209115A (en) Cloud desktop vGPU (virtual graphics processing Unit) over-allocation method
US9613390B2 (en) Host context techniques for server based graphics processing
CN116185554A (en) Configuration device, scheduling device, configuration method and scheduling method
CN116320469B (en) Virtualized video encoding and decoding system and method, electronic equipment and storage medium
CN110851179A (en) Controlling instruction execution in a data processor
CN106797470A (en) Multiple operating system multi-medium data decoding method, device, electronic equipment and computer program product
CN107122176A (en) A kind of pattern drawing method and device
CN106383747A (en) Method and device for scheduling computing resources
CN109542829A (en) The control method of GPU equipment, device and electronic equipment in multisystem
CN109101283A (en) Control method, device and the electronic equipment of GPU equipment

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