CN112330229B - Resource scheduling method, device, electronic equipment and computer readable storage medium - Google Patents
Resource scheduling method, device, electronic equipment and computer readable storage medium Download PDFInfo
- Publication number
- CN112330229B CN112330229B CN202011401446.7A CN202011401446A CN112330229B CN 112330229 B CN112330229 B CN 112330229B CN 202011401446 A CN202011401446 A CN 202011401446A CN 112330229 B CN112330229 B CN 112330229B
- Authority
- CN
- China
- Prior art keywords
- virtual machine
- type
- function
- application
- target virtual
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q10/00—Administration; Management
- G06Q10/06—Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
- G06Q10/063—Operations research, analysis or management
- G06Q10/0631—Resource planning, allocation, distributing or scheduling for enterprises or organisations
Landscapes
- Business, Economics & Management (AREA)
- Human Resources & Organizations (AREA)
- Engineering & Computer Science (AREA)
- Strategic Management (AREA)
- Entrepreneurship & Innovation (AREA)
- Economics (AREA)
- Operations Research (AREA)
- Game Theory and Decision Science (AREA)
- Development Economics (AREA)
- Marketing (AREA)
- Educational Administration (AREA)
- Quality & Reliability (AREA)
- Tourism & Hospitality (AREA)
- Physics & Mathematics (AREA)
- General Business, Economics & Management (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Stored Programmes (AREA)
Abstract
The embodiment of the application provides a resource scheduling method, a resource scheduling device, electronic equipment and a computer readable storage medium, and relates to the field of computers. The method is executed by an electronic device in which a plurality of virtual machines are installed, each virtual machine having an application installed therein, the method comprising: if the application is started, acquiring a function request generated by the application; determining a function type according to the function request, wherein the function type comprises at least two types; and distributing resources to the target virtual machine corresponding to the application according to the function type. According to the embodiment of the application, the allocated resources are suitable for corresponding applications, and the special requirements of different applications are met on the same electronic equipment.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a resource scheduling method, a device, an electronic apparatus, and a computer readable storage medium.
Background
Hybrid critical systems are real-time systems that allow applications of different critical classes, such as real-time control, security isolation, human-machine interaction, etc., to coexist and interact on the same hardware platform. Hybrid critical systems are increasingly being used in aerospace, automotive, unmanned systems, and other applications.
While the resources required for hardware are different for different types of applications. However, the existing device with the hybrid key system is difficult to meet the resource requirements of different types of applications on the device.
Disclosure of Invention
The application aims to at least solve one of the technical defects, and particularly provides the following technical scheme:
in a first aspect, a method for scheduling resources is provided, the method comprising:
if the application is started, acquiring a function request generated by the application;
determining a function type according to the function request, wherein the function type comprises at least two types;
and distributing resources to the target virtual machine corresponding to the application according to the function type.
In a second aspect, an apparatus for scheduling resources is provided, the apparatus comprising:
the request acquisition module is used for acquiring a function request generated by the application if the application is started;
the type determining module is used for determining a function type according to the function request, wherein the function type comprises at least two types;
and the resource allocation module is used for allocating resources to the target virtual machine corresponding to the application according to the function type.
In a third aspect, an electronic device is provided, the electronic device comprising:
one or more processors;
a memory;
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications configured to: the resource scheduling method according to the first aspect of the application is performed.
In a fourth aspect, a computer readable storage medium is provided, on which a computer program is stored, which program, when being executed by a processor, implements the resource scheduling method according to the first aspect of the application.
The technical scheme provided by the application has the beneficial effects that: if the application in the virtual machine is started, acquiring a function request generated by the application, and determining a function type according to the function request, wherein the function type comprises at least two types; and allocating resources to the target virtual machines corresponding to the applications according to the function types, wherein the allocated resources are suitable for the corresponding applications, and the special requirements of different applications are met on the same electronic equipment.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings that are required to be used in the description of the embodiments of the present application will be briefly described below.
Fig. 1 is a schematic diagram of an electronic device according to an embodiment of the present application;
fig. 2 is a schematic flow chart of a resource scheduling method according to an embodiment of the present application;
fig. 3 is a schematic flow chart of a resource scheduling method according to an embodiment of the present application;
fig. 4 is a schematic flow chart of a resource scheduling method according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a resource scheduling device according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device for resource scheduling according to an embodiment of the present application.
Detailed Description
Embodiments of the present application are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are illustrative only and are not to be construed as limiting the application.
As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless expressly stated otherwise, as understood by those skilled in the art. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. The term "and/or" as used herein includes all or any element and all combination of one or more of the associated listed items.
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the embodiments of the present application will be described in further detail with reference to the accompanying drawings.
The application provides a resource scheduling method, a resource scheduling device, electronic equipment and a computer readable storage medium, and aims to solve the technical problems in the prior art.
The following describes the technical scheme of the present application and how the technical scheme of the present application solves the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Referring to fig. 1, the resource scheduling method provided by the present application can be applied to an electronic device. In particular, the electronic device may be a terminal or a server. The electronic device 100 may include: at least one processor 101, a memory 102, an IO interface 103, and a memory 104.
Optionally, the electronic device 100 may further comprise a system bus, wherein the processor 101, the memory 102, the IO interface 103 and the memory 104 are connected to the bus, respectively. The processor 101 is capable of accessing the memory 102 and the memory 104 via the system bus, and the processor 101 is also capable of communicating with other devices, such as peripherals, via the bus and the IO interface 103.
The functions of the processor 101 are mainly to interpret instructions of a computer program and to process data in computer software.
The processor 101 may be an integrated circuit chip with signal processing capabilities. Specifically, the processor 101 may be a central processing unit (central processing unit, CPU).
Wherein the processor 101 includes a memory control unit and at least one processing unit.
The processing unit, which may also be referred to as a core, is the most important component of the processor. The processing unit may be manufactured from monocrystalline silicon in a certain production process, and all the calculation, the receiving command, the storing command and the processing data of the processor 101 are executed by the core. The processing units can independently run the program instructions respectively, and the running speed of the program is increased by utilizing the parallel computing capability. Various processing units have a fixed logic structure, for example, processing units include a first-level cache, a second-level cache, an execution unit, an instruction-level unit, and a bus interface.
The memory control unit is used to control the data interaction between the memory 104 and the processing unit. Specifically, the memory control unit may receive a memory access request from the processing unit and control access to the memory based on the memory access request. Alternatively, the memory control unit may be a memory management unit (memory management unit, MMU) or the like.
The memory (memory) may provide a running space for processes in the electronic device 100, for example, the memory 104 may store a computer program (i.e., code of a program) for generating the processes, and the memory 104 may store data generated during the running of the processes, for example, intermediate data, or process data.
It should be understood that the above-mentioned structure of the electronic device 100 is only illustrative, and the present application is not limited thereto, and the electronic device 100 according to the embodiment of the present application may include various hardware in a computer system in the prior art, for example, the electronic device 100 may also include various peripheral devices, etc.
The electronic device 100 may simultaneously run multiple virtual machines through a virtualization technology, each virtual machine may run at least one operating system, each operating system may run one or more applications, the operating systems between different virtual machines may be the same or different, and the applications between different virtual machines may be the same or different.
The electronic device is provided with a monitoring program, which can be a virtual machine monitor (virtual machine monitor, VMM). The VMM may be a hypervisor. The monitor program runs outside the virtual machine, for example, the monitor program can also run in a virtual machine outside the monitored virtual machine, and the monitor program is responsible for monitoring and recording the behavior of the sample program (or sample process) during execution.
A Virtual Machine (VM) refers to a complete computer system running in a completely isolated environment with complete hardware system functionality through software emulation.
When the electronic device 100 is running, if an application of the virtual machine is started, the electronic device 100 acquires a function request generated by the application; determining a function type according to the function request, wherein the function type comprises at least two types; and allocating resources to the target virtual machine corresponding to the application according to the function type.
As will be appreciated by those skilled in the art, a "terminal" as used herein may be a cell phone, tablet, PDA (Personal Digital Assistant ), MID (Mobile Internet Device, mobile internet device) or other terminal device; the "server" may be implemented as a stand-alone server or as a server cluster composed of a plurality of servers.
Referring to fig. 2, an embodiment of the present application provides a resource scheduling method, which may be applied to the foregoing electronic device, and the method includes:
s201: and if the application is started, acquiring a function request generated by the application.
A plurality of virtual machines are installed in the electronic device, and an application is installed in each virtual machine. An application is an application program, which refers to a computer program that performs some specific task or tasks. The number of applications installed in each virtual machine is not limited.
When an application in a virtual machine is started, the application generates a function request, and the function request is used for requesting resources required by the virtual machine where the application is located. The function request may include a requirement tag, and after the electronic device acquires the function request, the electronic device may acquire the requirement tag corresponding to the function request.
The specific content of the requirement label is not limited, for example, the requirement label may be a preset field or a preset identifier, the preset field may be a field determining (determining rate), and the preset identifier may be an identifier of an application or an identifier of a virtual machine.
When the function request is acquired, the function request can be acquired through a monitoring program, the application generates the function request, and the corresponding function request is acquired through the monitoring program.
S202: the function type is determined according to the function request, and the function type comprises at least two types.
After the electronic equipment acquires the function request generated by the application, the function type can be determined according to the function request. Different function requests may be for a different function type. Specifically, after the electronic device obtains the function request, a requirement label corresponding to the function request may be obtained. The corresponding relation between the demand label and the function type is preset in the electronic equipment, and the function type corresponding to the function request can be determined according to the corresponding relation between the demand label and the function type and the demand label.
S203: and allocating resources to the target virtual machine corresponding to the application according to the function type.
The electronic device may preset a resource allocation mechanism corresponding to the function type, and after the function type is determined, allocate resources to the target virtual machine corresponding to the application according to the resource allocation mechanism corresponding to the function type.
According to the resource scheduling method provided by the embodiment of the application, if the application in the virtual machine is started, the function request generated by the application is obtained, and the function type is determined according to the function request, wherein the function type comprises at least two types; and allocating resources to the target virtual machines corresponding to the applications according to the function types, wherein the allocated resources are suitable for the corresponding applications, and the special requirements of different applications are met on the same electronic equipment.
The embodiment of the application also provides a possible implementation manner, wherein the method for allocating resources to the target virtual machine corresponding to the application according to the function type comprises the following steps:
if the function type is the first type, the virtual cpu VCPU (Virtual Central Processing Unit) of the target virtual machine corresponds to one or more cores of the physical cpu PCPU (Physical Central Processing Unit) of the electronic device, the virtual memory address of the target virtual machine and the physical memory address of the electronic device are mapped one by one, and the mapping relationship between the virtual memory address and the physical memory address is stored in a preset page table.
PCPU of an electronic device, i.e. the actual existing CPU of the electronic device. The CPU includes one or more cores. The kernel is the most important component of the CPU, and all the computation, acceptance command, storage command, processing data and the like of the CPU are executed by the kernel. The kernels can independently run program instructions respectively, and the running speed of the program is increased by utilizing the parallel computing capability. Various cores have a fixed logic structure, for example, the cores include a first-level cache, a second-level cache, an execution unit, an instruction-level unit, a bus interface, and other logic units.
The specific type of the first type is not limited, and in the present application, the first type is a deterministic type. That is, the application in the target virtual machine needs to perform a highly deterministic task, and the time of the execution needs to be accurate, for example, the application may be a task for opening an anti-collision air bag. The function request corresponding to the first type may include a field Determinism. When the electronic device obtains the function request including the field Determinism, the function type corresponding to the function request can be determined to be the first type. The requirement labels included in the function requests corresponding to the first type may be of other types, and the present application will not be described in detail.
Each virtual machine is allocated with a VCPU, and if the target virtual machine needs to execute tasks, the tasks that the VCPU of the target virtual machine needs to execute are mapped to the PCPU through a scheduling algorithm to be executed. And (3) corresponding the VCPU of the target virtual machine to one or more cores of the PCPU of the electronic device, namely binding the VCPU of the target virtual machine to one or more cores of the PCPU of the electronic device, and mapping tasks to be executed by the VCPU of the target virtual machine to one or more cores corresponding to the VCPU in the PCPU through a scheduling algorithm for execution.
A virtual machine assigns a guest virtual address (guest virtual address, GVA) to a process during execution of the process. GVA is a logical address that a process can understand.
In order for a virtual machine to use an isolated, zero-start and contiguous memory space, the concept of virtual machine physical addresses (guest physical address, GPA) is introduced. This address space is not a real physical address space. For each virtual machine, the virtual machine physical address space is a contiguous address space starting from zero. However, for electronic devices, the virtual machine physical address space is not necessarily contiguous, and it is possible for the virtual machine physical address space of a virtual machine to be mapped in a number of discrete physical address intervals of the electronic device. The physical address of the electronic device may be referred to as a host physical address (host physical address, HPA). Thus, in order to enable a process in a virtual machine to access the memory of an electronic device, mapping, or address translation, from GVA to GPA to HPA needs to be implemented.
As an embodiment, for example, an extended page table (extended page table, EPT) may be configured within the CPU. Page tables are a way of managing address space, which is known in the art and will not be described in detail in this disclosure. Wherein the EPT may be maintained by a VMM on the electronic device. The page table includes the corresponding relation between GVA and GPA and the corresponding relation between GPA and HPA.
The virtual memory address of the target virtual machine is mapped with the physical memory address of the electronic device one by one, that is, GVA is mapped with HPA one by one. And the page missing of the virtual memory address of the target virtual machine in the execution process is avoided.
According to the technical scheme, when the application of the virtual machine is executed, the virtual central processor VCPU of the target virtual machine corresponds to one or more cores of the physical central processor PCPU of the electronic equipment, and the virtual memory address of the target virtual machine is mapped with the physical memory address of the electronic equipment one by one, so that the situation that the cores of the PCPU which are not corresponding to tasks to be executed by the VCPU are not executed by the cores of the PCPU is avoided, the defect of pages in the execution process of the virtual memory address of the target virtual machine is avoided, and the certainty requirement when the application is executed is met.
The embodiment of the application also provides a possible implementation manner, and the method allocates resources to the target virtual machine corresponding to the application according to the function type, and further comprises the following steps:
if the function type is the second type, the VCPU of the target virtual machine is corresponding to one or more cores of the PCPU of the electronic device, the virtual memory address of the target virtual machine is mapped with the physical memory address of the electronic device one by one, the mapping relation between the virtual memory address and the physical memory address is stored in a preset page table, the calling authority of the core is set, the calling authority of the target virtual machine is the highest, and the using authority of the physical memory address is set to be used by the target virtual machine only.
The specific type of the second type is not limited, and in the present application, the second type is a security type. Namely, the related information of the task which needs to be executed by the application in the target virtual machine needs to have higher security, and the related information of the task cannot be acquired by other virtual machines. The function request corresponding to the second type may include an identification of the virtual machine. When the electronic equipment acquires the function request comprising the preset identifier of the virtual machine, the function type corresponding to the function request can be determined to be the second type. The requirement labels included in the function requests corresponding to the second type may be of other types, and the present application will not be described in detail.
In this embodiment, the VCPU of the target virtual machine corresponds to one or more cores of the PCPU of the electronic device, the virtual memory address of the target virtual machine and the physical memory address of the electronic device are mapped one by one, and the mapping relationship between the virtual memory address and the physical memory address is stored in a preset page table, which is consistent with the foregoing embodiment and will not be described in detail herein.
The kernel invoking authority, that is, the authority of invoking the kernel of the PCPU to execute the task. The calling authority of the target virtual machine is the highest, namely the authority of the kernel corresponding to the target virtual machine calling is the highest. If a kernel receives tasks corresponding to multiple virtual machines, the kernel preferentially executes the tasks corresponding to the target virtual machine.
And setting the use authority of the physical memory address to be used by the target virtual machine only, wherein other virtual machines cannot use the physical memory address, and the electronic equipment can execute tasks irrelevant to the application of the target virtual machine and cannot use the physical memory address. The physical memory address can be used only by the target virtual machine by means of a memory management unit (Memory Management Unit, MMU) and the like.
Alternatively, if the function type is the first type, the calling authority of the kernel may be set, where the calling authority of the target virtual machine is the highest.
According to the technical scheme provided by the embodiment of the application, the kernel of the PCPU cannot be preempted by other virtual machines, and the physical memory address cannot be used by other virtual machines, so that the safety of the information of the application is ensured.
Referring to fig. 3, the embodiment of the present application further provides a possible implementation manner, and the resource scheduling method further includes:
s301: and acquiring memory release information.
The memory release information is used for enabling the electronic device to cancel the use authority of the physical memory address of the target virtual machine, so that the use authority of the physical memory address is not only used by the target virtual machine, but also used by other virtual machines.
The method for obtaining the memory release information is not limited, and the method for obtaining the memory release information may include:
acquiring a release request generated by an application; or (b)
And monitoring the running of the application, and if the application is closed, confirming that the memory release information is acquired.
If the application no longer needs to monopolize the corresponding physical memory address, the application can generate a release request, so that the electronic device obtains the release request generated by the application through the monitoring program, namely, the release request is obtained.
The electronic device may also monitor the running of the application by using the monitor program, and if the application is closed, the electronic device considers that the application does not need to monopolize the corresponding physical memory address, and the electronic device may consider that the memory release request is acquired.
S302: and canceling the use permission according to the memory release information, and deleting the information in the memory corresponding to the physical memory address corresponding to the target virtual machine.
And canceling the use permission according to the memory release information, namely canceling the use permission of the target virtual machine to the physical memory address, so that the use permission of the physical memory address is not used only by the target virtual machine, and other virtual machines can also use the physical memory address.
And deleting the information in the memory corresponding to the physical memory address corresponding to the target virtual machine, so that the information of the application of the target virtual machine in the physical memory address is deleted, other virtual machines cannot acquire the information corresponding to the application of the target virtual machine, and the information security of the application of the target virtual machine is ensured.
Referring to fig. 4, the embodiment of the present application further provides a possible implementation manner, and the resource scheduling method further includes:
s401: and acquiring a peripheral occupation request generated by the application.
The electronic device may generate a peripheral occupation request by adding a peripheral name to a hypervisor call (HVC) instruction. The peripheral occupation request may include a name of the peripheral or other related information of the peripheral, so that the electronic device determines a corresponding peripheral according to the peripheral occupation request. The peripheral occupation request is used for requesting to exclusively occupy the corresponding peripheral, and if the peripheral is exclusively occupied by the target virtual machine, other virtual machines can not use the peripheral any more.
The electronic equipment obtains the peripheral occupation request generated by the application and can be obtained through a monitoring program.
S402: and acquiring the address of the target peripheral according to the peripheral occupation request.
The electronic device stores the address of the peripheral. The address of the peripheral may be a register address of the peripheral. The peripheral request comprises information of the peripheral, if the electronic equipment allows the target virtual machine to monopolize the peripheral, the electronic equipment can determine a corresponding target peripheral according to the peripheral request, and then the address of the target peripheral can be obtained.
S403: modifying the peripheral address of the equipment tree corresponding to the target virtual machine as the address of the target peripheral.
The target virtual machine corresponds to a device tree (device tree) that retains device information existing in the target virtual machine.
S404: and sending interrupt information to the target virtual machine so that the target virtual machine enables the target peripheral.
The target virtual machine acquires the interrupt information, initializes and reads and writes the target peripheral, and starts the target peripheral.
According to the scheme provided by the embodiment of the application, the target peripheral equipment is started quickly and conveniently by the target virtual machine in a mode of updating the equipment tree and matching with the interrupt information.
The embodiment of the application also provides a possible implementation mode, and the resource scheduling method further comprises the following steps:
acquiring a peripheral cancel request generated by an application;
and modifying the address of the target peripheral into the address of the preset virtual peripheral according to the peripheral cancel request so as to enable the virtual peripheral.
If the virtual machine does not need to monopolize the target peripheral, the application generates a peripheral cancellation request. The peripheral cancel request is used for canceling the target peripheral which is exclusively occupied, so that other virtual machines can use the target peripheral. After the peripheral cancel request is acquired, contrary to the operation of acquiring the peripheral request, the address of the target peripheral needs to be modified into the preset address of the virtual peripheral, and interrupt information is sent to the target virtual machine so as to enable the virtual peripheral.
Referring to fig. 5, an embodiment of the present application provides a resource scheduling apparatus 500, where the resource scheduling apparatus 500 may include:
a request acquisition module 501, configured to acquire a function request generated by an application if the application is started;
a type determining module 502, configured to determine a function type according to the function request, where the function type includes at least two types;
and the resource allocation module 503 is configured to allocate resources to the target virtual machine corresponding to the application according to the function type.
In the resource scheduling device provided by the embodiment of the application, if the application in the virtual machine is started, the function request generated by the application is obtained, and the function type is determined according to the function request, wherein the function type comprises at least two types; and allocating resources to the target virtual machines corresponding to the applications according to the function types, wherein the allocated resources are suitable for the corresponding applications, and the special requirements of different applications are met on the same electronic equipment.
The resource allocation module 503 is further configured to, if the function type is the first type, correspond the virtual cpu VCPU of the target virtual machine to one or more cores of the physical cpu PCPU of the electronic device, map the virtual memory address of the target virtual machine to the physical memory address of the electronic device one by one, and store the mapping relationship between the virtual memory address and the physical memory address in a preset page table.
The resource allocation module 503 is further configured to, if the function type is the second type, correspond the VCPU of the target virtual machine to one or more cores of the PCPU of the electronic device, map the virtual memory address of the target virtual machine to the physical memory address of the electronic device one by one, store the mapping relationship between the virtual memory address and the physical memory address in a preset page table, set the invoking authority of the core, where the invoking authority of the target virtual machine is the highest, and set the using authority of the physical memory address to be used by only the target virtual machine.
The resource scheduling apparatus 500 may further include:
the release information acquisition module is used for acquiring the memory release information;
and the deleting module is used for canceling the use permission according to the memory release information and deleting the information in the memory corresponding to the physical memory address corresponding to the target virtual machine.
The release information acquisition module is used for acquiring a release request generated by the application; or (b)
And monitoring the running of the application, and if the application is closed, confirming that the memory release information is acquired.
The resource scheduling apparatus 500 may further include:
the occupation request acquisition module is used for acquiring a peripheral occupation request generated by an application;
the address acquisition module is used for acquiring the address of the target peripheral according to the peripheral occupation request;
the address modification module is used for modifying the peripheral address of the equipment tree corresponding to the target virtual machine into the address of the target peripheral;
and the interrupt sending module is used for sending interrupt information to the target virtual machine so as to enable the target virtual machine to enable the target peripheral.
The resource scheduling apparatus 500 may further include:
the peripheral cancel module is used for acquiring a peripheral cancel request generated by the application;
the virtual peripheral enabling module is used for modifying the address of the target peripheral into the preset address of the virtual peripheral according to the peripheral cancelling request so as to enable the virtual peripheral.
Referring to fig. 6, in an alternative embodiment, an electronic device is provided, the electronic device 6000 comprising: a processor 6001 and a memory 6003. In which a processor 6001 is coupled to a memory 6003, such as via a bus 6002. Optionally, the electronic device 6000 may also include a transceiver 6004. It should be noted that, in practical applications, the transceiver 6004 is not limited to one, and the structure of the electronic device 6000 is not limited to the embodiment of the present application.
The processor 6001 may be a CPU (Central Processing Unit ), general purpose processor, DSP (Digital Signal Processor, data signal processor), ASIC (Application Specific Integrated Circuit ), FPGA (Field Programmable Gate Array, field programmable gate array) or other programmable logic device, transistor logic device, hardware components, or any combination thereof. Which may implement or perform the various exemplary logic blocks, modules and circuits described in connection with this disclosure. The processor 6001 may also be a combination that performs computing functions, e.g., including one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
Bus 6002 may include a path to transfer information between the aforementioned components. Bus 6002 may be a PCI (Peripheral Component Interconnect, peripheral component interconnect standard) bus or EISA (Extended Industry Standard Architecture ) bus, or the like. The bus 6002 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The Memory 6003 may be, but is not limited to, ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, RAM (Random Access Memory ) or other type of dynamic storage device that can store information and instructions, EEPROM (Electrically Erasable Programmable Read Only Memory ), CD-ROM (Compact Disc Read Only Memory, compact disc Read Only Memory) or other optical disk storage, optical disk storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer.
The memory 6003 is used for storing application program codes for executing the scheme of the present application, and execution is controlled by the processor 6001. The processor 6001 is configured to execute application code stored in the memory 6003 to implement what has been shown in the foregoing method embodiments.
Among them, electronic devices include, but are not limited to: a terminal and a server.
The embodiment of the application provides electronic equipment, which comprises: a memory and a processor; at least one program stored in the memory for realizing the corresponding contents of the foregoing method embodiments when executed by the processor, wherein compared with the prior art, the method can realize: if the application in the virtual machine is started, acquiring a function request generated by the application, and determining a function type according to the function request, wherein the function type comprises at least two types; and allocating resources to the target virtual machines corresponding to the applications according to the function types, wherein the allocated resources are suitable for the corresponding applications, and the special requirements of different applications are met on the same electronic equipment.
Embodiments of the present application provide a computer-readable storage medium having a computer program stored thereon, which when run on a computer, causes the computer to perform the corresponding method embodiments described above. Compared with the prior art, if the application in the virtual machine is started, acquiring a function request generated by the application, and determining a function type according to the function request, wherein the function type comprises at least two types; and allocating resources to the target virtual machines corresponding to the applications according to the function types, wherein the allocated resources are suitable for the corresponding applications, and the special requirements of different applications are met on the same electronic equipment.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited in order and may be performed in other orders, unless explicitly stated herein. Moreover, at least some of the steps in the flowcharts of the figures may include a plurality of sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, the order of their execution not necessarily being sequential, but may be performed in turn or alternately with other steps or at least a portion of the other steps or stages.
The foregoing is only a partial embodiment of the present application, and it should be noted that it will be apparent to those skilled in the art that modifications and adaptations can be made without departing from the principles of the present application, and such modifications and adaptations should and are intended to be comprehended within the scope of the present application.
Claims (8)
1. A resource scheduling method, the method being performed by an electronic device in which a plurality of virtual machines are installed, each virtual machine having an application installed therein, the method comprising:
if the application is started, acquiring a function request generated by the application; the function request comprises a demand label, wherein the demand label comprises a preset field or a preset identifier;
determining a function type according to the function request, wherein the function type comprises at least two types;
distributing resources to the target virtual machine corresponding to the application according to the function type;
wherein determining a function type according to the function request comprises:
determining a function type corresponding to the function request according to a preset field or a preset identifier included in the demand label;
the allocating resources to the target virtual machine corresponding to the application according to the function type comprises the following steps:
if the function type is the first type, the virtual central processing unit VCPU of the target virtual machine corresponds to one or more cores of the physical central processing unit PCPU of the electronic equipment, the virtual memory address of the target virtual machine and the physical memory address of the electronic equipment are mapped one by one, and the mapping relation between the virtual memory address and the physical memory address is stored in a preset page table;
the allocating resources to the target virtual machine corresponding to the application according to the function type comprises the following steps:
if the function type is the second type, the VCPU of the target virtual machine is corresponding to one or more cores of the PCPU of the electronic device, the virtual memory address of the target virtual machine is mapped with the physical memory address of the electronic device one by one, the mapping relation between the virtual memory address and the physical memory address is stored in a preset page table, the calling authority of the cores is set, the calling authority of the target virtual machine is the highest, and the using authority of the physical memory address is set to be used by the target virtual machine only;
the first type is a deterministic type, and the function request corresponding to the first type comprises a demand label which comprises a preset field;
the second type is a security type, the function request corresponding to the second type comprises a demand label, and the demand label comprises a preset identifier.
2. The resource scheduling method of claim 1, wherein the method further comprises:
acquiring memory release information;
and canceling the use permission according to the memory release information, and deleting the information in the memory corresponding to the physical memory address corresponding to the target virtual machine.
3. The method for scheduling resources according to claim 2, wherein the obtaining the memory release information includes:
acquiring a release request generated by the application; or (b)
And monitoring the running of the application, and if the application is closed, confirming that the memory release information is acquired.
4. The resource scheduling method of claim 1, wherein the method further comprises:
acquiring a peripheral occupation request generated by the application;
acquiring the address of a target peripheral according to the peripheral occupation request;
modifying the peripheral address of the equipment tree corresponding to the target virtual machine into the address of the target peripheral;
and sending interrupt information to the target virtual machine so that the target virtual machine enables the target peripheral.
5. The resource scheduling method of claim 4, further comprising:
acquiring a peripheral cancel request generated by the application;
and modifying the address of the target peripheral to be the address of a preset virtual peripheral according to the peripheral cancel request so as to enable the virtual peripheral.
6. A resource scheduling apparatus for implementing the resource scheduling method of claim 1, comprising:
the request acquisition module is used for acquiring a function request generated by the application if the application is started; the function request comprises a demand label, wherein the demand label comprises a preset field or a preset identifier;
the type determining module is used for determining a function type according to the function request, wherein the function type comprises at least two types;
the resource allocation module is used for allocating resources to the target virtual machines corresponding to the applications according to the function types;
wherein determining a function type according to the function request comprises:
determining a function type corresponding to the function request according to a preset field or a preset identifier included in the demand label;
the allocating resources to the target virtual machine corresponding to the application according to the function type comprises the following steps:
if the function type is the first type, the virtual central processing unit VCPU of the target virtual machine corresponds to one or more cores of the physical central processing unit PCPU of the electronic equipment, the virtual memory address of the target virtual machine and the physical memory address of the electronic equipment are mapped one by one, and the mapping relation between the virtual memory address and the physical memory address is stored in a preset page table;
the allocating resources to the target virtual machine corresponding to the application according to the function type comprises the following steps:
if the function type is the second type, the VCPU of the target virtual machine is corresponding to one or more cores of the PCPU of the electronic device, the virtual memory address of the target virtual machine is mapped with the physical memory address of the electronic device one by one, the mapping relation between the virtual memory address and the physical memory address is stored in a preset page table, the calling authority of the cores is set, the calling authority of the target virtual machine is the highest, and the using authority of the physical memory address is set to be used by the target virtual machine only;
the first type is a deterministic type, and the function request corresponding to the first type comprises a demand label which comprises a preset field;
the second type is a security type, the function request corresponding to the second type comprises a demand label, and the demand label comprises a preset identifier.
7. An electronic device, comprising:
one or more processors;
a memory;
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications configured to: the resource scheduling method according to any one of claims 1 to 5 is performed.
8. A computer-readable storage medium, on which a computer program is stored, characterized in that the program, when executed by a processor, implements the resource scheduling method of any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011401446.7A CN112330229B (en) | 2020-12-02 | 2020-12-02 | Resource scheduling method, device, electronic equipment and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011401446.7A CN112330229B (en) | 2020-12-02 | 2020-12-02 | Resource scheduling method, device, electronic equipment and computer readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112330229A CN112330229A (en) | 2021-02-05 |
CN112330229B true CN112330229B (en) | 2023-09-22 |
Family
ID=74302092
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011401446.7A Active CN112330229B (en) | 2020-12-02 | 2020-12-02 | Resource scheduling method, device, electronic equipment and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112330229B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113485789B (en) * | 2021-06-30 | 2023-03-21 | 海光信息技术股份有限公司 | Resource allocation method and device and computer architecture |
CN113791905A (en) * | 2021-09-14 | 2021-12-14 | 联想(北京)有限公司 | Computing resource allocation method and device, electronic equipment and storage medium |
CN114217907A (en) * | 2021-12-27 | 2022-03-22 | 华云数据控股集团有限公司 | Virtual machine binding management method and device based on PCPU (physical control Unit) resource pool |
CN115220911A (en) * | 2022-06-17 | 2022-10-21 | 中科驭数(北京)科技有限公司 | Resource management method, device, equipment and medium |
Citations (23)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2005031572A2 (en) * | 2003-09-22 | 2005-04-07 | Jaluna Sa | Operating systems |
CN101398768A (en) * | 2008-10-28 | 2009-04-01 | 北京航空航天大学 | Construct method of distributed virtual machine monitor system |
CN102056079A (en) * | 2009-10-30 | 2011-05-11 | 中国移动通信集团上海有限公司 | Method, device and system for determining information to be pushed |
CN104281496A (en) * | 2014-10-27 | 2015-01-14 | 深圳中兴网信科技有限公司 | Virtual resource distribution method and virtual resource distribution device |
CN105138389A (en) * | 2015-07-30 | 2015-12-09 | 北京京东尚科信息技术有限公司 | Method and system for managing virtual devices in cluster |
CN105378667A (en) * | 2013-12-10 | 2016-03-02 | 华为技术有限公司 | Method and apparatus for scheduling virtual machine resources |
CN105955796A (en) * | 2016-04-22 | 2016-09-21 | 华中科技大学 | Method and system for dispatching high-performance parallel application on cloud platform |
JP2017147517A (en) * | 2016-02-15 | 2017-08-24 | 日本電信電話株式会社 | Resource allocation calculation device, resource allocation calculation method, and program |
CN107341115A (en) * | 2017-06-30 | 2017-11-10 | 联想(北京)有限公司 | Virutal machine memory access method, system and electronic equipment |
CN107404523A (en) * | 2017-07-21 | 2017-11-28 | 中国石油大学(华东) | Cloud platform adaptive resource dispatches system and method |
CN107436810A (en) * | 2017-07-03 | 2017-12-05 | 北京东土科技股份有限公司 | A kind of resource for computer system dispatching method and device |
CN107783913A (en) * | 2016-08-31 | 2018-03-09 | 华为技术有限公司 | A kind of resource access method and computer applied to computer |
CN108829523A (en) * | 2018-06-26 | 2018-11-16 | 迈普通信技术股份有限公司 | Memory source distribution method, device, electronic equipment and readable storage medium storing program for executing |
CN109445912A (en) * | 2018-11-14 | 2019-03-08 | 国网新疆电力有限公司信息通信公司 | A kind of configuration method of virtual machine, configuration system and SDN controller |
CN109753353A (en) * | 2017-11-07 | 2019-05-14 | 阿里巴巴集团控股有限公司 | Resources of virtual machine distribution method, device and electronic equipment |
CN110198243A (en) * | 2019-06-11 | 2019-09-03 | 深信服科技股份有限公司 | A kind of method for network access and relevant device of virtual machine |
CN110990114A (en) * | 2019-11-08 | 2020-04-10 | 浪潮电子信息产业股份有限公司 | Virtual machine resource allocation method, device, equipment and readable storage medium |
WO2020108536A1 (en) * | 2018-11-28 | 2020-06-04 | 深圳先进技术研究院 | Virtual network resource allocation method and system and electronic device |
CN111338745A (en) * | 2019-04-25 | 2020-06-26 | 中国移动通信集团湖南有限公司 | Deployment method and device of virtual machine and intelligent equipment |
CN111427669A (en) * | 2020-04-27 | 2020-07-17 | 安谋科技(中国)有限公司 | Method, apparatus, medium, and system for managing virtual machines on computer device |
CN111797390A (en) * | 2020-07-14 | 2020-10-20 | 北京元心科技有限公司 | Program running method and device, electronic equipment and computer readable storage medium |
CN111897654A (en) * | 2020-07-31 | 2020-11-06 | 腾讯科技(深圳)有限公司 | Method and device for migrating application to cloud platform, electronic equipment and storage medium |
CN113032101A (en) * | 2021-03-31 | 2021-06-25 | 深信服科技股份有限公司 | Resource allocation method for virtual machine, server and computer readable storage medium |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9405588B2 (en) * | 2012-05-18 | 2016-08-02 | Alcatel Lucent | Cloud resource allocation system and method |
US9483301B2 (en) * | 2015-02-26 | 2016-11-01 | Red Hat Israel, Ltd. | Dynamic virtual machine function enabling |
CN107038128B (en) * | 2016-02-03 | 2020-07-28 | 华为技术有限公司 | Virtualization of execution environment, and access method and device of virtual execution environment |
CN108399101B (en) * | 2017-02-06 | 2021-03-16 | 腾讯科技(深圳)有限公司 | Method, device and system for scheduling resources |
CN111722906A (en) * | 2019-03-22 | 2020-09-29 | 华为技术有限公司 | Method and device for deploying virtual machine and container |
-
2020
- 2020-12-02 CN CN202011401446.7A patent/CN112330229B/en active Active
Patent Citations (23)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2005031572A2 (en) * | 2003-09-22 | 2005-04-07 | Jaluna Sa | Operating systems |
CN101398768A (en) * | 2008-10-28 | 2009-04-01 | 北京航空航天大学 | Construct method of distributed virtual machine monitor system |
CN102056079A (en) * | 2009-10-30 | 2011-05-11 | 中国移动通信集团上海有限公司 | Method, device and system for determining information to be pushed |
CN105378667A (en) * | 2013-12-10 | 2016-03-02 | 华为技术有限公司 | Method and apparatus for scheduling virtual machine resources |
CN104281496A (en) * | 2014-10-27 | 2015-01-14 | 深圳中兴网信科技有限公司 | Virtual resource distribution method and virtual resource distribution device |
CN105138389A (en) * | 2015-07-30 | 2015-12-09 | 北京京东尚科信息技术有限公司 | Method and system for managing virtual devices in cluster |
JP2017147517A (en) * | 2016-02-15 | 2017-08-24 | 日本電信電話株式会社 | Resource allocation calculation device, resource allocation calculation method, and program |
CN105955796A (en) * | 2016-04-22 | 2016-09-21 | 华中科技大学 | Method and system for dispatching high-performance parallel application on cloud platform |
CN107783913A (en) * | 2016-08-31 | 2018-03-09 | 华为技术有限公司 | A kind of resource access method and computer applied to computer |
CN107341115A (en) * | 2017-06-30 | 2017-11-10 | 联想(北京)有限公司 | Virutal machine memory access method, system and electronic equipment |
CN107436810A (en) * | 2017-07-03 | 2017-12-05 | 北京东土科技股份有限公司 | A kind of resource for computer system dispatching method and device |
CN107404523A (en) * | 2017-07-21 | 2017-11-28 | 中国石油大学(华东) | Cloud platform adaptive resource dispatches system and method |
CN109753353A (en) * | 2017-11-07 | 2019-05-14 | 阿里巴巴集团控股有限公司 | Resources of virtual machine distribution method, device and electronic equipment |
CN108829523A (en) * | 2018-06-26 | 2018-11-16 | 迈普通信技术股份有限公司 | Memory source distribution method, device, electronic equipment and readable storage medium storing program for executing |
CN109445912A (en) * | 2018-11-14 | 2019-03-08 | 国网新疆电力有限公司信息通信公司 | A kind of configuration method of virtual machine, configuration system and SDN controller |
WO2020108536A1 (en) * | 2018-11-28 | 2020-06-04 | 深圳先进技术研究院 | Virtual network resource allocation method and system and electronic device |
CN111338745A (en) * | 2019-04-25 | 2020-06-26 | 中国移动通信集团湖南有限公司 | Deployment method and device of virtual machine and intelligent equipment |
CN110198243A (en) * | 2019-06-11 | 2019-09-03 | 深信服科技股份有限公司 | A kind of method for network access and relevant device of virtual machine |
CN110990114A (en) * | 2019-11-08 | 2020-04-10 | 浪潮电子信息产业股份有限公司 | Virtual machine resource allocation method, device, equipment and readable storage medium |
CN111427669A (en) * | 2020-04-27 | 2020-07-17 | 安谋科技(中国)有限公司 | Method, apparatus, medium, and system for managing virtual machines on computer device |
CN111797390A (en) * | 2020-07-14 | 2020-10-20 | 北京元心科技有限公司 | Program running method and device, electronic equipment and computer readable storage medium |
CN111897654A (en) * | 2020-07-31 | 2020-11-06 | 腾讯科技(深圳)有限公司 | Method and device for migrating application to cloud platform, electronic equipment and storage medium |
CN113032101A (en) * | 2021-03-31 | 2021-06-25 | 深信服科技股份有限公司 | Resource allocation method for virtual machine, server and computer readable storage medium |
Non-Patent Citations (2)
Title |
---|
Identification of transmitter systems and learning tag molecules involved in behavioral tagging during memory formation;Diego Moncada,等;PROCEEDINGS OF THE NATIONAL ACADEMY OF SCIENCES OF THE UNITED STATES OF AMERICA;第108卷(第31期);第12931-12936页 * |
基于度量模块的入侵检测模型的研究与实现;林涛,等;计算机应用;第26卷(第12期);第2917页右栏"2. 1 硬件固件在系统中的映射原理"项下一段 * |
Also Published As
Publication number | Publication date |
---|---|
CN112330229A (en) | 2021-02-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112330229B (en) | Resource scheduling method, device, electronic equipment and computer readable storage medium | |
CN109062833B (en) | Computing system operating method, computing system, vehicle and computer readable medium | |
US9454497B2 (en) | Technologies for secure inter-virtual-machine shared memory communication | |
JP5735070B2 (en) | Guest address to host address translation for devices to access memory in partitioned systems | |
JP5608243B2 (en) | Method and apparatus for performing I / O processing in a virtual environment | |
WO2018041075A1 (en) | Resource access method applied to computer, and computer | |
US10509729B2 (en) | Address translation for scalable virtualization of input/output devices | |
US10310974B2 (en) | Systems and methods for input/output computing resource control | |
US20240330199A1 (en) | Secure memory access in a virtualized computing environment | |
CN112148418A (en) | Method, apparatus, device and medium for accessing data | |
US10430327B2 (en) | Virtual machine based huge page balloon support | |
US9875132B2 (en) | Input output memory management unit based zero copy virtual machine to virtual machine communication | |
CN111290827A (en) | Data processing method and device and server | |
US10013199B2 (en) | Translation bypass by host IOMMU for systems with virtual IOMMU | |
US9367478B2 (en) | Controlling direct memory access page mappings | |
US20170147374A1 (en) | Virtual pci device based hypervisor bypass for vm bridging | |
US11036645B2 (en) | Secure userspace networking for guests | |
US10185679B2 (en) | Multi-queue device assignment to virtual machine groups | |
CN114443209A (en) | Storage virtualization apparatus, operation method thereof, and operation method of system having the same | |
US10922149B2 (en) | System comprising a plurality of virtualization systems | |
US20120054773A1 (en) | Processor support for secure device driver architecture | |
US9652296B1 (en) | Efficient chained post-copy virtual machine migration | |
US20240211293A1 (en) | Efficient queue shadowing for virtual machines |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |