CN107632881A - The state switching method and device of a kind of virtual processor - Google Patents

The state switching method and device of a kind of virtual processor Download PDF

Info

Publication number
CN107632881A
CN107632881A CN201610566049.2A CN201610566049A CN107632881A CN 107632881 A CN107632881 A CN 107632881A CN 201610566049 A CN201610566049 A CN 201610566049A CN 107632881 A CN107632881 A CN 107632881A
Authority
CN
China
Prior art keywords
vcpu
switched
idle states
pause
idle
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
CN201610566049.2A
Other languages
Chinese (zh)
Other versions
CN107632881B (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.)
Alibaba Cloud Computing Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201610566049.2A priority Critical patent/CN107632881B/en
Publication of CN107632881A publication Critical patent/CN107632881A/en
Application granted granted Critical
Publication of CN107632881B publication Critical patent/CN107632881B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The state switching method and device of a kind of virtual processor;Methods described includes:When meeting predetermined trigger condition, virtual processor VCPU selects to be switched to idle idle states using pause pause or termination halt instructions according to this VCPU operating index;When needing to be switched to idle states, the VCPU is switched to idle states according to selected instruction.The application can be switched to the mode of idle states according to situation dynamic select during operation.

Description

The state switching method and device of a kind of virtual processor
Technical field
The present invention relates to the state switching method and device of computer realm, more particularly to a kind of virtual processor.
Background technology
The principle of HT (Hyper-Threading, hyperthread) technology is to regard the concurrent physical processor of a tool HT function as Two logic processors use, the two logic processors be VCPU (Virtual Central Processing Unit, Virtual processor), the physical resource of their shared concurrent physical processors, including execution unit and Cache (cache memory); Operating system can be dispatched to worker thread the execution of the two logic processors, allow a variety of application programs or single application program Multiple thread (thread), it can be performed simultaneously on same concurrent physical processor.
When logic processor is carrying out state switching, if being switched to idle (free time) shape using halt (termination) instructions State, then logic processor will concede whole physical resources after being switched to idle states, at this moment another logic processor will Reach optimum performance;If being switched to idle states using pause (pause) instructions, logic processor is switched to idle states Of short duration execution unit can be only conceded afterwards, and system response can reach optimal.
But in the case where virtualizing scene, when being switched to idle states using halt instructions, wake up the logic in idle states Processor needs extra expense, and this is frequently applied for context switching, can cause system low-response;Referred to using pause When order is switched to idle states, because the logic processor in idle states still occupies a large amount of physical resources, therefore even if it is System is very idle, is still not able to provide good performance.
The content of the invention
The application provides a kind of state switching method and device of virtual processor, can be according to situation dynamic during operation Selection is switched to the mode of idle states.
The application adopts the following technical scheme that.
A kind of state switching method of virtual processor, including:
When meeting predetermined trigger condition, virtual processor VCPU is selected using pause according to this VCPU operating index Pause or termination halt instructions are switched to idle idle states;
When needing to be switched to idle states, the VCPU is switched to idle states according to selected instruction.
Alternatively, the predetermined trigger condition includes following any:
Reach new selection cycle;
The VCPU needs to be switched to idle states;
The VCPU needs to be switched to idle states, and is switched to idle states with the selection of this VCPU of last time and is used The time interval of instruction be more than default time span.
Alternatively, the operating index includes context switching frequency;
The VCPU selects to be switched to idle state bags using pause or halt instructions according to this VCPU operating index Include:
When this VCPU context switching frequency reaches at or above predetermined threshold value, select to be switched to using pause instructions Idle states;During less than predetermined threshold value, select to be switched to idle states using halt instructions.
Alternatively, the context switching frequency is:
Above and below being carried out between at the time of current time and last selection are switched to instruction used in idle states The number of text switching, divided by current time and last time are selected between being switched at the time of instruction used in idle states between institute Every time span.
Alternatively, described method also includes:
The VCPU determines to perform the number of pause instructions according to this VCPU operating index.
Alternatively, the number that the VCPU determines to perform pause instructions according to this VCPU operating index includes:
The VCPU determines to perform the number of pause instructions according to this VCPU context switching frequency;Wherein, described time Number and the context switching frequency positive correlation.
Alternatively, described when needing to be switched to idle states, the VCPU is switched to idle according to selected instruction State includes:
When needing to be switched to idle states, if selected instruct for pause, according to the identified number Perform pause instructions;If selected instruct for halt, halt instructions are performed.
A kind of state switching device of virtual processor, is arranged in virtual processor VCPU, including:
Selecting module, during for meeting predetermined trigger condition, selected according to the operating index of the VCPU using pause The VCPU is switched to idle idle states by pause or termination halt instructions;
Execution module, for when the VCPU needs to be switched to idle states, according to selected instruction will described in VCPU is switched to idle states.
Alternatively, the predetermined trigger condition includes following any:
Reach new selection cycle;
The VCPU needs to be switched to idle states;
The VCPU needs to be switched to idle states, and is switched to used in idle states and instructs with last selection Time interval be more than default time span.
Alternatively, the operating index includes context switching frequency;
The selecting module selects to cut the VCPU using pause or halt instructions according to the operating index of the VCPU Changing to idle states includes:
When the context switching frequency of the VCPU reaches at or above predetermined threshold value, selection is instructed institute using pause State VCPU and be switched to idle states;During less than predetermined threshold value, select that the VCPU is switched into idle states using halt instructions.
Alternatively, the context switching frequency is:
Above and below being carried out between at the time of current time and last selection are switched to instruction used in idle states The number of text switching, divided by current time and last time are selected between being switched at the time of instruction used in idle states between institute Every time span.
Alternatively, described device also includes:
Determining module, for being determined to perform the number of pause instructions according to the operating index of the VCPU.
Alternatively, the number that the determining module determines to perform pause instructions according to the operating index of the VCPU includes:
The determining module determines to perform the number of pause instructions according to the context switching frequency of the VCPU;Wherein, The number and the context switching frequency positive correlation.
Alternatively, the execution module, will according to selected instruction when the VCPU needs to be switched to idle states The VCPU, which is switched to idle states, to be included:
When the VCPU needs to be switched to idle states, if selected instruct for pause, it indicates that the VCPU Pause instructions are performed according to the identified number;If selected instructed for halt, it indicates that the VCPU is performed Halt is instructed.
A kind of state switching device of virtual processor, including:Processor and memory;
The memory is used to store the program for being used for carrying out virtual processor VCPU state switching;It is described to be used for void Intend the program of processor progress state switching when reading execution by the processor, perform following operate:
When meeting predetermined trigger condition, selected according to the operating index of the VCPU using pause pause or termination The VPU is switched to idle idle states by halt instructions;
When the VCPU needs to be switched to idle states, the VCPU is switched to idle shapes according to selected instruction State.
The application includes advantages below:
In at least one embodiment of the application, using pause instructions or halt instructions when VCPU is switched to idle states It is operating index dynamic selects of the VCPU according to this VCPU;When more idle, VCPU can use halt instructions be switched to Idle states, so as to as often as possible concede physical resource, ensure the performance of system;And select to adopt when process switching is frequent Idle states are switched to pause instructions, so that VCPU being capable of quick response when being waken up from idle states.Due to single system The independent instruction according to used in the running situation of itself voluntarily selects to be switched to idle states of each VCPU in system, thus it is single Each VCPU in system can select, for the most suitable idle modes of this VCPU, to ensure that the performance of whole system.
In one alternative of the embodiment of the present application, using context switching frequency as operating index, by comparison Hereafter switching frequency and predetermined threshold value, idle states are switched to select pause or halt to instruct;When context switching frequency reaches During to the predetermined threshold value, judge that current VCPU is in context switching frequently scene, idle is switched to using pause instructions State carrys out lifting system response speed;When context switching frequency is less than the predetermined threshold value, is then instructed and switched using halt Physical resource is conceded as far as possible to idle states, because the VCPU in idle states does not take physical resource, therefore System load can ensure higher systematic function when relatively low.
In another alternative of the application, when VCPU determines to be switched to idle states according to this VCPU operating index Perform the number of pause instructions;When identified number is more than 1, after idle states are switched to, idle shapes are maintained The time span of state is to continuously perform the time span sum of multiple pause instructions;It is comparatively idle (but not idle when at present Degree to selection using halt instructions) when, if iterating through pause instructions is switched to idle states, switching, wake up meeting Certain process performance is consumed, and multiple pause is instructed as single idle minimum working cell and (is switched to idle shapes State and implementation procedure of the process including at least M pause instruction for maintaining the idle states), then it can avoid switching, wake up The process performance consumed.
Certainly, implementing any product of the application must be not necessarily required to reach all the above advantage simultaneously.
Brief description of the drawings
Fig. 1 is the flow chart of the state switching method of the virtual processor of embodiment one;
Fig. 2 is the flow chart of the example of embodiment one;
Fig. 3 is the schematic diagram of the state switching device of the virtual processor of embodiment two.
Embodiment
The technical scheme of the application is described in detail below in conjunction with drawings and Examples.
If it should be noted that not conflicting, each feature in the embodiment of the present application and embodiment can be tied mutually Close, within the protection domain of the application.In addition, though logical order is shown in flow charts, but in some situations Under, can be with the step shown or described by being performed different from order herein.
In a typical configuration, state switching device may include one or more processors (CPU), input/output Interface, network interface and internal memory (memory).
Internal memory may include computer-readable medium in volatile memory, random access memory (RAM) and/or The forms such as Nonvolatile memory, such as read-only storage (ROM) or flash memory (flash RAM).Internal memory is computer-readable medium Example.Internal memory may include module 1, module 2 ... ..., module N (N is the integer more than 2).
Computer-readable medium includes permanent and non-permanent, removable and non-moveable storage medium.Storage is situated between Matter can realize that information stores by any method or technique.Information can be computer-readable instruction, data structure, program Module or other data.The example of the storage medium of computer includes, but are not limited to phase transition internal memory (PRAM), static random-access Memory (SRAM), dynamic random access memory (DRAM), other kinds of random access memory (RAM), read-only storage Device (ROM), Electrically Erasable Read Only Memory (EEPROM), fast flash memory bank or other memory techniques, read-only optical disc are only Read memory (CD-ROM), digital versatile disc (DVD) or other optical storages, magnetic cassette tape, the storage of tape magnetic rigid disk Or other magnetic storage apparatus or any other non-transmission medium, the information that can be accessed by a computing device available for storage.Press Defined according to herein, computer-readable medium does not include non-temporary computer readable media (transitory media), such as adjusts The data-signal and carrier wave of system.
Embodiment one, a kind of state switching method of virtual processor, including step S110~S120:
S110, when meeting predetermined trigger condition, VCPU uses pause or halt according to the selection of this VCPU operating index Instruction is switched to idle states;
S120, when needing to be switched to idle states, the VCPU is switched to idle states according to selected instruction.
In the present embodiment, it is difference root to be instructed when different VCPU is switched to idle states using pause instructions or halt According to this VCPU operating index dynamic select;When this VCPU is more idle, VCPU can use halt instructions to be switched to Idle states, so as to as often as possible concede physical resource, ensure the performance of system;And select to adopt when process switching is frequent Idle states are switched to pause instructions, so that this VCPU being capable of quick response when being waken up from idle states.Due to single The independent instruction according to used in the running situation of itself voluntarily selects to be switched to idle states of each VCPU in system, thus it is single Each VCPU in individual system can select, for the most suitable idle modes of this VCPU, to ensure that the performance of whole system.
In the present embodiment, VCPU, which is switched to the instruction used during idle states, to be referred to:For set by the VCPU Idle paths.VCPU can perform the instruction pointed by idle paths when needing to be switched to idle states.Therefore, selection switching To instruction used in idle states, the selection to idle paths can also be regarded as.
In a kind of alternative of the present embodiment, the predetermined trigger condition can include following any:
(1) new selection cycle is reached;
(2) VCPU needs to be switched to idle states;
(3) VCPU needs to be switched to idle states, and is switched to idle states institute with the selection of this VCPU of last time The instruction at the time of institute interlude length used is more than or equal to default time span;Wherein, institute's interlude is grown At the time of degree can refer to and detect or judge that this VPU needs to be switched to idle states, select to switch with this VCPU of the last time Institute's interlude length between used in idle states at the time of instruction.
The difference of above-mentioned trigger condition is that trigger condition (1) is switched to idle states equivalent to cycle Sexual behavior mode to be made Instruction, that is to say, that just once selected whenever new selection cycle is reached.In trigger condition (2), no matter upper one Secondary selection occur when, as long as to be cut just selected when changing to idle states.And in trigger condition (3), it is to be cut to change to First judge during idle states and how long is last selection interval, if interval time is not grown, running situation change is not too large, can Still to continue to use the selection of last time;Selection is just re-started when only interval time is longer, is expended when so can save selection Process performance, while can also obtain the selection result being more consistent with running situation.
In this alternative, the time span of the selection cycle or default time span can be the control of system Parameter, can in system initialization by keeper wait empirically or experimentally result by system interface set initial value, also It can be modified in system operation by system interface.
In other alternatives, other trigger conditions can also be used, such as when the variable quantity of performance indications reaches predetermined When ratio or predetermined value, it is larger periodically to judge whether operating index changes amplitude for another example, re-starts and selects etc. when larger.
In a kind of alternative of the present embodiment, the operating index includes but is not limited to context switching frequency;It is described VCPU is switched to idle states according to the selection of this VCPU operating index using pause or halt instructions to be included:
When this VCPU context switching frequency reaches at or above predetermined threshold value, select to be switched to using pause instructions Idle states;During less than predetermined threshold value, select to be switched to idle states using halt instructions.
In this alternative, context switching frequency reaches at or above predetermined threshold value and illustrates that current VCPU is cut in context Frequently scene is changed, being switched to idle states using pause instructions can be with lifting system response speed;If being less than predetermined threshold value, Physical resource can be conceded as far as possible by being then switched to idle states using halt instructions, to ensure systematic function.
In this alternative, the predetermined threshold value can be the control parameter of system, can be in system initialization by pipe Empirically or experimentally result sets initial value to reason persons etc. by system interface, can also pass through system in system operation Interface is modified.
In this alternative, the context in the period that the context switching frequency can also use predetermined length switches Number replaces, and the number selects pause instructions when reaching at or above default frequency threshold value, halt is then selected less than frequency threshold value Instruction.
In other alternatives, other operating index or other operating index and the context can also be used to cut The combination for changing frequency is selected.
In a kind of embodiment of this alternative, the context switching frequency can be, but not limited to for:Current time The number of the context switching carried out between at the time of being switched to instruction used in idle states with last selection, divided by Institute's interlude length between current time and last selection are switched at the time of instruction used in idle states.
At the time of the current time can be, but not limited to refer to start to calculate the context switching frequency.
Other manner can also be used to calculate the context frequency in other embodiment;Such as when using trigger condition (1) when, the context switching frequency can be:The number divided by selection week that context switches in recent selection cycle The time span of phase.
In a kind of alternative of the present embodiment, methods described can also include:
The VCPU determines to perform the number of pause instructions according to this VCPU operating index.The step can be full Carry out or carried out after it have selected pause instructions during the foot predetermined trigger condition.
In this alternative, the VCPU determines to perform number that pause instructs according to this VCPU operating index can be with Including:
The VCPU determines to perform the number of pause instructions according to this VCPU context switching frequency;Wherein, described time Number and the context switching frequency positive correlation.
For example context switching frequency is higher, it is determined that the number of execution pause instructions is few, and minimum is 1 time;Context is cut It is lower to change frequency, it is determined that the number for performing pause instructions is more.Pre- fixed length can also be passed through by performing the number of pause instructions Context switching times, other operating index or other operating index and context switching frequency in the period of degree Combination determines.
Described when needing to be switched to idle states in this alternative, the VCPU switches according to selected instruction It can include to idle states:
When needing to be switched to idle states, if selected instruct for pause, according to the identified number Perform pause instructions;If selected instruct for halt, halt instructions are performed.
In other alternatives, the number for performing pause instructions can be the control parameter of system, except can be by VCPU Voluntarily set, changed according to operating index, can also in system initialization by keeper wait empirically or experimentally result lead to System interface setting initial value is crossed, can also be modified in system operation by system interface.
In this alternative, VCPU sets execution pause when being switched to idle states to refer to according to this VCPU operating index The number of order;When number is more than 1, after idle states are switched to, the time span for maintaining idle states is continuous Perform the time span sum of multiple pause instructions;It is comparatively idle (but not idle to selecting to instruct using halt when at present Degree) when, if iterating through pause instructions is switched to idle states, switching, wakes up and can consume certain treatability Can, and multiple pause instructions will be performed and (be switched to idle states as single idle and maintain the mistake of the idle states Journey) minimum work unit, then can avoid switching, wake up consumed process performance.
In this alternative, if using trigger condition (1) above in step S110, selected instruction is to enter Selected instruction during the selection cycle being presently in;It is selected if using trigger condition (2) above in step S110 Instruction be that this to be cut changes to instruction selected during idle states;If trigger condition above is used in step S110 (3), then selected instruction is in two kinds of situation:When a kind of situation is that the VCPU needs to be switched to idle states, and it is last Selection is switched to instruction at the time of institute's interlude length used in idle states and is more than or equal to default time span, Selection is then re-started, selected instruction is the instruction reselected;Another situation is that the VCPU needs to be switched to During idle states, and last selection is switched to instruction at the time of institute's interlude length used in idle states less than pre- If time span, then selected instruction is the instruction of last selection (namely last time selects).
In the present embodiment, for the different VCPU in same system, described trigger condition, the time length of selection cycle Degree/default time span, predetermined threshold value, perform pause instructions one or more of number can be with identical or not phase Together.
Illustrate above-described embodiment with an exemplary example below.
In system operation, there is provided three system interfaces provide the control parameter on idle paths, at the beginning of system During beginningization, it will complete following two step 101~102:
When the 101st, initially entering system, keeper or other personnel can set three control parameters according to system interface Initial value, three control parameters be respectively idle paths (i.e.:It is switched to used in idle states and instructs), the time of selection It is spaced t_interval (that is, default time span described in trigger condition (3) above), context switching frequency threshold value l_ Ctx is (i.e.:The predetermined threshold value above) and pause several c_pause when entering pause states.
102nd, during each VCPU initialization, respective control structure variable will be initialized respectively, it is nearest to contain this VCPU The information such as T1, context switching times, current idle paths at the time of idle Path selection.
After VCPU completes initialization, below scheme will be performed when this VCPU needs and enters idle states, such as Fig. 2 institutes Show, including step 201~206:
201st, VCPU judge this VCPU last time carry out idle Path selections at the time of T1 to current time T2 be spaced when Between length T, if meet the time interval of idle Path selections, i.e.,:Whether T is more than or equal to t_interval.If satisfied, then Idle Path selections are carried out into step 202.If not satisfied, it is directly entered step 206.
202nd, VCPU calculate deuterzooid VCPU carry out idle Path selections at the time of and current time between context Switching times, based on context exchange times and the time span T calculate context switching frequency, into step 203.
If the context switching frequency the 203, calculated reaches context switching frequency threshold value, l_ctx (is more than or equal to L_ctx), then step 204a is carried out;Step 204b is carried out if not up to.
204a, mark VCPU idle paths are pause, carry out step 205.
The idle paths that 204b, mark put VCPU are halt, carry out step 205.
205th, VCPU control structure variables are updated, including:Context switching times and the last idle Path selections At the time of (i.e. at the time of idle paths are set in 204a or 204b), carry out step 206.
206th, judge whether VCPU idle paths are selected as pause, perform halt instructions if not then VCPU to allow Go out physical resource, single idle switchings are completed;If it is VCPU performs c_pause pause instruction, and single idle is completed.
Embodiment two, a kind of state switching device of virtual processor, are arranged in virtual processor VCPU, such as Fig. 3 institutes Show, including:
Selecting module 21, during for meeting predetermined trigger condition, used according to the selection of the operating index of the VCPU temporary Stop pause or the VCPU is switched to idle idle states by termination halt instructions;
Execution module 22, for when the VCPU needs to be switched to idle states, according to selected instruction will described in VCPU is switched to idle states.
In the present embodiment, the selecting module 21 is to be responsible for selection in described device to be switched to finger used in idle states The part of order, can be the combination of software, hardware or both.
In the present embodiment, the execution module 22 is to be responsible for being switched to idle states according to the instruction of selection in described device Part, can be software, hardware or both combination.
In a kind of alternative of the present embodiment, the predetermined trigger condition can be, but not limited to include following any Kind:
Reach new selection cycle;
The VCPU needs to be switched to idle states;
The VCPU needs to be switched to idle states, and is switched to used in idle states and instructs with last selection Time interval be more than default time span.
In a kind of alternative of the present embodiment, the operating index can include context switching frequency;
The selecting module 21 is instructed the VCPU according to the selection of the operating index of the VCPU using pause or halt Being switched to idle states can include:
When the context switching frequency of the VCPU reaches at or above predetermined threshold value, selection is instructed institute using pause State VCPU and be switched to idle states;During less than predetermined threshold value, select that the VCPU is switched into idle states using halt instructions.
In a kind of embodiment of this alternative, the context switching frequency can be, but not limited to for:
Above and below being carried out between at the time of current time and last selection are switched to instruction used in idle states The number of text switching, divided by current time and last time are selected between being switched at the time of instruction used in idle states between institute Every time span.
In a kind of alternative of the present embodiment, described device can also include:
Determining module, for being determined to perform the number of pause instructions according to the operating index of the VCPU.This alternative In, the determining module is the part for being responsible for determining to perform the number of pause instructions in described device, can be software, hardware Or both combination.
In this alternative, the determining module determines to perform time of pause instructions according to the operating index of the VCPU Number can include:
The determining module determines to perform the number of pause instructions according to the context switching frequency of the VCPU;Wherein, The number and the context switching frequency positive correlation.
In this, the execution module 22, will according to selected instruction when the VCPU needs to be switched to idle states The VCPU, which is switched to idle states, to be included:
When the VCPU needs to be switched to idle states, if selected instruct for pause, it indicates that the VCPU Pause instructions are performed according to the identified number;If selected instructed for halt, it indicates that the VCPU is performed Halt is instructed.
In a kind of alternative of the present embodiment, described device can also include setup module, for according to the VCPU Operating index set perform puase instruction number;The setup module can also provide interface, for the external world set and/or Change one or more of following parameter:
The number of puase instructions, the length of selection cycle or default time span, context switching frequency is performed to preset Threshold value.
The step of method includes in module performs in the present embodiment aforesaid operations and embodiment one corresponds to respectively, these Module performs the other of aforesaid operations and realizes that details may be referred to embodiment one.
Embodiment three, a kind of state switching device of virtual processor, including:Processor and memory;
The memory is used to store the program for being used for carrying out virtual processor VCPU state switching;It is described to be used for void Intend the program of processor progress state switching when reading execution by the processor, perform following operate:
When meeting predetermined trigger condition, selected according to the operating index of the VCPU using pause pause or termination The VPU is switched to idle idle states by halt instructions;
When the VCPU needs to be switched to idle states, the VCPU is switched to idle shapes according to selected instruction State.
In the present embodiment, the different VCPU in individual system can each be performed with described be used for virtual processor progress The program of state switching, multiple VCPU in individual system can also be performed with described be used for virtual processor progress shape together The program of state switching, but select to be switched to used in idle states by the different threads in the program for different VCPU Instruction.All VCPU in individual system can be multiplexed the processor and memory.
In the present embodiment, when the program for carrying out state switching to virtual processor is read execution, it will hold In method described in row embodiment one comprising the step of, the program and the program are read the other of the operation that is performed during execution Realize that details can be found in embodiment one.
One of ordinary skill in the art will appreciate that all or part of step in the above method can be instructed by program Related hardware is completed, and described program can be stored in computer-readable recording medium, such as read-only storage, disk or CD Deng.Alternatively, all or part of step of above-described embodiment can also be realized using one or more integrated circuits.Accordingly Ground, each module/unit in above-described embodiment can be realized in the form of hardware, can also use the shape of software function module Formula is realized.The application is not restricted to the combination of the hardware and software of any particular form.
Certainly, the application can also have other various embodiments, ripe in the case of without departing substantially from the application spirit and its essence Know those skilled in the art when can be made according to the application it is various it is corresponding change and deformation, but these corresponding change and become Shape should all belong to the protection domain of claims hereof.

