CN106776013B - Multi-system resource scheduling method and device - Google Patents

Multi-system resource scheduling method and device Download PDF

Info

Publication number
CN106776013B
CN106776013B CN201611070446.7A CN201611070446A CN106776013B CN 106776013 B CN106776013 B CN 106776013B CN 201611070446 A CN201611070446 A CN 201611070446A CN 106776013 B CN106776013 B CN 106776013B
Authority
CN
China
Prior art keywords
resource
container system
background
foreground
container
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
Application number
CN201611070446.7A
Other languages
Chinese (zh)
Other versions
CN106776013A (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.)
Yuanxin Information Technology Group Co ltd
Original Assignee
Yuanxin Technology
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 Yuanxin Technology filed Critical Yuanxin Technology
Priority to CN201611070446.7A priority Critical patent/CN106776013B/en
Publication of CN106776013A publication Critical patent/CN106776013A/en
Application granted granted Critical
Publication of CN106776013B publication Critical patent/CN106776013B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/545Interprogram communication where tasks reside in different layers, e.g. user- and kernel-space
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/504Resource capping

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides a method and a device for scheduling resources of multiple systems, wherein the method comprises the following steps: when the master control system is started, according to the respective resource proportion upper limits of the master control system, the foreground container system and the background container system specified in the preset resource allocation strategy, creating a resource allocation directory comprising respective resource allocation subdirectories of the master control system, the first container system in the foreground and at least one other container system in the background; the main control system starts the first container system and at least one other container system; and the first container system and each other container system after starting acquire resources according to the respective resource allocation subdirectory. In the embodiment of the invention, the main control system, the foreground container system and the background container system can acquire and use the resources of the terminal equipment in the range of the upper limit of the respective resource occupation ratio, and can prevent a certain system from occupying the resources of other systems; the foreground container system can acquire enough resources to ensure that the interaction with the client is not influenced, and the user experience is improved.

Description

