CN116893893B - Virtual machine scheduling method and device, electronic equipment and storage medium - Google Patents

Virtual machine scheduling method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116893893B
CN116893893B CN202311153625.7A CN202311153625A CN116893893B CN 116893893 B CN116893893 B CN 116893893B CN 202311153625 A CN202311153625 A CN 202311153625A CN 116893893 B CN116893893 B CN 116893893B
Authority
CN
China
Prior art keywords
priority
virtual
processor
virtual machine
processing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311153625.7A
Other languages
Chinese (zh)
Other versions
CN116893893A (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.)
Beijing Acoinfo Technology Co ltd
Original Assignee
Beijing Acoinfo Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Acoinfo Technology Co ltd filed Critical Beijing Acoinfo Technology Co ltd
Priority to CN202311153625.7A priority Critical patent/CN116893893B/en
Publication of CN116893893A publication Critical patent/CN116893893A/en
Application granted granted Critical
Publication of CN116893893B publication Critical patent/CN116893893B/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/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • 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
    • 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
    • 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5077Logical partitioning of resources; Management or configuration of virtualized resources
    • 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
    • G06F2009/4557Distribution of virtual machine instances; Migration and load balancing
    • 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
    • G06F2009/45575Starting, stopping, suspending or resuming virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/48Indexing scheme relating to G06F9/48
    • G06F2209/484Precedence
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5021Priority

Abstract

The invention discloses a virtual machine scheduling method, a virtual machine scheduling device, electronic equipment and a storage medium. The invention relates to the technical field of computers. The method comprises the following steps: acquiring virtual priority of a virtual machine with an enabling state being a preset enabling state; when the virtual machine to which the highest virtual priority belongs is detected to change, determining the processing priority of a virtual processor in a ready state in the virtual machine; and updating the corresponding processing task list of the physical processor based on the tasks to be processed of the virtual processor according to the processor configuration information, the highest virtual priority and the processing priority, so that the physical processor processes the tasks in the processing task list in a time window. The method solves the problems of low scheduling instantaneity and poor system operation stability caused by the fact that the priority of the virtual machine processor is adjusted by monitoring the task priority to schedule the virtual machine, achieves the purposes of improving the instantaneity and the flexibility of the virtual machine scheduling, improving the task processing efficiency and improving the system operation fluency.

Description