Claims (15)

1. a kind of state switching method of virtual processor, including:
When meeting predetermined trigger condition, virtual processor VCPU is selected using pause pause according to this VCPU operating index Or stop halt instructions and be switched to idle idle states;
When needing to be switched to idle states, the VCPU is switched to idle states according to selected instruction.
2. the method as described in claim 1, it is characterised in that the predetermined trigger condition includes following any:
Reach new selection cycle;
The VCPU needs to be switched to idle states;
The VCPU needs to be switched to idle states, and is switched to used in idle states and refers to the selection of this VCPU of last time The time interval of order is more than default time span.
3. the method as described in claim 1, it is characterised in that the operating index includes context switching frequency;
The VCPU is switched to idle states according to the selection of this VCPU operating index using pause or halt instructions to be included:
When this VCPU context switching frequency reaches at or above predetermined threshold value, select to be switched to idle using pause instructions State;During less than predetermined threshold value, select to be switched to idle states using halt instructions.
4. method as claimed in claim 3, it is characterised in that the context switching frequency is:
The context that current time and last selection are carried out between being switched at the time of instruction used in idle states is cut The number changed, divided by current time and last time select what is be spaced between being switched at the time of instruction used in idle states Time span.
5. such as method according to any one of claims 1 to 4, it is characterised in that also include:
The VCPU determines to perform the number of pause instructions according to this VCPU operating index.
6. method as claimed in claim 5, it is characterised in that the VCPU determines to perform according to this VCPU operating index The number of pause instructions includes:
The VCPU determines to perform the number of pause instructions according to this VCPU context switching frequency;Wherein, the number with The context switching frequency positive correlation.
7. method as claimed in claim 5, it is characterised in that described when needing to be switched to idle states, the VCPU is pressed Being switched to idle states according to selected instruction includes:
When needing to be switched to idle states, if selected instruct for pause, performed according to the identified number Pause is instructed;If selected instruct for halt, halt instructions are performed.
8. a kind of state switching device of virtual processor, is arranged in virtual processor VCPU, including:
Selecting module, during for meeting predetermined trigger condition, selected according to the operating index of the VCPU using pause pause Or stop halt instructions and the VCPU is switched to idle idle states;
Execution module, for when the VCPU needs to be switched to idle states, cutting the VCPU according to selected instruction Change to idle states.
9. device as claimed in claim 8, it is characterised in that the predetermined trigger condition includes following any:
Reach new selection cycle;
The VCPU needs to be switched to idle states;
The VCPU needs to be switched to idle states, and and last selection be switched to instruction used in idle states when Between interval be more than default time span.
10. device as claimed in claim 8, it is characterised in that the operating index includes context switching frequency;
The selecting module selects to be switched to the VCPU using pause or halt instructions according to the operating index of the VCPU Idle states include:
When the context switching frequency of the VCPU reaches at or above predetermined threshold value, selection is using pause instructions by described in VCPU is switched to idle states;During less than predetermined threshold value, select that the VCPU is switched into idle states using halt instructions.
11. device as claimed in claim 10, it is characterised in that the context switching frequency is:
The context that current time and last selection are carried out between being switched at the time of instruction used in idle states is cut The number changed, divided by current time and last time select what is be spaced between being switched at the time of instruction used in idle states Time span.
12. the device as any one of claim 8~11, it is characterised in that also include:
Determining module, for being determined to perform the number of pause instructions according to the operating index of the VCPU.
13. device as claimed in claim 5, it is characterised in that the determining module is true according to the operating index of the VCPU Surely performing the number of pause instructions includes:
The determining module determines to perform the number of pause instructions according to the context switching frequency of the VCPU;Wherein, it is described Number and the context switching frequency positive correlation.
14. device as claimed in claim 13, it is characterised in that the execution module needs to be switched to idle in the VCPU During state, the VCPU is switched into idle states according to selected instruction includes:
When the VCPU needs to be switched to idle states, if it is selected for pause instruct, it indicates that the VCPU according to The identified number performs pause instructions;If selected instruct for halt, it indicates that the VCPU performs halt and referred to Order.
15. a kind of state switching device of virtual processor, including:Processor and memory;
It is characterized in that:
The memory is used to store the program for being used for carrying out virtual processor VCPU state switching;It is described to be used for virtual place The program of device progress state switching is managed when reading execution by the processor, performs following operate:
When meeting predetermined trigger condition, referred to according to the selection of the operating index of the VCPU using pause pause or termination halt The VPU is switched to idle idle states by order;
When the VCPU needs to be switched to idle states, the VCPU is switched to idle states according to selected instruction.
CN201610566049.2A 2016-07-18 2016-07-18 State switching method and device of virtual processor Active CN107632881B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610566049.2A CN107632881B (en) 2016-07-18 2016-07-18 State switching method and device of virtual processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610566049.2A CN107632881B (en) 2016-07-18 2016-07-18 State switching method and device of virtual processor