Multi-system resource scheduling method and device
Technical Field
The invention relates to the technical field of terminals, in particular to a resource scheduling method and device for multiple systems.
Background
With the progress of society and the development of science and technology, terminal devices such as smart phones, tablet computers, electronic readers and the like are widely popularized. A considerable number of terminal devices have two operating systems installed therein.
Due to the requirement of fast switching of the operating systems, two operating systems are usually running in the terminal device at the same time. In this case, the terminal device system in which the two operating systems are installed needs to provide more resources, such as processor resources and memory resources, than a single operating system is run, so as to ensure the normal operation of the two operating systems.
On a terminal device, in order to ensure the smooth experience of using an application by a user, when an application is switched from a foreground to a background, resources occupied by the application are often not released, but original resources are continuously occupied. Thus, when a new application is opened and applies for resources, the terminal device allocates corresponding resources from the idle resources to be used by the new application. After a period of operation, the terminal device is often prone to have insufficient idle resources, which requires scheduling resources for the newly created foreground process. The existing dual system has not been configured with an effective resource scheduling method.
The existing resource scheduling method of a single system comprises the following steps: when the idle resources are insufficient, closing a relatively unimportant background process to dispatch the resources for a newly created foreground process to use; when only necessary processes for maintaining the operation system are left in the background process, the relatively unimportant foreground process is closed.
However, if the resource scheduling method of the single system is directly applied to the terminal devices in the dual systems, it is likely to cause confusion of resource scheduling. For example, the operating systems a and B independently adopt the existing resource scheduling method of a single system, and the operating systems a and B are located in the foreground and the background, respectively, on one hand, because the existing dual system is not yet configured with an effective resource scheduling method, the process of the operating system a may occupy less resources, and the process of the operating system B may occupy more resources; on the other hand, when the process of the operating system B occupies more resources and the shortage of idle resources does not occur, the process of the operating system B cannot be closed actively by using the existing resource scheduling method of the single system, so that the resources are scheduled to be used by the operating system A of the foreground. Therefore, the situation of insufficient resources of the operating system of the foreground is easily caused, inconvenience is brought to the user, and the user experience is reduced.
Disclosure of Invention
The invention provides a multi-system resource scheduling method and device aiming at the defects of the prior art, and aims to solve the problem that the process of one operating system occupies resources of other operating systems in the prior art.
According to an aspect, an embodiment of the present invention provides a method for scheduling resources of multiple systems, including:
when the master control system is started, according to the respective resource proportion upper limits of the master control system, a foreground container system and a background container system specified in a preset resource allocation strategy, creating a resource allocation directory comprising respective resource allocation subdirectories of the master control system, a first container system in the foreground and at least one other container system in the background;
the master control system starts a first container system and at least one other container system;
and the first container system and each other container system after starting acquire resources according to the respective resource allocation subdirectory.
According to another aspect, an embodiment of the present invention further provides a multi-system resource scheduling apparatus, including: a master control system, a first container system, and at least one other container system;
the master control system comprises:
the resource allocation directory processing module is used for creating a resource allocation directory comprising resource allocation subdirectories of the main control system, the first container system in the foreground and the at least one other container system in the background according to respective resource proportion upper limits of the main control system, the foreground container system and the background container system specified in a preset resource allocation strategy when the main control system is started;
a container system activation module for activating a first container system and at least one other container system;
the first container system includes:
the first resource acquisition and distribution module is used for acquiring resources according to the resource distribution subdirectory of the first container system;
each of the other container systems includes:
and the other resource acquisition and distribution module is used for acquiring resources according to the resource distribution subdirectory of the other container system to which the other resource acquisition and distribution module belongs.
Preferably, the resource allocation directory processing module is specifically configured to mount the resource subsystem when the master control system is started; and creating a resource allocation directory comprising respective resource allocation subdirectories of the main control system, the first container system in the foreground and each other container system in the background according to respective resource proportion upper limits of the main control system, the foreground container system and the background container system specified in a preset resource allocation strategy through the resource subsystem.
Preferably, the resource allocation directory processing module is specifically configured to create resource allocation subdirectories of the master control system, the first container system, and other container systems, and set resource occupation upper limits of the master control system, the foreground container system, and the background container system, which are specified by the resource allocation policy, in an assigned file of each resource allocation subdirectory.
Preferably, the master control system further comprises:
a main control resource allocation module, configured to create front and background resource subdirectories of the main control system under the names of the resource allocation subdirectories of the main control system according to respective resource occupation upper limits of front and background processes of the main control system specified in the resource allocation policy in a range of the resource occupation upper limit in the resource allocation subdirectory of the main control system; and distributing resources for the front and the back stage processes of the main control system according to the front and the back stage resource subdirectories of the main control system.
Preferably, the first resource acquiring and allocating module is specifically configured to mount the resource subsystem when the first container system is started; acquiring a resource allocation subdirectory of the first container system through the resource subsystem; acquiring resources according to the resource allocation subdirectory of the first container system; and
the other resource acquisition and distribution module is specifically used for mounting the resource subsystem when other container systems to which the other resource acquisition and distribution module belongs are started; acquiring resource allocation subdirectories of other container systems to which the resource subsystems belong through the resource subsystems; and acquiring the resources according to the resource allocation subdirectory of the other container system to which the system belongs.
Preferably, the container system starting module is further configured to send a resource occupation ratio upper limit transmission notification after the first container system is started;
the resource allocation catalog processing module is further configured to send, to the first container system, the resource allocation catalog upper limit of each of the foreground and background processes of the foreground container system specified in the resource allocation policy through the container channel after receiving the resource allocation catalog upper limit transmission notification; and
the first resource acquisition and distribution module is further used for respectively creating front and background resource subdirectories of the first container system under the distribution subdirectory names of the first container system according to the received resource proportion upper limits of the front and background processes of the front and background container systems in the range of the resource proportion upper limits in the resource distribution subdirectory of the first container system; and allocating resources for the front and background processes of the first container system according to the front and background resource subdirectories of the first container system.
Preferably, the first resource obtaining and allocating module is specifically configured to create front and background resource subdirectories of the first container system under the resource allocation subdirectory name of the first container system according to respective resource proportion upper limits of front and background processes preset in the first container system; and allocating resources for the front and background processes of the first container system according to the front and background resource subdirectories of the first container system.
Preferably, the resource allocation directory processing module is further configured to, after detecting that the first container system is switched between the background and the other container systems, update the resource occupation upper limits in the resource allocation subdirectories of the first container system and the other container system respectively switched to the background and the foreground according to the resource occupation upper limits of the background container system and the foreground container system specified in the resource allocation policy.
Preferably, the resource allocation catalog processing module is further configured to determine resource occupation upper limits of the first container system and the one other container system respectively switched to the background and the foreground according to respective resource occupation upper limits of the background container system and the foreground container system specified in the resource allocation policy after detecting that the first container system and the one other container system are switched between the background and the foreground, and send the resource occupation upper limits to the first container system and the one other container system through the container channel respectively; and
the first resource acquisition and distribution module is further used for updating the resource proportion upper limit in the resource distribution subdirectory of the first container system according to the received resource proportion upper limit of the first container system switched to the background;
the other resource acquisition and distribution module is also used for updating the resource proportion upper limit in the resource distribution subdirectory of the other container system to which the other container system belongs according to the received resource proportion upper limit of the other container system to which the other container system is switched to the foreground.
In the embodiment of the invention, according to the resource allocation strategy, the main control system, the container system in the foreground and at least one container system in the background all have respective resource proportion upper limits, and each system can acquire and use software and hardware resources of the terminal equipment in the range of the respective resource proportion upper limits, so that each system can be ensured to be in a running state, and a certain system can be prevented from occupying the resource share of other systems, for example, the container system in the background can be prevented from occupying the resource share of the container system in the foreground; therefore, the system can not delay each system to process each task, and can also ensure that the container system at the foreground can obtain enough resources to ensure that the interaction with the user is not influenced, thereby bringing convenience to the user and improving the experience of the user.
Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
The foregoing and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
fig. 1 is a schematic frame diagram of an internal structure of a terminal device according to an embodiment of the present invention;
fig. 2a, 2b and 2c are schematic flow diagrams of three multi-system resource scheduling methods according to embodiments of the present invention, respectively;
fig. 3 is a schematic diagram of an example of a resource allocation directory of multiple systems in a terminal device according to an embodiment of the present invention;
fig. 4 is a schematic frame diagram of an internal structure of a multi-system resource scheduling apparatus according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, 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 illustrative only and should not be construed as limiting the invention.
As used herein, the singular forms "a", "an", "the" 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.
It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
As will be appreciated by those skilled in the art, a "terminal" as used herein includes both devices having a wireless signal receiver, which are devices having only a wireless signal receiver without transmit capability, and devices having receive and transmit hardware, which have devices having receive and transmit hardware capable of two-way communication over a two-way communication link. Such a device may include: a cellular or other communication device having a single line display or a multi-line display or a cellular or other communication device without a multi-line display; PCS (Personal Communications Service), which may combine voice, data processing, facsimile and/or data communication capabilities; a PDA (Personal Digital Assistant), which may include a radio frequency receiver, a pager, internet/intranet access, a web browser, a notepad, a calendar and/or a GPS (Global Positioning System) receiver; a conventional laptop and/or palmtop computer or other device having and/or including a radio frequency receiver. As used herein, a "terminal" or "terminal device" may be portable, transportable, installed in a vehicle (aeronautical, maritime, and/or land-based), or situated and/or configured to operate locally and/or in a distributed fashion at any other location(s) on earth and/or in space. As used herein, a "terminal Device" may also be a communication terminal, a web terminal, a music/video playing terminal, such as a PDA, an MID (Mobile Internet Device) and/or a Mobile phone with music/video playing function, or a smart tv, a set-top box, etc.
In the embodiment of the invention, the terminal equipment is provided with the main control system and at least two container systems, and a resource allocation strategy is preset. When the master control system is started, according to the respective resource proportion upper limits of the master control system, the foreground container system and the background container system specified in the preset resource allocation strategy, creating a resource allocation directory comprising respective resource allocation subdirectories of the master control system, the first container system in the foreground and at least one other container system in the background; the main control system starts the first container system and at least one other container system; and the first container system and each other container system after starting acquire resources according to the respective resource allocation subdirectory. It can be seen that, in the embodiment of the present invention, according to the resource allocation policy, the main control system, the container system in the foreground, and the at least one other container system in the background all have respective resource occupation upper limits, and each system can obtain and use software and hardware resources of the terminal device within the respective resource occupation upper limits, so that each system can be ensured to be in a runnable state, and a certain system can be prevented from occupying resource shares of other systems, for example, other container systems in the background can be prevented from occupying resource shares of the container system in the foreground; therefore, the system can not delay each system to process each task, and can also ensure that the container system at the foreground can obtain enough resources to ensure that the interaction with the user is not influenced, thereby bringing convenience to the user and improving the experience of the user.
The technical solution of the embodiments of the present invention is specifically described below with reference to the accompanying drawings.
A frame schematic diagram of an internal structure of a terminal device according to an embodiment of the present invention is shown in fig. 1, and includes: a master control system and more than two container systems.
Wherein the two or more container systems comprise a first container system, a second container system, … …, and an Nth container system. N is a positive integer of 2 or more.
The container system in the embodiment of the present invention is an operating system provided in a container created by the Linux container virtualization technology. The operating system may be a Linux operating system or a Unix operating system in the conventional sense, an Android system or an Ubuntu system derived from the Linux operating system, or a Windows system based on a Windows platform. In fact, the container system of the present invention is not limited to the aforementioned exemplary operating systems, and may cover all operating systems capable of operating in a container. For convenience of description, the technical solution of the present invention is described below by taking an Android system as a container system as an example.
The master control system may be the above-mentioned conventional operating system, or may be an operating system obtained by modifying the conventional operating system. The kernel is a kernel, or an enhanced kernel obtained after a functional module is added on the basis of the kernel. Preferably, the master control system may include a kernel; the container system calls or accesses the kernel through the master control system to realize various functions. Or the container system and the master control system share the kernel; the container system and the master control system comprise parts except the kernel in the existing operating system, such as parts of a framework layer and an application layer; both the container system and the master control system can independently call or access the kernel to realize various functions.
The main control system is mainly used for performing foreground and background management on a plurality of container systems, interacting with each container system and the like.
Preferably, the master control system may communicate with the container system through a container channel. Further, the container channel may be a socket channel.
The method for establishing the container channel between the main control system and the container system is described below.
The container system sends a container channel creating request to the master control system, wherein the container channel creating request comprises file descriptors corresponding to the container channel, file permissions, system identifiers of more than two operating systems allowing access to the container channel, the maximum allowed access number, identifiers of descriptors of files to be generated and the like. The two or more operating systems include a container system (that sends a container channel creation request) and an operating system that the container system expects to interact with.
After receiving a container channel creation request of the container system, the master control system creates a pair of socket file descriptors (socket pair) and a container channel connecting the pair of file descriptors, and names the pair of file descriptors. And recording the file authority, the system identification allowed to be accessed, the maximum access number allowed and the identification of the descriptor of the file to be generated in the container channel creating request into the created container channel.
The master control system registers the container channel and its identifier and a pair of file descriptors, and a system identifier allowing access to the container channel in an NSS (domain Space Server) virtual device of the kernel. The master control system and the kernel correspondingly record the registered container channel, the identification and file descriptor pair thereof and the system identification allowing the container channel to be accessed.
The NSS of the kernel returns the identification of the container channel to the container system, along with the system identifications that allow access to the container channel. And respectively returning the identifier of the container channel and each system identifier allowing to access the container channel to the operating system corresponding to each system identifier.
The container system acquires one file descriptor in the file descriptor pair of the container channel from the NSS according to the acquired identifier of the container channel.
After receiving the request of the main control system for acquiring the container channel, the main control system finds out the identifier of the registered container channel and returns the identifier to the main control system.
After acquiring the identifier of the container channel, the master control system sends a file descriptor acquisition request carrying the identifier of the container channel to the NSS virtual device in the kernel.
And the NSS virtual equipment in the kernel searches out the other file descriptor in the file descriptor pair of the container channel from the registered container channel, the identifier of the container channel and the file descriptor pair according to the identifier of the container channel in the received file descriptor acquisition request, and returns the other file descriptor. Preferably, the NSS checks whether the security information such as the system identifier, the access number, and the like of the container system that sends the file descriptor acquisition request matches with the corresponding information recorded in the container channel; if the verification result is consistent, the identifier of the container channel in the request is obtained according to the received file descriptor, and the other file descriptor in the file descriptor pair of the container channel is found out from the registered container channel, the identifier of the container channel and the file descriptor pair, and is returned to the master control system.
Equivalently, one file descriptor in a pair of file descriptors connecting two ends of the container channel is returned to the container system, and the other file descriptor is returned to the process of the master control system.
And after the master control system acquires the other file descriptor returned by the kernel, the establishment of the container channel between the master control system and the container system is finished. The master control system may communicate with the container system that owns a file descriptor of the container channel to which the another file descriptor belongs, through the another file descriptor.
Preferably, for a pair of file descriptors, the master control system obtains the structure of the socket description file from the kernel according to one file descriptor returned to one container system, associates the structure with the one file descriptor, and records the structure in the container channel. The container channel is then registered into the NSS virtual device of the kernel.
After receiving a file descriptor acquisition request of a process of a main control system, NSS virtual equipment in a kernel queries an unused file descriptor in the process of the main control system, associates the unused file descriptor with a file structure of a socket description file stored in a container channel, and returns the associated file descriptor to the process of the main control system. At this time, the associated file descriptor is equivalent to another file descriptor in the file descriptors of the same container channel.
The terminal equipment in the embodiment of the invention is preset with a resource scheduling strategy. The resource scheduling policy defines respective resource occupation upper limits of the main control system, the foreground container system and the background container system. The resource in the embodiment of the present invention may include at least one of the following: processor resources, memory resources, non-volatile memory resources, data transfer bus bandwidth resources, and the like.
Preferably, in the embodiment of the present invention, a main control system, a container system in the foreground, and at least one other container system in the background may be configured in the terminal device.
For example, when there is one other container system in the background, the resource occupancy upper limits of the master system, the container system in the foreground, and the other container system in the background specified in the resource scheduling policy are 30%, 50%, and 20%, respectively.
When the number of the other container systems in the background is more than two, the resource scheduling policy specifies the resource occupation upper limit of each other container system in the background.
Preferably, the resource scheduling policy may first specify the resource occupancy upper limit of the master control system and the container system in the foreground from the total resources of the terminal device, and then determine the remaining resources outside the resource occupancy upper limit of the master control system and the container system in the foreground, and specify the resource occupancy upper limit of each of the other container systems in the background within the range of the remaining resources. And the resource proportion upper limit of each other container system in the background is not less than the minimum resource required by the other container systems to maintain running.
Further, the average resource required by the continuous operation of each other container system in the background is determined, and the resource proportion upper limit and the like of each other container system in the background are specified by taking the average resource as a unit from the residual resources. For example, when there are two other container systems in the background, the resource ratio upper limits of the master control system, the container system in the foreground, the container system a in the background, and the container system B in the background specified in the resource scheduling policy are 30%, 50%, 10%, and 10%, respectively.
Therefore, the resource scheduling strategy and the subsequent resource scheduling method of the multi-system based on the resource scheduling strategy in the embodiment of the invention are suitable for application scenes of a plurality of other container systems in the background.
For convenience of understanding, a method for scheduling resources of multiple systems according to an embodiment of the present invention is described below by taking a main control system, a first container system in a foreground, and a second container system in a background (i.e., one other container system in the background) as an example, where a flowchart of the method is shown in fig. 2a, and includes the following steps:
s201: when the master control system is started, according to the resource proportion upper limit of each of the master control system, the foreground container system and the background container system specified in the preset resource allocation strategy, a resource allocation directory including resource allocation subdirectories of the master control system, the first container system in the foreground and the second container system in the background is created.
And when the master control system is started, mounting the resource subsystem. For example, when the master control system starts up and needs to allocate processor resources of the master control system, the first container system and the second container system, the processor resource subsystem in the Cgroup of the kernel is acquired and mounted.
The main control system creates a resource allocation directory comprising resource allocation subdirectories of the main control system, a first container system in the foreground and a second container system in the background through the resource subsystem according to respective resource proportion upper limits of the main control system, the foreground container system and the background container system specified in a preset resource allocation strategy.
Preferably, the master control system creates a multi-system resource allocation directory through the resource subsystem.
The master control system creates a resource allocation subdirectory of the master control system under the name of the resource allocation directory through the resource subsystem; in the specified file of the resource allocation subdirectory of the main control system, the resource occupation ratio upper limit of the main control system and/or the numerical value related to the resource occupation ratio upper limit specified by the resource allocation strategy are set.
The main control system creates a resource allocation subdirectory of a first container system in the foreground through a resource subsystem; in a designated file of the resource allocation subdirectory of the first container system, a resource occupation upper limit of the foreground container system and/or a numerical value related to the resource occupation upper limit specified by the resource allocation policy are set.
The master control system creates a resource allocation subdirectory of a second container system in the background through the resource subsystem; and setting a resource proportion upper limit of the background container system and/or a numerical value related to the resource proportion upper limit specified by the resource allocation strategy in a specified file of the resource allocation subdirectory of the second container system.
For example, when the resource is specifically a processor resource, in a specified file cpu.shares in a processor resource allocation subdirectory of the master control system, a numerical value associated with a resource occupation ratio upper limit of the master control system specified by the resource allocation policy is set to be 614; in a designated file cpu.shares in a processor resource allocation subdirectory of a first container system, setting a value associated with a resource occupation ratio upper limit of a main control system specified by a resource allocation strategy as 1024; shares in a designated file cpu in a processor resource allocation subdirectory of the second container system, a numerical value associated with a resource occupation ratio upper limit of the main control system specified by the resource allocation policy is set as 410. The numerical value of the total processor resource of the terminal equipment of the embodiment of the invention is represented as the sum 2048 of 614, 1024 and 410; the processor resource allocation upper limits of the master control system, the first container system in the foreground, and the second container system in the background are about 614/2048-30%, 1024/2048-50%, and 410/2048-20%, respectively.
Preferably, the master control system stores the created resource allocation directory including the resource allocation subdirectories of the respective systems in the master control system or the kernel for the respective container systems to acquire.
Preferably, the master control system creates the front and background resource subdirectories of the master control system under the names of the resource allocation subdirectories thereof according to the respective resource occupation upper limits of the front and background processes of the master control system specified in the resource allocation strategy within the range of the resource occupation upper limit in the resource allocation subdirectories thereof.
The main control system distributes resources for the front and the back stage processes according to the front and the back stage resource subdirectories respectively.
Specifically, the master control system creates a foreground resource subdirectory of the master control system under the name of a resource allocation subdirectory of the master control system through a resource subsystem; in the range of the resource occupation upper limit in the resource allocation subdirectory, the resource occupation upper limit of the foreground process of the main control system specified in the resource allocation strategy and/or the numerical value related to the resource occupation upper limit are set in the specified file of the foreground resource subdirectory of the main control system.
The master control system creates a background resource subdirectory of the master control system under the name of the resource allocation subdirectory through the resource subsystem; in the range of the resource ratio upper limit in the resource allocation subdirectory, the resource ratio upper limit of the background process of the main control system and/or the numerical value related to the resource ratio upper limit specified in the resource allocation strategy are set in the specified file of the background resource subdirectory of the main control system.
The main control system distributes resources for the foreground process and the background process of the main control system according to the resource occupation upper limit in the foreground resource subdirectory and the background resource subdirectory and/or the numerical value associated with the resource occupation upper limit.
For example, the resource is specifically a processor resource, the upper limit of the processor resource occupation ratio of the front and the background processes of the main control system specified in the resource allocation policy is 60% and 40%, respectively, and the upper limit of the resource occupation ratio in the processor resource allocation subdirectory of the main control system is 30%; the upper limit of the processor resource ratio is set to 30% × 60% >, 18%, and 30% × 40% >, 12% respectively in the designated files of the front and back resource subdirectories of the main control system. The main control system distributes processor resources for a foreground process and a background process of the main control system according to the upper limit of the processor resource occupation ratio of 18 percent and 12 percent respectively.
S202: the master control system starts the first and second container systems.
Preferably, after the master control system starts the first container system, the resource occupation upper limits of the front and background processes of the background container system specified in the resource allocation policy are sent to the first container system through the container channel.
And after the master control system starts the second container system, sending the resource ratio upper limits of the front and background processes of the background container system specified in the resource allocation strategy to the second container system through the container channel.
S203: and the first container system and the second container system after starting acquire resources according to respective resource allocation subdirectories.
And when the first container system and the second container system are started, respectively acquiring the resource subsystems from the kernel, and mounting the acquired resource subsystems.
The first and second container systems obtain respective resource allocation subdirectories through the resource subsystem.
The first and second container systems respectively obtain resources according to their respective resource allocation subdirectories.
Preferably, the first and second container systems may use a variety of methods to allocate resources for their foreground and background processes.
A method for a container system to allocate resources for a front and a back stage process thereof comprises the following steps: after the first container system receives the resource occupation upper limits of the front and the background processes of the background container system specified in the resource allocation strategy sent by the master control system through the container channel, in the range of the resource occupation upper limits in the resource allocation subdirectory of the first container system, the front and the background resource subdirectories of the first container system are respectively created under the names of the resource allocation subdirectories according to the received resource occupation upper limits of the front and the background processes of the background container system.
And the first container system allocates resources for the front and the background processes according to the front and the background resource subdirectories.
Specifically, the first container system creates a foreground resource subdirectory of the first container system under the name of a resource allocation subdirectory of the first container system through a resource subsystem; in the range of the resource occupation upper limit in the resource allocation subdirectory, the resource occupation upper limit of the foreground process of the foreground container system specified in the resource allocation strategy and/or the numerical value related to the resource occupation upper limit are set in the specified file of the foreground resource subdirectory of the first container system.
The first container system creates a background resource subdirectory of the first container system under the name of a resource allocation subdirectory of the first container system through a resource subsystem; in the range of the resource occupation upper limit in the resource allocation subdirectory, the resource occupation upper limit of the background process of the foreground container system specified in the resource allocation strategy and/or the numerical value related to the resource occupation upper limit are set in the specified file of the background resource subdirectory of the first container system.
The first container system distributes resources for the foreground process and the background process of the first container system according to the resource occupation upper limit in the foreground resource subdirectory and the background resource subdirectory and/or the numerical value associated with the resource occupation upper limit.
For example, the resource is specifically a processor resource, the respective processor resource occupation upper limits of the front and back processes of the front container system specified in the resource allocation policy are 70% and 30%, respectively, and the resource occupation upper limit in the processor resource allocation subdirectory of the front container system is 50%; then, in the designated files of the front and back-end resource subdirectories of the first container system, the upper limit of the processor resource ratio is set to 50% × 70% >, 35%, 50% × 30% >, 15%, respectively. The first container system allocates processor resources for the foreground process and the background process of the first container system according to the processor resource occupation upper limits of 35% and 15% respectively.
Similarly, the second container system may allocate resources for the foreground and background processes of the second container system according to the method.
For example, the resource is specifically a processor resource, the respective upper limits of the processor resource occupation ratios of the front and the background processes of the background container system specified in the resource allocation policy are respectively 80% and 20%, and the upper limit of the resource occupation ratio in the processor resource allocation subdirectory of the background container system is 20%; then, in the designated files of the front and back-end resource subdirectories of the second container system, the upper limit of the processor resource ratio is set to 20% × 80% >, 16%, 20% × 20% >, 4%, respectively. And the second container system allocates processor resources for the foreground process and the background process of the second container system according to the 16 percent and 4 percent of processor resource occupation ratio upper limit respectively.
In addition, it should be noted that, in this step, the resource occupation rate upper limits of the foreground process and the background process of the first container system in the foreground are higher than the resource occupation rate upper limits of the foreground process and the background process of the second container system in the background. However, this is not essential. Those skilled in the art can reasonably determine the resource ratio upper limit of each system and its foreground and background processes according to historical data, empirical data, experimental data, and/or actual conditions, etc., so as to meet various needs of users.
Another method for allocating resources to the front and the back processes by the container system comprises the following steps: the first container system respectively creates front and background resource subdirectories of the first container system under the name of a resource allocation subdirectory thereof according to respective resource proportion upper limits of the front and background processes preset therein; the first container system allocates resources for the front and background processes according to the front and background resource subdirectories respectively.
Specifically, the first container system creates a foreground resource subdirectory of the first container system under the name of a resource allocation subdirectory of the first container system through a resource subsystem; in the range of the resource occupation upper limit in the resource allocation subdirectory, the resource occupation upper limit of the foreground process preset in the first container system and/or the numerical value associated with the resource occupation upper limit are set in the specified file of the foreground resource subdirectory of the first container system.
The first container system creates a background resource subdirectory of the first container system under the name of a resource allocation subdirectory of the first container system through a resource subsystem; in the range of the resource ratio upper limit in the resource allocation subdirectory, the resource ratio upper limit of the background process preset in the first container system and/or the numerical value associated with the resource ratio upper limit are set in the designated file of the background resource subdirectory of the first container system.
The first container system distributes resources for the foreground process and the background process of the first container system according to the resource occupation upper limit in the foreground resource subdirectory and the background resource subdirectory and/or the numerical value associated with the resource occupation upper limit.
Similarly, the second container system respectively creates front and background resource subdirectories of the second container system under the names of the resource allocation subdirectories according to the respective resource proportion upper limits of the front and background processes preset in the second container system; and the second container system distributes resources for the front and the background processes according to the front and the background resource subdirectories respectively.
It is easy to understand that the method for allocating resources to the foreground and background processes by the container system is more suitable for application scenarios in which the container system does not have (preset) the resource occupation upper limit of the foreground and background processes, or has higher security requirements although the container system has the resource occupation upper limit of the foreground and background processes; for example, the resource occupation upper limit of the foreground and background processes of the container system may be tampered with by a malicious program, and a file where the resource occupation upper limit of the foreground and background processes of the container system is attached by the malicious program.
In practical operation, for the above steps S201 and S202, step S201 may be executed first and then step S202 may be executed, step S202 may be executed first and then step S201 may be executed, or step S201 and step S202 may be executed simultaneously.
In fact, through the flow of the above steps S201 to S203, a schematic diagram of an example of the resource allocation directory of multiple systems in the terminal device in the embodiment of the present invention is shown in fig. 3, and the resource allocation directory is in a tree structure, and is located at a root node, and has resource allocation subdirectories of the master control system, the first container system in the foreground, and the second container system in the background; a foreground resource subdirectory and a background resource subdirectory of the master control system are arranged under the resource allocation subdirectory name of the master control system; a foreground resource subdirectory and a background resource subdirectory of the first system are arranged under the name of the resource allocation subdirectory of the first system; the resource allocation subdirectory of the second system is provided with a foreground resource subdirectory and a background resource subdirectory of the second system.
The other method for distributing resources for the foreground and background processes by the container system is more suitable for application scenarios in which the container system has the resource occupation upper limit of the foreground and background processes and has lower security requirements.
In fact, an embodiment of the present invention further provides a method for scheduling resources of multiple systems suitable for foreground and background switching of a container system, where a flowchart of the method is shown in fig. 2b, and on the basis of the above steps S201 to S203, the following steps are added:
s204: and the master control system updates the resource allocation subdirectories of the first container system and the second container system which are respectively switched to the background and the foreground according to the resource allocation strategy.
And after the main control system detects that the first container system and the second container system are switched between the front stage and the back stage, updating the resource occupation upper limits in the resource allocation subdirectories of the first container system and the second container system respectively switched to the back stage and the front stage according to the respective resource occupation upper limits of the back stage container system and the front stage container system specified in the resource allocation strategy.
Specifically, after detecting that the first container system is switched to the background and the second container system is switched to the foreground, the main control system updates the resource proportion upper limit and/or the numerical value associated with the resource proportion upper limit in the specified file of the resource allocation subdirectory of the first container system to the resource proportion upper limit and/or the numerical value associated with the resource proportion upper limit of the background container system specified in the resource allocation strategy; and updating the resource occupation upper limit and/or the numerical value associated with the resource occupation upper limit in the specified file of the resource allocation subdirectory of the second container system into the resource occupation upper limit and/or the numerical value associated with the resource occupation upper limit of the foreground container system specified in the resource allocation strategy.
S205: and respectively switching to the first container system and the second container system of the background and the foreground, and respectively acquiring resources according to the updated resource allocation subdirectories.
And respectively switching to the first container system and the second container system of the background and the foreground, respectively acquiring the resource subsystems from the kernel, and mounting the acquired resource subsystems.
And respectively switching to the first container system and the second container system of the background and the foreground to obtain the updated resource allocation subdirectories through the resource subsystems.
And respectively switching to the first container system and the second container system of the background and the foreground to acquire resources according to the updated resource allocation subdirectories.
Preferably, the main control system updates the resource proportion upper limit and/or the numerical value associated with the resource proportion upper limit in the specified file of the resource allocation subdirectory of the first container system switched to the background to the resource proportion upper limit and/or the numerical value associated with the resource proportion upper limit of the background container system specified by the resource allocation policy through the resource subsystem.
And the main control system updates the resource occupation upper limit and/or the numerical value associated with the resource occupation upper limit in the specified file of the resource allocation subdirectory of the second container system switched to the foreground into the resource occupation upper limit and/or the numerical value associated with the resource occupation upper limit of the foreground container system specified by the resource allocation strategy through the resource subsystem.
Preferably, the first container system is switched to the background, and the foreground resource subdirectory and the background resource subdirectory of the first container system under the name of the resource allocation subdirectory of the first container system are updated according to the respective resource occupation upper limits of the front and background processes of the background container system or the respective resource occupation upper limits of the front and background processes preset in the first container system, which are specified in the resource allocation strategy, in the range of the resource occupation upper limit in the updated resource allocation subdirectory of the first container system.
And the first container system switched to the background allocates resources for the front and background processes according to the updated front and background resource subdirectories.
Further, the first container system switched to the background updates the resource occupation upper limit of the foreground process in the specified file of the foreground resource subdirectory of the first container system and/or the numerical value associated with the resource occupation upper limit to the resource occupation upper limit of the foreground process of the background container system and/or the numerical value associated with the resource occupation upper limit specified in the resource allocation strategy in the range of the resource occupation upper limit in the resource allocation subdirectory updated by the resource subsystem.
And the first container system switched to the background updates the resource occupation upper limit of the background process in the specified file of the background resource subdirectory of the first container system and/or the numerical value associated with the resource occupation upper limit into the resource occupation upper limit of the background process of the background container system and/or the numerical value associated with the resource occupation upper limit specified in the resource allocation strategy in the range of the resource occupation upper limit in the resource allocation subdirectory updated by the first container system through the resource subsystem.
And the first container system switched to the background allocates resources for the foreground process and the background process of the first container system switched to the background according to the updated resource occupation upper limit in the foreground resource subdirectory and the background resource subdirectory and/or the value associated with the resource occupation upper limit.
For example, the resource is specifically a processor resource, the respective upper limits of the processor resource occupation ratios of the front and the background processes of the background container system specified in the resource allocation policy are respectively 80% and 20%, and the upper limit of the resource occupation ratio in the processor resource allocation subdirectory of the background container system is 20%; the processor resource in the designated file of the updated front and background resource subdirectories of the first container system switched to the background is updated to 20% × 80% ═ 16%, and 20% × 20% ═ 4%, respectively. And the first container system switched to the background allocates processor resources for the foreground process and the background process of the first container system switched to the background according to the processor resource occupation upper limits of 16% and 4% respectively.
Similarly, the resource allocation subdirectory, the foreground resource subdirectory, and the resource proportion upper limit and/or the resource proportion upper limit associated numerical value in the background resource subdirectory of the second container system switched to the foreground can be updated.
In real time, the resource proportion upper limit of the first container system and the foreground and background processes switched to the background is consistent with the resource proportion upper limit of the second container system and the foreground and background processes when the second container system and the foreground and background processes are in the background; the resource ratio upper limit of the second container system and the foreground and background processes switched to the foreground is consistent with the resource ratio upper limit of the first container system and the foreground and background processes when the first container system and the foreground and background processes are in the foreground.
The embodiment of the present invention further provides another resource scheduling method for multiple systems suitable for switching between a front and a back of a container system, and a flowchart of the method is shown in fig. 2c, where on the basis of the above steps S201 to S203, the following steps are added:
s211: and the main control system determines the resource ratio upper limits of the first container system and the second container system which are respectively switched to the background and the background according to the resource allocation strategy, and respectively sends the resource ratio upper limits to the first container system and the second container system.
Specifically, after detecting that the first container system is switched to the background and the second container system is switched to the foreground, the main control system determines values associated with the resource ratio upper limit and/or the resource ratio upper limit of the first container system switched to the background and the resource ratio upper limit and/or the resource ratio upper limit of the second container system switched to the foreground according to the resource ratio upper limits of the background container system and the foreground container system specified in the resource allocation policy.
And the main control system sends the determined resource occupation ratio upper limit and/or the numerical value related to the resource occupation ratio upper limit of the first container system switched to the background to the first container system through a container channel between the main control system and the first container system.
Preferably, the main control system sends the determined foreground process of the first container system switched to the background, and the resource occupation ratio upper limit of the background process and/or the numerical value associated with the resource occupation ratio upper limit to the first container system through a container channel between the main control system and the first container system.
And the main control system sends the determined resource occupation ratio upper limit and/or the numerical value related to the resource occupation ratio upper limit of the second container system switched to the foreground to the second container system through a container channel between the main control system and the second container system.
Preferably, the main control system sends the determined foreground process of the second container system switched to the foreground and the resource occupation ratio upper limit and/or the value associated with the resource occupation ratio upper limit of the background process to the second container system through a container channel between the main control system and the second container system.
S212: and respectively switching to the first container system and the second container system of the background and the background to update the respective resource allocation subdirectories according to the respective received resource ratio upper limit.
And after the first container system switched to the background receives the resource proportion upper limit and/or the numerical value associated with the resource proportion upper limit of the first container system sent by the main control system through the container channel, updating the resource proportion upper limit and/or the numerical value associated with the resource proportion upper limit in the specified file of the resource allocation catalog of the first container system according to the received resource proportion upper limit and/or the numerical value associated with the resource proportion upper limit.
Preferably, after the first container system switched to the background receives the values associated with the resource occupation upper limit and/or the resource occupation upper limit of the foreground process and the resource occupation upper limit of the background process sent by the main control system through the container channel, the values associated with the resource occupation upper limit and/or the resource occupation upper limit in the specified file of the foreground resource subdirectory and the background resource subdirectory of the first container system are updated.
And after the second container system switched to the foreground receives the resource ratio upper limit and/or the numerical value associated with the resource ratio upper limit of the second container system sent by the main control system through the container channel, updating the resource ratio upper limit and/or the numerical value associated with the resource ratio upper limit in the specified file of the resource allocation catalog of the second container system according to the received resource ratio upper limit and/or the numerical value associated with the resource ratio upper limit.
Preferably, after the second container system switched to the foreground receives the values, which are sent by the master control system, of the foreground process of the second container system and associated with the resource occupation upper limit and/or the resource occupation upper limit of the foreground process through the container channel, the values associated with the resource occupation upper limit and/or the resource occupation upper limit in the foreground resource subdirectory and the specified file of the foreground resource subdirectory of the second container system are updated.
S213: and respectively switching to the first container system and the second container system of the background and the foreground, and respectively acquiring resources according to the updated resource allocation subdirectories.
The method in this step is consistent with the specific method in step S205, and is not described herein again.
Based on the foregoing method for scheduling resources for multiple systems, an embodiment of the present invention further provides a device for scheduling resources for multiple systems, where the device is disposed in a terminal device in the embodiment of the present invention, and a schematic frame diagram of an internal structure of the device is shown in fig. 4, where the method includes: a master control system, a first container system, and at least one other container system.
Wherein, master control system includes: a resource allocation directory processing module 401 and a container system startup module 402.
The resource allocation directory processing module 401 is configured to, when the master control system is started, create a resource allocation directory that includes resource allocation subdirectories of the master control system, the first container system in the foreground, and the at least one other container system in the background, according to resource occupation upper limits of the master control system, the foreground container system, and the background container system, which are specified in a preset resource allocation policy.
The container system activation module 402 is used to activate a first container system and at least one other container system.
The first container system includes:
the first resource obtaining and allocating module 411 is configured to obtain resources according to the resource allocation subdirectory of the first container system.
Each of the other container systems includes:
the other resource acquiring and allocating module 421 is configured to acquire resources according to the resource allocation subdirectory of the other container system to which the other resource acquiring and allocating module 421 belongs.
Preferably, the resource allocation directory processing module 401 is specifically configured to mount the resource subsystem when the master control system is started; and creating a resource allocation directory comprising respective resource allocation subdirectories of the main control system, the first container system in the foreground and each other container system in the background through the resource subsystem according to respective resource proportion upper limits of the main control system, the foreground container system and the background container system specified in a preset resource allocation strategy.
Preferably, the resource allocation directory processing module 401 is specifically configured to create resource allocation subdirectories of the master control system, the first container system, and other container systems, and set resource occupation upper limits of the master control system, the foreground container system, and the background container system, which are specified by the resource allocation policy, in an assigned file of each resource allocation subdirectory.
Preferably, as shown in fig. 4, the master control system in the embodiment of the present invention further includes:
the main control resource allocation module 403 is configured to create front and background resource subdirectories of the main control system under the resource allocation subdirectory name of the main control system according to respective resource occupation upper limits of front and background processes of the main control system specified in the resource allocation policy in the range of the resource occupation upper limit in the resource allocation subdirectory of the main control system; and distributing resources for the front and the back stage processes of the main control system according to the front and the back stage resource subdirectories of the main control system.
Preferably, the first resource obtaining and allocating module 411 is specifically configured to mount the resource subsystem when the first container system is started; acquiring a resource allocation subdirectory of the first container system through a resource subsystem; the resources are acquired according to the resource allocation subdirectory of the first container system.
The other resource obtaining and allocating module 421 is specifically configured to mount the resource subsystem when the other container system to which the other resource obtaining and allocating module belongs is started; acquiring resource allocation subdirectories of other container systems to which the resource subsystems belong through the resource subsystems; and acquiring the resources according to the resource allocation subdirectory of the other container system to which the system belongs.
Preferably, the container system starting module 402 is further configured to send the resource occupation ratio upper limit transmission notification after the first container system is started.
The resource allocation catalog processing module 401 is further configured to send, after receiving the resource allocation upper limit transmission notification, the resource allocation catalog upper limit of each of the foreground and background processes of the foreground container system specified in the resource allocation policy to the first container system through the container channel.
The first resource obtaining and allocating module 411 is further configured to, within the range of the resource proportion upper limit in the resource allocation subdirectory of the first container system, respectively create front and background resource subdirectories of the first container system under the allocation subdirectory name of the first container system according to the received resource proportion upper limit of the front and background processes of the front and background container systems; and allocating resources for the front and background processes of the first container system according to the front and background resource subdirectories of the first container system.
Further, the resource allocation catalog processing module 401 is further configured to send, after receiving the resource allocation upper limit transmission notification, the resource allocation catalog upper limit of each of the foreground and background processes of the corresponding background container system specified in the resource allocation policy to each of the other container systems through the container channel.
The second resource obtaining and allocating module 421 is further configured to, within the range of the resource proportion upper limit in the resource allocation subdirectory of the other container system to which the second resource obtaining and allocating module belongs, respectively create the front and background resource subdirectories of the other container system under the allocation subdirectory names of the other container system to which the second resource obtaining and allocating module belongs according to the received respective resource proportion upper limits of the front and background processes of the corresponding background container system; and allocating resources for the front and background processes of the other container systems according to the front and background resource subdirectories of the other container systems.
Preferably, the first resource obtaining and allocating module 411 is specifically configured to respectively create front and background resource subdirectories of the first container system under the resource allocation subdirectory names of the first container system according to respective resource proportion upper limits of front and background processes preset in the first container system; and allocating resources for the front and background processes of the first container system according to the front and background resource subdirectories of the first container system.
Preferably, the second resource obtaining and allocating module 421 is specifically configured to respectively create front and background resource subdirectories of other container systems under the resource allocation subdirectory names of the other container systems to which the second resource obtaining and allocating module belongs, according to respective resource occupation upper limits of front and background processes preset in the other container systems to which the second resource obtaining and allocating module belongs; and allocating resources for the front and background processes of the other container systems according to the front and background resource subdirectories of the other container systems.
Preferably, the resource allocation directory processing module 401 is further configured to, after detecting that the first container system is switched between the background and the other container systems, update the resource occupation upper limits in the resource allocation subdirectories of the first container system and the other container system respectively switched to the background and the foreground according to the resource occupation upper limits of the background container system and the foreground container system specified in the resource allocation policy.
Preferably, the resource allocation catalog processing module 401 is further configured to determine, according to respective resource occupation upper limits of the background container system and the foreground container system specified in the resource allocation policy, resource occupation upper limits of the first container system and the one other container system respectively switched to the background and the foreground, after detecting that the first container system is switched to the other container system in the foreground and the background, and send the determined resource occupation upper limits to the first container system and the one other container system through the container channel.
And the first resource obtaining and allocating module 411 is further configured to update the resource proportion upper limit in the resource allocation subdirectory of the first container system according to the received resource proportion upper limit of the first container system switched to the background.
The second resource obtaining and allocating module 421 is further configured to update the resource occupation upper limit in the resource allocation subdirectory of the other container system to which the foreground belongs according to the received resource occupation upper limit of the other container system to which the foreground belongs.
For the above-mentioned method for implementing the functions of the resource allocation directory processing module 401, the container system starting module 402, and the main control resource allocation module 403 in the main control system, the first resource obtaining and allocating module 411 in the first container system, and the other resource obtaining and allocating modules 421 in the other container systems, reference may be made to the above-mentioned specific contents of the flow steps shown in fig. 2a, 2b, and 2c, and details thereof are not repeated here.
In the embodiment of the invention, according to the resource allocation strategy, the main control system, the container system in the foreground and at least one container system in the background all have respective resource proportion upper limits, and each system can acquire and use software and hardware resources of the terminal equipment in the range of the respective resource proportion upper limits, so that each system can be ensured to be in a running state, and a certain system can be prevented from occupying the resource share of other systems, for example, the container system in the background can be prevented from occupying the resource share of the container system in the foreground; therefore, the system can not delay each system to process each task, and can also ensure that the container system at the foreground can obtain enough resources to ensure that the interaction with the user is not influenced, thereby bringing convenience to the user and improving the experience of the user.
In addition, in the embodiment of the invention, the resources in the resource occupation upper limit range of the resource allocation subdirectory of the main control system are equivalent to the resources allocated to the main control system; the main control system can independently distribute resources to the foreground process and the background process of the main control system within the resource range allocated to the main control system according to the resource occupation ratio upper limit of the front process and the background process of the main control system specified by the resource distribution strategy. The resource occupation upper limits of the front and the background processes of the main control system in the resource allocation strategy are reasonably set, so that the processes in the main control system can be prevented from occupying the resources of the processes allocated to the container system in an crowded manner under the condition of ensuring the normal operation of the front and the background processes in the main control system; the method not only fully utilizes the resource of the upper limit range of the resource occupation of the main control system, but also enhances the safety and reliability of the process utilizing the resource of the main control system.
Furthermore, in the embodiment of the present invention, the resources in the resource occupation ratio upper limit ranges of the resource allocation subdirectories of the first container system and the at least one other container system respectively located in the foreground and the background are equivalent to the resources allocated to the first container system and each other container system located in the foreground and the background respectively; the first container system and each other container system respectively in the foreground and the background can respectively and independently perform resource allocation on the respective foreground process and the respective background process in the resource allocation range according to the resource occupation upper limit of the respective foreground process and the respective background process specified by the resource allocation strategy. The resource occupation upper limits of the respective front and background processes of the foreground container system and the background container system in the resource allocation strategy are reasonably set, so that the process in one container system can be prevented from occupying the resources of the processes allocated to the main control system and the other container system in an crowded manner under the condition that the front and background processes in the first container system in the foreground and the background and the front and background processes in the other container systems are ensured to run normally; the method not only fully utilizes the resource of the resource proportion upper limit range of each container system, but also enhances the safety and reliability of the process utilizing the resource of the container system to which the process belongs.
In addition, in the embodiment of the present invention, after detecting that the foreground and background states of the first container system are switched to the other container system, the resource proportion upper limit in the resource allocation subdirectory of the first container system and the other container system respectively switched to the background and the foreground may be updated, which is equivalent to updating the resource range allocated to the first container system and the other container system switched to the background and the foreground. Moreover, the resource occupation upper limits in the foreground resource subdirectory and the background resource subdirectory of the first container system and the other container system respectively switched to the background and the foreground can be updated, which is equivalent to updating the resource ranges allocated to the foreground process and the background process of the first container system and the other container system respectively switched to the background and the foreground. By utilizing the embodiment of the invention, the allocated (acquirable) resource range of each container system for switching the foreground and background states and the allocated resource range of the foreground and background processes in the container system can be automatically adjusted under the condition that the container system is switched between the foreground and background states; the method and the system ensure that the resources of the terminal equipment are fully utilized on the whole, prevent the process of each container system switching the foreground and background states from occupying the resources in the resource range of other systems, and ensure the safety and reliability of the process of each container system in resource utilization.
Those skilled in the art will appreciate that the present invention includes apparatus directed to performing one or more of the operations described in the present application. These devices may be specially designed and manufactured for the required purposes, or they may comprise known devices in general-purpose computers. These devices have stored therein computer programs that are selectively activated or reconfigured. Such a computer program may be stored in a device (e.g., computer) readable medium, including, but not limited to, any type of disk including floppy disks, hard disks, optical disks, CD-ROMs, and magnetic-optical disks, ROMs (Read-Only memories), RAMs (Random Access memories), EPROMs (Erasable Programmable Read-Only memories), EEPROMs (Electrically Erasable Programmable Read-Only memories), flash memories, magnetic cards, or optical cards, or any type of media suitable for storing electronic instructions, and each coupled to a bus. That is, a readable medium includes any medium that stores or transmits information in a form readable by a device (e.g., a computer).
It will be understood by those within the art that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented by computer program instructions. Those skilled in the art will appreciate that the computer program instructions may be implemented by a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, implement the features specified in the block or blocks of the block diagrams and/or flowchart illustrations of the present disclosure.
Those of skill in the art will appreciate that various operations, methods, steps in the processes, acts, or solutions discussed in the present application may be alternated, modified, combined, or deleted. Further, various operations, methods, steps in the flows, which have been discussed in the present application, may be interchanged, modified, rearranged, decomposed, combined, or eliminated. Further, steps, measures, schemes in the various operations, methods, procedures disclosed in the prior art and the present invention can also be alternated, changed, rearranged, decomposed, combined, or deleted.
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 method for scheduling resources of multiple systems is characterized by comprising the following steps:
when the master control system is started, according to the resource ratio upper limit of each of the master control system, the foreground container system and the background container system specified in a preset resource distribution strategy, creating a resource distribution directory comprising the resource distribution subdirectory of each of the master control system, the first container system in the foreground and at least one other container system in the background, wherein the resource ratio upper limit of the foreground container system is greater than the resource ratio upper limit of the background container system;
the master control system starts a first container system and at least one other container system;
the first container system and each other container system after starting obtain resources according to their respective resource allocation subdirectories;
the resource scheduling method of the multiple systems further comprises the following steps:
after the main control system detects that the first container system and one other container system are switched between the foreground and the background, the resource proportion upper limit of the first container system and one other container system respectively switched to the background and the foreground is updated according to the resource proportion upper limit of the background container system and the foreground container system specified in the resource allocation strategy, the resource proportion upper limit of the first container system and the foreground and background processes respectively switched to the background is consistent with the resource proportion upper limit of one other container system and the foreground and background processes when the first container system and the other container system are in the background, and the resource proportion upper limit of one other container system and the foreground and background processes switched to the foreground is consistent with the resource proportion upper limit of the first container system and the foreground and background processes when the first container system and the foreground and background processes are in the foreground.
2. The method according to claim 1, wherein when the master control system is started, creating a resource allocation directory including resource allocation subdirectories of the master control system, the first container system in the foreground, and the at least one other container system in the background according to resource occupation upper limits of the master control system, the foreground container system, and the background container system, which are specified in a preset resource allocation policy, includes:
when the master control system is started, the resource subsystem is mounted;
and creating a resource allocation directory comprising respective resource allocation subdirectories of the main control system, the first container system in the foreground and each other container system in the background according to respective resource proportion upper limits of the main control system, the foreground container system and the background container system specified in a preset resource allocation strategy through the resource subsystem.
3. The method according to claim 2, wherein the creating a resource allocation directory including resource allocation subdirectories of the master control system, the first container system in the foreground, and each of the other container systems in the background according to the resource occupation upper limit of each of the master control system, the foreground container system, and the background container system specified in the preset resource allocation policy includes:
and creating respective resource allocation subdirectories of the main control system, the first container system and other container systems, and respectively setting resource occupation upper limits of the main control system, the foreground container system and the background container system specified by the resource allocation strategy in an appointed file of each resource allocation subdirectory.
4. The method of claim 3, further comprising:
the main control system creates front and background resource subdirectories of the main control system under the names of the resource allocation subdirectories according to the resource occupation upper limits of the front and background processes of the main control system specified in the resource allocation strategy within the range of the resource occupation upper limit in the resource allocation subdirectories of the main control system;
and the master control system distributes resources for the front and the back stage processes according to the front and the back stage resource subdirectories respectively.
5. The method of claim 3, wherein the acquiring resources by the first container system and each other container system after starting according to their respective resource allocation subdirectories comprises:
when the first container system and each other container system are started, the resource subsystems are mounted respectively;
acquiring respective resource allocation subdirectories through the resource subsystems;
and respectively acquiring resources according to the respective resource allocation subdirectories.
6. The method of claim 5, wherein after the master control system initiates the first container system, further comprising:
the main control system sends the resource proportion upper limit of the front and the background processes of the foreground container system specified in the resource allocation strategy to the first container system through a container channel;
and the acquiring the resources according to the respective resource allocation subdirectory further comprises:
in the range of the resource proportion upper limit in the resource allocation subdirectory of the first container system, respectively creating a front-stage resource subdirectory and a back-stage resource subdirectory of the first container system under the resource allocation subdirectory name of the first container system according to the received resource proportion upper limit of the front-stage process and the back-stage process of the front-stage container system;
and allocating resources for the front and the background processes according to the front and the background resource subdirectories.
7. The method of claim 5, wherein the obtaining resources according to the respective resource allocation subdirectory comprises:
the first container system respectively creates front and background resource subdirectories of the first container system under the name of a resource allocation subdirectory thereof according to respective resource proportion upper limits of the front and background processes preset therein;
the first container system allocates resources for the front and background processes according to the front and background resource subdirectories respectively.
8. The method of claim 3, further comprising:
and after the main control system detects that the first container system is switched with one other container system in a foreground and a background mode, updating the resource occupation upper limits in the resource allocation subdirectories of the first container system and the other container system respectively switched to the background and the foreground according to the resource occupation upper limits of the background container system and the foreground container system specified in the resource allocation strategy.
9. The method of claim 3, further comprising:
after the main control system detects that the first container system is switched with one other container system in a foreground and a background mode, according to the resource ratio upper limit of the background container system and the resource ratio upper limit of the foreground container system specified in the resource allocation strategy, the resource ratio upper limit of the first container system and the resource ratio upper limit of the other container system which are respectively switched to the background and the foreground are determined, and the resource ratio upper limits are respectively sent to the first container system and the other container system through container channels;
and the first container system and the other container system which are switched to the background and the foreground update the resource ratio upper limit in the resource allocation subdirectory according to the received resource ratio upper limit.
10. A multisystem resource scheduling apparatus, comprising: a master control system, a first container system, and at least one other container system;
the master control system comprises:
the resource allocation catalog processing module is used for creating a resource allocation catalog comprising resource allocation subdirectories of the main control system, a first container system in a foreground and at least one other container system in the background according to respective resource allocation upper limits of the main control system, the foreground container system and a background container system specified in a preset resource allocation strategy when the main control system is started, wherein the resource allocation upper limit of the foreground container system is greater than the resource allocation upper limit of the background container system;
a container system activation module for activating a first container system and at least one other container system;
the first container system includes:
the first resource acquisition and distribution module is used for acquiring resources according to the resource distribution subdirectory of the first container system;
each of the other container systems includes:
the other resource acquisition and distribution module is used for acquiring resources according to the resource distribution subdirectory of the other container system to which the other resource acquisition and distribution module belongs;
after the main control system detects that the first container system and one other container system are switched between the foreground and the background, the resource proportion upper limit of the first container system and one other container system respectively switched to the background and the foreground is updated according to the resource proportion upper limit of the background container system and the foreground container system specified in the resource allocation strategy, the resource proportion upper limit of the first container system and the foreground and background processes respectively switched to the background is consistent with the resource proportion upper limit of one other container system and the foreground and background processes when the first container system and the other container system are in the background, and the resource proportion upper limit of one other container system and the foreground and background processes switched to the foreground is consistent with the resource proportion upper limit of the first container system and the foreground and background processes when the first container system and the foreground and background processes are in the foreground.
CN201611070446.7A 2016-11-29 2016-11-29 Multi-system resource scheduling method and device Active CN106776013B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611070446.7A CN106776013B (en) 2016-11-29 2016-11-29 Multi-system resource scheduling method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611070446.7A CN106776013B (en) 2016-11-29 2016-11-29 Multi-system resource scheduling method and device

