Nothing Special   »   [go: up one dir, main page]

CN114816678A - Method, system, equipment and storage medium for scheduling virtual machine - Google Patents

Method, system, equipment and storage medium for scheduling virtual machine Download PDF

Info

Publication number
CN114816678A
CN114816678A CN202210610965.7A CN202210610965A CN114816678A CN 114816678 A CN114816678 A CN 114816678A CN 202210610965 A CN202210610965 A CN 202210610965A CN 114816678 A CN114816678 A CN 114816678A
Authority
CN
China
Prior art keywords
lock
virtual
cpu thread
virtual machine
queue
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
CN202210610965.7A
Other languages
Chinese (zh)
Other versions
CN114816678B (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.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent 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 Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202210610965.7A priority Critical patent/CN114816678B/en
Publication of CN114816678A publication Critical patent/CN114816678A/en
Application granted granted Critical
Publication of CN114816678B publication Critical patent/CN114816678B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/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/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
    • G06F2009/45575Starting, stopping, suspending or resuming virtual machine instances

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a method, a system, equipment and a storage medium for scheduling a virtual machine, wherein the method comprises the following steps: creating different lock queues on a host machine according to different locks applied by the virtual machine, and setting business processes which hold the same lock and wait for unlocking in the same lock queue; judging whether a virtual CPU thread exists in a current queue on a host machine through a virtual machine service process; responding to the condition that no virtual CPU thread exists in the current queue, acquiring a lock and executing the service process; and responding to the virtual CPU thread existing in the current queue, creating a new virtual CPU thread according to the information of the business process, mounting the new virtual CPU thread to the tail of the queue, and suspending the business process. The invention enables the physical host to sense whether the virtual machine is in a state that the spin lock does not obtain the lock, thereby coordinating the operation of the virtual CPU thread of the virtual machine and improving the scheduling capability and the service capability of the physical server.

Description

Method, system, equipment and storage medium for scheduling virtual machine
Technical Field
The present invention relates to the field of servers, and in particular, to a method, a system, a device, and a storage medium for virtual machine scheduling.
Background
Cloud computing has become the infrastructure for new infrastructure construction in the country. Virtualization technology is an important technical support means and a key support technology for cloud computing. Currently, virtualization mainly includes technologies such as physical server virtualization, storage virtualization, network virtualization, device virtualization, and the like, and by these technologies, virtualization of hardware, virtualization of an operating system, and virtualization of upper layer services are realized. The characteristics of high reliability and elastic expansion of computing resources of cloud computing are effectively guaranteed. Through the elastic management of the resources of the server, the utilization rate of the resources of the server is improved, and the resource loss is reduced.
The virtualization technology is divided into full virtualization and paravirtualization according to the virtualization degree. The most intuitive embodiment of full virtualization is that any type of operating system can be installed on a virtual server. The operating systems installed in the current virtual machines run on respective virtual servers independently, and the operating systems are not sensed. Spin locks are a locking mechanism in which an acquisition resource waits until it is not satisfied, and are mainly used in a multiprocessor operating environment. Due to the characteristics of death and the like, even if other tasks (processes) to be executed exist on the system in the period of time, CPU resources cannot be made available for other processes to use. In order to improve the performance of the spin lock, the spin lock has been developed into a spin lock with different designs such as a raw spin lock (ram spin lock), a ticket spin lock, an mcs spin lock, a queue spin lock, and the like. In the virtualization scenario, however, the physical CPUs are virtualized as VCPUs, with each CPU being threaded. In this case, once the virtual operating system enters a spinlock state, it means that the thread is continuously waiting, which wastes resources of the CPU, and a Lock Holder Preemption (LHP) is generated to preempt the Lock holding thread in the virtual machine, which causes the Lock holding thread to be busy, and so on, until the Lock Holder thread is scheduled again and releases the Lock, the Lock holding thread can not acquire the Lock. The remaining lock-waiting threads are actually wasting CPU power waiting from the time the lock-holding thread is preempted until it is scheduled to run again. And the next Lock waiting thread in the Lock Wait Preemption (LWP) virtual machine is preempted until the next time the Lock is scheduled again and the Lock is acquired, the blind of the other Lock waiting threads and the like actually Lock the threads, which wastes CPU calculation power. Thus, once a virtual CPU (thread) is trapped in a blind or the like, the host can simply suspend the thread from running to perform other tasks. In this case the spin lock again generates paravir spinlock. The spin lock is designed based on a virtualization scene, the spinlock under the virtualization scene is optimized, the guest kernel is modified to sense that the spin lock is in the virtualization scene, and the LHP and LWP problems can be reduced to a certain extent by using a halt vcpu mode instead of enabling vcpu to spin.
Currently, spinlock only considers the use of a lock within the range of an operating system, and cannot sense the problem of service synchronization under different virtual machines.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method, a system, a computer device, and a computer readable storage medium for virtual machine scheduling, so that a physical host can sense whether a virtual machine is in a state where a spinlock does not obtain a lock, thereby coordinating operation of virtual CPU threads of the virtual machine, and improving scheduling capability and service capability of a physical server.
Based on the above object, an aspect of the embodiments of the present invention provides a method for scheduling a virtual machine, including the following steps: creating different lock queues on a host machine according to different locks applied by the virtual machine, and setting business processes which hold the same lock and wait for unlocking in the same lock queue; judging whether a virtual CPU thread exists in a current queue on a host machine through a virtual machine service process; responding to the condition that no virtual CPU thread exists in the current queue, acquiring a lock and executing the service process; and responding to the virtual CPU thread existing in the current queue, creating a new virtual CPU thread according to the information of the business process, mounting the new virtual CPU thread to the tail of the queue, and suspending the business process.
In some embodiments, the creating a different lock queue on the host according to a difference in the lock applied by the virtual machine includes: and initializing the lock, and providing the name of the lock for all the virtual machines on the host machine to access the lock for use.
In some embodiments, the method further comprises: and responding to the service process holding the lock to complete work, releasing the current virtual CPU thread, and awakening the next virtual CPU thread in the queue.
In some embodiments, the method further comprises: and in response to closing the virtual machine, clearing the virtual CPU thread information of all locks of the virtual machine.
In another aspect of the embodiments of the present invention, a system for virtual machine scheduling is provided, including: the creation module is configured to create different lock queues on a host according to different locks applied by the virtual machine, and set business processes which hold the same lock and wait for unlocking in the same lock queue; the judging module is configured to judge whether a virtual CPU thread exists in a current queue on a host machine through a virtual machine service process; the execution module is configured to respond to the fact that no virtual CPU thread exists in the current queue, acquire a lock and execute the business process; and the mounting module is configured to respond to the virtual CPU thread existing in the current queue, create a new virtual CPU thread according to the information of the business process, mount the new virtual CPU thread to the tail of the queue, and suspend the business process.
In some embodiments, the creation module is configured to: and initializing the lock, and providing the name of the lock for all the virtual machines on the host machine to access the lock for use.
In some embodiments, the system further comprises an unlocking module configured to: and responding to the service process holding the lock to complete work, releasing the current virtual CPU thread, and awakening the next virtual CPU thread in the queue.
In some embodiments, the system further comprises an emptying module configured to: and in response to closing the virtual machine, clearing the virtual CPU thread information of all locks of the virtual machine.
In another aspect of the embodiments of the present invention, there is also provided a computer device, including: at least one processor; and a memory storing computer instructions executable on the processor, the instructions when executed by the processor implementing the steps of the method as above.
In a further aspect of the embodiments of the present invention, a computer-readable storage medium is also provided, in which a computer program for implementing the above method steps is stored when the computer program is executed by a processor.
The invention has the following beneficial technical effects: the physical host can sense whether the virtual machine is in a state that the spin lock does not obtain the lock, so that the running of the virtual CPU thread of the virtual machine is coordinated, and the scheduling capability and the service capability of the physical server are improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the prior art descriptions will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other embodiments can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic diagram of an embodiment of a method for scheduling a virtual machine according to the present invention;
FIG. 2 is a schematic diagram of a lock queuing mechanism provided by the present invention;
FIG. 3 is a content diagram of a virtual CPU thread according to the present invention;
FIG. 4 is a diagram illustrating an embodiment of a system for virtual machine scheduling provided by the present invention;
FIG. 5 is a schematic hardware structure diagram of an embodiment of a virtual machine scheduling computer device provided in the present invention;
FIG. 6 is a schematic diagram of an embodiment of a computer storage medium for virtual machine scheduling provided by the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the following embodiments of the present invention are described in further detail with reference to the accompanying drawings.
It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are used for distinguishing two entities with the same name but different names or different parameters, and it should be noted that "first" and "second" are merely for convenience of description and should not be construed as limitations of the embodiments of the present invention, and they are not described in any more detail in the following embodiments.
In a first aspect of the embodiments of the present invention, an embodiment of a method for scheduling a virtual machine is provided. Fig. 1 is a schematic diagram illustrating an embodiment of a method for scheduling a virtual machine according to the present invention. As shown in fig. 1, the embodiment of the present invention includes the following steps:
s1, creating different lock queues on a host machine according to different locks applied by the virtual machine, and setting business processes which hold the same lock and wait for unlocking in the same lock queue;
s2, judging whether a virtual CPU thread exists in the current queue on the host machine through the virtual machine service process;
s3, responding to the virtual CPU thread which does not exist in the current queue, acquiring a lock and executing the service process; and
and S4, responding to the virtual CPU thread existing in the current queue, creating a new virtual CPU thread according to the information of the business process, mounting the new virtual CPU thread to the tail of the queue, and suspending the business process.
The embodiment of the invention utilizes the virtualization technology to improve the resource utilization rate of the server on the basis of server virtualization, and coordinates the server resources to provide services to the outside to the greatest extent. The embodiment of the invention coordinates and schedules the operation of the virtual operating system (virtual machine) by sensing the operating state (spin lock) of the operating system on the virtual server.
Raw spinlock is the most initial spinlock. Expressed by a shaping variable, the initial value of which is 1, which represents the state of available. When one CPU (set to CPU a) acquires spinlock, the value of the variable is set to 0, and then when the other CPU tries to acquire this spinlock, it waits until CPU a releases spinlock and sets the value of the variable to 1. The Raw spinlock is implemented quickly, especially without a real race (which is in fact the case most of the time), but this approach has a drawback: it is "unfair". Once spinlock is released, the first CPU that can successfully perform the spinlock operation will become the new owner, and there is no way to ensure that the CPU with the longest latency on the spinlock preferentially acquires the lock, which will cause a problem with indeterminable latency.
To address the unfair problem caused by such "out-of-order competition," another implementation of spinlock is to use a "ticket spinlock" in the form of queuing. Each cpu under this mechanism that attempts to acquire a lock gets a queue number. When the current number of the lock is equal to the queuing number, the cpu acquires the lock. When the lock is acquired, if the number of the current lock is equal to the queue number acquired by the CPU, the queue is empty, and the lock is immediately acquired and executed. Otherwise, waiting. Each time a lock is released, a global synchronization is required to each CPU holding the lock. All locks waiting in spin must acquire the owner value of the current lock in real time. The cache line of the cpu is flushed every time the value of the owner value changes, and the more threads waiting for the lock, the more frequent the flushing. But in practice only one cpu core will be used per refresh. Excessive refresh results in unnecessary overhead.
And modifying the clock based on the ticket clock to ensure that each CPU does not wait for the same clock variable any more but waits based on the variables of different per-CPUs, so that each CPU only needs to query the local cache line where the corresponding variable is located at ordinary times, and only when the variable changes, the memory needs to be read and the cache line needs to be refreshed. The ticket spinlock problem can be solved. The Mcs spinlock is not consistent with the current spinlock lock of the kernel in size, and cannot be replaced by default directly, and the code needs to be modified for trial use.
Queue spinlock is the default locking mechanism of current Linux systems. By optimizing the mcs lock, and adopting a mechanism of data structure compression and cache line refreshing avoidance, the ticket spinlock is perfectly replaced by the mcs.
The paravir spine can optimize the spine under the virtualization scene, the guest kernel is modified to enable the guest kernel to perceive that the guest kernel is in the virtualization scene, and a hash vcpu mode is used instead of enabling the vcpu to spin, so that LHP and LWP problems can be reduced to a certain extent.
The method is divided into different execution functions according to the fact that the current operating system runs on a virtual machine or a physical machine. The virtual machine has three parts of lock initialization, lock acquisition and lock unlocking. There are locking, scheduling, and lock queuing mechanisms on the hosts (i.e., physical machines). Because the service on the virtual machines needs to be synchronized between the virtual machines, the embodiment of the invention realizes the synchronization target by constructing a queuing mechanism of the lock and a scheduling mechanism of the lock on the host machine. The communication between the virtual machine and the host machine can be realized by special instructions, virtio construction and the like.
And creating different lock queues on the host machine according to different locks applied by the virtual machine, and setting the business processes which hold the same lock and wait for unlocking in the same lock queue.
In some embodiments, the creating a different lock queue on the host according to a difference in the lock applied by the virtual machine includes: initializing the lock, and providing the name of the lock for all virtual machines on the host machine to access the lock for use. The initialization lock creates a lock on behalf of the virtual machine business process. The primary task to accomplish is to create a queue of locks on the host, the names of which are used by all virtual machines on the host to access the locks.
Fig. 2 is a schematic diagram of a lock queuing mechanism provided in the present invention, and as shown in fig. 2, a lock needs to close an interrupt mechanism during use to prohibit preemption. There can only be one lock per VCPU (virtual CPU thread) at the same time. Only one can appear per business process on the lock's queuing mechanism queue. Each queue represents a lock that the virtual machine applies for, and the vcpu on the queue represents that a business process holding the same lock is waiting to be unlocked.
Fig. 3 is a schematic diagram of contents of a virtual CPU thread provided in the present invention, and as shown in fig. 3, the contents of the virtual CPU thread include a lock state, an affiliated virtual machine, an affiliated business process, and a count. The state of the lock: 0 represents locked and 1 represents currently held lock. The affiliated virtual machine represents the virtual machine currently applying for the lock. The business process represents the currently applied VCPU. The Count represents the number of locks applied by the virtual machine, and the value is mainly used for counting the use condition of the locks.
And judging whether the current queue has a virtual CPU thread or not on the host machine through the service process of the virtual machine.
And responding to the condition that the virtual CPU thread does not exist in the current queue, acquiring a lock and executing the business process. And responding to the virtual CPU thread existing in the current queue, creating a new virtual CPU thread according to the information of the business process, mounting the new virtual CPU thread to the tail of the queue, and suspending the business process. And acquiring the lock to represent the service process of the virtual machine to host the state of the lock, and if the current queue is empty, namely no vcpu exists, immediately acquiring the lock and executing. And if the current queue is not empty, creating a vcpu for the related information of the business process and mounting the vcpu to the tail of the queue, and finally suspending the business process.
In some embodiments, the method further comprises: and responding to the service process holding the lock to complete work, releasing the current virtual CPU thread, and awakening the next virtual CPU thread in the queue. Unlocking represents the process of releasing the lock after the business process holding the lock completes the related work. The method mainly comprises the step of releasing the vcpu and waking up the next vcpu of the queue, wherein the waking method is to recover the operation of the business process.
Scheduling is responsible for the management of the business process, such as suspending the business process and resuming the business process.
In some embodiments, the method further comprises: and in response to closing the virtual machine, clearing the virtual CPU thread information of all locks of the virtual machine. The maintenance module is responsible for maintaining the queue of the whole lock, for example, emptying the vcpu information of the lock related to the virtual machine when the virtual machine is closed, such as destroying the lock.
In the embodiment of the invention, the physical host can sense whether the virtual machine is in a spinlock state without acquiring a lock, and schedule a thread (vcpu) in the spinlock state to tune away from an execution state; and scheduling the threads obtaining the spinlock lock, recovering the operation of the threads, and enabling the virtual machines to run in a coordinated mode through the lock mechanism, wherein different virtual machines can initialize and compete for the spinlock lock. And (5) the service in the virtual machine is operated in a coordinated manner.
It should be particularly noted that, the steps in the foregoing embodiments of the method for virtual machine scheduling may be mutually intersected, replaced, added, or deleted, and therefore, these methods for virtual machine scheduling transformed by reasonable permutation and combination shall also belong to the scope of the present invention, and shall not limit the scope of the present invention to the embodiments.
In view of the foregoing, a second aspect of the embodiments of the present invention provides a system for virtual machine scheduling. As shown in fig. 4, the system 200 includes the following modules: the creation module is configured to create different lock queues on a host according to different locks applied by the virtual machine, and set business processes which hold the same lock and wait for unlocking in the same lock queue; the judging module is configured to judge whether a virtual CPU thread exists in a current queue on a host machine through a virtual machine service process; the execution module is configured to respond to the fact that no virtual CPU thread exists in the current queue, acquire a lock and execute the business process; and the mounting module is configured to respond to the virtual CPU thread existing in the current queue, create a new virtual CPU thread according to the information of the business process, mount the new virtual CPU thread to the tail of the queue, and suspend the business process.
In some embodiments, the creation module is configured to: and initializing the lock, and providing the name of the lock for all the virtual machines on the host machine to access the lock for use.
In some embodiments, the system further comprises an unlocking module configured to: and responding to the service process holding the lock to complete work, releasing the current virtual CPU thread, and awakening the next virtual CPU thread in the queue.
In some embodiments, the system further comprises an emptying module configured to: and in response to closing the virtual machine, clearing the virtual CPU thread information of all locks of the virtual machine.
In view of the above object, a third aspect of the embodiments of the present invention provides a computer device, including: at least one processor; and a memory storing computer instructions executable on the processor, the instructions being executable by the processor to perform the steps of: s1, creating different lock queues on a host machine according to different locks applied by the virtual machine, and setting business processes which hold the same lock and wait for unlocking in the same lock queue; s2, judging whether a virtual CPU thread exists in the current queue on the host machine through the virtual machine service process; s3, responding to the virtual CPU thread which does not exist in the current queue, acquiring a lock and executing the service process; and S4, responding to the virtual CPU thread existing in the current queue, creating a new virtual CPU thread according to the information of the business process, mounting the new virtual CPU thread to the tail of the queue, and suspending the business process.
In some embodiments, the creating a different lock queue on the host according to a difference in the lock applied by the virtual machine includes: initializing the lock, and providing the name of the lock for all virtual machines on the host machine to access the lock for use.
In some embodiments, the steps further comprise: and responding to the service process holding the lock to complete work, releasing the current virtual CPU thread, and awakening the next virtual CPU thread in the queue.
In some embodiments, the steps further comprise: and in response to closing the virtual machine, clearing the virtual CPU thread information of all locks of the virtual machine.
Fig. 5 is a schematic hardware structure diagram of an embodiment of the computer device for virtual machine scheduling provided by the present invention.
Taking the device shown in fig. 5 as an example, the device includes a processor 301 and a memory 302.
The processor 301 and the memory 302 may be connected by a bus or other means, such as the bus connection in fig. 5.
The memory 302 is a non-volatile computer-readable storage medium and can be used for storing non-volatile software programs, non-volatile computer-executable programs, and modules, such as program instructions/modules corresponding to the method for scheduling virtual machines in the embodiments of the present application. The processor 301 executes various functional applications of the server and data processing, i.e., a method of implementing virtual machine scheduling, by executing nonvolatile software programs, instructions, and modules stored in the memory 302.
The memory 302 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the method of virtual machine scheduling, and the like. Further, the memory 302 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, memory 302 optionally includes memory located remotely from processor 301, which may be connected to a local module via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
Computer instructions 303 corresponding to one or more methods of virtual machine scheduling are stored in the memory 302 and when executed by the processor 301 perform the method of virtual machine scheduling in any of the above-described method embodiments.
Any embodiment of the computer device executing the method for scheduling the virtual machine may achieve the same or similar effects as any corresponding embodiment of the foregoing method.
The present invention also provides a computer-readable storage medium storing a computer program for executing the method of virtual machine scheduling when executed by a processor.
Fig. 6 is a schematic diagram of an embodiment of a computer storage medium for scheduling the virtual machine according to the present invention. Taking the computer storage medium as shown in fig. 6 as an example, the computer readable storage medium 401 stores a computer program 402 which, when executed by a processor, performs the method as described above.
Finally, it should be noted that, as one of ordinary skill in the art can appreciate that all or part of the processes of the methods of the above embodiments can be implemented by a computer program to instruct related hardware to implement the methods of virtual machine scheduling. The storage medium of the program may be a magnetic disk, an optical disk, a Read Only Memory (ROM), a Random Access Memory (RAM), or the like. The embodiments of the computer program may achieve the same or similar effects as any of the above-described method embodiments.
The foregoing is an exemplary embodiment of the present disclosure, but it should be noted that various changes and modifications could be made herein without departing from the scope of the present disclosure as defined by the appended claims. The functions, steps and/or actions of the method claims in accordance with the disclosed embodiments described herein need not be performed in any particular order. Furthermore, although elements of the disclosed embodiments of the invention may be described or claimed in the singular, the plural is contemplated unless limitation to the singular is explicitly stated.
It should be understood that, as used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly supports the exception. It should also be understood that "and/or" as used herein is meant to include any and all possible combinations of one or more of the associated listed items.
The numbers of the embodiments disclosed in the embodiments of the present invention are merely for description, and do not represent the merits of the embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
Those of ordinary skill in the art will understand that: the discussion of any embodiment above is meant to be exemplary only, and is not intended to intimate that the scope of the disclosure, including the claims, of embodiments of the invention is limited to these examples; within the idea of an embodiment of the invention, also technical features in the above embodiment or in different embodiments may be combined and there are many other variations of the different aspects of the embodiments of the invention as described above, which are not provided in detail for the sake of brevity. Therefore, any omissions, modifications, substitutions, improvements, and the like that may be made without departing from the spirit and principles of the embodiments of the present invention are intended to be included within the scope of the embodiments of the present invention.

Claims (10)

1. A method for scheduling a virtual machine is characterized by comprising the following steps:
creating different lock queues on a host machine according to different locks applied by the virtual machine, and setting business processes which hold the same lock and wait for unlocking in the same lock queue;
judging whether a virtual CPU thread exists in a current queue on a host machine through a virtual machine service process;
responding to the condition that no virtual CPU thread exists in the current queue, acquiring a lock and executing the service process; and
and responding to the virtual CPU thread existing in the current queue, creating a new virtual CPU thread according to the information of the business process, mounting the new virtual CPU thread to the tail of the queue, and suspending the business process.
2. The method of claim 1, wherein creating different lock queues on a host according to different locks applied by a virtual machine comprises:
and initializing the lock, and providing the name of the lock for all the virtual machines on the host machine to access the lock for use.
3. The method of claim 1, further comprising:
and responding to the service process holding the lock to complete work, releasing the current virtual CPU thread, and awakening the next virtual CPU thread in the queue.
4. The method of claim 1, further comprising:
and in response to closing the virtual machine, clearing the virtual CPU thread information of all locks of the virtual machine.
5. A system for virtual machine scheduling, comprising:
the system comprises a creating module, a locking module and a locking module, wherein the creating module is configured to create different lock queues on a host according to different locks applied by a virtual machine, and set service processes which hold the same lock and wait for unlocking in the same lock queue;
the judging module is configured to judge whether a virtual CPU thread exists in a current queue on a host machine through a virtual machine service process;
the execution module is configured to respond to the fact that no virtual CPU thread exists in the current queue, acquire a lock and execute the business process; and
and the mounting module is configured to respond to the virtual CPU thread existing in the current queue, create a new virtual CPU thread according to the information of the business process, mount the new virtual CPU thread to the tail of the queue, and suspend the business process.
6. The system of claim 5, wherein the creation module is configured to:
and initializing the lock, and providing the name of the lock for all the virtual machines on the host machine to access the lock for use.
7. The system of claim 5, further comprising an unlocking module configured to:
and responding to the completion of the service process holding the lock, releasing the current virtual CPU thread, and awakening the next virtual CPU thread in the queue.
8. The system of claim 5, further comprising an emptying module configured to:
and in response to closing the virtual machine, clearing the virtual CPU thread information of all locks of the virtual machine.
9. A computer device, comprising:
at least one processor; and
a memory storing computer instructions executable on the processor, the instructions when executed by the processor implementing the steps of the method of any one of claims 1 to 4.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 4.
CN202210610965.7A 2022-05-31 2022-05-31 Virtual machine scheduling method, system, equipment and storage medium Active CN114816678B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210610965.7A CN114816678B (en) 2022-05-31 2022-05-31 Virtual machine scheduling method, system, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210610965.7A CN114816678B (en) 2022-05-31 2022-05-31 Virtual machine scheduling method, system, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114816678A true CN114816678A (en) 2022-07-29
CN114816678B CN114816678B (en) 2024-06-11

Family

ID=82519573

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210610965.7A Active CN114816678B (en) 2022-05-31 2022-05-31 Virtual machine scheduling method, system, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114816678B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118349368A (en) * 2024-05-14 2024-07-16 哈尔滨工业大学 Real-time-oriented construction method of interruptible mutual exclusive lock of virtualization platform, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103473135A (en) * 2013-09-23 2013-12-25 中国科学技术大学苏州研究院 Processing method for spinlock LHP (Lock-Holder Preemption) phenomenon under virtual environment
US20140149633A1 (en) * 2012-11-27 2014-05-29 Red Hat Israel, Ltd. Delivery of events from a virtual machine to a thread executable by multiple host cpus using memory monitoring instructions
KR20180066387A (en) * 2016-12-08 2018-06-19 한국전자통신연구원 Method and system for scalability using paravirtualized opportunistic spinlock algorithm
CN113032098A (en) * 2021-03-25 2021-06-25 深信服科技股份有限公司 Virtual machine scheduling method, device, equipment and readable storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140149633A1 (en) * 2012-11-27 2014-05-29 Red Hat Israel, Ltd. Delivery of events from a virtual machine to a thread executable by multiple host cpus using memory monitoring instructions
CN103473135A (en) * 2013-09-23 2013-12-25 中国科学技术大学苏州研究院 Processing method for spinlock LHP (Lock-Holder Preemption) phenomenon under virtual environment
KR20180066387A (en) * 2016-12-08 2018-06-19 한국전자통신연구원 Method and system for scalability using paravirtualized opportunistic spinlock algorithm
CN113032098A (en) * 2021-03-25 2021-06-25 深信服科技股份有限公司 Virtual machine scheduling method, device, equipment and readable storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118349368A (en) * 2024-05-14 2024-07-16 哈尔滨工业大学 Real-time-oriented construction method of interruptible mutual exclusive lock of virtualization platform, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN114816678B (en) 2024-06-11

Similar Documents

Publication Publication Date Title
Humphries et al. ghost: Fast & flexible user-space delegation of linux scheduling
CN105700939B (en) The method and system of Multi-thread synchronization in a kind of distributed system
CN101833475B (en) Method and device for execution of instruction block
EP3701377B1 (en) Method and apparatus for updating shared data in a multi-core processor environment
US8438341B2 (en) Common memory programming
US9378069B2 (en) Lock spin wait operation for multi-threaded applications in a multi-core computing environment
US8856801B2 (en) Techniques for executing normally interruptible threads in a non-preemptive manner
US9256477B2 (en) Lockless waterfall thread communication
US11132294B2 (en) Real-time replicating garbage collection
WO2014090008A1 (en) Task processing method and virtual machine
TW201413456A (en) Method and system for processing nested stream events
JP2006515690A (en) Data processing system having a plurality of processors, task scheduler for a data processing system having a plurality of processors, and a corresponding method of task scheduling
US11620215B2 (en) Multi-threaded pause-less replicating garbage collection
CN111414256A (en) Application program process derivation method, system and medium based on kylin mobile operating system
WO2021022964A1 (en) Task processing method, device, and computer-readable storage medium based on multi-core system
US20090133099A1 (en) Methods and systems for transparent software license suspension
CA2419340A1 (en) Software barrier synchronization
US10289306B1 (en) Data storage system with core-affined thread processing of data movement requests
CN114816678A (en) Method, system, equipment and storage medium for scheduling virtual machine
EP2316072A1 (en) Data sharing in chip multi-processor systems
Goyette An analysis and description of the inner workings of the freertos kernel
CN114281529B (en) Method, system and terminal for dispatching optimization of distributed virtualized client operating system
CN115964150A (en) Business processing method, system, device and medium based on double real-time kernels
US9619277B2 (en) Computer with plurality of processors sharing process queue, and process dispatch processing method
Fukuoka et al. An efficient inter-node communication system with lightweight-thread scheduling

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