Publications (2)

Publication Number Publication Date
CN107632881A true CN107632881A (en) 2018-01-26
CN107632881B CN107632881B (en) 2021-08-03

Family

ID=61112164

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610566049.2A Active CN107632881B (en) 2016-07-18 2016-07-18 State switching method and device of virtual processor

Country Status (1)

Country Link
CN (1) CN107632881B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115576645A (en) * 2022-09-29 2023-01-06 中汽创智科技有限公司 Virtual processor scheduling method and device, storage medium and electronic equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101055493A (en) * 2007-01-24 2007-10-17 威盛电子股份有限公司 Computer system and its electricity-saving method
US20090089562A1 (en) * 2007-09-27 2009-04-02 Ethan Schuchman Methods and apparatuses for reducing power consumption of processor switch operations

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101055493A (en) * 2007-01-24 2007-10-17 威盛电子股份有限公司 Computer system and its electricity-saving method
US20090089562A1 (en) * 2007-09-27 2009-04-02 Ethan Schuchman Methods and apparatuses for reducing power consumption of processor switch operations

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
INTEL SOFTWARE NETWORK SUPPORT: "Q&A_ HT and Pause vs. Halt", 《HTTPS://SOFTWARE.INTEL.COM/ZH-CN/NODE/309782》 *
ZENNY_CHEN: "Intel系统编程指南第八章——8.10空闲和阻塞情况的管理", 《HTTPS://BLOG.CSDN.NET/ZENNY_CHEN/ARTICLE/DETAILS/6105834?UTM_SOURCE=BLOGXGWZ7》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115576645A (en) * 2022-09-29 2023-01-06 中汽创智科技有限公司 Virtual processor scheduling method and device, storage medium and electronic equipment
CN115576645B (en) * 2022-09-29 2024-03-08 中汽创智科技有限公司 Virtual processor scheduling method and device, storage medium and electronic equipment

