A device access method and device based on KVM thread
Through the device access method based on KVM threads, the problem of difficult environmental isolation and resource isolation in cloud computing is solved, lightweight high-performance computing is realized, secure isolation and flexible resource configuration are provided, and it is suitable for a variety of cloud computing applications.
Patent Information
- Application Number
- CN202411782569.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-04-04
AI Technical Summary
In existing cloud computing technologies, environmental isolation and resource isolation are difficult to achieve, resulting in low system security, complex programming models, limited performance, and unable to meet the needs of high-performance, low-latency and low-cost computing platforms.
Using a device access method based on KVM threads, the client terminal's processing request is received through the KVM scheduling system, stored in shared memory, and started the KVM virtual machine to execute the pre-stored ELF static executable file to realize device access.
It realizes lightweight high-performance computing, provides secure isolation and flexible resource configuration, and can quickly start and no additional consumption. It is suitable for cloud computing fields such as function computing and dedicated computing.
Smart Images

Figure CN119759489A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing technology, and in particular to a device access method and apparatus based on a KVM thread. Background Art
[0002] The most important limitations in cloud computing are environment isolation and resource isolation to ensure system security, customer privacy, and system elasticity. Most current implementation methods are based on processes, such as containers, QEMU / kvm virtual machines, or lightweight virtual machines such as Lua, WebAssembly, etc. These methods are either performance-limited, or have complex programming models, or are not very secure. In recent years, with the rise of different computing forms such as serverless computing, function computing, edge computing, and privacy computing, the requirements for isolated, secure, low-latency, high-performance, and low-cost computing platforms have become increasingly high. Summary of the invention
[0003] The present application shows a device access method and apparatus based on KVM threads.
[0004] In a first aspect, the present application shows a device access method based on a KVM thread, the method comprising:
[0005] Receive processing requests sent by client terminals through the KVM scheduling system;
[0006] The processing request is stored in a shared memory, and a KVM virtual machine is started to enable the KVM virtual machine to execute a pre-stored ELF static executable file;
[0007] After the KVM virtual machine completes executing the ELF static executable file, obtaining the execution result from the shared memory through the KVM scheduling system;
[0008] The execution result is sent to the client terminal.
[0009] In some embodiments of the present application, the method further includes:
[0010] Receive the initial code file input by the user;
[0011] The initial code file is compiled using a code compilation tool chain to obtain a code file in a binary format, wherein the code file in the binary format is an ELF static executable file;
[0012] The ELF static executable file is loaded through the KVM scheduling system, and the ELF static executable file is stored in a shared memory and expanded into a directly executable memory layout.
[0013] In some embodiments of the present application, the ELF static executable file is a freestanding or bare-metal executable file.
[0014] In some embodiments of the present application, the method further includes:
[0015] During the process of the KVM virtual machine executing the pre-stored ELF static executable file, device access is performed through input and output instructions.
[0016] In a second aspect, the present application shows a device access apparatus based on a KVM thread, the apparatus comprising:
[0017] A receiving module, used for receiving a processing request sent by a client terminal through a KVM scheduling system;
[0018] A startup module, used for storing the processing request in a shared memory, and starting a KVM virtual machine so that the KVM virtual machine executes a pre-stored ELF static executable file;
[0019] An execution module, configured to obtain an execution result from the shared memory through the KVM scheduling system after the KVM virtual machine executes the ELF static executable file;
[0020] The sending module is used to send the execution result to the client terminal.
[0021] In some embodiments of the present application, the receiving module is used to:
[0022] Receive the initial code file input by the user;
[0023] The initial code file is compiled using a code compilation tool chain to obtain a code file in a binary format, wherein the code file in the binary format is an ELF static executable file;
[0024] The ELF static executable file is loaded through the KVM scheduling system, and the ELF static executable file is stored in a shared memory and expanded into a directly executable memory layout.
[0025] In some embodiments of the present application, the ELF static executable file is a freestanding or bare-metal executable file.
[0026] In some embodiments of the present application, the execution module is used to:
[0027] During the process of the KVM virtual machine executing the pre-stored ELF static executable file, device access is performed through input and output instructions.
[0028] In a third aspect, the present application shows an electronic device, which includes: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the method described in any of the above aspects.
[0029] In a fourth aspect, the present application illustrates a non-temporary computer-readable storage medium, which, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute a method as described in any of the above aspects.
[0030] In a fifth aspect, the present application illustrates a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device is enabled to execute the method described in any of the above aspects.
[0031] The technical solution provided by the present application may include the following beneficial effects: an embodiment of the present application provides a device access method and apparatus based on KVM threads, including: receiving a processing request sent by a client terminal through a KVM scheduling system; storing the processing request in a shared memory, and starting a KVM virtual machine so that the KVM virtual machine executes a pre-stored ELF static executable file; after the KVM virtual machine executes the ELF static executable file, obtaining the execution result from the shared memory through the KVM scheduling system; sending the execution result to the client terminal. This method of implementing lightweight high-performance computing based on KVM thread isolation realizes secure isolation, flexible resource configuration, fast startup, and a computing platform with no additional consumption, and can be widely used in cloud computing fields such as function computing and special computing. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 This is a step flow chart of a KVM thread-based device access method of the present application.
[0033] Figure 2 It is a structural diagram of a KVM thread-based device access system of the present application.
[0034] Figure 3 This is a structural block diagram of a KVM thread-based device access device of the present application.
[0035] Figure 4 It is a block diagram of an electronic device of the present application.
[0036] Figure 5 It is a block diagram of a computer-readable storage medium of the present application. DETAILED DESCRIPTION
[0037] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0038] Glossary:
[0039] KVM: Kernel-based Virtual Machine, an open source system virtualization module, is a mature technology for virtual machines and a basic technology for cloud computing.
[0040] ELF: Executable and Linking Format, static executable file, executable and linkable format.
[0041] Freestanding: refers to the fact that the program does not need to rely on other systems or services such as standard libraries during compilation and runtime.
[0042] The overall architecture of this application: KVM API is an API based on CPU hardware functions, which is exposed to user space by the operating system kernel. KVM API can be used to quickly and efficiently create lightweight, high-performance virtual machines. It can start quickly, and automatically end after executing the code. It consumes little CPU and memory, and can completely control CPU and memory consumption based on the executed code. For example, the code to be executed is only 10K after being compiled into an executable file, and the dynamic memory requirement does not exceed 10K. You can create a KVM virtual machine that uses 20K of memory. This is impossible to achieve by other means. Refer to Figure 1 , shows a step flow chart of a device access method based on KVM thread of the present application, the method can be applied to electronic devices, wherein the method specifically may include the following steps:
[0043] S101, receiving a processing request sent by a client terminal through a KVM scheduling system;
[0044] Receive the initial code file input by the user;
[0045] The initial code file is compiled using a code compilation tool chain to obtain a code file in a binary format, wherein the code file in the binary format is an ELF static executable file;
[0046] The ELF static executable file is loaded through the KVM scheduling system, and the ELF static executable file is stored in a shared memory and expanded into a directly executable memory layout.
[0047] The ELF static executable file is a freestanding or bare-metal executable file.
[0048] Bare-metal: In the computer field, it refers to a computer that executes instructions directly on logical hardware without an operating system. This type of computer is often called "bare metal" or "bare machine". The English name is BareMetal or Bare Machine.
[0049] The present application embodiment includes two aspects of ecology:
[0050] 1) Runtime system, including host machine, KVM scheduling system, and KVM virtual machine system;
[0051] 2) Compilation system, including compilation tool chain and common code base in virtual machine system. KVM scheduling system receives processing request from user, writes the request into shared memory, and starts KVM virtual machine. After executing the code, KVM virtual machine exits. During execution, device access, network and other functions can be realized through host machine through In / Out instructions. Scheduling system reads the result after KVM virtual machine execution from shared memory and returns it to user.
[0052] S102, storing the processing request in the shared memory, and starting the KVM virtual machine so that the KVM virtual machine executes the pre-stored ELF static executable file;
[0053] During the process of the KVM virtual machine executing the pre-stored ELF static executable file, device access is performed through input and output instructions.
[0054] S103, after the KVM virtual machine finishes executing the ELF static executable file, obtaining the execution result from the shared memory through the KVM scheduling system;
[0055] S104: Send the execution result to the client terminal.
[0056] The present invention provides a device access method based on KVM threads, in particular, a method for realizing lightweight high-performance computing based on KVM thread isolation, which can realize secure isolation, flexible resource configuration, rapid startup, and a computing platform with no additional consumption, and can be widely used in cloud computing fields such as function computing and special computing.
[0057] The embodiment of the present application provides a device access method based on KVM threads, including: receiving a processing request sent by a client terminal through a KVM scheduling system; storing the processing request in a shared memory, and starting a KVM virtual machine so that the KVM virtual machine executes a pre-stored ELF static executable file; after the KVM virtual machine executes the ELF static executable file, obtaining the execution result from the shared memory through the KVM scheduling system; and sending the execution result to the client terminal. This method for implementing lightweight high-performance computing based on KVM thread isolation realizes secure isolation, flexible resource configuration, fast startup, and a computing platform with no additional consumption, and can be widely used in cloud computing fields such as function computing and dedicated computing.
[0058] Another embodiment of the present application further supplements the KVM thread-based device access method provided in the above embodiment.
[0059] In some embodiments of the present application, the above method may further include the following steps:
[0060] (1) Receive the initial code file input by the user;
[0061] (2) using a code compilation tool chain to compile the initial code file to obtain a binary code file, where the binary code file is an ELF static executable file;
[0062] (3) Load the ELF static executable file through the KVM scheduling system, store the ELF static executable file in the shared memory, and expand it into a memory layout that can be directly executed.
[0063] In some embodiments of the present application, the ELF static executable file is a freestanding or bare-metal executable file.
[0064] In some embodiments of the present application, the method further includes: performing device access through input and output instructions during the process of the KVM virtual machine executing a pre-stored ELF static executable file.
[0065] KVM API is an API based on CPU hardware functions, which is exposed to user space by the operating system kernel. KVM API can be used to quickly and efficiently create lightweight, high-performance virtual machines. It can start quickly, and automatically end after executing the code. It consumes little CPU and memory, and can completely control CPU and memory consumption based on the executed code. For example, the code to be executed is only 10K after being compiled into an executable file, and the dynamic memory requirement does not exceed 10K. You can create a KVM virtual machine using 20K memory. This is impossible to achieve in other ways.
[0066] A typical system such as Figure 2As shown, the system at least includes:
[0067] 1) Runtime system, including host machine, KVM scheduling system, and KVM virtual machine system;
[0068] 2) Compilation system, including compilation tool chain and common code library in the virtual machine system.
[0069] Basic process:
[0070] 1. The user's code is compiled into a specific binary format by the compilation tool chain, generally an ELF static executable file, supporting both x86 and ARM architectures, and supporting 16-bit, 32-bit or 64-bit modes. The ELF file is a freestanding or bare-metal executable file.
[0071] 2. The KVM scheduling system loads the ELF file into shared memory and expands it into a directly executable memory layout, setting up CPU registers, page tables, etc.
[0072] 3. The KVM scheduling system receives the processing request from the user, writes the request into the shared memory, and starts the KVM virtual machine.
[0073] 4. After the KVM virtual machine executes the code, it exits. During execution, the In / Out command can be used to implement device access, network and other functions through the host machine.
[0074] 5. The KVM scheduling system reads the results of the KVM virtual machine execution from the shared memory and returns them to the user.
[0075] Although KVM is a basic technology for cloud computing, its use is often limited to creating a "traditional" virtual machine, without taking advantage of its lightweight and high-performance features. In order to solve the lightweight and high-performance isolation problem, the industry has developed a variety of technologies such as containers; a variety of virtual machines, such as Lua, WebAssembly, ebpf, etc. These virtual machines introduce new virtual instruction sets, but ignore the more mature and native KVM virtual machines. Moreover, the industry often uses KVM virtual machines to run a complete operating system again, which brings a lot of CPU and memory overhead, ignoring that the CPU itself can directly execute user instructions, and the user's code can be compiled into binary code that can run on the bare CPU.
[0076] Compared with the prior art, the main advantages of this application are:
[0077] 1. Compared with the lightweight virtual machines in the prior art such as Microsvm and Firecraker, the present invention eliminates the dependence on the kernel, saves CPU and memory overhead, can achieve a startup speed of less than 5 milliseconds, and the memory consumption is only related to the user's binary code, without additional overhead; on a modern typical server, more virtual machines can be created to support higher concurrency.
[0078] 2. Compared with container-based solutions, such as Alibaba's runD architecture, the isolation security of the present invention is stronger, more flexible, has less additional overhead, and has a higher startup speed and virtual machine density (resource utilization).
[0079] 3. Compared with solutions based on virtual machines such as WebAssembly, the present invention does not introduce new instruction sets and additional virtualization overhead, and is directly based on the CPU native virtualization function.
[0080] The embodiments of this application fully exploit existing mature technologies and build a lighter, safer, and higher-performance computing system. The scheduling system of the KVM virtual machine is fully utilized, and higher performance can be achieved by caching binary code and the initial state of the KVM virtual machine, which is comparable to the native system. After testing a simple web application, under the same environment, the concurrency based on KVM thread isolation is close to the native system, which is 5-10 times faster than the solution based on WebAssembly.
[0081] The purpose of the present invention is to provide a method for realizing lightweight high-performance computing based on KVM thread isolation, realizing secure isolation, flexible resource configuration, fast startup, and a computing platform with no additional consumption, which can be widely used in cloud computing fields such as function computing and special computing.
[0082] Applications in the field of function computing are as follows:
[0083] (1) The platform provides developers with a complete development environment through websites, command line tools, IDE plug-ins, etc., including compilation tool chains, basic function libraries, documentation, testing environments, CI / CD deployment environments, etc.
[0084] (2) Developers complete function coding, local testing, online debugging, configure trigger rules, and publish to the platform.
[0085] (3) The platform compiles the user-submitted code into machine code that can run on the KVM bare vCPU, usually packaged as an ELF file.
[0086] (4) The platform monitors the trigger rules set by the developer and forwards the request to the KVM scheduling system when the rules are met.
[0087] (5) The KVM scheduling system loads the corresponding bytecode into shared memory according to the request, sets the initial state of the KVM vCPU, loads the request information into shared memory, and executes the bytecode. The initial state of the virtual machine is cached in the scheduling system, so the next trigger can avoid startup overhead, further improving performance.
[0088] (6) The bytecode runs inside the virtual machine and communicates with the host machine through Hypercall methods such as shared memory and In / Out instructions.
[0089] (7) After the bytecode finishes running, the KVM scheduling system reads the function output from the shared memory and returns it.
[0090] The embodiment of the present application proposes a novel method for realizing lightweight high-performance computing based on KVM thread isolation; the code to be executed is compiled into bytecode that can be executed on the bare vCPU, eliminating the CPU booting, kernel loading and other processes; the initial state of the KVM virtual machine is saved in the cache, avoiding repeated KVM API calls, memory settings, initial state settings, etc., further improving performance; the KVM scheduling system can manage the KVM virtual machine according to the system situation, such as CPU duration limit, hypercall call number limit, etc.
[0091] It should be noted that each implementable method in this embodiment may be implemented separately, or may be implemented in combination in any combination without conflict, and this application is not limited thereto.
[0092] The embodiment of the present application provides a device access method based on KVM threads, including: receiving a processing request sent by a client terminal through a KVM scheduling system; storing the processing request in a shared memory, and starting a KVM virtual machine so that the KVM virtual machine executes a pre-stored ELF static executable file; after the KVM virtual machine executes the ELF static executable file, obtaining the execution result from the shared memory through the KVM scheduling system; and sending the execution result to the client terminal. This method for implementing lightweight high-performance computing based on KVM thread isolation realizes secure isolation, flexible resource configuration, fast startup, and a computing platform with no additional consumption, and can be widely used in cloud computing fields such as function computing and dedicated computing.
[0093] Another embodiment of the present application provides a KVM thread-based device access apparatus, which is used to execute the KVM thread-based device access method provided in the above embodiment.
[0094] like Figure 3 , which is a schematic diagram of the structure of a KVM thread-based device access apparatus provided in an embodiment of the present application. The KVM thread-based device access apparatus comprises a receiving module 301, a starting module 302, an execution module 303 and a sending module 304, wherein:
[0095] The receiving module 301 is used to receive a processing request sent by a client terminal through the KVM scheduling system;
[0096] The startup module 302 is used to store the processing request in the shared memory and start the KVM virtual machine so that the KVM virtual machine executes the pre-stored ELF static executable file;
[0097] The execution module 303 is used to obtain the execution result from the shared memory through the KVM scheduling system after the KVM virtual machine executes the ELF static executable file;
[0098] The sending module 304 is used to send the execution result to the client terminal.
[0099] Regarding the device in this embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0100] An embodiment of the present application provides a device access apparatus based on KVM threads, comprising: receiving a processing request sent by a client terminal through a KVM scheduling system; storing the processing request in a shared memory, and starting a KVM virtual machine, so that the KVM virtual machine executes a pre-stored ELF static executable file; after the KVM virtual machine executes the ELF static executable file, obtaining the execution result from the shared memory through the KVM scheduling system; and sending the execution result to the client terminal. This method of implementing lightweight high-performance computing based on KVM thread isolation realizes secure isolation, flexible resource configuration, fast startup, and a computing platform with no additional consumption, and can be widely used in cloud computing fields such as function computing and dedicated computing.
[0101] Another embodiment of the present application further supplements the KVM thread-based device access apparatus provided in the above embodiment.
[0102] In some embodiments of the present application, the receiving module is used to:
[0103] Receive the initial code file input by the user;
[0104] The initial code file is compiled using a code compilation tool chain to obtain a code file in a binary format, and the code file in the binary format is an ELF static executable file;
[0105] The ELF static executable file is loaded through the KVM scheduling system, stored in the shared memory, and expanded into a directly executable memory layout.
[0106] In some embodiments of the present application, the ELF static executable file is a freestanding or bare-metal executable file.
[0107] In some embodiments of the present application, the execution module is used to:
[0108] When the KVM virtual machine executes the pre-stored ELF static executable file, the device is accessed through input and output instructions.
[0109] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0110] Optionally, an embodiment of the present application further provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0111] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0112] Figure 4 800 is a block diagram of an electronic device 800 shown in the present application. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0113] Reference Figure 4 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .
[0114] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.
[0115] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, images, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0116] The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.
[0117] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0118] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.
[0119] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.
[0120] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0121] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast operation information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0122] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0123] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by a processor 820 of an electronic device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0124] Figure 5 19 is a block diagram of a computer-readable storage medium 1900 shown in the present application. For example, the computer-readable storage medium 1900 may be provided as a server.
[0125] Reference Figure 5 , the computer-readable storage medium 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions, such as an application, that can be executed by the processing component 1922. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.
[0126] The computer readable storage medium 1900 may also include a power supply component 1926 configured to perform power management of the computer readable storage medium 1900, a wired or wireless network interface 1950 configured to connect the computer readable storage medium 1900 to a network, and an input / output (I / O) interface 1958. The computer readable storage medium 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™ or the like.
[0127] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0128] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0129] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
[0130] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the present application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0131] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0132] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0133] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0134] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0135] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks, or optical disks.
[0136] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A device access method based on KVM thread, characterized in that: The method comprises: Receive processing requests sent by client terminals through the KVM scheduling system; The processing request is stored in a shared memory, and a KVM virtual machine is started to enable the KVM virtual machine to execute a pre-stored ELF static executable file; After the KVM virtual machine completes executing the ELF static executable file, obtaining the execution result from the shared memory through the KVM scheduling system; The execution result is sent to the client terminal.
2. The device access method based on KVM thread according to claim 1, characterized in that: The method further comprises: Receive the initial code file input by the user; The initial code file is compiled using a code compilation tool chain to obtain a code file in a binary format, wherein the code file in the binary format is an ELF static executable file; The ELF static executable file is loaded through the KVM scheduling system, and the ELF static executable file is stored in a shared memory and expanded into a directly executable memory layout.
3. The device access method based on KVM thread according to claim 2, characterized in that: The ELF static executable file is a freestanding or bare-metal executable file.
4. The device access method based on KVM thread according to claim 1, characterized in that: The method further comprises: During the process of the KVM virtual machine executing the pre-stored ELF static executable file, device access is performed through input and output instructions.
5. A device access device based on KVM thread, characterized in that: The device comprises: A receiving module, used for receiving a processing request sent by a client terminal through a KVM scheduling system; A startup module, used for storing the processing request in a shared memory, and starting a KVM virtual machine so that the KVM virtual machine executes a pre-stored ELF static executable file; An execution module, configured to obtain an execution result from the shared memory through the KVM scheduling system after the KVM virtual machine executes the ELF static executable file; The sending module is used to send the execution result to the client terminal.
6. The device access apparatus based on KVM thread according to claim 5, characterized in that: The receiving module is used for: Receive the initial code file input by the user; The initial code file is compiled using a code compilation tool chain to obtain a code file in a binary format, wherein the code file in the binary format is an ELF static executable file; The ELF static executable file is loaded through the KVM scheduling system, and the ELF static executable file is stored in a shared memory and expanded into a directly executable memory layout.
7. The device access apparatus based on KVM thread according to claim 6, characterized in that: The ELF static executable file is a freestanding or bare-metal executable file.
8. The device access apparatus based on KVM thread according to claim 5, characterized in that: The execution module is used to: During the process of the KVM virtual machine executing the pre-stored ELF static executable file, device access is performed through input and output instructions.
9. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the method according to any one of claims 1 to 4 when executed by the processor.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.