Publications (2)

Publication Number Publication Date
CN106776013A CN106776013A (en) 2017-05-31
CN106776013B true CN106776013B (en) 2020-11-24

Family

ID=58904297

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611070446.7A Active CN106776013B (en) 2016-11-29 2016-11-29 Multi-system resource scheduling method and device

Country Status (1)

Country Link
CN (1) CN106776013B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107329829A (en) * 2017-06-28 2017-11-07 快云信息科技有限公司 A kind of Service Source management-control method for application container engine of increasing income
CN110069338B (en) * 2018-01-24 2024-03-19 中兴通讯股份有限公司 Resource control method, device and equipment and computer readable storage medium
CN111367648A (en) * 2018-12-25 2020-07-03 成都鼎桥通信技术有限公司 Resource allocation method and device
CN110311813A (en) * 2019-06-25 2019-10-08 贵阳海信网络科技有限公司 A kind of method and device of track comprehensive network management
CN114583838A (en) * 2022-05-05 2022-06-03 北京智芯微电子科技有限公司 Management method, terminal and system of power distribution network

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102053869B (en) * 2009-10-29 2013-11-06 杭州华三通信技术有限公司 Resource allocation method and device for multi-operation system
US20120017074A1 (en) * 2010-07-16 2012-01-19 International Business Machines Corporation Dynamic system mode switching
CN104268022B (en) * 2014-09-23 2017-06-27 浪潮(北京)电子信息产业有限公司 The resource allocation methods and system of process in a kind of operating system
CN104331337B (en) * 2014-11-25 2018-07-24 宇龙计算机通信科技(深圳)有限公司 Installed System Memory management method, Installed System Memory managing device and terminal