Also Published As

Publication number Publication date
CN107632881B (en) 2021-08-03

Similar Documents

Publication Publication Date Title
EP3129880B1 (en) Method and device for augmenting and releasing capacity of computing resources in real-time stream computing system
US10444812B2 (en) Power shifting in multicore platforms by varying SMT levels
US20150106582A1 (en) Apparatus and method for managing data in hybrid memory
CN108228672A (en) A kind of metadata migration method, apparatus, system and equipment
KR101406493B1 (en) Computer having flash memory and operating method of flash memory
JP2016526735A (en) Virtual hadoop manager
EP2488929A2 (en) Memory object relocation for power savings
US20150268710A1 (en) Power management for multi-core processing systems
CN110389842B (en) Dynamic resource allocation method, device, storage medium and equipment
JP2010015446A (en) Storage device and power control method
CN105989015B (en) Database capacity expansion method and device and method and device for accessing database
CN102346682A (en) Information processing device and information processing method
CN109358816A (en) A kind of flow control method and device of distributed memory system
US20190332275A1 (en) Information processing system and volume allocation method
CN102467403B (en) Software fast switching method based on progress emigration/immigration and device thereof
CN109324983A (en) A kind of method, storage medium, equipment and the system of automatic cleaning cache file
CN111414228B (en) Method and related device for managing storage space based on Kubernetes
CN105893155A (en) Virtual machine load balancing control method and device
US11194623B2 (en) Resource scheduling method and related apparatus
CN107632881A (en) The state switching method and device of a kind of virtual processor
US10657022B2 (en) Input and output recording device and method, CPU and data read and write operation method thereof
CN104702654A (en) Video cloud storage system based storage and extraction performance balancing method and device
CN104808967A (en) Dynamic data prefetching system of processor
CN106547517B (en) A kind of method and device controlling the waiting time
CN105892937B (en) Information processing method and electronic 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
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20230522

Address after: Room 1-2-A06, Yungu Park, No. 1008 Dengcai Street, Sandun Town, Xihu District, Hangzhou City, Zhejiang Province

Patentee after: Aliyun Computing Co.,Ltd.

Address before: Box 847, four, Grand Cayman capital, Cayman Islands, UK

Patentee before: ALIBABA GROUP HOLDING Ltd.