CN112330229A - Resource scheduling method and device, electronic equipment and computer readable storage medium - Google Patents

Resource scheduling method and device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN112330229A
CN112330229A CN202011401446.7A CN202011401446A CN112330229A CN 112330229 A CN112330229 A CN 112330229A CN 202011401446 A CN202011401446 A CN 202011401446A CN 112330229 A CN112330229 A CN 112330229A
Authority
CN
China
Prior art keywords
application
virtual machine
function
target virtual
peripheral
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011401446.7A
Other languages
Chinese (zh)
Other versions
CN112330229B (en
Inventor
姜哲
邹仕洪
张广伟
黄浩东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Yuanxin Science and Technology Co Ltd
Original Assignee
Beijing Yuanxin Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Yuanxin Science and Technology Co Ltd filed Critical Beijing Yuanxin Science and Technology Co Ltd
Priority to CN202011401446.7A priority Critical patent/CN112330229B/en
Publication of CN112330229A publication Critical patent/CN112330229A/en
Application granted granted Critical
Publication of CN112330229B publication Critical patent/CN112330229B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION 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/00Administration; Management
    • G06Q10/06Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
    • G06Q10/063Operations research, analysis or management
    • G06Q10/0631Resource 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 and device, electronic equipment and a computer readable storage medium, and relates to the field of computers. The method is executed by an electronic device, wherein a plurality of virtual machines are installed in the electronic device, and each virtual machine is provided with an application, and the method comprises the following steps: if the application is started, acquiring a function request generated by the application; determining function types according to the function request, wherein the function types comprise at least two types; and allocating 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 on the same electronic device are met.

Description

Resource scheduling method and device, electronic equipment and computer readable storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a resource scheduling method, an apparatus, an electronic device, and a computer-readable storage medium.
Background
The hybrid key system is a real-time system which allows application programs with different key levels, such as real-time control, safety isolation, man-machine interaction and the like, to coexist and interact on the same hardware platform. Hybrid key systems are increasingly emerging in applications such as aerospace, automotive, unmanned systems, etc.
While the resources required for the hardware are different for different types of applications. The existing equipment with the mixed key system is difficult to meet the resource requirements of different types of applications on the equipment.
Disclosure of Invention
The purpose of the present application is to solve at least one of the above technical drawbacks, and to provide the following solutions:
in a first aspect, a method for resource scheduling is provided, where the method includes:
if the application is started, acquiring a function request generated by the application;
determining function types according to the function request, wherein the function types comprise at least two types;
and allocating resources to the target virtual machine corresponding to the application according to the function type.
In a second aspect, an apparatus for resource scheduling 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 function types according to the function requests, and the function types comprise 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, which includes:
one or more processors;
a memory;
one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to: the resource scheduling method according to the first aspect of the present application is performed.
In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, which when executed by a processor, implements the resource scheduling method shown in the first aspect of the present application.
The beneficial effect that technical scheme that this application provided brought is: if the application in the virtual machine is started, acquiring a function request generated by the application, and determining function types according to the function request, wherein the function types comprise at least two; and resources are allocated to the target virtual machine corresponding to the application according to the function type, and the allocated resources are suitable for the corresponding application, so that 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 used in the description of the embodiments of the present application will be briefly described below.
Fig. 1 is a schematic view of an electronic device according to an embodiment of the present disclosure;
fig. 2 is a schematic flowchart of a resource scheduling method according to an embodiment of the present application;
fig. 3 is a schematic flowchart of a resource scheduling method according to an embodiment of the present application, further including;
fig. 4 is a schematic flowchart of a resource scheduling method according to an embodiment of the present application, where the method further includes;
fig. 5 is a schematic structural diagram of a resource scheduling apparatus 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
Reference will now be made in detail to the embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present invention.
As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. 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. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
The present application provides a resource scheduling method, an apparatus, an electronic device, and a computer-readable storage medium, which are intended to solve the above technical problems in the prior art.
The following describes the technical solutions of the present application and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated 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 in the present application may be applied to an electronic device. Specifically, 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 computer device 101 may further include a system bus, wherein the processor 101, the storage 102, the IO interface 103, and the memory 104 are respectively connected to the bus. The processor 101 can access the memory 102 and the memory 104 through the system bus, and the processor 101 can also communicate with other devices, such as peripheral devices, through 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 having signal processing capabilities. Specifically, the processor 101 may be a Central Processing Unit (CPU).
The processor 101 includes a memory control unit and at least one processing unit.
A processing unit, which may also be referred to as a core, is the most important component of a processor. The processing unit may be fabricated from single crystal silicon in a certain manufacturing process, and all of the calculations, commands, memory commands, and data processing of the processor 101 are performed by the core. The processing units can respectively and independently run the program instructions, and the running speed of the program is accelerated by utilizing the parallel computing capability. The various processing units have a fixed logic structure, for example, the processing units include first level cache, second level cache, execution unit, instruction level unit, and bus interface logic units.
The memory control unit is used for controlling data interaction between the memory 104 and the processing unit. In particular, 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 (MMU) or other devices.
The memory (memory) may provide an operating space for the processes in the electronic device 100, for example, the memory 102 may store computer programs (i.e., codes of the programs) for generating the processes, and the memory 102 may store data generated during the operation of the processes, for example, intermediate data or process data.
It should be understood that the structure of the electronic device 100 described above is only an exemplary one, and is not limited in this application, and the electronic device 100 of the embodiment of this application may include various hardware in a computer system in the prior art, for example, the electronic device 101 may also include various peripherals and the like.
The electronic device 100 may run multiple virtual machines simultaneously through virtualization technology, each virtual machine may run at least one operating system, each operating system may run one or more applications, operating systems between different virtual machines may be the same or different, and applications between different virtual machines may be the same or different.
The electronic device is installed with a monitoring program, which may be a Virtual Machine Monitor (VMM). The VMM, which may be a hypervisor. The monitoring program runs outside the virtual machine, for example, the monitoring program may run in a virtual machine other than the monitored virtual machine, and the monitoring program is responsible for monitoring and recording the behavior of the sample program (or sample process) during the execution process.
A Virtual Machine (VM) refers to a complete computer system with complete hardware system functions, which is simulated by software and runs in a completely isolated environment.
When the electronic device 100 is running, if an application of the virtual machine is started, the electronic device 100 obtains a function request generated by the application; determining function types according to the function request, wherein the function types comprise at least two; and allocating resources to the target virtual machine corresponding to the application according to the function type.
Those skilled in the art will appreciate that the "terminal" used herein may be a Mobile phone, a tablet computer, a PDA (Personal Digital Assistant), an MID (Mobile Internet Device), or other terminal Device; a "server" may be implemented as a stand-alone server or as a server cluster comprised of multiple servers.
Referring to fig. 2, an embodiment of the present application provides a resource scheduling method, which can be applied to the 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 equipment, and each virtual machine is provided with an application. An application, or application, refers to a computer program designed to perform a particular 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 obtains the function request, the requirement tag corresponding to the function request may be obtained.
The specific content of the requirement tag is not limited, for example, the requirement tag may be a preset field or a preset identifier, the preset field may be a field determinisms (determination 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 the monitoring program, the application generates the function request, and the corresponding function request is acquired through the monitoring program.
S202: determining function types according to the function request, wherein the function types comprise 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 tag corresponding to the function request may be obtained. The corresponding relation between the requirement 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 requirement label and the function type and the requirement 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, the resource may be allocated 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 types are determined according to the function request, wherein the function types comprise at least two types; and resources are allocated to the target virtual machine corresponding to the application according to the function type, and the allocated resources are suitable for the corresponding application, so that the special requirements of different applications are met on the same electronic equipment.
The embodiment of the present application further provides a possible implementation manner, where allocating resources to a target virtual machine corresponding to an application according to a function type includes:
if the function type is the first type, corresponding a virtual Central Processing unit (vcpu) of the target virtual machine to one or more cores of a physical Central Processing unit (pcpu) of the electronic device, mapping virtual memory addresses of the target virtual machine to physical memory addresses of the electronic device one by one, and storing the mapping relationship between the virtual memory addresses and the physical memory addresses in a preset page table.
The PCPU of the electronic device, i.e. the real 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 computations, commands reception, commands storage, data processing, and the like of the CPU are executed by the kernel. The kernels can respectively and independently run the program instructions, and the running speed of the program is accelerated by utilizing the parallel computing capability. Various cores have fixed logic structures, for example, the cores include first level caches, second level caches, execution units, instruction level units, and bus interfaces.
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 execution needs to be precise, for example, the application may be a task for starting an air bag crash. The first type corresponds to a function request, and the requirement tag corresponding to the function request may include a field determinisms. When the electronic device acquires the function request comprising the field determinisms, the function type corresponding to the function request can be determined to be the first type. The requirement tag included in the function request corresponding to the first type may also be of other types, and is not described in detail in this application.
Each virtual machine is allocated with a VCPU, and if the target virtual machine needs to execute tasks, the tasks needing to be executed by the VCPU of the target virtual machine are mapped to the PCPU to be executed through a scheduling algorithm. The method comprises the steps of enabling a VCPU of a target virtual machine to correspond to one or more cores of a PCPU of an electronic device, namely binding the VCPU of the target virtual machine with one or more cores of the PCPU of the electronic device, and mapping tasks needing to be executed by the VCPU of the target virtual machine to one or more cores of the PCPU corresponding to the VCPU to be executed through a scheduling algorithm.
During the running of a process, a virtual machine assigns a Guest Virtual Address (GVA) to the process. The GVA is a logical address that the process can understand.
In order for a virtual machine to use an isolated, beginning-with-zero, and continuous memory space, the concept of virtual machine physical address (GPA) was introduced. This address space is not a true physical address space. For each virtual machine, the virtual machine physical address space is a continuous address space from scratch. However, for the electronic device, the virtual machine physical address space is not necessarily continuous, and the virtual machine physical address space of one virtual machine may be mapped to several discontinuous physical address intervals of the electronic device. The physical address of the electronic device may be referred to as a Host Physical Address (HPA). Therefore, in order to access the memory of the electronic device by a process in a virtual machine, mapping from GVA to GPA to HPA, or address translation, needs to be implemented.
In one embodiment, for example, an Extended Page Table (EPT) may be configured in the CPU. The page table is a management method of the address space, and the page table is the prior art and is not detailed in the application. Where 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.
And mapping the virtual memory address of the target virtual machine and the physical memory address of the electronic equipment one by one, namely mapping the GVA and the HPA one by one. The missing page 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 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 is mapped with the physical memory address of the electronic equipment one by one, the situation that a task needing to be executed by the VCPU is not executed by the corresponding core of the PCPU is avoided, the page fault of the virtual memory address of the target virtual machine in the execution process is avoided, and the certainty requirement in application execution is met.
The embodiment of the present application further provides a possible implementation manner, where allocating resources to a target virtual machine corresponding to an application according to a function type, further includes:
if the function type is the second type, the VCPU of the target virtual machine corresponds to one or more kernels of the PCPU of the electronic equipment, the virtual memory addresses of the target virtual machine and the physical memory addresses of the electronic equipment are mapped one by one, the mapping relation between the virtual memory addresses and the physical memory addresses is stored in a preset page table, in the calling authority of the kernels, the calling authority of the target virtual machine is the highest, and the use authority of the physical memory addresses is set to be used only by the target virtual machine.
The specific type of the second type is not limited, and in the present application, the second type is a security type. Namely, the relevant information of the task that the application in the target virtual machine needs to execute needs to have higher security, and the relevant information of the task cannot be acquired by other virtual machines. And a function request corresponding to the second type, wherein the requirement label corresponding to the function request can comprise the identification of the virtual machine. When the electronic device obtains the function request including the preset identifier of the virtual machine, it can be determined that the function type corresponding to the function request is the second type. The requirement tag included in the function request corresponding to the second type may also be of other types, and is not described in detail in this application.
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 the preset page table, which is consistent with the foregoing embodiment and will not be described in detail herein.
And the calling authority of the kernel is the authority for calling the kernel of the PCPU to execute tasks. And the calling authority of the target virtual machine is highest, namely the authority of the target virtual machine calling the corresponding kernel is highest. If one kernel receives tasks corresponding to a plurality of virtual machines, the kernel preferentially executes the tasks corresponding to the target virtual machine.
The use permission of the physical memory address is set to be used only by the target virtual machine, other virtual machines cannot use the physical memory address, and the electronic equipment executes tasks unrelated 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 (MMU) and the like.
Alternatively, if the function type is the first type, the call authority of the target virtual machine may be the highest among the call authorities of the kernel.
According to the technical scheme of the embodiment of the application, the kernel of the PCPU can not be preempted by other virtual machines, and the physical memory address can not be used by other virtual machines, so that the safety of the applied information is ensured.
Referring to fig. 3, a possible implementation manner is further provided in the embodiment of the present application, 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 permission of the target virtual machine to the physical memory address, so that the use permission of the physical memory address is no longer used by the target virtual machine, and other virtual machines can also use the physical memory address.
The obtaining method of the memory release information is not limited, and obtaining the memory release information may include:
obtaining a release request generated by an application; or
And monitoring the running of the application, and confirming to acquire the memory release information if the application is closed.
If the application does not need to monopolize the corresponding physical memory address any more, 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 obtains the release request.
The electronic device may also monitor the operation of the application through the monitoring program, and if the application is closed, the electronic device regards that the application does not need to monopolize the corresponding physical memory address, and the electronic device regards that the memory release request is obtained.
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 only used by the target virtual machine any more, 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, and other virtual machines cannot acquire the information corresponding to the application of the target virtual machine, thereby ensuring the information safety of the application of the target virtual machine.
Referring to fig. 4, a possible implementation manner is further provided in the embodiment of the present application, and the resource scheduling method further includes:
s401: and acquiring a peripheral occupation request generated by the application.
The electronic device may generate the peripheral occupation request by adding a peripheral name to a hypervisor call (HVC) command. The peripheral occupation request may include a name of the peripheral or other related information of the peripheral, so that the electronic device determines the 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.
The electronic equipment acquires the peripheral occupation request generated by the application and can acquire the peripheral occupation request through the 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 device may be a register address of the peripheral device. The peripheral request includes peripheral information, and if the electronic device allows the target virtual machine to monopolize the peripheral, the electronic device can determine the corresponding target peripheral according to the peripheral request, and then the address of the target peripheral can be acquired.
S403: and modifying the peripheral address of the device tree corresponding to the target virtual machine into the target peripheral address.
The target virtual machine corresponds to a device tree (device tree), which 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 equipment.
And the target virtual machine acquires the interrupt information, initializes and reads and writes the target peripheral equipment, and starts the target peripheral equipment.
According to the scheme of the embodiment of the application, the target peripheral is started quickly and conveniently by means of matching the equipment tree update with the interrupt information.
The embodiment of the present application further provides a possible implementation manner, and the resource scheduling method further includes:
acquiring a peripheral equipment cancellation request generated by an application;
and modifying the address of the target peripheral equipment into the preset address of the virtual peripheral equipment according to the peripheral equipment canceling request so as to start the virtual peripheral equipment.
If the virtual machine does not need to monopolize the target peripheral, the application generates a peripheral cancellation request. The peripheral cancellation request is used for canceling the target peripheral corresponding to the exclusive occupation, so that other virtual machines can use the target peripheral. After the peripheral cancellation request is obtained, contrary to the operation of obtaining the peripheral request, the address of the target peripheral needs to be modified into the address of the preset virtual peripheral, and the interrupt information is sent to the target virtual machine to start the virtual peripheral.
Referring to fig. 5, an embodiment of the present invention provides a resource scheduling apparatus 500, where the resource scheduling apparatus 500 may include:
a request obtaining module 501, configured to obtain a function request generated by an application if the application is started;
a type determining module 502, configured to determine function types according to the function request, where the function types include at least two;
and a resource allocation module 503, configured to allocate resources to the target virtual machine corresponding to the application according to the function type.
According to 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 types are determined according to the function request, wherein the function types comprise at least two; and resources are allocated to the target virtual machine corresponding to the application according to the function type, and the allocated resources are suitable for the corresponding application, so that 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 central processing unit VCPU of the target virtual machine to one or more cores of the physical central processing unit PCPU of the electronic device, map the virtual memory address of the target virtual machine and the physical memory address of the electronic device one to 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 a calling authority of the core, where the calling authority of the target virtual machine is highest, and set a usage 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 an application; or
And monitoring the running of the application, and confirming to acquire the memory release information if the application is closed.
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 start the target peripheral equipment.
The resource scheduling apparatus 500 may further include:
the peripheral cancellation module is used for acquiring a peripheral cancellation request generated by the application;
and 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, where the electronic device 6000 includes: a processor 6001 and a memory 6003. Processor 6001 and memory 6003 are coupled, such as via bus 6002. Optionally, the electronic device 6000 may also include a transceiver 6004. It should be noted that the transceiver 6004 is not limited to one in practical applications, 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), a general-purpose Processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other Programmable logic device, transistor logic device, hardware component, or any combination thereof. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. The processor 6001 might also be a combination that performs a computing function, such as a combination comprising one or more microprocessors, a combination of a DSP and a microprocessor, or the like.
The bus 6002 may include a path that conveys information between the aforementioned components. The bus 6002 may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus 6002 can be divided into an address bus, a data bus, a control bus, and so forth. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The Memory 6003 can be, but is not limited to, a ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, a RAM (Random Access Memory) or other type of dynamic storage device that can store information and instructions, an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical Disc storage, optical Disc storage (including Compact Disc, laser Disc, optical Disc, digital versatile Disc, blu-ray Disc, etc.), a magnetic disk storage medium or other magnetic storage device, 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 to store application code that implements aspects of the subject application, and execution is controlled by the processor 6001. The processor 6001 is configured to execute application program code stored in the memory 6003 to implement the aspects of the foregoing method embodiments.
Among them, electronic devices include but are not limited to: a terminal and a server.
An embodiment of the present application provides an electronic device, including: a memory and a processor; at least one program stored in the memory for execution by the processor to implement the corresponding aspects of the foregoing method embodiments, compared with the prior art, can implement: if the application in the virtual machine is started, acquiring a function request generated by the application, and determining function types according to the function request, wherein the function types comprise at least two; and resources are allocated to the target virtual machine corresponding to the application according to the function type, and the allocated resources are suitable for the corresponding application, so that the special requirements of different applications are met on the same electronic equipment.
The present application provides a computer-readable storage medium, on which a computer program is stored, which, when running on a computer, enables the computer to execute the corresponding content in the foregoing method embodiments. Compared with the prior art, if the application in the virtual machine is started, the function request generated by the application is obtained, and the function types are determined according to the function request, wherein the function types comprise at least two; and resources are allocated to the target virtual machine corresponding to the application according to the function type, and the allocated resources are suitable for the corresponding application, so that 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, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
The foregoing is only a partial embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (10)

1. A resource scheduling method, performed by an electronic device, wherein a plurality of virtual machines are installed in the electronic device, and each virtual machine has an application installed therein, the method comprising:
if the application is started, acquiring a function request generated by the application;
determining function types according to the function request, wherein the function types comprise at least two types;
and allocating resources to the target virtual machine corresponding to the application according to the function type.
2. The method according to claim 1, wherein the allocating resources to the target virtual machine corresponding to the application according to the function type includes:
if the function type is the first type, corresponding the virtual central processing unit VCPU of the target virtual machine to one or more cores of the physical central processing unit PCPU of the electronic device, mapping the virtual memory address of the target virtual machine to the physical memory address of the electronic device one by one, and storing the mapping relationship between the virtual memory address and the physical memory address in a preset page table.
3. The method according to claim 1, wherein the allocating resources to the target virtual machine corresponding to the application according to the function type includes:
if the function type is a second type, the VCPU of the target virtual machine corresponds to one or more kernels of the PCPU of the electronic equipment, the virtual memory addresses of the target virtual machine are mapped with the physical memory addresses of the electronic equipment one by one, the mapping relation between the virtual memory addresses and the physical memory addresses is stored in a preset page table, the calling authority of the kernels is set, the calling authority of the target virtual machine is the highest, and the use authority of the physical memory addresses is set to be used only by the target virtual machine.
4. The method for scheduling resources according to claim 3, 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.
5. The method according to claim 4, wherein the obtaining the memory release information comprises:
obtaining a release request generated by the application; or
And monitoring the running of the application, and confirming to acquire the memory release information if the application is closed.
6. The method for scheduling resources according to claim 1, wherein the method further comprises:
acquiring a peripheral occupation request generated by the application;
acquiring the address of the target peripheral according to the peripheral occupation request;
modifying the peripheral address of the device tree corresponding to the target virtual machine into the target peripheral address;
and sending interrupt information to the target virtual machine so that the target virtual machine enables the target peripheral.
7. The method for scheduling resources according to claim 6, wherein the method further comprises:
acquiring a peripheral equipment cancellation request generated by the application;
and modifying the address of the target peripheral equipment into a preset address of the virtual peripheral equipment according to the peripheral equipment canceling request so as to start the virtual peripheral equipment.
8. A resource scheduling 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 function types according to the function requests, and the function types comprise 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.
9. 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 programs configured to: performing the resource scheduling method according to any of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the resource scheduling method according to any one of claims 1 to 7.
CN202011401446.7A 2020-12-02 2020-12-02 Resource scheduling method, device, electronic equipment and computer readable storage medium Active CN112330229B (en)

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 true CN112330229A (en) 2021-02-05
CN112330229B 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)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113485789A (en) * 2021-06-30 2021-10-08 海光信息技术股份有限公司 Resource allocation method and device and computer architecture
CN115220911A (en) * 2022-06-17 2022-10-21 中科驭数(北京)科技有限公司 Resource management method, device, equipment and medium

Citations (28)

* Cited by examiner, † Cited by third party
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
US20130311662A1 (en) * 2012-05-18 2013-11-21 Aleksandr Stolyar Cloud resource allocation system and method
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
US20160253193A1 (en) * 2015-02-26 2016-09-01 Red Hat Israel, Ltd. Dynamic virtual machine function enabling
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
US20180330081A1 (en) * 2016-02-03 2018-11-15 Huawei Technologies Co., Ltd. Execution environment virtualization method and apparatus and virtual execution environment access method and apparatus
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
US20190294479A1 (en) * 2017-02-06 2019-09-26 Tencent Technology (Shenzhen) Company Limited Resource scheduling method, system, server, and storage medium
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
US20220004410A1 (en) * 2019-03-22 2022-01-06 Huawei Technologies Co., Ltd. Method For Deploying Virtual Machine And Container, And Related Apparatus

Patent Citations (28)

* Cited by examiner, † Cited by third party
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
US20130311662A1 (en) * 2012-05-18 2013-11-21 Aleksandr Stolyar Cloud resource allocation system and method
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
US20160253193A1 (en) * 2015-02-26 2016-09-01 Red Hat Israel, Ltd. Dynamic virtual machine function enabling
CN105138389A (en) * 2015-07-30 2015-12-09 北京京东尚科信息技术有限公司 Method and system for managing virtual devices in cluster
US20180330081A1 (en) * 2016-02-03 2018-11-15 Huawei Technologies Co., Ltd. Execution environment virtualization method and apparatus and virtual execution environment access method and apparatus
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
US20190294479A1 (en) * 2017-02-06 2019-09-26 Tencent Technology (Shenzhen) Company Limited Resource scheduling method, system, server, and storage medium
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
US20220004410A1 (en) * 2019-03-22 2022-01-06 Huawei Technologies Co., Ltd. Method For Deploying Virtual Machine And Container, And Related Apparatus
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)