Virtual machine scheduling method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a virtual machine scheduling method, a device, an electronic device, and a storage medium.
Background
Virtual machines (Virtual machines), in the architecture of computer science, refer to a special piece of software that creates an environment between a computer platform and an end user, who operates the software based on the environment created by the software, so that the Virtual Machine runs a program like a real Machine. In the process of using the virtual machine, the virtual machine needs to be scheduled, and the virtual machine scheduling refers to the allocation of virtual machine processors to real physical servers.
In the existing application, the manner of scheduling the virtual machine is generally to monitor index data (such as task arrival time, task duration, task deadline, etc.) corresponding to an execution task of a virtual machine processor, determine whether to raise or lower the priority of the monitored task according to the monitored data and a threshold, and allocate the virtual machine processor to a physical server. Under the strategy, virtual machine processors with high priority occupy a physical server for a long time, so that the problem of high waiting time among the virtual machine processors is caused, and the smoothness of system use is affected.
Disclosure of Invention
The invention provides a virtual machine scheduling method, a device, electronic equipment and a storage medium, which are used for improving the real-time performance and flexibility of virtual machine scheduling, improving the task processing efficiency of the virtual machine and achieving the technical effect of improving the running smoothness of a system.
According to an aspect of the present invention, there is provided a virtual machine scheduling method applied to a system in which at least two virtual machines are deployed, the at least two virtual machines sharing at least one physical processor; the method comprises the following steps:
acquiring a virtual priority of the virtual machine with the starting state being a preset starting state;
when the virtual machine to which the highest virtual priority belongs is detected to change, determining the processing priority of a virtual processor in a ready state in the virtual machine to which the highest virtual priority belongs;
and updating a processing task list of a physical processor corresponding to the virtual processor based on the tasks to be processed of the virtual processor according to preset processor configuration information, the highest virtual priority and the processing priority, so that the physical processor processes the tasks in the processing task list in a time window.
According to another aspect of the present invention, there is provided a virtual machine scheduling apparatus configured to a system in which at least two virtual machines are deployed, the at least two virtual machines sharing at least one physical processor; the device comprises:
The virtual priority determining module is used for acquiring the virtual priority of the virtual machine with the starting state being the preset starting state;
the processing priority determining module is used for determining the processing priority of a virtual processor in a ready state in the virtual machine to which the highest virtual priority belongs when detecting that the virtual machine to which the highest virtual priority belongs changes;
the scheduling module is used for updating a processing task list of a physical processor corresponding to the virtual processor based on the task to be processed of the virtual processor according to preset processor configuration information, the highest virtual priority and the processing priority, so that the physical processor processes the tasks in the processing task list in a time window.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the virtual machine scheduling method of any one of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer readable storage medium storing computer instructions for causing a processor to implement the virtual machine scheduling method according to any one of the embodiments of the present invention when executed.
According to the technical scheme, the virtual priority of the virtual machine with the starting state being the preset starting state is obtained; when the virtual machine to which the highest virtual priority belongs is detected to change, determining the processing priority of a virtual processor in a ready state in the virtual machine to which the highest virtual priority belongs; according to preset processor configuration information, the highest virtual priority and the processing priority, a processing task list of a physical processor corresponding to the virtual processor is updated based on a task to be processed of the virtual processor, so that the physical processor processes tasks in the processing task list in a time window, the problems that scheduling of the virtual machine is low in real-time performance and poor in system operation stability are caused by the fact that the priority of the processor of the virtual machine is adjusted through monitoring the task priority in the prior art are solved, the physical processor is preempted for a virtual machine with high virtual priority through dynamically adjusting the virtual priority of the virtual machine and the processing priority of the virtual processor under the virtual machine, and dynamic scheduling among different virtual machines is achieved. Selecting a proper physical processor for the virtual processor through the processor configuration information, scheduling the task to be processed of the virtual processor to an adaptive physical processor to process a task list in a time window through the processing priority, realizing dynamic scheduling among the virtual processors in the same virtual machine, improving the real-time performance and flexibility of virtual machine scheduling, further improving the task processing efficiency of the virtual machine, and achieving the technical effect of improving the running smoothness of the system.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of a virtual machine scheduling method according to a first embodiment of the present invention;
FIG. 2 is a schematic diagram of a system according to a first embodiment of the present invention;
FIG. 3 is a schematic diagram of a virtual machine priority before a first embodiment of the present invention is used to characterize the adjustment of priority;
FIG. 4 is a schematic diagram of a virtual machine for characterizing priority after adjusting priority according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a virtual machine for characterizing priority after adjusting priority according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of a virtual processor in priority before a first embodiment of the present invention is used to characterize an adjustment priority;
FIG. 7 is a schematic diagram of a virtual processor for characterizing priority levels after adjusting the priority levels according to an embodiment of the present invention;
FIG. 8 is a schematic diagram of a virtual processor for characterizing priority levels after adjusting the priority levels according to an embodiment of the present invention;
FIG. 9 is a diagram of a time window of a physical processor according to one embodiment of the present invention;
fig. 10 is a schematic diagram of a virtual machine scheduling method according to a second embodiment of the present invention;
fig. 11 is a schematic structural diagram of a virtual machine scheduling apparatus according to a third embodiment of the present invention;
fig. 12 is a schematic structural diagram of an electronic device implementing a virtual machine scheduling method according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
Fig. 1 is a flowchart of a virtual machine scheduling method according to a first embodiment of the present invention, where the method may be applicable to a case of allocating physical processors to virtual machines, and the method may be performed by a virtual machine scheduling device, where the virtual machine scheduling device may be implemented in the form of hardware and/or software, and the virtual machine scheduling device may be configured in a system in which at least two virtual machines are deployed, where the at least two virtual machines share at least one physical processor. As shown in fig. 1, the method includes:
S110, acquiring virtual priority of the virtual machine with the starting state being the preset starting state.
In this embodiment, the virtual machine may refer to a complete computer system with complete hardware system functions, which is simulated by software and runs in a completely isolated environment, where at least one virtual processor (VCPU) is deployed in each virtual machine, and all virtual machines share at least one physical processor (PCPU). The physical processor refers to a hardware device that actually exists, and the virtual processor is a virtual resource divided by the physical processor, so that multiple virtual machine instances can be run on the same physical processor. For example, referring to fig. 2, a system includes a virtual machine VM0 and a VM1, where VM0 includes four virtual processor VCPUs, VM1 includes two virtual processor VCPUs, and VM0 and VM1 share two physical processor PCPUs, and the technical solution provided in this embodiment may be applied by a scheduler Hypervisor Scheduler to schedule the VCPUs to run in the physical processor PCPUs.
The preset enabling state may be a working state. Virtual priority may be used to characterize how well a virtual machine is prioritized, e.g., virtual machine priority may reflect its priority in a numerical value, e.g., the higher the virtual machine priority, the smaller the numerical value, characterizing the more prioritized.
In this embodiment, the virtual priority of the virtual machine whose enabled state is the working state may be maintained and monitored in real time, so as to ensure instantaneity of the obtained virtual priority of the virtual machine. The virtual priority may be dynamically updated based on the priority of the events of the virtual machine job.
Optionally, under the condition that the starting state of the virtual machine is a preset starting state, acquiring the job information of the virtual machine; if the job information reaches at least one virtual machine event in a pre-configured virtual machine event table, updating the virtual priority of the virtual machine based on the first priority of the reached virtual machine event; and if the job information does not reach all the virtual machine events, determining the virtual priority of the virtual machine as the initial priority of the virtual machine.
The job information includes, but is not limited to, a current running state of the virtual machine, a virtual machine event waiting to be processed by the virtual machine, and the like. The virtual machine event table contains at least one virtual machine event and an event priority of each virtual machine event, namely a first priority. For example, virtual machine events include, but are not limited to, interrupt events for various external devices, communication events between virtual machines, etc., which affect the priority of the virtual machines, each event having some attribute. Attributes include, but are not limited to: event priority, target virtual machine (when a virtual machine event occurs, the priority of the target virtual machine will be updated), the state of the current event (non-occurring, and processed). The first priority characterizes the degree to which the virtual machine event is preferentially scheduled, e.g., the first priority may reflect its degree of priority in terms of a value, e.g., the higher the virtual machine event priority, the smaller the value, characterizing the more preferentially scheduled. The initial priority may represent a priority between virtual machines, that is, a priority before being adjusted by the first priority, and different virtual machines may correspond to different initial priorities, or may correspond to the same initial priority. It should be noted that, to ensure uniformity of priorities, the first priority of the same value is consistent with the initial priority meaning of the virtual machine.
In practical application, for a virtual machine with an enabled state being a working state, processing events of the virtual machine can be monitored in real time through job information of the virtual machine. If the occurrence event of the virtual machine does not match all the virtual machine events, the virtual priority of the virtual machine can be maintained, i.e. the virtual priority of the virtual machine is maintained as the initial priority of the virtual machine. If the occurrence event in the virtual machine is detected to be matched with the virtual machine event in the virtual machine event table, whether to change the virtual priority of the virtual machine can be judged through the first priority of the matched virtual machine event in the virtual machine event table.
Specifically, updating the virtual priority of the virtual machine based on the first priority of the reached virtual machine event includes: if the first priority of the virtual machine event is higher than the initial priority of the virtual machine, determining the virtual priority of the virtual machine based on the first priority, and updating the virtual priority of the virtual machine based on the initial priority when the end of the execution of the virtual machine event is detected; and if the first priority of the virtual machine event is lower than the initial priority of the virtual machine, determining the virtual priority of the virtual machine as the initial priority.
Specifically, if the first priority of the matched virtual machine event is higher than the virtual priority of the virtual machine, the virtual priority of the virtual machine can be increased to the priority of the event, and when the execution end of the virtual machine event is detected, the virtual priority of the virtual machine is restored to the initial priority; if not, the virtual priority of the virtual machine may be maintained.
Referring to fig. 3, job data of a virtual machine may be recorded using a virtual machine list including, but not limited to, a virtual machine name (VM), virtual priority (prio), a preset time slice budget (budget), status (status), and pending event (pending). The virtual machine event priority table is a virtual machine event table, and the virtual machine event table includes, but is not limited to, a virtual machine event (event), a first priority (prio), a target virtual machine (target-VM) corresponding to the virtual machine event, a status (status), and an original priority (origin-prio) of the target virtual machine. The priority is represented by a numerical value, with a smaller value representing a higher priority. Illustratively, initially, virtual machines VM1, VM2 have priority values of 4 and VM0 have priority values of 2. When the virtual machine event c occurs, the priority of the virtual machine event c is 3, the priority of the target virtual machine VM1 executing the virtual machine event c is 4, see fig. 4, and at this time, the scheduler adjusts the priority value of VM1 to be 3, and records the initial priority 4 of VM 1. When the virtual machine event c processing ends, referring to fig. 5, the priority of vm1 is reset to priority 4.
And S120, when the virtual machine to which the highest virtual priority belongs is detected to change, determining the processing priority of the virtual processor in the ready state in the virtual machine to which the highest virtual priority belongs.
Wherein the processing priority may be used to characterize the degree to which the virtual processor is preferentially scheduled, e.g., the processing priority may reflect its degree of priority in terms of a numerical value, e.g., the higher the priority, the smaller the numerical value, the more preferentially scheduled.
In this embodiment, if the virtual machine with the highest virtual priority changes, virtual machine scheduling needs to be performed, and at this time, the virtual machine with the highest priority may be controlled to preempt the physical processor of the virtual machine with the lower priority allocated to the physical processor, so that the task of the virtual machine with the highest priority is scheduled to the physical processor. In the process, the processing priority of the virtual processor in the ready state in the affiliated virtual machine can be determined, and then the task scheduling of the virtual processor is realized through the processing priority of the virtual processor.
In this embodiment, when the virtual machine with the highest virtual priority changes, the virtual machine with the highest priority is controlled to preempt the physical processor of the virtual machine with the lower priority allocated to the physical processor, including: and selecting a physical processor matched with the virtual processor based on configuration information (including a physical processor which the virtual processor theoretically operates) of the virtual processor in a ready state in the virtual machine with the highest virtual priority, and preempting operation resources of the virtual machine with the lowest priority on the matched physical processor so as to schedule the virtual processor in the ready state to the physical processor subsequently.
It should be noted that, the processing priority of the virtual processor in the ready state may be dynamically updated according to the priority of the event of the virtual machine job, so as to ensure the instantaneity of the acquired processing priority of the virtual processor. In this embodiment, under the condition that the working state of the virtual processor is a ready state, job data of each virtual processor in the virtual machine is obtained; and if the job data reaches at least one processor event in a pre-configured processor event table, updating the processing priority of the virtual processor based on the second priority of the reached processor event.
Among other things, the job data includes, but is not limited to, the name of the VCPU (i.e., virtual processor), the original priority of the VCPU, the VCPU's slice budget, the VCPU's operating state, whether the VCPU has a VCPU event waiting to be processed, and the like. The processor event table contains at least one processor event and an event priority, i.e., a second priority, of each processor event. Processor events include, but are not limited to, the VCPU having an IPI interrupt to process, the VCPU having an external interrupt to process, the VCPU masking the interrupt, the VCPU having acquired a spin lock, and so on. The second priority of processor events affects the processing priority of the VCPU, each event having a number of attributes including: event priority, state of the current event (non-occurring, occurring and processed). The second priority characterizes the degree to which the processor event is preferentially scheduled, e.g., the processor event may reflect its degree of priority in terms of a value, e.g., the higher the processor event priority, the smaller the value, the more preferentially scheduled. The original priority may represent a priority level between virtual processors in the same virtual machine, that is, a priority level before being not adjusted by the second priority level, and different virtual processors may correspond to different original priorities or may correspond to the same original priority level. The second priority of the same value is consistent with the original priority meaning of the virtual processor.
In practical applications, for a virtual processor whose working state is a ready state, processing events (including waiting for processing tasks) of the virtual processor may be monitored in real time by job data of the virtual processor. The current waiting processing task may be compared with the processor events in the processor event table, and when there is a matching processor event, a determination may be made as to whether to alter the processing priority of the virtual processor by the second priority of the processor event. For example, if the occurrence of a virtual processor does not match all of the processor events, the processing priority of the virtual processor may be maintained, i.e., the processing priority of the virtual processor may be maintained as its original priority. If an occurrence event in the virtual processor is detected to match a processor event, the virtual priority of the virtual machine may be updated with the second priority of the matching processor event.
It should be noted that, different virtual processors in the same virtual machine may wait for processing one or more events at the same time, where the priority of the events is different, and the processing order is also different. If so, the second priority of the event may be determined whether to alter the processing priority of the virtual processor. If the number of the virtual processors is more than one, the highest second priority in the event can be selected to judge whether to change the processing priority of the virtual processors so as to schedule and process the event preferentially and improve the scheduling accuracy.
In this embodiment, updating the processing priority of the virtual processor based on the second priority of the processor event reached includes: if the highest second priority in the processor event is lower than the original priority of the virtual processor, taking the original priority as the processing priority; and if the highest second priority in the processor event is higher than the original priority, taking the highest second priority as the processing priority of the virtual processor, and re-determining the highest second priority in the processor event when the execution of the processor event to which the highest second priority belongs is detected to be ended, so as to update the processing priority of the virtual processor based on the highest second priority and the original priority.
Specifically, if the highest second priority in the reached processor event is lower than the original priority of the virtual processor, the processing priority of the virtual processor may be kept as the original priority; if the highest second priority is higher than the original priority of the virtual processor, the processing priority of the virtual processor may be updated to the highest second priority. And when the processor event execution of the highest second priority is detected to be ended, the highest second priority in the reached processor event can be redetermined, and whether to change the processing priority of the virtual processor is judged based on the highest second priority.
Referring to fig. 6, job information of the VCPU may be recorded using a virtual machine VCPU list including, but not limited to, a virtual processor name (VM-VCPU), a processing priority (prio), a status (status), and pending events (pending). The VCPU event priority table is a processor event table, and the processor event table includes, but is not limited to, a processor event (VCPU-event), a second priority (prio), and a status (status). The priority is represented by a numerical value, with a smaller value representing a higher priority. Illustratively, initially, the priority values of virtual processors VM0-v pu3, VM0-vcpu2, VM0-vcpu1, VM0-vcpu0 are 255. When VCPU events aa, cc of VM0-VCPU0 occur, and VCPU event bb of VM0-VCPU2 occurs, the priority of VCPU event aa is 0, the priority of VCPU event cc is 2, and the priority of VCPU event bb is 1. Referring to fig. 7, the scheduler adjusts the priority of the VCPU having the event occurred according to the VCPU event priority table, the priority of VM0-VCPU0 is set to 0, and the priority of vm0-VCPU2 is set to 1. When VCPU events aa and bb are processed, see fig. 8, the scheduler will again adjust the priority of the corresponding VCPU, the priority of VM0-VCPU0 is set to 2, and the priority of vm0-VCPU2 is restored to 255.
S130, updating a processing task list of a physical processor corresponding to the virtual processor based on the to-be-processed task of the virtual processor according to preset processor configuration information, the highest virtual priority and the processing priority, so that the physical processor processes the task in the processing task list in a time window.
The processor configuration information comprises a physical processor which is theoretically operated by a virtual processor.
In this embodiment, the task to be processed of the virtual processor may be scheduled on the physical processor adapted to the virtual processor based on the highest virtual priority and the processing priority of the virtual processor. For example, the highest virtual priority characterizes that the virtual machine is at the highest scheduling level, and then is ranked at the first scheduling location on the physical processor, and the virtual processors under the virtual machine may schedule to the corresponding list of processing tasks of the physical processor in priority order. The tasks in the processing task list are ordered. To ensure the order of task processing and improve the processing efficiency, a time window may be allocated to the physical processor, where the time window has a processing time limit, so that the physical processor processes the tasks in the processing task list within the time window. The running sequence of the virtual machines in the time window is determined by the priority of the virtual machines, and the virtual machines with high priority are scheduled to run first, and the virtual processors with high priority in the virtual machines are scheduled to be executed in the physical processor first. The high-priority virtual machine can preempt the low-priority virtual machine, and the high-priority virtual processor can preempt the operation resources of the low-priority virtual processor in the same virtual machine.
In this embodiment, updating a processing task list of a physical processor corresponding to a virtual processor based on a task to be processed of the virtual processor according to preset processor configuration information, a highest virtual priority, and a processing priority includes: determining a physical processor corresponding to each virtual processor based on the processor configuration information; determining a scheduling order of each virtual processor according to the processing priority; and updating the corresponding processing task list of the physical processor in the time window based on the tasks to be processed of the virtual processor according to the highest virtual priority and the scheduling order.
Specifically, a physical processor that the virtual processor theoretically operates on may be determined by the processor configuration information, and the physical processor is adapted to the virtual processor. Further, the scheduling order of each virtual processor can be determined according to the mode that the scheduling of the high processing priority is earlier than the scheduling of the low processing priority, the task to be processed of the virtual processor is obtained to be located at the forefront of the corresponding physical processor in the processing task list in the time window through the highest virtual priority, and the tasks to be processed of the virtual processor are arranged in the processing task list according to the scheduling order. It should be noted that, in each time window, the tasks in the processing task list may be limited, and the tasks to be processed of the high-priority virtual processor may be preferentially scheduled in the processing task list by the high-priority virtual processor preempting the low-priority virtual processor in the same virtual machine. For example, referring to fig. 9, virtual priority values for vm0, VM1, VM2, VM3, VM4, VM5 are 2, 4, respectively. The processing priority values of VM0-vcpu0, VM0-vcpu1, VM0-vcpu2, VM0-vcpu3, VM1-vcpu0 and VM1-vcpu1 are 1, 255, 3, 255 and 255 respectively. VM0-vcpu0, VM0-vcpu1, and VM1-vcpu0 are allocated in a time window TimeWindow0 of the physical processor CPU1. VM0-vcpu2, VM0-vcpu3, and VM1-vcpu1 are allocated within a time window TimeWindow0 of the physical processor CPU 2.
In this embodiment, the virtual machine scheduling method further includes: when the virtual machine to which the highest virtual priority belongs is detected to be unchanged and the virtual processor to which the highest processing priority under the virtual machine belongs is changed, updating a processing task list of a physical processor corresponding to the virtual processor based on the task to be processed of the virtual processor according to preset processor configuration information, the highest virtual priority and the processing priority.
In practical application, the virtual priority of the virtual machine and the processing priority of the virtual processor can be dynamically updated based on the priorities of the events which are respectively reached, and if the virtual processor to which the highest processing priority belongs under the virtual machine to which the highest virtual priority belongs changes under the condition that the virtual machine to which the highest virtual priority belongs does not change, the scheduling order of the tasks to be processed of the virtual processor is dynamically updated through the processing priority of the virtual processor, and then the processing task list of the physical processor corresponding to the virtual processor in the time window is updated based on the tasks to be processed according to the scheduling order.
It should be noted that, in order to meet the running requirement of the virtual machine, when determining the time window, the time window may also be determined by the time slice budget of the virtual machine in the working state, if the time in the time window is used up, the time window may also be redetermined by the time slice budget of the virtual machine in the current working state, so as to ensure that the time window is available. Wherein the time slice budget of each virtual machine is fixed and may be preset.
In this embodiment, the virtual machine scheduling method further includes: monitoring the starting states of all virtual machines; determining the limiting duration of a time window according to a preset time slice corresponding to a virtual machine with an enabling state being a preset enabling state, so that the limiting duration is consumed when a physical processor processes tasks in the time window; if the current residual duration of the time window reaches the preset threshold value, updating the limit duration of the time window according to the preset time slice corresponding to the virtual machine with the current monitored starting state being the preset starting state.
The preset time slice corresponds to the time slice budget, and can be determined according to actual working conditions. The preset threshold may be 0 or close to 0.
Specifically, the starting state of each virtual machine in the system can be monitored in real time, and at the beginning, the sum of preset time slices can be used as the size of an initial time window, namely the limiting duration of the time window, by counting the preset time slices corresponding to the virtual machines in the working state. The physical processor consumes a limiting time length when processing the task in the time window, the time length is gradually reduced, the task in the processing task list is processed, in the process, whether the current residual time length reaches a preset threshold value can be detected, if the current residual time length reaches the preset threshold value, the time window is exhausted (or is about to be exhausted), at the moment, the limiting time length of the time window can be determined again through the sum of preset time slices corresponding to the virtual machines in the current working state, and the smooth execution of the task is ensured while the time window is kept available.
According to the technical scheme, virtual priority of the virtual machine with the starting state being the preset starting state is obtained; when the virtual machine to which the highest virtual priority belongs is detected to change, determining the processing priority of a virtual processor in a ready state in the virtual machine to which the highest virtual priority belongs; according to preset processor configuration information, the highest virtual priority and the processing priority, a processing task list of a physical processor corresponding to the virtual processor is updated based on a task to be processed of the virtual processor, so that the physical processor processes tasks in the processing task list in a time window, the problems that scheduling of the virtual machine is low in real-time performance and poor in system operation stability are caused by the fact that the priority of the processor of the virtual machine is adjusted through monitoring the task priority in the prior art are solved, the physical processor is preempted for a virtual machine with high virtual priority through dynamically adjusting the virtual priority of the virtual machine and the processing priority of the virtual processor under the virtual machine, and dynamic scheduling among different virtual machines is achieved. Selecting a proper physical processor for the virtual processor through the processor configuration information, scheduling the task to be processed of the virtual processor to an adaptive physical processor to process a task list in a time window through the processing priority, realizing dynamic scheduling among the virtual processors in the same virtual machine, improving the real-time performance and flexibility of virtual machine scheduling, further improving the task processing efficiency of the virtual machine, and achieving the technical effect of improving the running smoothness of the system.
Example two
As an alternative embodiment of the foregoing embodiment, a specific application scenario example is given to make the technical solution of the embodiment of the present invention further clear to those skilled in the art. In particular, reference may be made to the following details.
For example, referring to fig. 10, the virtual machine scheduling method based on dynamic priority includes: creating a virtual machine and configuring an initial priority of the virtual machine and a preset time slice (i.e., a time slice budget) of the virtual machine; creating a virtual machine event table for dynamically adjusting the priority of the virtual machine; creating a processor event table for dynamically adjusting priorities with virtual processors (VCPUs) within the virtual machine; calculating the size of a time window according to the currently ready virtual machine, and setting a time window expiration timer; the scheduler selects a virtual machine with the highest priority and preempts a physical processor running a virtual machine with lower priority; scheduling the virtual processor to a corresponding physical processor for operation according to the processing priority and the configuration information of the virtual processor; judging whether the processor with the highest priority changes or not, if the virtual machine with the higher priority is ready, reselecting the virtual machine with the highest priority, otherwise, continuing to execute the judgment on whether the virtual processor with the same virtual machine runs out or whether the virtual processor with the higher priority runs out or not by the virtual machine, if the virtual processor with the same virtual machine runs out of the VCPU (virtual processor unit) or has the VCPU with the higher priority ready, reselecting the processing priority and configuration information of the virtual processor, and dispatching the virtual processor to the corresponding physical processor for running; if the time window expires, calculating the time window according to the current ready virtual machine, and restarting the scheduling of the virtual machine and the virtual processor in the new time window, otherwise, continuing to execute the virtual processor to which the virtual machine belongs; the virtual processor continues to run in the physical processor until the runnable time expires or a priority change event occurs, and when a higher priority virtual machine is ready, the scheduler schedules a new virtual processor to run in the physical processor.
The technical scheme provided by the embodiment is suitable for the situation that one or more physical CPUs are shared by a plurality of virtual machines, wherein the number of VCPUs of the virtual machines can be larger than the number of actual physical CPUs or smaller than the number of actual physical CPUs. The priority between virtual machines may be referred to as a master priority, and the priority between VCPUs within a virtual machine may be referred to as a child priority. There is one virtual machine event priority table and one VCPU event priority table in the system. The priority of each virtual machine event is recorded in the virtual machine event priority table. When the virtual machine event occurs, the priority of the target virtual machine corresponding to the event is updated, if the priority of the current virtual machine is smaller than the priority corresponding to the virtual machine event, the priority of the virtual machine is set to be the priority corresponding to the virtual machine event, and if the priority of the current virtual machine is greater than or equal to the priority corresponding to the virtual machine event, the priority of the virtual machine is unchanged. When the virtual machine event ends, the priority of the virtual machine will be set to the priority before the virtual machine event occurs. Likewise, the priority of each processor event is recorded in the processor event priority table. When a VCPU event occurs, the scheduler also dynamically adjusts the priority of the VCPU according to the VCPU event priority table. The dynamic priority adjustment between the virtual machines can enable the virtual machines to process virtual machine events in higher real-time performance, and the dynamic priority adjustment between the VCPUs in the virtual machines can enable the VCPUs to have smaller waiting time when mutual waiting occurs.
Example III
Fig. 11 is a schematic structural diagram of a virtual machine scheduling apparatus according to a third embodiment of the present invention. As shown in fig. 11, the apparatus is configured in a system in which at least two virtual machines are deployed, the at least two virtual machines sharing at least one physical processor; the device comprises: virtual priority determination module 210, processing priority determination module 220, scheduling module 230.
The virtual priority determining module 210 is configured to obtain a virtual priority of the virtual machine whose enabled state is a preset enabled state; a processing priority determining module 220, configured to determine, when detecting that a virtual machine to which a highest virtual priority belongs changes, a processing priority of a virtual processor in a ready state in the virtual machine to which the highest virtual priority belongs; the scheduling module 230 is configured to update, based on the preset processor configuration information, the highest virtual priority, and the processing priority, a processing task list of a physical processor corresponding to the virtual processor based on a task to be processed of the virtual processor, so that the physical processor processes the task in the processing task list within a time window.
According to the technical scheme, virtual priority of the virtual machine with the starting state being the preset starting state is obtained; when the virtual machine to which the highest virtual priority belongs is detected to change, determining the processing priority of a virtual processor in a ready state in the virtual machine to which the highest virtual priority belongs; according to preset processor configuration information, the highest virtual priority and the processing priority, a processing task list of a physical processor corresponding to the virtual processor is updated based on a task to be processed of the virtual processor, so that the physical processor processes tasks in the processing task list in a time window, the problems that scheduling of the virtual machine is low in real-time performance and poor in system operation stability are caused by the fact that the priority of the processor of the virtual machine is adjusted through monitoring the task priority in the prior art are solved, the physical processor is preempted for a virtual machine with high virtual priority through dynamically adjusting the virtual priority of the virtual machine and the processing priority of the virtual processor under the virtual machine, and dynamic scheduling among different virtual machines is achieved. Selecting a proper physical processor for the virtual processor through the processor configuration information, scheduling the task to be processed of the virtual processor to an adaptive physical processor to process a task list in a time window through the processing priority, realizing dynamic scheduling among the virtual processors in the same virtual machine, improving the real-time performance and flexibility of virtual machine scheduling, further improving the task processing efficiency of the virtual machine, and achieving the technical effect of improving the running smoothness of the system.
On the basis of the device, the device also comprises a job information acquisition module and a virtual priority updating module.
The operation information acquisition module is used for acquiring operation information of the virtual machine under the condition that the starting state of the virtual machine is a preset starting state;
and the virtual priority updating module is used for updating the virtual priority of the virtual machine based on the first priority of the reached virtual machine event if the job information reaches at least one virtual machine event in a pre-configured virtual machine event table.
On the basis of the device, the virtual priority updating module is optional, and is used for determining the virtual priority of the virtual machine based on the first priority if the first priority of the virtual machine event is higher than the initial priority of the virtual machine, and updating the virtual priority of the virtual machine based on the initial priority when the execution end of the virtual machine event is detected.
On the basis of the device, the device can also comprise a job data acquisition module and a processing priority updating module.
The job data acquisition module is used for acquiring job data of each virtual processor in the virtual machine under the condition that the working state of the virtual processor is the ready state;
And the processing priority updating module is used for updating the processing priority of the virtual processor based on the second priority of the reached processor event if the job data reaches at least one processor event in a pre-configured processor event table.
On the basis of the above device, optionally, the processing priority updating module is configured to take the highest second priority as the processing priority of the virtual processor if the highest second priority in the processor event is higher than the original priority of the virtual processor, and re-determine the highest second priority in the processor event when the execution of the processor event to which the highest second priority belongs is detected to end, so as to update the processing priority of the virtual processor based on the highest second priority and the original priority.
On the basis of the above apparatus, optionally, the scheduling module 230 includes a physical processor determining unit, and a scheduling unit.
A physical processor determining unit configured to determine a physical processor corresponding to each of the virtual processors based on the processor configuration information;
A scheduling order determining unit, configured to determine a scheduling order of each virtual processor according to the processing priority;
and the scheduling unit is used for updating the corresponding processing task list of the physical processor in the time window based on the tasks to be processed of the virtual processor according to the highest virtual priority and the scheduling order.
On the basis of the above device, optionally, the scheduling module 230 is further configured to update, when it is detected that the virtual machine to which the highest virtual priority belongs is unchanged and the virtual processor to which the highest processing priority under the virtual machine belongs is changed, a processing task list of a physical processor corresponding to the virtual processor based on a task to be processed of the virtual processor according to preset processor configuration information, the highest virtual priority, and the processing priority.
In addition to the above apparatus, optionally, the apparatus further includes: a state monitoring module, a time window determining module and a time window updating module,
the state monitoring module is used for monitoring the starting states of all the virtual machines;
the time window determining module is used for determining the limiting duration of the time window according to a preset time slice corresponding to the virtual machine with the starting state being the preset starting state, so that the limiting duration is consumed when the physical processor processes tasks in the time window;
And the time window updating module is used for updating the limit duration of the time window according to the preset time slice corresponding to the virtual machine with the preset starting state which is monitored currently if the current residual duration of the time window is detected to reach the preset threshold value.
The virtual machine scheduling device provided by the embodiment of the invention can execute the virtual machine scheduling method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example IV
Fig. 12 is a schematic structural diagram of an electronic device implementing a virtual machine scheduling method according to an embodiment of the present invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 12, the electronic device 10 includes at least one processor 11, and a memory, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, etc., communicatively connected to the at least one processor 11, in which the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 may also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
Various components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, etc.; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as virtual machine scheduling methods.
In some embodiments, the virtual machine scheduling method may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the virtual machine scheduling method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the virtual machine scheduling method in any other suitable manner (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present invention may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention are achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (9)

1. A virtual machine scheduling method, characterized by being applied to a system in which at least two virtual machines are deployed, the at least two virtual machines sharing at least one physical processor; the method comprises the following steps:
acquiring a virtual priority of the virtual machine with the starting state being a preset starting state;
when the virtual machine to which the highest virtual priority belongs is detected to change, determining the processing priority of a virtual processor in a ready state in the virtual machine to which the highest virtual priority belongs;
Updating a processing task list of a physical processor corresponding to the virtual processor based on a task to be processed of the virtual processor according to preset processor configuration information, the highest virtual priority and the processing priority, so that the physical processor processes the task in the processing task list in a time window, and the method comprises the following steps:
determining a physical processor corresponding to each virtual processor based on the processor configuration information;
determining a scheduling order of each virtual processor according to the processing priority;
and updating a corresponding processing task list of the physical processor in a time window based on the tasks to be processed of the virtual processor according to the highest virtual priority and the scheduling order.
2. The method as recited in claim 1, further comprising:
acquiring the job information of the virtual machine under the condition that the starting state of the virtual machine is a preset starting state;
and if the job information reaches at least one virtual machine event in a pre-configured virtual machine event table, updating the virtual priority of the virtual machine based on the first priority of the reached virtual machine event.
3. The method of claim 2, wherein updating the virtual priority of the virtual machine based on the first priority of the reached virtual machine event comprises:
and if the first priority of the virtual machine event is higher than the initial priority of the virtual machine, determining the virtual priority of the virtual machine based on the first priority, and updating the virtual priority of the virtual machine based on the initial priority when the end of the execution of the virtual machine event is detected.
4. The method as recited in claim 1, further comprising:
acquiring the job data of each virtual processor in the virtual machine under the condition that the working state of the virtual processor is the ready state;
and if the job data reaches at least one processor event in a pre-configured processor event table, updating the processing priority of the virtual processor based on the second priority of the reached processor event.
5. The method of claim 4, wherein updating the processing priority of the virtual processor based on the second priority of the reached processor event comprises:
And if the highest second priority in the processor events is higher than the original priority of the virtual processor, taking the highest second priority as the processing priority of the virtual processor, and when the execution end of the processor event to which the highest second priority belongs is detected, re-determining the highest second priority in the reached processor events so as to update the processing priority of the virtual processor based on the highest second priority and the original priority.
6. The method as recited in claim 1, further comprising:
when the virtual machine to which the highest virtual priority belongs is detected to be unchanged and the virtual processor to which the highest processing priority belongs under the virtual machine to which the highest processing priority belongs is changed, updating a processing task list of a physical processor corresponding to the virtual processor based on a task to be processed of the virtual processor according to preset processor configuration information, the highest virtual priority and the processing priority.
7. The method as recited in claim 1, further comprising:
monitoring the starting states of all the virtual machines;
determining the limiting duration of the time window according to a preset time slice corresponding to the virtual machine with the starting state being the preset starting state, so that the physical processor consumes the limiting duration when processing tasks in the time window;
If the current residual duration of the time window is detected to reach the preset threshold value, updating the limit duration of the time window according to the preset time slice corresponding to the virtual machine with the currently monitored starting state being the preset starting state.
8. A virtual machine scheduling apparatus, configured in a system in which at least two virtual machines are deployed, the at least two virtual machines sharing at least one physical processor; the device comprises:
the virtual priority determining module is used for acquiring the virtual priority of the virtual machine with the starting state being the preset starting state;
the processing priority determining module is used for determining the processing priority of a virtual processor in a ready state in the virtual machine to which the highest virtual priority belongs when detecting that the virtual machine to which the highest virtual priority belongs changes;
the scheduling module is used for updating a processing task list of a physical processor corresponding to the virtual processor based on the task to be processed of the virtual processor according to preset processor configuration information, the highest virtual priority and the processing priority, so that the physical processor processes the tasks in the processing task list in a time window; the scheduling module comprises a physical processor determining unit, a scheduling order determining unit and a scheduling unit; wherein,
The physical processor determining unit is used for determining a physical processor corresponding to each virtual processor based on the processor configuration information;
the scheduling order determining unit is used for determining the scheduling order of each virtual processor according to the processing priority;
the scheduling unit is used for updating the corresponding processing task list of the physical processor in the time window based on the tasks to be processed of the virtual processor according to the highest virtual priority and the scheduling order.
9. A computer readable storage medium storing computer instructions for causing a processor to implement the virtual machine scheduling method of any one of claims 1-7 when executed.
CN202311153625.7A 2023-09-08 2023-09-08 Virtual machine scheduling method and device, electronic equipment and storage medium Active CN116893893B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311153625.7A CN116893893B (en) 2023-09-08 2023-09-08 Virtual machine scheduling method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311153625.7A CN116893893B (en) 2023-09-08 2023-09-08 Virtual machine scheduling method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN116893893A CN116893893A (en) 2023-10-17
CN116893893B true CN116893893B (en) 2024-03-22

Family

ID=88313763

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311153625.7A Active CN116893893B (en) 2023-09-08 2023-09-08 Virtual machine scheduling method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116893893B (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102193853A (en) * 2010-03-12 2011-09-21 三星电子株式会社 Virtual machine monitor and scheduling method thereof
CN102662763A (en) * 2012-04-11 2012-09-12 华中科技大学 Virtual machine resource scheduling method based on service quality
CN103577249A (en) * 2013-11-13 2014-02-12 中国科学院计算技术研究所 Method and system for virtual machine online migration
US9286104B1 (en) * 2015-01-05 2016-03-15 International Business Machines Corporation Selecting virtual machines to be relocated based on memory volatility
CN107506234A (en) * 2017-07-03 2017-12-22 北京东土科技股份有限公司 A kind of dispatching method of virtual machine and device
CN107624181A (en) * 2015-06-17 2018-01-23 英特尔公司 Idle and scheduling virtual machine management method and equipment including virtual processor
CN107678860A (en) * 2017-10-13 2018-02-09 郑州云海信息技术有限公司 A kind of optimization method and system of KVM virtual machines CPU scheduling strategies
CN108595249A (en) * 2018-05-02 2018-09-28 联想(北京)有限公司 A kind of virtual machine method for scheduling task and electronic equipment
CN114048004A (en) * 2021-11-22 2022-02-15 北京志凌海纳科技有限公司 High-availability batch scheduling method, device, equipment and storage medium for virtual machines
CN115576645A (en) * 2022-09-29 2023-01-06 中汽创智科技有限公司 Virtual processor scheduling method and device, storage medium and electronic equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2323035B1 (en) * 2009-11-16 2019-04-17 Red Bend Software Scheduling system

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102193853A (en) * 2010-03-12 2011-09-21 三星电子株式会社 Virtual machine monitor and scheduling method thereof
CN102662763A (en) * 2012-04-11 2012-09-12 华中科技大学 Virtual machine resource scheduling method based on service quality
CN103577249A (en) * 2013-11-13 2014-02-12 中国科学院计算技术研究所 Method and system for virtual machine online migration
US9286104B1 (en) * 2015-01-05 2016-03-15 International Business Machines Corporation Selecting virtual machines to be relocated based on memory volatility
CN107624181A (en) * 2015-06-17 2018-01-23 英特尔公司 Idle and scheduling virtual machine management method and equipment including virtual processor
CN107506234A (en) * 2017-07-03 2017-12-22 北京东土科技股份有限公司 A kind of dispatching method of virtual machine and device
CN107678860A (en) * 2017-10-13 2018-02-09 郑州云海信息技术有限公司 A kind of optimization method and system of KVM virtual machines CPU scheduling strategies
CN108595249A (en) * 2018-05-02 2018-09-28 联想(北京)有限公司 A kind of virtual machine method for scheduling task and electronic equipment
CN114048004A (en) * 2021-11-22 2022-02-15 北京志凌海纳科技有限公司 High-availability batch scheduling method, device, equipment and storage medium for virtual machines
CN115576645A (en) * 2022-09-29 2023-01-06 中汽创智科技有限公司 Virtual processor scheduling method and device, storage medium and electronic equipment

Also Published As

Publication number Publication date
CN116893893A (en) 2023-10-17

Similar Documents

Publication Publication Date Title
CN105550040B (en) CPU resources of virtual machine preservation algorithm based on KVM platform
US9304814B2 (en) Determine variable wait time in an asynchronous call-back system based on calculated average sub-queue wait time
US10216530B2 (en) Method for mapping between virtual CPU and physical CPU and electronic device
CN110795238B (en) Load calculation method and device, storage medium and electronic equipment
US20150378782A1 (en) Scheduling of tasks on idle processors without context switching
CN112783659A (en) Resource allocation method and device, computer equipment and storage medium
CN114968567A (en) Method, apparatus and medium for allocating computing resources of a compute node
CN111597044A (en) Task scheduling method and device, storage medium and electronic equipment
CN114490048A (en) Task execution method and device, electronic equipment and computer storage medium
US9612907B2 (en) Power efficient distribution and execution of tasks upon hardware fault with multiple processors
CN112860401A (en) Task scheduling method and device, electronic equipment and storage medium
CN116893893B (en) Virtual machine scheduling method and device, electronic equipment and storage medium
CN109189581B (en) Job scheduling method and device
RU2450330C2 (en) Hardware-implemented method of executing programs
CN113986497B (en) Queue scheduling method, device and system based on multi-tenant technology
CN115168040A (en) Job preemption scheduling method, device, equipment and storage medium
CN113051051B (en) Scheduling method, device, equipment and storage medium of video equipment
CN115309507A (en) Method, device, equipment and medium for calculating CPU resource occupancy rate
EP4235424A1 (en) Resource control method for function computing, device, and medium
CN113127205B (en) Workflow scheduling method meeting deadline constraint and optimizing cost in cloud
CN114860403B (en) Task scheduling method, device, equipment and storage medium
US11966787B2 (en) Dynamic process criticality scoring
CN117632425A (en) Task allocation method and device, electronic equipment and storage medium
WO2024041401A1 (en) Method and apparatus for processing task, and device and storage medium
US20220318061A1 (en) Dynamic process criticality scoring

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