US20240069953A1 - Timer processing method, apparatus, electronic device, and computer-readable storage medium - Google Patents

Timer processing method, apparatus, electronic device, and computer-readable storage medium Download PDF

Info

Publication number
US20240069953A1
US20240069953A1 US18/261,473 US202218261473A US2024069953A1 US 20240069953 A1 US20240069953 A1 US 20240069953A1 US 202218261473 A US202218261473 A US 202218261473A US 2024069953 A1 US2024069953 A1 US 2024069953A1
Authority
US
United States
Prior art keywords
timer
time
deadline
type
virtual machine
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
US18/261,473
Other languages
English (en)
Inventor
Yang Zhang
Yibo Zhou
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 ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network 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 ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Publication of US20240069953A1 publication Critical patent/US20240069953A1/en
Pending legal-status Critical Current

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/4812Task transfer initiation or dispatching by interrupt, e.g. masked
    • G06F9/4825Interrupt from clock, e.g. time of day
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • Embodiments of the present disclosure relate to the field of computer technology, and in particular, to a timer processing method, an apparatus, an electronic device, and a computer-readable storage medium.
  • kernel-based virtual machine (KVM) platforms implement timers for virtual machines through software simulation. Each time a deadline is set for a timer, a virtual machine exits to a physical machine if the virtual machine uses a local APIC timer and runs in TSC deadline mode.
  • KVM kernel-based virtual machine
  • an embodiment of the present disclosure provides a timer processing method, comprising: determining a type of a timer used by a physical machine before a virtual machine starts, wherein the virtual machine runs on the physical machine; determining a first time and a first deadline of the virtual machine which are before the virtual machine starts; in a case where the timer used by the physical machine is a first-type timer, adjusting a time of the first-type timer to a second time corresponding to the first time and adjusting a deadline of the first-type timer to a second deadline corresponding to the first deadline to obtain an adjusted first-type timer; and configuring the adjusted first-type timer as a timer of the virtual machine.
  • some embodiments of the present disclosure provide a timer processing apparatus, comprising: a first determination unit for determining a type of a timer used by a physical machine before a virtual machine starts, wherein the virtual machine runs on the physical machine; a second determination unit for determining a first time and a first deadline of the virtual machine which are before the virtual machine starts; an adjustment unit for, in a case where the timer used by the physical machine is a first-type timer, adjusting a time of the first-type timer to a second time corresponding to the first time and adjusting a deadline of the first-type timer to a second deadline corresponding to the first deadline to obtain an adjusted first-type timer; and a configuration unit for configuring the adjusted first-type timer as a timer of the virtual machine.
  • some embodiments of the present disclosure provide an electronic device, comprising: one or more processors; a memory device having stored thereon one or more programs that, when executed by the one or more processors, cause the one or more processors to implement the method described in the first aspect.
  • some embodiments of the present disclosure provide a non-transitory computer-readable medium having stored thereon a computer program that, when executed by a processor, implements the method described in the first aspect.
  • an embodiment of the present disclosure provides a computer program, comprising: instructions that, when executed by a processor, cause the processor to execute the method described in the first aspect.
  • an embodiment of the present disclosure provides a computer program product comprising instructions that, when executed by a processor, cause the processor to perform the method described in the first aspect.
  • FIG. 1 is a schematic diagram showing an application scenario of a timer processing method according to some embodiments of the present disclosure
  • FIG. 2 is a flowchart of the timer processing method according to some embodiments of the present disclosure
  • FIG. 3 is a schematic diagram showing a virtual machine triggering an interrupt in the timer processing method according to some embodiments of the present disclosure
  • FIG. 4 is a flowchart of the timer processing method according to other embodiments of the present disclosure.
  • FIG. 5 is a schematic diagram showing a physical machine triggering an interrupt in the timer processing method according to some embodiments of the present disclosure
  • FIG. 6 is a schematic structural diagram of a timer processing apparatus according to some embodiments of the present disclosure.
  • FIG. 7 is a schematic structural diagram of an electronic device suitable for implementing some embodiments of the present disclosure.
  • Some embodiments of the present disclosure provide a timer processing method, an apparatus, a device, and a computer-readable storage medium to solve the above technical problem.
  • FIG. 1 is a schematic diagram showing an application scenario of a timer processing method according to some embodiments of the present disclosure.
  • an electronic device 101 determines a type of timer used by a physical machine 102 before a virtual machine 103 starts, wherein the virtual machine 103 runs on the physical machine 102 . Then, a first time and a first deadline of the virtual machine 103 which are before the virtual machine 103 starts are determined. Then, in a case where the timer used by the physical machine 102 is a first-type timer 104 , adjusting a time of the first-type timer 104 to a second time corresponding to the first time and adjusting a deadline of the first-type timer 104 to a second deadline corresponding to the first deadline to obtain an adjusted first-type timer 105 . Finally, the adjusted first-type timer 105 is configured as a timer of the virtual machine 103 .
  • the timer processing method can be executed by the electronic device 101 .
  • the electronic device 101 described above may be hardware or software. If the electronic device is hardware, it can be implemented as a distributed cluster composed of multiple servers or terminal devices, or as a single server or a single terminal device. If the electronic device 101 is embodied as software, it may be implemented as multiple pieces of software or multiple software modules for providing distributed services, or may be implemented as a single piece of software or a single software module. Here, no specific limitation is imposed thereto.
  • FIG. 1 the number of the electronic device in FIG. 1 is merely illustrative. There can be any number of electronic devices according to implementation needs.
  • the timer processing method comprises the following steps.
  • step 201 a type of a timer used by a physical machine before a virtual machine starts is determined.
  • the executive body of the timer processing method can determine the type of the timer used by the physical machine before the virtual machine starts through querying, wherein the virtual machine runs on the physical machine.
  • the virtual machine may be a complete computer system with complete hardware system functionality simulated through software and running in a completely isolated environment. Any work that can be done on a physical computer can be done on the virtual machine.
  • it is necessary to use a portion of the physical machine's hard disk and memory as the virtual machine's hard disk and memory.
  • Each virtual machine has components such as a hard disk and an operating system that allow users to operate the virtual machine as if it were a physical machine.
  • a physical machine can provide a hardware environment for the virtual machine. Through the cooperation of a physical machine and virtual machines, multiple operating systems (an external operating system and multiple operating systems of the virtual machines) can be installed on the computer, and communication between these operating systems can be achieved as if they were multiple computers.
  • the physical machine may use at least one timer.
  • the timer may be a retentive timer or a non-retentive timer.
  • step 202 a first time and a first deadline of the virtual machine which are before the virtual machine starts are determined.
  • the executive body can determine the first time and first deadline of the virtual machine before the virtual machine starts by querying, wherein the first time and the first deadline of the virtual machine may be in the form of timestamps.
  • the first time may be: “1492239370”.
  • the first deadline may be “1598339370”.
  • step 203 in a case where the timer used by the physical machine is a first-type timer, a time of the first-type timer is adjusted to a second time corresponding to the first time and a deadline of the first-type timer is adjusted to a second deadline corresponding to the first deadline to obtain an adjusted first-type timer.
  • the executive body can adjust the time of the first-type timer to a second time corresponding to the first time, and adjust the deadline of the first-type timer to a second deadline corresponding to the first deadline using time adjustment instructions, so as to obtain an adjusted first-type timer, wherein the first-type timer may be a timer of any specific type.
  • the first-type timer may be an APIC Timer.
  • the APIC Timer has Periodic Mode, One-Shot Mode, and TSC Deadline Mode.
  • timers may have different frequencies, before the virtual machine can use the first-type timer normally, it is necessary to adjust the time of the first-type timer to a second time corresponding to the first time and adjust the deadline of the first-type timer to a second deadline corresponding to the first deadline, so that the configured timer can be used by the virtual machine normally.
  • the first time may be: “1492239370”.
  • the first deadline may be “1598339370”.
  • the second time may be “1492249370”, and the second deadline may be “1598349370”. That is, the second time may be the same as the first time, and the second deadline may be the same as the first deadline.
  • the adjusted first-type timer is configured as a timer of the virtual machine.
  • the executive body can configure the timer of the virtual machine using the adjusted first-type timer in various ways.
  • the executive body may not adjust the timer of the physical machine and the deadline of the third-type timer.
  • the third-type timer may be: a High Precision Event Timer (HPET).
  • a second time interrupt is triggered to terminate the adjusted first-type timer in response to a detection that a time of the adjusted first-type timer in the virtual machine reaches the second deadline.
  • the physical machine in response to the detection that the time of the first-type timer in the virtual machine reaches the deadline of the first-type timer, the physical machine first receives an interrupt request, and then determines whether the interrupt request is used by a virtual machine. If it is used by a virtual machine, a second time interrupt is directly injected to terminate the first-type timer.
  • the physical machine 301 in response to a detection that the time 305 of the adjusted first-type timer 304 in the virtual machine 302 reaches a second deadline 306 , the physical machine 301 first receives an interrupt request 303 , wherein the time 305 and the deadline 306 of the adjusted first-type timer 304 are both “1598339370”. Then, it is determined whether the interrupt request 303 is an interrupt from the virtual machine 302 . In response to a determination that the interrupt request 303 is an interrupt from the virtual machine 302 , a second time interrupt 307 is directly injected to terminate the adjusted first-type timer 304 .
  • the executive body can instruct the virtual machine to access relevant registers of the adjusted first-type timer.
  • the above embodiments of the present disclosure have the following beneficial effects.
  • the problem of frequent virtual machine exits due to the use of a simulated timer in the virtual machine can be solved in a simple and effective manner, thereby eliminating the impact on virtual machine performance caused by the use of the simulated timer.
  • a virtual machine uses a local APIC timer and runs in TSC-Deadline mode, every time a deadline is set for the timer, the virtual machine exits to the physical machine.
  • frequent virtual machine exits have a significant impact on virtual machine performance.
  • a type of timer used by a physical machine before a virtual machine starts is first determined, wherein the virtual machine runs on the physical machine.
  • a type of a timer used by a physical machine is determined to enable a virtual machine to use the timer later.
  • the correlation between the physical machine and the virtual machine is also described.
  • a first time and a first deadline of the virtual machine before the virtual machine starts are determined.
  • a first time and a first deadline are determined for adjusting the timer used by the virtual machine in order to ensure that the timer can be normally used by the virtual machine.
  • the timer used by the physical machine is a first-type timer
  • the time of the first-type timer is adjusted to a second time corresponding to the first time
  • the deadline of the first-type timer is adjusted to a second deadline corresponding to the first deadline, so as to obtain an adjusted first-type timer.
  • the time frequency of the timer used by the virtual machine previously may be different from that of the first-type timer used by the physical machine. Therefore, it is necessary to adjust the first time and first deadline to match the time and deadline in the first-type timer used by the virtual machine.
  • the timer processing method comprises the following steps.
  • step 401 a type of a timer used by a physical machine before a virtual machine starts is determined, wherein the virtual machine runs on the physical machine.
  • step 402 a first time and a first deadline of the virtual machine before the virtual machine starts are determined.
  • step 403 in a case where the timer used by the physical machine is a first-type timer, a time of the first-type timer is adjusted to a second time corresponding to the first time and a deadline of the first-type timer is adjusted to a second deadline corresponding to the first deadline to obtain an adjusted first-type timer.
  • the adjusted first-type timer is configured as a timer of the virtual machine.
  • steps 401 - 404 and the technical effects brought about reference may be made to steps 201 - 204 in the embodiments corresponding to FIG. 2 , which will not be described in detail herein.
  • step 405 in a case where the timer used by the physical machine is the first-type timer, a third time and a third deadline of the first-type timer which are before the virtual machine starts are determined.
  • the executive body determines a third time and a third deadline of the first-type timer which are before the virtual machine starts through a query command.
  • the first-type timer may be a APIC Timer.
  • the third time and the third deadline may be a third time and a third deadline used by the physical machine for the first-type timer before the virtual machine starts.
  • a time of a second-type timer is adjusted to a fourth time corresponding to the third time and a deadline of the second-type timer is adjusted to a fourth deadline corresponding to the third deadline to obtain an adjusted second-type timer.
  • the executive body may adjust the time of the second-type timer to a fourth time corresponding to the third time, and adjust the deadline of the second-type timer to a fourth deadline corresponding to the third deadline to obtain an adjusted second-type timer, wherein the second-type timer may be a timer different from the first-type timer.
  • the second type-timer may be a Preemption Timer, wherein the Preemption Timer only starts when the physical machine enters virtual machine mode (i.e. the physical machine enters non root mode).
  • the second-type timer and the first-type timer may have different frequencies, before the second-type timer can be normally used by the physical machine, it is necessary to adjust the time of the second-type timer to a fourth time corresponding to the third time and adjust the deadline of the second-type timer to a fourth deadline corresponding to the third deadline, so that the configured timer can be normally used by the physical machine.
  • the adjusted second-type timer is configured as the timer of the physical machine.
  • the executive body can configure the timer for the physical machine using the adjusted second-type timer.
  • the executive body may further perform the following steps:
  • the time on the virtual machine is often smaller than the time on the physical machine.
  • the time on the physical machine is greater than the time on the virtual machine (i.e. the deadline of the adjusted first-type timer). Therefore, according to the implementation principle of the first-type timer, it is impossible to trigger a termination of the adjusted first-type timer. Therefore, the executive body needs to adjust the fourth time and the fourth deadline. So, the virtual machine can use the adjusted first-type timer to trigger a time interrupt.
  • the adjusted second-type timer used by the physical machine is replaced with the first-type timer in response to a detection that the virtual machine exits and the timer used by the physical machine before the virtual machine starts is the first-type timer.
  • a first time interrupt is triggered to terminate the adjusted second-type timer in response to a detection that the time of the adjusted second-type timer in the physical machine reaches the fourth deadline.
  • a first time interrupt 505 is triggered to terminate the adjusted second-type timer 502 , wherein the time 503 of the adjusted second-type timer 502 and the fourth deadline 504 are both: “159339370”.
  • the executive body can add the time of the first-type timer in the physical machine with the time difference to obtain an adjusted time, which is then used as the time of the first-type timer.
  • the process 400 of the timer processing method of the embodiments corresponding to FIG. 4 highlights the specific steps of selecting a timer for the physical machine and adjusting the timer selected for the physical machine after providing a first-type timer to the virtual machine after the virtual machine starts. Therefore, the scheme described in these embodiments can effectively ensure normal timer operation and triggered interrupts for both the timer of the virtual machine and the timer of the physical machine.
  • the present disclosure provides some embodiments of a timer processing apparatus. These apparatus embodiments correspond to those method embodiments shown in FIG. 2 . Specifically, the apparatus can be applied to various electronic devices.
  • the timer processing apparatus 600 of this embodiment comprises: a first determination unit 601 , a second determination unit 602 , an adjustment unit 603 , and a configuration unit 604 .
  • the first determination unit 601 is configured for determining a type of a timer used by a physical machine before a virtual machine starts, wherein the virtual machine runs on the physical machine.
  • the second determination unit 602 is configured for determining a first time and a first deadline of the virtual machine which are before the virtual machine starts.
  • the adjustment unit 603 is configured for, in a case where the timer used by the physical machine is a first-type timer, adjusting a time of the first-type timer to a second time corresponding to the first time and adjusting a deadline of the first-type timer to a second deadline corresponding to the first deadline to obtain an adjusted first-type timer.
  • the configuration unit 604 is configured for configuring the adjusted first-type timer as a timer of the virtual machine.
  • the apparatus 600 may further comprise: a fourth determination unit, a first time adjustment unit, and a timer configuration unit (not shown in the figure).
  • the fourth determination unit may be configured for, in a case where the timer used by the physical machine is the first-type timer, determining a third time and a third deadline of the first-type timer which are before the virtual machine starts.
  • the first time adjustment unit may be configured for adjusting a time of a second-type timer to a fourth time corresponding to the third time and adjusting a deadline of the second-type timer to a fourth deadline corresponding to the third deadline to obtain an adjusted second-type timer.
  • the timer configuration unit is configured for configuring the adjusted second-type timer as the timer of the physical machine.
  • the apparatus 600 may further comprise: a fifth determination unit and a second time adjustment unit (not shown in the figure).
  • the fifth determination unit may be configured for determining a time difference between the first time and the third time which are before the virtual machine starts.
  • the second time adjustment unit is configured for adjusting the fourth time and the fourth deadline according to the time difference.
  • the apparatus 600 may further comprise: a third time adjustment unit (not shown in the figure).
  • the third time adjustment unit may be configured for, in a case where the timer used by the physical machine before the virtual machine starts is a third-type timer, no adjustment is performed on a current time and a deadline of the third-type timer of the physical machine.
  • the apparatus 600 may further comprise: a replacement unit (not shown in the figure).
  • the replacement unit may be configured for: replacing the adjusted second-type timer used by the physical machine with the first-type timer in response to a detection that the virtual machine exits and the timer used by the physical machine before the virtual machine starts is the first-type timer.
  • the apparatus 600 may further comprise: a first termination unit (not shown in the figure).
  • the first termination unit may be configured for: triggering a first time interrupt to terminate the adjusted second-type timer in response to a detection that the time of the adjusted second-type timer in the physical machine reaches the fourth deadline.
  • the apparatus 600 may further comprise: a second termination unit (not shown in the figure).
  • the second termination unit may be configured for: triggering a second time interrupt to terminate the adjusted first-type timer in response to a detection that a time of the adjusted first-type timer in the virtual machine reaches the second deadline.
  • the apparatus 600 may further comprise: an addition unit (not shown in the figure).
  • the addition unit may be configured for: adding the time of the first-type timer in the physical machine with the time difference to obtain an adjusted time as the time of the first-type timer.
  • the apparatus 600 may further comprise: an instruction unit (not shown in the figure).
  • the instruction unit may be configured for: instructing the virtual machine to access relevant register(s) of the adjusted first-type timer.
  • the units of the apparatus 600 correspond to the various steps in the method described with reference to FIG. 2 . Therefore, the operations, features, and beneficial effects described above for the method are also applicable to the apparatus 600 and the units comprised the apparatus 600 , which will not be repeated herein.
  • FIG. 7 a structural diagram of an electronic device (e.g., a terminal device shown in FIG. 1 ) 700 suitable for implementing some embodiments of the present disclosure is shown.
  • the electronic device shown in FIG. 7 is merely an example and should not impose any limitation on the function and scope of the embodiments of the present disclosure.
  • the electronic device 700 may comprise a processing device (e.g., a central processing unit, a graphics processor) 701 , which may perform various appropriate actions and processes according to a program stored in Read Only Memory (ROM) 702 or a program loaded from storage device 708 into Random Access Memory (RAM) 703 .
  • ROM Read Only Memory
  • RAM Random Access Memory
  • processing device 701 , ROM 702 and RAM 703 are connected to each other through bus 704 .
  • An input/output (I/O) interface 705 is also connected to the bus 704 .
  • I/O interface 705 input devices 706 comprising, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc; output devices 707 comprising a liquid crystal display (LCD), a speaker, a vibrator, etc.; a memory device 708 such as a magnetic tape, a hard disk, etc; and a communication device 709 .
  • the communication device 709 enables the electronic device 700 to communicate wirelessly or wirelessly with other devices to exchange data.
  • FIG. 7 shows the electronic device 700 with various components, it should be understood that it is not required to implement or have all of these components. Alternatively, more or fewer components can be implemented or provided. Each block shown in FIG. 7 may represent one device, or may represent multiple devices as required.
  • the processes described above with reference to the flowcharts may be implemented as computer software programs.
  • some embodiments of the present disclosure comprise a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the method illustrated in the flowcharts.
  • the computer program may be downloaded and installed from the network through the communication device 709 , or installed from the storage device 708 , or from the ROM 702 .
  • the processing device 701 the above functions defined in the method of some embodiments of the present disclosure are performed.
  • the computer-readable medium described in some embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof.
  • the computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer readable storage medium may comprise, but are not limited to: electrical connection with one or more wires, portable computer disk, hard disk, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash), fiber optics, portable compact disk Read only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing.
  • a computer readable storage medium can be any tangible medium that can contain or store a program, which can be used by or in connection with an instruction execution system, apparatus or device.
  • a computer readable signal medium may comprise a data signal that is propagated in the baseband or as part of a carrier, carrying computer readable program code. Such propagated data signals can take a variety of forms comprising, but not limited to, electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • the computer readable signal medium can also be any computer readable medium other than a computer readable storage medium, which can transmit, propagate, or transport a program for use by or in connection with the instruction execution system, apparatus, or device.
  • Program code embodied on a computer readable medium can be transmitted by any suitable medium, comprising but not limited to wire, fiber optic cable, radio frequency (RF), etc., or any suitable combination of the foregoing.
  • a client and a server can communicate using any currently known or future developed network protocol such as HyperText Transfer Protocol (HTTP), and can be interconnected by any form or medium of digital data communication, e.g., a communication network.
  • HTTP HyperText Transfer Protocol
  • Examples of communication networks comprise a local area network (“LAN”) and a wide area network (“WAN”), the Internet, and end-to-end networks (for example, ad hoc end-to-end networks), as well as any currently known or future developed networks.
  • the above computer-readable medium may be comprised in the electronic device described above; or it may exist alone without being assembled into the electronic device.
  • the computer-readable medium carries one or more programs that cause, when executed by the electronic device, the electronic device to perform operations of: determining a type of a timer used by a physical machine before a virtual machine starts, wherein the virtual machine runs on the physical machine; determining a first time and a first deadline of the virtual machine which are before the virtual machine starts; in a case where the timer used by the physical machine is a first-type timer, adjusting a time of the first-type timer to a second time corresponding to the first time and adjusting a deadline of the first-type timer to a second deadline corresponding to the first deadline to obtain an adjusted first-type timer; and configuring the adjusted first-type timer as a timer of the virtual machine.
  • the computer program code for executing operations of some embodiments of the present disclose may be complied by any combination of one or more program design languages, the program design languages comprising object-oriented program design languages, such as Java, Smalltalk, C++, etc, as well as conventional procedural program design languages, such as “C” program design language or similar program design language.
  • a program code may be completely or partly executed on a user computer, or executed as an independent software package, partly executed on the user computer and partly executed on a remote computer, or completely executed on a remote computer or server.
  • the remote computer may be connected to the user computer through various kinds of networks, comprising local area network (LAN) or wide area network (WAN), or connected to external computer (for example, through an Internet connection provided by an Internet service provider).
  • LAN local area network
  • WAN wide area network
  • Internet service provider for example, AT&T, MCI, Sprint, EarthLink, etc.
  • each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified function or functions.
  • the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved.
  • Units described in some embodiments of the present disclosure may be implemented in software or in hardware.
  • the described units can also be provided in a processor, which for example can be described as: a processor comprising a first determination unit, a second determination unit, an adjustment unit, and a configuration unit.
  • a processor comprising a first determination unit, a second determination unit, an adjustment unit, and a configuration unit.
  • the name of a unit does not constitute a limitation of the unit itself under certain circumstances, for example, the first determination unit may also be described as “a unit for determining a type of timer used by a physical machine before a virtual machine starts”.
  • exemplary types of hardware logic components comprise: Field Programmable Gate Array (FPGA), Application Specific Integrated Circuit (ASIC), Application Specific Standard Product (ASSP), System on Chip (SOC), Complex Programmable Logic Device (CPLD), etc.
  • FPGA Field Programmable Gate Array
  • ASIC Application Specific Integrated Circuit
  • ASSP Application Specific Standard Product
  • SOC System on Chip
  • CPLD Complex Programmable Logic Device
  • a timer processing method comprising: determining a type of a timer used by a physical machine before a virtual machine starts, wherein the virtual machine runs on the physical machine; determining a first time and a first deadline of the virtual machine which are before the virtual machine starts; in a case where the timer used by the physical machine is a first-type timer, adjusting a time of the first-type timer to a second time corresponding to the first time and adjusting a deadline of the first-type timer to a second deadline corresponding to the first deadline to obtain an adjusted first-type timer; and configuring the adjusted first-type timer as a timer of the virtual machine.
  • the method further comprises: in a case where the timer used by the physical machine is the first-type timer, determining a third time and a third deadline of the first-type timer which are before the virtual machine starts; adjusting a time of a second-type timer to a fourth time corresponding to the third time and adjusting a deadline of the second-type timer to a fourth deadline corresponding to the third deadline to obtain an adjusted second-type timer; and configuring the adjusted second-type timer as the timer of the physical machine.
  • the method further comprises: determining a time difference between the first time and the third time which are before the virtual machine starts; and adjusting the fourth time and the fourth deadline according to the time difference.
  • the method further comprises: in a case where the timer used by the physical machine before the virtual machine starts is a third-type timer, no adjustment is performed on a current time and a deadline of the third-type timer of the physical machine.
  • the method further comprises: replacing the adjusted second-type timer used by the physical machine with the first-type timer in response to a detection that the virtual machine exits and the timer used by the physical machine before the virtual machine starts is the first-type timer.
  • the method further comprises: triggering a first time interrupt to terminate the adjusted second-type timer in response to a detection that the time of the adjusted second-type timer in the physical machine reaches the fourth deadline.
  • the method further comprises: triggering a second time interrupt to terminate the adjusted first-type timer in response to a detection that a time of the adjusted first-type timer in the virtual machine reaches the second deadline.
  • the method further comprises: adding the time of the first-type timer in the physical machine with the time difference to obtain an adjusted time as the time of the first-type timer.
  • configuring a timer for the virtual machine using the adjusted first-type timer comprises: instructing the virtual machine to access relevant register(s) of the adjusted first-type timer.
  • a timer processing apparatus comprising: a first determination unit configured for determining a type of a timer used by a physical machine before a virtual machine starts, wherein the virtual machine runs on the physical machine; a second determination unit configured for determining a first time and a first deadline of the virtual machine which are before the virtual machine starts; an adjustment unit configured for, in a case where the timer used by the physical machine is a first-type timer, adjusting a time of the first-type timer to a second time corresponding to the first time and adjusting a deadline of the first-type timer to a second deadline corresponding to the first deadline to obtain an adjusted first-type timer; a configuration unit configured for configuring the adjusted first-type timer as a timer of the virtual machine.
  • the apparatus may further comprise: a fourth determination unit, a first time adjustment unit, and a timer configuration unit (not shown in the figure).
  • the fourth determination unit may be configured for, in a case where the timer used by the physical machine is the first-type timer, determining a third time and a third deadline of the first-type timer which are before the virtual machine starts.
  • the first time adjustment unit may be configured for adjusting a time of a second-type timer to a fourth time corresponding to the third time and adjusting a deadline of the second-type timer to a fourth deadline corresponding to the third deadline to obtain an adjusted second-type timer.
  • the timer configuration unit is configured for configuring the adjusted second-type timer as the timer of the physical machine.
  • the apparatus may further comprise: a fifth determination unit and a second time adjustment unit (not shown in the figure).
  • the fifth determination unit may be configured for determining a time difference between the first time and the third time which are before the virtual machine starts.
  • the second time adjustment unit is configured for adjusting the fourth time and the fourth deadline according to the time difference.
  • the apparatus may further comprise: a third time adjustment unit (not shown in the figure).
  • the third time adjustment unit may be configured for, in a case where the timer used by the physical machine before the virtual machine starts is a third-type timer, no adjustment is performed on a current time and a deadline of the third-type timer of the physical machine.
  • the apparatus may further comprise: a replacement unit (not shown in the figure).
  • the replacement unit may be configured for: replacing the adjusted second-type timer used by the physical machine with the first-type timer in response to a detection that the virtual machine exits and the timer used by the physical machine before the virtual machine starts is the first-type timer.
  • the apparatus may further comprise: a first termination unit (not shown in the figure).
  • the first termination unit may be configured for: triggering a first time interrupt to terminate the adjusted second-type timer in response to a detection that the time of the adjusted second-type timer in the physical machine reaches the fourth deadline.
  • the apparatus may further comprise: a second termination unit (not shown in the figure).
  • the second termination unit may be configured for: triggering a second time interrupt to terminate the adjusted first-type timer in response to a detection that a time of the adjusted first-type timer in the virtual machine reaches the second deadline.
  • the apparatus may further comprise: an addition unit (not shown in the figure).
  • the addition unit may be configured for: adding the time of the first-type timer in the physical machine with the time difference to obtain an adjusted time as the time of the first-type timer.
  • the apparatus may further comprise: an instruction unit (not shown in the figure).
  • the instruction unit may be configured for: instructing the virtual machine to access relevant register(s) of the adjusted first-type timer.
  • an electronic device comprising: one or more processors; a memory device having stored thereon one or more programs that, when executed by the one or more processors, cause the one or more processors to implement the method described in any of the above embodiments.
  • a non-transitory computer-readable medium having stored thereon a computer program that, when executed by a processor, implements the method described in any of the above embodiments.
US18/261,473 2021-02-25 2022-02-21 Timer processing method, apparatus, electronic device, and computer-readable storage medium Pending US20240069953A1 (en)

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
CN202110210738.0A CN112817701B (zh) 2021-02-25 2021-02-25 定时器处理方法、装置、电子设备和计算机可读介质
CN202110210738.0 2021-02-25
PCT/CN2022/077037 WO2022179470A1 (zh) 2021-02-25 2022-02-21 定时器处理方法、装置、电子设备和计算机可读存储介质

Publications (1)

Publication Number Publication Date
US20240069953A1 true US20240069953A1 (en) 2024-02-29

Family

ID=75865585

Family Applications (1)

Application Number Title Priority Date Filing Date
US18/261,473 Pending US20240069953A1 (en) 2021-02-25 2022-02-21 Timer processing method, apparatus, electronic device, and computer-readable storage medium

Country Status (3)

Country Link
US (1) US20240069953A1 (zh)
CN (1) CN112817701B (zh)
WO (1) WO2022179470A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112817701B (zh) * 2021-02-25 2024-03-12 北京火山引擎科技有限公司 定时器处理方法、装置、电子设备和计算机可读介质

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8327357B2 (en) * 2009-08-31 2012-12-04 Red Hat, Inc. Mechanism for virtual time stamp counter acceleration
US8468524B2 (en) * 2010-10-13 2013-06-18 Lsi Corporation Inter-virtual machine time profiling of I/O transactions
CN106406974B (zh) * 2015-07-30 2020-07-17 中兴通讯股份有限公司 一种用于虚拟机的高性能定时器实现方法、虚拟机
US10203977B2 (en) * 2015-11-25 2019-02-12 Red Hat Israel, Ltd. Lazy timer programming for virtual machines
CN108196934B (zh) * 2016-12-08 2022-04-26 阿里巴巴集团控股有限公司 一种定时器的定时设置方法、装置和虚拟化设备
CN108241522B (zh) * 2016-12-27 2022-05-17 阿里巴巴集团控股有限公司 虚拟化环境中的睡眠状态切换方法、装置及电子设备
CN108512780B (zh) * 2017-02-28 2020-12-15 华为技术有限公司 定时器实现方法及相关装置
CN110333843B (zh) * 2019-04-19 2023-03-24 中科创达(重庆)汽车科技有限公司 虚拟机高精度定时器的实现方法、装置及电子设备
CN112817701B (zh) * 2021-02-25 2024-03-12 北京火山引擎科技有限公司 定时器处理方法、装置、电子设备和计算机可读介质