* Cited by examiner, † Cited by third party
Title
DIEGO MONCADA,等: "Identification of transmitter systems and learning tag molecules involved in behavioral tagging during memory formation", PROCEEDINGS OF THE NATIONAL ACADEMY OF SCIENCES OF THE UNITED STATES OF AMERICA, vol. 108, no. 31, pages 12931 - 12936 *
林涛,等: "基于度量模块的入侵检测模型的研究与实现", 计算机应用, vol. 26, no. 12, pages 2917 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113485789A (en) * 2021-06-30 2021-10-08 海光信息技术股份有限公司 Resource allocation method and device and computer architecture
CN113485789B (en) * 2021-06-30 2023-03-21 海光信息技术股份有限公司 Resource allocation method and device and computer architecture
CN115220911A (en) * 2022-06-17 2022-10-21 中科驭数(北京)科技有限公司 Resource management method, device, equipment and medium

Also Published As

Publication number Publication date
CN112330229B (en) 2023-09-22

Similar Documents

Publication Publication Date Title
CN106201646B (en) Apparatus and method for secure inter-virtual machine shared memory communications
CN107783913B (en) Resource access method applied to computer and computer
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
US20210216453A1 (en) Systems and methods for input/output computing resource control
US10019276B2 (en) Dynamic non-uniform memory architecture (NUMA) locality for remote direct memory access (RDMA) applications
CN105830026A (en) Apparatus and method for scheduling graphics processing unit workloads from virtual machines
CN112148418A (en) Method, apparatus, device and medium for accessing data
US11836091B2 (en) Secure memory access in a virtualized computing environment
CN112330229B (en) Resource scheduling method, device, electronic equipment and computer readable storage medium
US20170147376A1 (en) Input ouput memory management unit based zero copy virtual machine to virtual machine communication
CN111427669A (en) Method, apparatus, medium, and system for managing virtual machines on computer device
JP2023545818A (en) Chip system, virtual interrupt handling method and corresponding device
US7389398B2 (en) Methods and apparatus for data transfer between partitions in a computer system
US10162787B1 (en) Multicore safe PCIe solution
US11036645B2 (en) Secure userspace networking for guests
KR20120070326A (en) A apparatus and a method for virtualizing memory
US11429412B2 (en) Guest protection from application code execution in kernel mode
US20120054773A1 (en) Processor support for secure device driver architecture
CN108932205B (en) Method and equipment for defending RowHammer attack
CN118113411A (en) Physical equipment access method, device, equipment, storage medium and vehicle
CN117991989A (en) Virtual machine disk mounting method, device, equipment and storage medium
CN116662223A (en) Data transmission method, system and electronic equipment

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