Also Published As

Publication number Publication date
CN106776013A (en) 2017-05-31

Similar Documents

Publication Publication Date Title
CN106776013B (en) Multi-system resource scheduling method and device
US8813175B2 (en) Multimodal computing device
US9351153B2 (en) Apparatus for end-user transparent utilization of computational, storage, and network capacity of mobile devices, and associated methods
CN102202289B (en) Method and system for remote calling software and hardware resources through mobile terminal
CN105046156B (en) Intelligent terminal and its equipment access right control method
CN106933648B (en) Method and system for multi-tenant container resource management
CN106776067B (en) Method and device for managing system resources in multi-container system
CN106547628B (en) Multi-system resource release method and device
CN112532632B (en) Resource allocation method and device for multi-level cloud platform and computer equipment
CN101023401A (en) Mobile terminal, resource access control system of mobile terminal, and resource access control method of mobile terminal
KR102340637B1 (en) Mobile cloud system and operating method of the same
CN103064703A (en) Staged rapid application stream transmission using on-demand
WO2015076709A1 (en) Profile integration management
CN113746777B (en) Method for safely accessing data and electronic equipment
CN105453126A (en) Application sharing service method and apparatus applied thereto
Do et al. Enforcing file system permissions on android external storage: Android file system permissions (afp) prototype and owncloud
CN106776066B (en) Multi-system function processing method and device
CN103259869A (en) Concentrated information management method based on distributed data storage
CN114996750A (en) Data sharing method and device
CN111045802A (en) Redis cluster component scheduling system and method and platform device
KR101899970B1 (en) Mobile terminal and cloud server for mobile cloud computing environment and method of mobile cloud computing using the same
CN110046510B (en) Cross-cloud data migration method, device and system
CN114979114B (en) Cloud application processing method and system
CN117331576A (en) Application pre-download method, device, computer and storage medium
KR20110104959A (en) Circuit card data protection

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
CB03 Change of inventor or designer information

Inventor after: Zou Shihong

Inventor after: Huang Haodong

Inventor after: Zhu Shaofeng

Inventor after: Xu Guoai

Inventor before: Zhu Shaofeng

CB03 Change of inventor or designer information
TR01 Transfer of patent right

Effective date of registration: 20230512

Address after: Room 401, Floor 4, No. 2, Haidian East Third Street, Haidian District, Beijing 100080

Patentee after: Yuanxin Information Technology Group Co.,Ltd.

Address before: 100176 room 2222, building D, building 33, 99 Kechuang 14th Street, Beijing Economic and Technological Development Zone, Beijing

Patentee before: YUANXIN TECHNOLOGY

TR01 Transfer of patent right