CPU security sharing method for multiple virtual machines
Through full-core sharing and micro-kernel fine-grained permission management technology, CPU resource allocation is dynamically adjusted, solving the problems of differentiated security and resource allocation strategies in multi-VM environments, and improving the security and performance stability of the system.
Patent Information
- Application Number
- CN202411085812.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-08
- Publication Date
- 2024-11-26
AI Technical Summary
In multi-VM environments, it is difficult for the prior art to implement differentiated security and resource allocation strategies, making it difficult to ensure security and performance stability between different virtual machines or applications within the same virtual machine.
Adopting full-core sharing strategy, weight and capability-based scheduling mechanism, priority scheduling and micro-kernel fine-grained permission management technology, virtual machine environment is created through the Nebula system, dynamically adjust CPU resource allocation, and provide flexible configuration options to meet different virtualizations. performance requirements of the machine and ensure safety.
It realizes the maximum utilization rate of CPU resources, improves the system's real-time response capabilities and security, effectively prevents interference from malicious or defective programs, and meets the needs of different workloads and application scenarios.
Smart Images

Figure CN119025272A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of interface management, and in particular to a CPU security sharing method for multiple virtual machines. Background Art
[0002] In many systems, virtualization technology is used to abstract and transform the various physical resources of the computer (CPU, memory, disk space, network adapter, etc.) and present them to the user so that they can be divided and combined into one or more operating environments, breaking the indivisible barriers between physical structures and allowing users to use these computer hardware resources in a better way than the original configuration. The new virtual parts of these resources are not limited by the way the existing resources are set up, the region or the physical configuration.
[0003] For example, CN102457507B discloses a method for securely sharing cloud computing resources, the method comprising: a user sends a resource access request to a cloud computing service provider server, the resource access request carries relevant information of the resource to be accessed; the cloud computing service provider server obtains information of the service provider server to which the resource to be accessed belongs according to the relevant information of the resource to be accessed, and sends an authentication request to the service provider server to which the resource to be accessed belongs; the authentication request carries the user's identification information; the service provider server authenticates the user according to the user's identification information, and sends resource access control information to the user or the cloud computing service provider server after the authentication is passed; the cloud computing service provider server authenticates the resource access control information, and provides the resource to be accessed to the user after the authentication is passed, thereby improving the efficiency and security of shared resource access. In virtualization technology, based on security and performance considerations, it is very important to adopt different protection methods and resource matching for different applications or application groups, because any system does not want an application, whether it is a malicious program or a defective program, to destroy or prevent the operation of another program. Different virtual machines abstracted by virtualization technology have different requirements for security and performance, and even different applications in the same virtual machine or different applications in different virtual machines have different security and performance requirements.
[0004] Therefore, a CPU security sharing method for multiple virtual machines is proposed. Summary of the invention
[0005] The purpose of the present invention is to provide a CPU security sharing method for multiple virtual machines, aiming to solve the problem in the above-mentioned background technology that differentiated security and resource allocation strategies need to be implemented between different virtual machines or different applications in the same virtual machine to ensure the security and performance stability of each application.
[0006] To achieve the above object, the present invention provides the following technical solution: a CPU security sharing method for multiple virtual machines, comprising the following implementation steps:
[0007] S1: Full-core sharing: Create a full-core sharing virtual machine environment through the Nebula system, so that all virtual machines can use any physical CPU to maximize resource utilization;
[0008] S2: Scheduling based on weight and capability level: assign weight and capability cap to each control unit (thread object) created by the Nebula system. Thread object is referred to as thread OBJ.
[0009] S3: Dynamic + static resource sharing: Nebula system provides two CPU usage configuration methods, namely, setting the CPU usage cycle through dynamic instructions or static settings in configuration files, specifying the use rights of specific CPU cores and the time slice occupancy time;
[0010] S4: Priority-based scheduling: The status of the virtual CPU (VCPU) is divided into different priorities, and the Nebula scheduler automatically determines and adjusts the priority of the VCPU to give priority to scheduling high-priority tasks;
[0011] S5: Service VM + User VM Cooperative Control: Nebula system provides two types of VMs: one and only one server VM and one or more user VMs. The server VM and user VMs fully share the CPU cores.
[0012] S6: Microkernel fine-grained permission control: A microkernel-based fine-grained permission control mechanism to achieve secure time partitioning.
[0013] Furthermore, in S1, the VCPU resources used by the virtual machine indirectly use the physical CPU through the threadOBJ provided by the Nebula system, and the virtual machine connects to the thread OBJ through the thread of the VCPU.
[0014] Furthermore, in S2, the weight weight is the resource rate of a certain CPU that the thread OBJ is allowed to occupy, and the capacity cap is the fixed CPU usage frequency of each thread OBJ, and the upper limit is expressed as a percentage of the physical CPU.
[0015] Furthermore, in S3, the dynamic instruction must be issued through the VHM Service in the service virtual machine, and the weight and cap of the thread OBJ are dynamically adjusted in the hot machine state through the command line instructions in the server OS.
[0016] Furthermore, in S3, when the configuration file is statically set, the cap and weight of all VCPUs in each virtual machine are set before the system is started. After the system is started, since the threads of the VCPU correspond to the thread OBJ one by one, the weight and cap of each thread OBJ are indirectly set.
[0017] Furthermore, in S4, the status of the VCPU is graded into the highest priority, the second priority and the third priority, and the VCPU with a low priority is more likely to be preempted.
[0018] Furthermore, in S4, the Nebula system defines the priority of the task according to the number of credit points. For tasks with more credit points, they are defined as high priority and are called first.
[0019] Furthermore, in S5, the server virtual machine provides a CPU sharing configuration scheme, and its workflow is: VHMService->Nebula->thread OBJ; VHM Service obtains CPU sharing configuration information through an external configuration file or receives an external dynamic instruction, and completes static and dynamic sharing configuration.
[0020] Furthermore, in S6, the Nebula system controls the operating capabilities of upper-layer applications or virtual machines in a fine-grained manner and sets the capability level of specified applications through configuration files, thereby achieving different levels of secure access.
[0021] Furthermore, in S6, under the premise of achieving safety under the fine-grained management of the microkernel and the capability-level mechanism, the Nebula system dynamically generates multiple thread objects. The thread objects are based on the underlying CPU hardware shared by all cores, dynamically connect to each CPU core, and complete the CPU scheduling of urgent work under the action of the scheduler, providing the hardware foundation and software mechanism for hard real-time.
[0022] Compared with the prior art, the present invention has the following beneficial effects:
[0023] A CPU security sharing method for multiple virtual machines proposed in the present invention can not only maximize the utilization of CPU resources by integrating a full-core sharing strategy, a scheduling mechanism based on weight and capability level, priority scheduling, and microkernel fine-grained permission management technology, but also ensure that key tasks can be processed in a timely manner to meet the performance requirements of different virtual machines by dynamically adjusting resource allocation, thereby improving the real-time response capability of the system. At the same time, the microkernel fine-grained permission management is used to allocate capability levels to system objects and set application access rights, thereby significantly enhancing the security of the system, effectively preventing malicious or defective programs from interfering with other programs, and providing flexible configuration options, supporting dynamic and static CPU usage adjustment, and meeting the needs of different workloads and application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 It is a processing flow chart of the CPU security sharing method of the present invention. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0026] To solve the problem of implementing differentiated security and resource allocation strategies between different virtual machines or different applications in the same virtual machine to ensure the security and performance stability of each application, please refer to Figure 1 , provide the following preferred technical solutions:
[0027] Step 1: Propose a physical CPU resource management mechanism
[0028] 1. Full core sharing
[0029] Full core sharing means that any virtual machine created by the Nebula system can use any physical CPU. Full core sharing can maximize resource utilization. For different physical CPU numbers N and virtual machines n, the control units that can be created by the Nebula system are N*n thread objects. The VCPU resources used by the virtual machine indirectly use the physical CPU through the thread OBJ provided by the Nebula system. The virtual machine connects to the threadOBJ through the VCPU thread. Full core sharing means that each virtual machine can use all N physical CPUs, that is, one virtual machine corresponds to N threadOBJs. Therefore, the thread OBJs connected to the VCPU threads can be N completely different physical CPUs, or different thread OBJs in the same CPU.
[0030] 2. Scheduling method based on weight and capacity level
[0031] Nebula scheduler assigns a weight and a capacity (cap) to each thread OBJ. Weight refers to the resource rate that a thread OBJ can occupy on a certain CPU. For example, if thread OBJ_A with weight 3 and thread OBJ_B with weight 1 share a physical CPU, then VCPU thread_1 corresponding to thread OBJ_A and VCPU thread_2 corresponding to thread OBJ_B will get 1 / 4 and 3 / 4 of the CPU utilization respectively (for example, if the time slice is 25ms, then there are 40 time slices per second, VCPU thread_1 will get 30 time slices, while VCPU thread_2 will only get 10 time slices). Cap refers to the fixed time that each thread The CPU usage frequency of OBJ, the upper limit is expressed as a percentage of the physical CPU; for example: 100 is 1 times the physical CPU frequency, 50 is 0.5 times the CPU frequency, 400 is 4 times the CPU frequency, etc. The default value 0 means no upper limit. (For a host with only one physical CPU, when the cap of a virtual machine is set to 50, then even if there is no other task competing with it, the other half of the time slice will not be given to the thread OBJ with a cap of 50 to run even if it is idle)
[0032] 3. A dynamic + static CPU resource sharing update method
[0033] Nebula system provides two CPU usage configuration methods, namely, setting the CPU usage cycle through dynamic instructions or static settings in configuration files, specifying the usage rights of specific CPU cores and the time slice occupancy time;
[0034] Dynamic: The issuance of dynamic instructions must be completed through the VHM Service in the service virtual machine. Through the command line instructions in the server OS, the weight and cap of the thread OBJ are dynamically adjusted in the hot machine state;
[0035] Static: Set the cap and weight of all VCPUs in each virtual machine before the system starts. After startup, since the threads of the VCPU correspond one-to-one to the thread OBJ, the weight and cap of each thread OBJ are indirectly set.
[0036] 4. A priority-based scheduling method
[0037] We classify the status of VCPU into the highest priority, the second priority and the third priority. Low-priority VCPUs are more likely to be preempted. The Nebula scheduler automatically determines and adjusts the priority of VCPUs by recording the previous running status. The Nebula system defines the priority of tasks by the number of credit points. Tasks with more credit points are defined as high priority and are called first. For example, if a VCPU performs IO and is blocked and just awakened, its priority will be temporarily increased in credit points to help it quickly obtain CPU resources as compensation for the time slice it gave up. For a VCPU that has nothing to do, that is, the task does not require any computing resources, the task is defined as the third priority, that is, the credit points of the task are reduced, so that the task is easily preempted by high-priority tasks. For different task types, especially when events occur and strong real-time performance is required, we forcibly increase the credit points of the task, thereby promoting the event to the highest priority task for processing.
[0038] Step 2: Propose a control method for cooperating between a service virtual machine and a multi-user virtual machine
[0039] Nebula system provides two types of virtual machines: there is only one server virtual machine and there can be one or more user virtual machines. The server virtual machine and the user virtual machine share the CPU core. The server virtual machine provides a CPU sharing configuration scheme. Its workflow is: VHM Service->Nebula->thread OBJ. VHM Service obtains CPU sharing configuration information through external configuration files or receives external dynamic instructions, and completes static and dynamic sharing configuration.
[0040] Step 3: Implement high-security time partitioning based on microkernel fine-grained permission control mechanism
[0041] A fine-grained permission control mechanism based on the microkernel is proposed to achieve secure time partitioning. All objects in the Nebula system are given capability levels. For example, for an operation that wants to kill a process through the signal kill, the control object should include the sys_kill capability. The Nebula system contains a variety of capability level ranges. It uses fine-grained control of the operation capabilities of upper-level applications or virtual machines, and sets the capability level of a certain application through configuration files, thereby achieving secure access to applications of different levels. Under the premise of achieving security through the fine-grained management of the microkernel and the capability level mechanism, the Nebula system can dynamically generate multiple thread objects. These objects can share the underlying CPU hardware across all cores, dynamically connect to each CPU core, and complete the CPU scheduling of emergency work under the action of the scheduler, providing the hardware foundation and software mechanism for hard real-time.
[0042] Specifically, based on the full-core sharing strategy, the Nebula system allows virtual machines to access all physical CPU resources. At the same time, it adopts a scheduling mechanism based on weight and capability level to dynamically adjust CPU resource allocation to meet the performance requirements of different virtual machines. The Nebula system also introduces priority scheduling to ensure that key tasks can obtain CPU resources first and improve system response speed. More importantly, it uses the microkernel fine-grained permission management mechanism to assign capability levels to each system object and set application access permissions through configuration files, effectively preventing malicious or defective programs from interfering with other programs and enhancing system security. This comprehensive strategy not only improves the utilization of CPU resources and the overall performance of the system, but also ensures secure isolation between virtual machines, providing a more stable, efficient and secure CPU resource sharing solution for the virtualized environment, avoiding the need to implement differentiated security and resource allocation strategies between different virtual machines or different applications in the same virtual machine in the virtualized environment to ensure the security and performance stability of each application, and the problem of overly complicated processing methods.
[0043] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or apparatus that includes 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 apparatus.
[0044] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the invention, and the scope of the invention is defined by the appended claims and their equivalents.
Claims
1. A CPU security sharing method for multiple virtual machines, characterized in that: The implementation steps include: S1: Full-core sharing: Create a full-core sharing virtual machine environment through the Nebula system, so that all virtual machines can use any physical CPU to maximize resource utilization; S2: Scheduling based on weight and capability level: Assign weight and capability cap to each control unit (thread object) created by the Nebula system. Thread object is referred to as thread OBJ. S3: Dynamic + static resource sharing: Nebula system provides two CPU usage configuration methods, namely, setting the CPU usage cycle through dynamic instructions or static settings in configuration files, specifying the use rights of specific CPU cores and the time slice occupancy time; S4: Priority-based scheduling: The status of the virtual CPU (VCPU) is divided into different priorities, and the Nebula scheduler automatically determines and adjusts the priority of the VCPU to give priority to scheduling high-priority tasks; S5: Service VM + User VM Cooperative Control: Nebula system provides two types of VMs: one and only one server VM and one or more user VMs. The server VM and user VMs fully share the CPU cores. S6: Microkernel fine-grained permission control: A microkernel-based fine-grained permission control mechanism to achieve secure time partitioning.
2. A CPU security sharing method for multiple virtual machines according to claim 1, characterized in that: In S1, the VCPU resources used by the virtual machine indirectly use the physical CPU through the thread OBJ provided by the Nebula system, and the virtual machine connects to the thread OBJ through the VCPU thread.
3. A CPU security sharing method for multiple virtual machines according to claim 1, characterized in that: In S2, the weight weight is the resource rate that the thread OBJ is allowed to occupy a certain CPU, and the capacity cap is the fixed CPU usage frequency of each thread OBJ, and the upper limit is expressed as a percentage of the physical CPU.
4. A CPU security sharing method for multiple virtual machines according to claim 1, characterized in that: In S3, the delivery of dynamic instructions must be completed through the VHM Service in the service virtual machine, and the weight and cap of the thread OBJ are dynamically adjusted in the hot machine state through the command line instructions in the server OS.
5. A CPU security sharing method for multiple virtual machines as claimed in claim 4, characterized in that: In S3, when the configuration file is statically set, the cap and weight of all VCPUs in each virtual machine are set before the system starts. After the system starts, since the threads of the VCPU correspond to the thread OBJ one by one, the weight and cap of each thread OBJ are indirectly set.
6. A CPU security sharing method for multiple virtual machines according to claim 1, characterized in that: In S4, the status of the VCPU is graded into the highest priority, the second priority and the third priority respectively, and the VCPU with a low priority is more likely to be preempted.
7. A CPU security sharing method for multiple virtual machines according to claim 6, characterized in that: In S4, the Nebula system defines the priority of tasks according to the number of credit points. Tasks with more credit points are defined as high priority and are called first.
8. A CPU security sharing method for multiple virtual machines according to claim 1, characterized in that: In S5, the server virtual machine provides a CPU sharing configuration solution, and its workflow is: VHM Service->Nebula->thread OBJ; VHM Service obtains CPU sharing configuration information through an external configuration file or receives an external dynamic instruction, and completes static and dynamic sharing configuration.
9. A CPU security sharing method for multiple virtual machines according to claim 1, characterized in that: In S6, the Nebula system achieves different levels of secure access by fine-grainedly controlling the operational capabilities of upper-layer applications or virtual machines and setting the capability level of specified applications through configuration files.
10. A CPU security sharing method for multiple virtual machines according to claim 9, characterized in that: In S6, under the premise of achieving safety through fine-grained management of the microkernel and capability-level mechanism, the Nebula system dynamically generates multiple thread objects. The thread objects are based on the underlying CPU hardware shared by all cores, dynamically connect to each CPU core, and complete the CPU scheduling of urgent work under the action of the scheduler, providing the hardware foundation and software mechanism for hard real-time.
Citation Information
Cited By
High-reliability multiple redundancy virtualization method based on microkernel
CN119883516A