Also Published As

Publication number Publication date
CN112817701B (zh) 2024-03-12
CN112817701A (zh) 2021-05-18
WO2022179470A1 (zh) 2022-09-01

Similar Documents

Publication Publication Date Title
CN111090536B (zh) 一种获取内存泄露信息的方法、装置、介质和电子设备
JP7339425B2 (ja) スマートコントラクトを実行するための方法及び装置
EP3934132B1 (en) Clock queue with arming and/or self-arming features
EP3422210A1 (en) Method, device, and system for processing data in webpage
CN111338623B (zh) 一种开发用户界面的方法、装置、介质和电子设备
CN112416632B (zh) 事件通信方法、装置、电子设备和计算机可读介质
US20240069953A1 (en) Timer processing method, apparatus, electronic device, and computer-readable storage medium
US9513660B2 (en) Calibrated timeout interval on a configuration value, shared timer value, and shared calibration factor
CN110928715A (zh) 一种提示错误描述信息的方法、装置、介质和电子设备
US20210160202A1 (en) Managing and executing serverless function command sets in a messaging service
CN112954056A (zh) 监控数据处理方法、装置、电子设备及存储介质
US11962929B2 (en) Method, apparatus, and device for configuring video special effect, and storage medium
CN116302271A (zh) 一种页面展示方法、装置及电子设备
EP4224384A1 (en) Method and apparatus for determining reservation information
CN112882921B (zh) 故障模拟方法和装置
CN109491830A (zh) 切换数据源的方法及系统
CN112148417A (zh) 页面调整方法、装置、电子设备和计算机可读介质
CN110750424A (zh) 资源巡检方法和装置
CN111240801A (zh) 生成堆内存快照文件的方法、装置、介质和电子设备
US11809880B2 (en) Dynamically verifying ingress configuration changes
EP3872630A2 (en) Request processing method and apparatus, electronic device, and computer storage medium
WO2023226787A1 (zh) 通信方法、系统、装置和电子设备
CN115859355B (zh) 日志脱敏方法、装置、电子设备和计算机可读介质
CN113761548B (zh) 用于Shuffle过程的数据传输方法和装置
CN111324888B (zh) 应用程序启动时的验证方法、装置、电子设备及存储介质

Legal Events

Date Code Title Description
STPP Information on status: patent application and granting procedure in general

Free format text: DOCKETED NEW CASE - READY FOR EXAMINATION