WO2017080276A1 - 资源管理方法和系统、计算机存储介质 - Google Patents

资源管理方法和系统、计算机存储介质 Download PDF

Info

Publication number
WO2017080276A1
WO2017080276A1 PCT/CN2016/095906 CN2016095906W WO2017080276A1 WO 2017080276 A1 WO2017080276 A1 WO 2017080276A1 CN 2016095906 W CN2016095906 W CN 2016095906W WO 2017080276 A1 WO2017080276 A1 WO 2017080276A1
Authority
WO
WIPO (PCT)
Prior art keywords
task
task group
tasks
group
time
Prior art date
Application number
PCT/CN2016/095906
Other languages
English (en)
French (fr)
Inventor
林庚佑
张文彦
Original Assignee
深圳市万普拉斯科技有限公司
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 深圳市万普拉斯科技有限公司 filed Critical 深圳市万普拉斯科技有限公司
Priority to EP16863454.1A priority Critical patent/EP3376381A4/en
Priority to US15/774,282 priority patent/US10467054B2/en
Publication of WO2017080276A1 publication Critical patent/WO2017080276A1/zh

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]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3234Power saving characterised by the action undertaken
    • G06F1/329Power saving characterised by the action undertaken by task scheduling
    • 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/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • 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/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • G06F9/4887Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues involving deadlines, e.g. rate based, periodic
    • 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
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Definitions

  • the present invention relates to the field of operating system technologies, and in particular, to a resource management method and system, and a computer storage medium.
  • computing devices such as smart phones, tablets, etc.
  • multi-tasking systems that is, devices can run multiple applications at the same time, one application may have one or more threads, and one thread runs on each thread.
  • tasks compete for resources, such as foreground tasks and background tasks. Background tasks can preempt the foreground task resources, sometimes hindering the running of foreground tasks.
  • the resources may be a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a memory, and the like.
  • CPU Central Processing Unit
  • GPU Graphics Processing Unit
  • memory and the like.
  • the traditional practice is to completely suspend tasks that will hinder the main task from running, but some suspended tasks need to communicate with the server in real time, such as messaging or mail services. If these tasks are completely suspended, it will result in Information cannot be promptly fed back or cause other unexpected behaviors.
  • the embodiment of the invention provides a computer storage medium, which can ensure the normal operation of the background task, and can also reduce the resource competition between the background task and the foreground task, and save resources.
  • each task of the task group is respectively entered into a waiting state.
  • a task group is created and a specific task is added to the task group according to a predetermined rule.
  • the determining the allowed running time of each task of the task group in a unit time specifically includes:
  • the determining the allowed running time of each task of the task group in a unit time specifically includes:
  • determining that the running time allowed for each task in the task group is the resource usage time quota of the task group divided by the task outside the task group and the task group The sum of the number of tasks;
  • a task determining module configured to determine a task in the task group and a preset task time corresponding to each task in the task group;
  • a first determining module configured to determine a preset corresponding to all tasks in the task group Whether the sum of time is less than a preset time threshold
  • a group time determining module configured to determine, when the sum of preset task times corresponding to all tasks in the task group is less than a preset time threshold, determining a resource usage time quota of the task group as the task The sum of the preset task times corresponding to all tasks in the group;
  • the group time determining module is further configured to: when the sum of the preset task times corresponding to all tasks in the task group is not less than a preset time threshold, determine that the resource usage time limit of the task group is The time threshold;
  • a running time determining module configured to determine a running time allowed for each task of the task group in a unit time, and a sum of the allowed running times of the tasks of the task group in a unit time is less than or equal to the The resource usage time limit of the task group;
  • the waiting module is configured to enable each task of the task group to enter a waiting state when each task of the task group is outside the corresponding running time period.
  • system further comprises:
  • a module is created, configured to establish a module, establish a task group, and add a specific task to the task group according to a predetermined rule.
  • the runtime determining module includes:
  • An obtaining unit configured to acquire a priority of a task in the task group
  • a determining unit configured to determine whether priorities of tasks in the task group are the same
  • a determining unit configured to: when the tasks in the task group have the same priority and no tasks outside the task group are being executed, determine that the running time of each task in the task group is within the unit time is The resource usage time quota of the task group is divided by the number of tasks in the task group;
  • the determining unit is further configured to: when the priorities of the tasks in the task group are different, based on priorities of the tasks in the task group, and determine each of the task groups according to a predetermined algorithm The running time allowed for the task in the unit time.
  • the obtaining unit is further configured to acquire a priority of a task outside the task group being executed and a task within the task group;
  • the determining unit is further configured to determine whether the tasks outside the task group and the tasks in the task group have the same priority
  • the determining unit is further configured to: when the tasks outside the task group have the same priority as the tasks in the task group, determine the allowed operations of each task in the task group in a unit time The time is the sum of the resource usage time of the task group divided by the sum of the tasks outside the task group and the number of tasks in the task group;
  • the determining unit is further configured to: when the tasks outside the task group are different from the priorities of the tasks in the task group, based on the tasks outside the task group and the tasks in the task group The priority level is determined, and the running time allowed for each task in the task group in a unit time is determined according to a predetermined algorithm.
  • system further comprises:
  • a second determining module configured to determine whether a task outside the task group is being executed when each task of the task group enters a waiting state
  • the running time determination is further configured to: when each task of the task group enters a waiting state, a task outside the task group is being executed, and it is determined that the task outside the task group obtains all resource usage time;
  • the hibernation module is configured to: when each task of the task group enters a waiting state, no tasks other than the task group are being executed, and the hibernation state is entered.
  • the task determining module, the first determining module, the group time determining module, the running time determining module, the waiting module, the establishing module, the obtaining unit, the determining unit, and the The determining unit, the second determining module, and the hibernation module may use a central processing unit (CPU), a digital signal processor (DSP, Digital Singnal Processor), or a programmable logic array (FPGA) when performing processing. ,Field -Programmable Gate Array) implementation.
  • CPU central processing unit
  • DSP digital signal processor
  • FPGA programmable logic array
  • the embodiment of the present invention further provides a computer storage medium, where the computer storage medium stores computer executable instructions, and the computer executable instructions are configured to perform the resource management method according to any one of the foregoing embodiments.
  • the resource management method and system, and the computer storage medium by comparing the preset task time sums corresponding to all tasks in the task group and the preset time threshold size, thereby determining the resource usage time quota of the group, according to the
  • the preset task time corresponding to each task in the group dynamically controls the resources that can be used by the tasks in the group, ensuring that the resource usage time obtained by each task in the group is within a reasonable range, and improving resource utilization efficiency. save resources.
  • each task in the group runs only in its corresponding running time period in a unit time, which can ensure the completion of the work in the group, and can reduce the competition with the task resources outside the group, and make the tasks outside the group. Have better resource efficiency.
  • entering the sleep state can reduce the power consumption of the device.
  • FIG. 1 is a schematic flow chart of a resource management method in an embodiment
  • FIG. 2 is a schematic diagram of determining a resource usage time quota of a task group in an embodiment
  • FIG. 3 is a schematic diagram showing the time when the task of the task group is running in an embodiment
  • FIG. 4 is a schematic flow chart of determining the allowed running time of each task in a task group in a unit time in one embodiment
  • FIG. 5 is a schematic diagram showing the time when the task of the task group is running in another embodiment
  • FIG. 6 is a schematic flow chart of when all tasks in a task group enter a waiting state in a unit time in one embodiment
  • FIG. 7 is a schematic diagram showing the time when a task of a task group is running in another embodiment
  • FIG. 8 is a schematic structural diagram of a resource management system in an embodiment
  • FIG. 9 is a schematic diagram showing the internal structure of a running time determining module in an embodiment.
  • a resource management method includes the following steps:
  • Step S110 determining tasks in the task group and preset task times corresponding to each task in the task group.
  • the preset task time is an upper limit of the resource usage time that can be obtained by the task in the preset task group in a unit time, that is, the running time of each task in the task group in the unit time does not exceed
  • the preset task time corresponding to all tasks in the task group can be set to be the same.
  • the unit time is 2T
  • the task time is L
  • L can be T/2, T/4, and the like.
  • each task in the task group can only use resources of L time at most.
  • T can be a shorter value of 10s (seconds), 15s, 20s, etc.
  • Resources can be CPU, GPU, memory, and so on. It can be understood that the preset task time corresponding to each task in the task group can be set according to actual needs, and is not necessarily identical.
  • the method before the step determining the tasks in the task group and the preset task time corresponding to each task in the task group, the method further includes: establishing a task group, and setting a specific one according to a predetermined rule. Tasks are added to this task group.
  • the task group is established to manage the task, and only the tasks in the task group are limited by the resource usage time quota of the task group.
  • Tasks in a task group can be background tasks that do not require interaction with the user, such as mail services, messaging, auto-save, and other background tasks. Adding certain tasks to the task group and making resource usage restrictions can ensure that the tasks in the task group are executed normally, and the tasks in the task group are prevented from being unrestricted outside the task group. Other tasks seize resources and waste resources. Understandably, other rules can be set as needed, and then specific tasks that conform to the rules are added to the task group.
  • step S120 it is determined whether the sum of the preset task times corresponding to all tasks in the task group is less than a preset time threshold. If yes, step S130 is performed, and if no, step S140 is performed.
  • the time threshold is an upper limit of the resource usage time per unit time of the preset task group.
  • the unit time, time threshold, and task time must be set according to requirements. The relationship between the three is that the unit time is greater than the time threshold, and the time threshold is greater than the task time. Comparing the sum of the preset task times and the time thresholds of all the tasks in the task group. If the sum of the preset task times corresponding to all the tasks in the task group is less than the time threshold, determining the task group in the unit time
  • the resource usage time limit is the sum of the preset task times corresponding to all tasks in the task group.
  • the task group is determined to be The resource usage time limit per unit time is the time threshold.
  • the task 20 and the task group 10 outside the task group are included.
  • the preset task time corresponding to the tasks D and E in the task group 10 is L, and the time threshold is T.
  • the tasks D and E in the task group 10 correspond to The sum of the preset task times is 2L, which is less than the preset time threshold T, and the resource usage time limit of the task group 10 is 2L.
  • the task group 10 includes tasks D, E, and F, and the preset task time corresponding to the tasks D, E, and F in the task group 10 is L, and the task group 10 is The sum of the preset task times corresponding to the tasks D, E, and F is 3L, which is greater than the time threshold T, and the resource usage time limit of the task group 10 is T. In unit time, the sum of the allowed running times of all tasks in the task group is less than or equal to the resource usage time quota of the task group.
  • Step S130 determining a resource usage time quota of the task group is a sum of preset task times corresponding to all tasks in the task group.
  • the resource usage time quota of the task group is determined by comparing the preset task time sum and the time threshold corresponding to all tasks in the task group, so as to avoid being in the task group.
  • the waste of resources caused by too few services, the resource usage time obtained by each task in the task group is controlled within a reasonable range.
  • the unit time is set to 2T and the time threshold is T
  • the preset task time corresponding to the task is T/4
  • the comparison corresponding to all tasks in the task group is not compared
  • the sum of the task time and the time threshold are used to determine the resource usage time quota of the task group, and the task can use the T time resource in 2T unit time, which may cause problems such as low resource use efficiency, and by comparison
  • the task can only use the T/4 time resource in the 2T unit time, which can improve the resource utilization efficiency.
  • Step S140 determining a resource usage time quota of the task group is the time threshold.
  • step S150 the running time allowed for each task of the task group in the unit time is determined.
  • the time is divided into consecutive multiple unit time for monitoring, and the task of the task group only has the resource usage right in a part of the time in the unit time, that is, each task in the task group is only corresponding to the task.
  • a partial time period is run, the duration of the partial time period being equal to the previously determined allowed running time.
  • the sum of the allowed running times of the tasks in the task group in the unit time is less than or equal to the resource usage time quota of the previously determined task group.
  • Step S160 in the unit time, when each task of the task group is outside the corresponding running time period, each task of the task group is respectively entered into a waiting state.
  • FIG. 3 is a schematic diagram of task execution of a task group in an embodiment.
  • the resource usage time of the task group 10 is 2L, and tasks E and F are performed.
  • the allowed running time is 2L/3, and the tasks are executed during the respective running periods of the tasks E and F.
  • Waiting state means that the task will not use any resources.
  • the sum of the running times allowed by tasks E and F is less than the resource usage time limit of task group 10 by 2L.
  • the resource usage time quota of the task group 10 is T
  • the running time allowed for the tasks E, F, and G is T/3
  • the tasks are executed during the respective running periods of the tasks E, F, and G
  • the tasks E, F, and G are respectively in a waiting state.
  • the sum of the allowed runtimes of tasks E, F, and G is equal to the resource usage time quota T of task group 10.
  • the tasks in the task group may enter the waiting state and perform the execution in a unit time. For example, in 2T unit time, all tasks in the task group first enter the waiting state, and after the T time, Performing each task according to the runtime allowed by each task in the task group, it can be understood that it is essentially the same as the resource management method of FIG.
  • the resource management method determines the resource usage time quota of the group by comparing the preset task time and the preset time threshold corresponding to all tasks in the task group, and can determine each group according to the time limit.
  • the preset task time corresponding to the task dynamically controls the resources that can be used by the tasks in the group, ensuring that the resource usage time obtained by each task in the group is within a reasonable range, improving resource utilization efficiency and saving resources.
  • each task in the group runs only in its corresponding running time period in a unit time, which can ensure the completion of the work in the group, and can reduce the competition with the task resources outside the group, and make the tasks outside the group. Have better resource efficiency.
  • the step determines the allowed running time of each task of the task group in a unit time, and specifically includes:
  • Step S410 Acquire a priority of a task in the task group.
  • the tasks in the task group can obtain resources of the resource usage time quota of the task group at most. If the task outside the task group is being executed at this time, the tasks in the task group do not need to compete with other tasks outside the task group, and the running time allowed by the tasks in the task group may be based on the priority of the task. And determined according to a predetermined algorithm. usually, Tasks with higher priority in the task group get more allowed runtime than tasks with lower priority.
  • step S420 it is determined whether the priorities of the tasks in the task group are the same. If the tasks in the task group have the same priority and no tasks outside the task group are being executed, step S430 is performed, and if no, step S440 is performed. .
  • the running time allowed for each task in the task group is the resource usage time of the task group divided by the number of tasks in the task group. If the priorities of the tasks in the task group are different, the running time allowed for each task in the task group in the unit time is determined according to the priority of the task and according to a predetermined algorithm.
  • Step S430 determining that the running time allowed for each task in the task group in the unit time is the resource usage time quota of the task group divided by the number of tasks in the task group.
  • the resource usage time quota of the task group 10 is 2L, and the task group 10 includes tasks.
  • D and task E the number of tasks is 2, then task D and task E each have a resource usage time of L; in the second 2T unit time, tasks outside the task group are being executed, assuming resources of the task group
  • the usage time limit is T, and the task group 10 includes the tasks D, E, and F, and the task D, the task E, and the task F each have a resource usage time of T/3.
  • the running time allowed by the tasks in the task group will be less than the resource usage time obtained in the embodiment.
  • Step S440 Determine, according to a predetermined algorithm, a running time allowed for each task in the task group in a unit time according to a priority level of the tasks in the task group.
  • Resource usage time of tasks within a task group can be prioritized according to tasks Low and determined according to a predetermined algorithm. For example, in 2T unit time, tasks outside the task group are being executed. It is assumed that the resource usage time limit of the task group is 2L, the task group includes tasks D and E, and the priority of task D is higher than task E. Task D can be divided into 4L/3 resource usage time, and task E is divided into 2L/3 resource usage time. When the tasks in the task group are not in the corresponding running time period, the tasks in the task group immediately enter the waiting state.
  • each task in the group runs only in its corresponding running time period in a unit time, and the resource usage time is determined according to the priority of the task in the task group, so that the task can be better run. It can ensure the completion of work within the group, and can reduce the competition with the task resources outside the group, so that the tasks outside the group have better resource utilization efficiency.
  • the step determines the allowed running time of each task of the task group in a unit time, and further includes the following steps:
  • the tasks outside the task group will compete with the tasks in the task group to form resources. Obtain the priority of the task outside the task group being executed and each task in the task group, and determine the resource usage time of each task according to the priority level. Typically, tasks with higher priority get more allowed runtime than tasks with lower priority.
  • Determining the running time allowed for each task in the task group in the unit time is the sum of the resource usage time of the task group divided by the number of tasks outside the task group and the number of tasks in the task group.
  • the running time allowed for each task in the task group is The resource usage time limit of the task group is divided by the sum of the tasks outside the task group and the number of tasks in the task group.
  • the resource usage time quota of the task group 10 is T
  • the resource usage time quota of the task group 10 is T
  • Task C outside the task group can also obtain the time T outside the resource usage time limit of the task group in the unit time.
  • the task C outside the task group can be divided into T+T/4.
  • the tasks outside the task group and the tasks in the task group may be divided into half of the task groups.
  • the resource usage time quota the resource usage time quota of the task group allowed by each task in the task group is divided by the number of tasks in the task group. For example, in a unit time, the resource usage time of the task group is T, and the task group includes tasks E, F, and G, and the tasks E, F, and G obtain a total resource usage time of T/2, and each task has a task time.
  • the resource usage time of T/6 is obtained, and the task outside the task group obtains the resource usage time of T+T/2, which is related to the task scheduler algorithm in the operating system.
  • the running time allowed by the tasks in the task group may be based on the task group.
  • Tasks within tasks and task groups are prioritized and determined according to a predetermined algorithm.
  • each task in the group runs only in its corresponding running time period in a unit time, and the resource usage time of the task is determined according to the task priority, so that the resource scheduling can be better performed, and the work is completed.
  • each task in the group is outside the corresponding running time period, each task enters a waiting state, and the allowed running time of all tasks in the group does not exceed the resource usage time quota of the group, which can ensure the group.
  • the work in the group is completed and can be reduced Less competition with task resources outside the group, making tasks outside the group more efficient.
  • the tasks of the task group are respectively entered into a waiting state, and the following includes:
  • step S610 it is determined whether there is a task outside the task group being executed when each task of the task group enters the waiting state. If yes, step S620 is performed, and if no, step S630 is performed.
  • the sleep state may be entered, wherein entering the sleep state means that the device performing the resource management method enters the sleep state and has reached the purpose of power saving. For example, as shown in FIG. 7, in the first 2T unit time, when the task E in the task group 10 runs for L time, it enters the waiting state, and before that, the task D in the task group 10 Has entered the wait state.
  • step S620 it is determined that the tasks outside the task group obtain all resource usage time.
  • step S630 the sleep state is entered.
  • the sleep state is entered, thereby reducing the power consumption of the device.
  • a resource management system includes a task determination module 810, a first determination module 820, a group time determination module 830, a runtime determination module 840, and a wait module 850.
  • the task determination module 810 is configured to determine tasks within the task group and preset task times corresponding to each task within the task group.
  • the preset task time is an upper limit of the resource usage time that can be obtained by the task in the preset task group in a unit time, that is, the running time of each task in the task group in the unit time does not exceed
  • the preset task time corresponding to all tasks in the task group can be set to be the same.
  • the unit time is 2T
  • the task time is L
  • L can be T/2, T/4, and the like.
  • each task in the task group can only use resources of L time at most.
  • T can be a shorter value of 10s (seconds), 15s, 20s, etc.
  • Resources can be CPU, GPU, memory, and so on. It can be understood that the preset task time corresponding to each task in the task group can be set according to actual needs, and is not necessarily identical.
  • the first determining module 820 is configured to determine whether a sum of preset task times corresponding to all tasks in the task group is less than a preset time threshold.
  • the time threshold is an upper limit of the resource usage time per unit time of the preset task group.
  • the unit time, time threshold, and task time must be set according to requirements. The relationship between the three is that the unit time is greater than the time threshold, and the time threshold is greater than the task time. Comparing the sum of the preset task times and the time thresholds of all the tasks in the task group. If the sum of the preset task times corresponding to all the tasks in the task group is less than the time threshold, determining the task group in the unit time
  • the resource usage time limit is the sum of the preset task times corresponding to all tasks in the task group.
  • the task group is determined to be The resource usage time limit per unit time is the time threshold.
  • the task 20 and the task group 10 outside the task group are included.
  • the preset task time corresponding to the tasks D and E in the task group 10 is L, and the time threshold is T.
  • the tasks D and E in the task group 10 correspond to The sum of the preset task times is 2L, which is less than the preset time threshold T, and the resource usage time limit of the task group 10 is 2L.
  • the task group 10 includes tasks D, E, and F, and the preset task time corresponding to the tasks D, E, and F in the task group 10 is L, and the task group 10 is The sum of the preset task times corresponding to the tasks D, E, and F is 3L, which is greater than the time threshold T, and the resource usage time limit of the task group 10 For T.
  • the sum of the allowed running times of all tasks in the task group is less than or equal to the resource usage time quota of the task group.
  • the group time determining module 830 is configured to determine that the resource usage time quota of the task group is all tasks in the task group when the sum of the preset task times corresponding to all the tasks in the task group is less than the preset time threshold. The sum of the corresponding preset task times.
  • the resource usage time quota of the task group is determined by comparing the preset task time sum and the time threshold corresponding to all the tasks in the task group, thereby avoiding waste of resources when the number of tasks in the task group is too small. , the resource usage time obtained by each task in the task group is controlled within a reasonable range.
  • the unit time is set to 2T and the time threshold is T
  • the preset task time corresponding to the task is T/4
  • the comparison corresponding to all tasks in the task group is not compared
  • the sum of the task time and the time threshold are used to determine the resource usage time quota of the task group, and the task can use the T time resource in 2T unit time, which may cause problems such as low resource use efficiency, and by comparison
  • the task can only use the T/4 time resource in the 2T unit time, which can improve the resource utilization efficiency.
  • the group time determining module 830 is further configured to determine that the resource usage time limit of the task group is the time threshold when the sum of the preset task times corresponding to all tasks in the task group is not less than a preset time threshold.
  • the runtime determination module 840 is configured to determine the allowed runtime of each task of the task group in a unit time.
  • the time is divided into consecutive multiple unit time for monitoring, and the task of the task group only has the resource usage right in a part of the time in the unit time, that is, each task in the task group is only corresponding to the task.
  • a partial time period is run, the duration of the partial time period being equal to the previously determined allowed running time.
  • the sum of the allowed running times of the tasks in the task group in the unit time is less than or equal to the resource usage time quota of the previously determined task group.
  • the waiting module 850 is configured to enable each task of the task group to enter a waiting state when each task of the task group is outside the corresponding running time period.
  • FIG. 3 is a schematic diagram of task execution of a task group in an embodiment.
  • the resource usage time of the task group 10 is 2L, and tasks E and F are performed.
  • the allowed running time is 2L/3, and the tasks are executed during the respective running periods of the tasks E and F.
  • Waiting state means that the task will not use any resources.
  • the sum of the running times allowed by tasks E and F is less than the resource usage time limit of task group 10 by 2L.
  • the resource usage time quota of task group 10 is T
  • the running time allowed for tasks E, F, and G is T/3, and the corresponding operations of tasks E, F, and G are respectively performed.
  • the task is executed, and when outside the respective corresponding running hours, the tasks E, F, and G are respectively in a waiting state.
  • the sum of the allowed runtimes of tasks E, F, and G is equal to the resource usage time quota T of task group 10.
  • the tasks in the task group may enter the waiting state and perform the execution in a unit time. For example, in 2T unit time, all tasks in the task group first enter the waiting state, and after the T time, Performing each task according to the runtime allowed by each task in the task group, it can be understood that it is essentially the same as the resource management system of FIG.
  • the resource management system further includes an establishing module.
  • a module is created, configured to create a task group, and add a specific task to the task group according to a predetermined rule.
  • the task group is established to manage the task, only the tasks in the task group, It is limited by the amount of time spent by the task group.
  • Tasks in a task group can be background tasks that do not require interaction with the user, such as mail services, messaging, auto-save, and other background tasks. Adding certain tasks to the task group and performing resource usage restrictions can ensure that the tasks in the task group are executed normally, and the tasks in the task group can be prevented from preempting resources with other tasks outside the task group without restriction. , resulting in waste of resources. Understandably, other rules can be set as needed, and then specific tasks that conform to the rules are added to the task group.
  • the resource management system determines the resource usage time quota of the group by comparing the preset task time and the preset time threshold corresponding to all tasks in the task group, and can determine each group according to the time limit.
  • the preset task time corresponding to the task dynamically controls the resources that can be used by the tasks in the group, ensuring that the resource usage time obtained by each task in the group is within a reasonable range, improving resource utilization efficiency and saving resources.
  • each task in the group runs only in its corresponding running time period in a unit time, which can ensure the completion of the work in the group, and can reduce the competition with the task resources outside the group, and make the tasks outside the group. Have better resource efficiency.
  • the runtime determination module 840 includes an acquisition unit 842, a determination unit 844, and a determination unit 846.
  • the obtaining unit 842 is configured to acquire the priority of the tasks in the task group.
  • the tasks in the task group can obtain resources of the resource usage time quota of the task group at most. If the task outside the task group is being executed at this time, the tasks in the task group do not need to compete with other tasks outside the task group, and the running time allowed by the tasks in the task group may be based on the priority of the task. And determined according to a predetermined algorithm. Typically, tasks with higher priority in the task group get more allowed runtime than tasks with lower priority.
  • the determining unit 844 is configured to determine whether the priorities of the tasks in the task group are the same.
  • the running time allowed for each task in the task group in the unit time is divided by the resource usage time quota of the task group.
  • the number of tasks in the task group. If the tasks in the task group have different priorities, the running time of each task in the task group is determined according to the priority of the task and according to a predetermined algorithm.
  • the determining unit 846 is configured to: when the tasks in the task group have the same priority and no tasks outside the task group are being executed, determine that the running time allowed for each task in the task group is the task group.
  • the resource usage time amount is divided by the number of tasks in the task group.
  • the resource usage time quota of the task group 10 is 2L, and the task group 10 includes tasks.
  • D and task E the number of tasks is 2, then task D and task E each have a resource usage time of L; in the second 2T unit time, tasks outside the task group are being executed, assuming resources of the task group
  • the usage time limit is T, and the task group 10 includes the tasks D, E, and F, and the task D, the task E, and the task F each have a resource usage time of T/3.
  • the running time allowed by the tasks in the task group will be less than the resource usage time obtained in the embodiment.
  • the determining unit 846 is further configured to: when the priorities of the tasks in the task group are different, determine the priority of the tasks in the task group based on the priority of the tasks in the task group, and determine, according to a predetermined algorithm, the tasks in the task group are allowed in the unit time. operation hours.
  • the tasks in the task group are sorted according to the priority level, and the tasks with the higher priority are ranked in front of the tasks with lower priority.
  • the resource usage time of the tasks in the task group can be determined according to the priority of the task and according to a predetermined algorithm. For example, in 2T unit time, tasks outside the task group are being executed. It is assumed that the resource usage time limit of the task group is 2L, the task group includes tasks D and E, and the priority of task D is higher than task E. Task D can be divided into 4L/3 resource usage time, and task E is divided into 2L/3 resource usage time. When the tasks in the task group are not in the corresponding running time period, the tasks in the task group immediately enter the waiting state.
  • each task in the group runs only in its corresponding running time period in a unit time, and the resource usage time is determined according to the priority of the task in the task group, so that the task can be better run. It can ensure the completion of work within the group, and can reduce the competition with the task resources outside the group, so that the tasks outside the group have better resource utilization efficiency.
  • the acquisition unit 842 is further configured to obtain the priority of tasks outside the task group being executed and tasks within the task group.
  • the tasks outside the task group will compete with the tasks in the task group to form resources. Obtain the priority of the task outside the task group being executed and each task in the task group, and determine the resource usage time of each task according to the priority level. Typically, tasks with higher priority get more allowed runtime than tasks with lower priority.
  • the determining unit 844 is further configured to determine whether the tasks outside the task group and the tasks in the task group have the same priority.
  • the determining unit 846 is further configured to: when the tasks outside the task group have the same priority as the tasks in the task group, determine that the running time allowed for each task in the task group in the unit time is the resource of the task group.
  • the usage time credit is divided by the sum of the tasks outside the task group and the number of tasks in the task group.
  • the running time allowed for each task in the task group in the unit time is the resource of the task group.
  • the usage time credit is divided by the sum of the tasks outside the task group and the number of tasks in the task group.
  • the resource usage time quota of the task group 10 is T, and there are a task C outside the task group and tasks E, H in the three task groups. I, on average, get T/4 resource usage time per task.
  • Task C outside the task group can also obtain the time T outside the resource usage time limit of the task group in the unit time.
  • the task C outside the task group can be divided into T+T/4. Resource usage time.
  • the tasks outside the task group and the tasks in the task group may each share the resource usage time of the task group.
  • the amount of resource usage time of the task group allowed by each task in the task group is divided by the number of tasks in the task group.
  • the resource usage time of the task group is T
  • the task group includes tasks E, F, and G
  • the tasks E, F, and G obtain a total resource usage time of T/2
  • each task has a task time.
  • the resource usage time of T/6 is obtained, and the task outside the task group obtains the resource usage time of T+T/2, which is related to the task scheduler algorithm in the operating system.
  • the determining unit 846 is further configured to: when the tasks outside the task group and the tasks in the task group have different priorities, based on the priority of the tasks outside the task group and the tasks in the task group, according to a predetermined algorithm Determine the allowed runtime for each task in the task group during the unit time.
  • the running time allowed by the tasks in the task group may be based on the task group.
  • Tasks within tasks and task groups are prioritized and determined according to a predetermined algorithm.
  • each task in the group runs only in its corresponding running time period in a unit time, and the resource usage time of the task is determined according to the task priority, so that the resource scheduling can be better performed, and the work is completed.
  • each task in the group is outside the corresponding running time period, each task enters a waiting state, and the allowed running time of all tasks in the group does not exceed the resource usage time quota of the group, which can ensure the group.
  • the work within the group is completed, which can reduce the competition with the task resources outside the group, and make the tasks outside the group have better resource utilization efficiency.
  • the resource management system includes a task determining module 810, a first determining module 820, a group time determining module 830, a running time determining module 840, and a waiting module 850, and a second determining module and a hibernation module. .
  • the second determining module is configured to determine whether a task outside the task group is being executed when each task of the task group enters a waiting state.
  • the sleep state may be entered, wherein entering the sleep state means that the device performing the resource management method enters the sleep state and has reached the purpose of power saving. For example, as shown in FIG. 7, in the first 2T unit time, when the task E in the task group 10 runs for L time, it enters the waiting state, and before that, the task D in the task group 10 Has entered the wait state.
  • the runtime determining module 840 is further configured to have tasks outside the task group being executed when each task of the task group enters the waiting state, and it is determined that the tasks outside the task group obtain all resource usage time.
  • the hibernation module is configured to perform a task other than the task group when the tasks of the task group enter the waiting state, and enter a sleep state.
  • the above resource management system can reduce the power consumption of the device when all the tasks in the group enter the waiting state and no tasks outside the group are executed, and enter the sleep state.
  • the embodiment of the present invention further provides a computer storage medium, where the computer storage medium stores computer executable instructions, and the computer executable instructions are configured to perform the resource management method according to any one of the foregoing embodiments.
  • the resource management scheme of the embodiment of the present invention determines the resource usage time quota of the group by comparing the preset task time and the preset time threshold value corresponding to all tasks in the task group, and can determine the resource usage time quota of the group.
  • the preset task time corresponding to each task in the task dynamically controls the resources that can be used by the tasks in the group, ensuring that the resource usage time obtained by each task in the group is within a reasonable range, improving resource use efficiency, and saving resources.
  • each task in the group runs only in its corresponding running time period in a unit time, which can ensure the completion of the work in the group, and can reduce the competition with the task resources outside the group, and make the tasks outside the group. Have better resource efficiency.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Telephonic Communication Services (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

一种资源管理方法和系统、计算机存储介质。其中,所述方法包括:确定任务群组内的任务及与任务群组内的每个任务对应的预设的任务时间(S110);判断任务群组内所有任务对应的预设的任务时间之和是否小于预设的时间阈值(S120);若是,则确定任务群组的资源使用时间额度为任务群组内所有任务对应的预设的任务时间之和(S130);若否,则确定任务群组的资源使用时间额度为所述时间阈值(S140);确定任务群组的各个任务在单位时间内所允许的运行时间(S150);在单位时间内,当任务群组的各个任务在对应的运行时段之外时,使任务群组的各个任务分别进入等待状态(S160)。

Description

资源管理方法和系统、计算机存储介质 技术领域
本发明涉及操作系统技术领域,特别是涉及一种资源管理方法和系统、计算机存储介质。
背景技术
目前,很多计算设备(例如智能手机、平板电脑等)均支持多任务系统,即同一时间内设备可运行多个应用程序,一个应用程序中可能有一个或多个线程,每个线程上运行一个任务。而多任务中任务之间会竞争资源,例如前台任务与后台任务,后台任务会抢占前台任务资源,有时会妨碍前台任务的运行。资源可以是中央处理器(CPU,Central Processing Unit)、图形处理器(GPU,Graphics Processing Unit)、内存等。为解决该问题,传统做法是将那些会妨碍主要任务运行的任务完全暂停,但有些被暂停的任务需要实时与服务器进行沟通,例如讯息传递或邮件服务等,若是将这些任务完全暂停,会造成信息无法及时反馈或是产生其它预期外的行为等问题。
发明内容
基于此,有必要提供一种资源管理方法,能够确保群组内的每个任务正常运行,也能减少群组内的任务与群组外的其它任务的资源竞争,节约资源。
此外,还有必要提供一种资源管理系统,能够确保群组内的每个任务正常运行,也能减少群组内的任务与群组外的其它任务的资源竞争,节约资源。
此外,本发明实施例提供了一种计算机存储介质,既能保证后台任务的正常运行,也能减少后台任务与前台任务的资源竞争,节约资源。
本发明实施例的一种资源管理方法,包括:
确定任务群组内的任务及与所述任务群组内的每个任务对应的预设的任务时间;
判断所述任务群组内所有任务对应的预设的任务时间之和是否小于预设的时间阈值;
若是,则确定所述任务群组的资源使用时间额度为所述任务群组内所有任务对应的预设的任务时间之和;
若否,则确定所述任务群组的资源使用时间额度为所述时间阈值;
确定所述任务群组的各个任务在单位时间内所允许的运行时间,所述任务群组的所有任务在单位时间内所允许的运行时间之和小于或等于所述任务群组的资源使用时间额度;
在单位时间内,当所述任务群组的各个任务在对应的运行时段之外时,使所述任务群组的各个任务分别进入等待状态。
在其中一个实施例中,在所述确定任务群组内的任务及与所述任务群组内的每个任务对应的预设的任务时间的步骤之前,还包括以下步骤:
建立任务群组,并根据预定的规则将特定的任务添加入所述任务群组。
在其中一个实施例中,所述确定所述任务群组的各个任务在单位时间内所允许的运行时间具体包括:
获取所述任务群组内的任务的优先级;
判断所述任务群组内的任务的优先级是否相同;
若所述任务群组内的任务的优先级相同且没有任务群组外的任务正在执行,则确定所述任务群组内的各个任务在单位时间内所允许的运行时间为所述任务群组的资源使用时间额度除以所述任务群组内的任务数量;
若否,则基于所述任务群组内的任务的优先级高低并按照预定的算法确定所述任务群组内的各个任务在单位时间内所允许的运行时间。
在其中一个实施例中,所述确定所述任务群组的各个任务在单位时间内所允许的运行时间具体包括:
获取正在执行的任务群组外的任务与所述任务群组内的任务的优先级;
判断所述任务群组外的任务与所述任务群组内的任务的优先级是否相同;
若是,则确定所述任务群组内的各个任务在单位时间内所允许的运行时间为所述任务群组的资源使用时间额度除以所述任务群组外的任务与所述任务群组内的任务的数量之和;
若否,则基于所述任务群组外的任务与所述任务群组内的任务的优先级高低,并按照预定的算法确定所述任务群组内的各个任务在单位时间内所允许的运行时间。
在其中一个实施例中,在所述在单位时间内,当所述任务群组的各个任务在对应的运行时段之外时,使所述任务群组的各个任务分别进入等待状态的步骤之后,还包括:
判断当所述任务群组的各个任务均进入等待状态时是否有任务群组外的任务正在执行;
若是,则确定所述任务群组外的任务获得全部的资源使用时间;
若否,则进入休眠状态。
本发明实施例的一种资源管理系统,包括:
任务确定模块,配置为确定任务群组内的任务及与所述任务群组内的每个任务对应的预设的任务时间;
第一判断模块,配置为判断所述任务群组内所有任务对应的预设的任 务时间之和是否小于预设的时间阈值;
群组时间确定模块,配置为当所述任务群组内所有任务对应的预设的任务时间之和小于预设的时间阈值时,则确定所述任务群组的资源使用时间额度为所述任务群组内所有任务对应的预设的任务时间之和;
所述群组时间确定模块还配置为当所述任务群组内所有任务对应的预设的任务时间之和不小于预设的时间阈值时,则确定所述任务群组的资源使用时间额度为所述时间阈值;
运行时间确定模块,配置为确定所述任务群组的各个任务在单位时间内所允许的运行时间,所述任务群组的所有任务在单位时间内所允许的运行时间之和小于或等于所述任务群组的资源使用时间额度;
等待模块,配置为在单位时间内,当所述任务群组的各个任务在对应的运行时段之外时,使所述任务群组的各个任务分别进入等待状态。
在其中一个实施例中,所述系统还包括:
建立模块,配置为建立模块,建立任务群组,并根据预定的规则将特定的任务添加入所述任务群组。
在其中一个实施例中,所述运行时间确定模块包括:
获取单元,配置为获取所述任务群组内的任务的优先级;
判断单元,配置为判断所述任务群组内的任务的优先级是否相同;
确定单元,配置为当所述任务群组内的任务的优先级相同且没有任务群组外的任务正在执行,则确定所述任务群组内的各个任务在单位时间内所允许的运行时间为所述任务群组的资源使用时间额度除以所述任务群组内的任务数量;
所述确定单元还配置为当所述任务群组内的任务的优先级不同,则基于所述任务群组内的任务的优先级高低,并按照预定的算法确定所述任务群组内的各个任务在单位时间内所允许的运行时间。
在其中一个实施例中,所述获取单元还配置为获取正在执行的任务群组外的任务与所述任务群组内的任务的优先级;
所述判断单元还配置为判断所述任务群组外的任务与所述任务群组内的任务的优先级是否相同;
所述确定单元还配置为当所述任务群组外的任务与所述任务群组内的任务的优先级相同时,则确定所述任务群组内的各个任务在单位时间内所允许的运行时间为所述任务群组的资源使用时间额度除以所述任务群组外的任务与所述任务群组内的任务的数量之和;
所述确定单元还配置为当所述任务群组外的任务与所述任务群组内的任务的优先级不同时,则基于所述任务群组外的任务与所述任务群组内的任务的优先级高低,并按照预定的算法确定所述任务群组内的各个任务在单位时间内所允许的运行时间。
在其中一个实施例中,所述系统还包括:
第二判断模块,配置为判断当所述任务群组的各个任务均进入等待状态时是否有任务群组外的任务正在执行;
所述运行时间确定还配置为当所述任务群组的各个任务均进入等待状态时有任务群组外的任务正在执行,将确定所述任务群组外的任务获得全部的资源使用时间;
休眠模块,配置为当所述任务群组的各个任务均进入等待状态时没有任务群组外的任务正在执行,进入休眠状态。
所述任务确定模块、所述第一判断模块、所述群组时间确定模块、所述运行时间确定模块、所述等待模块、所述建立模块、所述获取单元、所述判断单元、所述确定单元、所述第二判断模块、所述休眠模块在执行处理时,可以采用中央处理器(CPU,Central Processing Unit)、数字信号处理器(DSP,Digital Singnal Processor)或可编程逻辑阵列(FPGA,Field -Programmable Gate Array)实现。
本发明实施例还提供一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,该计算机可执行指令配置为执行上述实施例中任一项所述的资源管理方法。
上述资源管理方法和系统、计算机存储介质,通过比较该任务群组内所有任务对应的预设的任务时间之和及预设的时间阈值大小,以此决定群组的资源使用时间额度,能够根据群组内的每个任务对应的预设的任务时间动态控制群组内的任务所能使用的资源,确保群组内每个任务所获得的资源使用时间在合理范围内,提高资源使用效率,节约资源。此外,群组内的各个任务在单位时间内只在其对应的运行时段内运行,既能保证群组内的工作完成,又能减少与群组外的任务资源竞争,使群组外的任务拥有更佳的资源使用效率。
当群组内的所有任务均进入等待状态且无群组外的任务执行时,进入休眠状态,可减少设备电力消耗。
附图说明
图1为一个实施例中资源管理方法的流程示意图;
图2为一个实施例中确定任务群组的资源使用时间额度示意图;
图3为一个实施例中任务群组的任务运行时的时间示意图;
图4为一个实施例中在单位时间内确定任务群组内各个任务所允许的运行时间的流程示意图;
图5为另一个实施例中任务群组的任务运行时的时间示意图;
图6为一个实施例中在单位时间内当任务群组内的所有任务均进入等待状态时的流程示意;
图7为另一个实施例中任务群组的任务运行时的时间示意图;
图8为一个实施例中资源管理系统的结构示意图;
图9为一个实施例中运行时间确定模块的内部结构示意图。
具体实施方式
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本发明,并不用于限定本发明。
如图1所示,一种资源管理方法,包括以下步骤:
步骤S110,确定任务群组内的任务及与任务群组内的每个任务对应的预设的任务时间。
具体的,预设的任务时间为预设的任务群组内的任务在单位时间内可获得的资源使用时间上限,即任务群组内的每一项任务在单位时间内的运行时间不超过与之对应的任务时间,在本实施方式中,可设定任务群组内所有任务对应的预设的任务时间是相同的。例如,假设单位时间为2T,任务时间为L,L可为T/2、T/4等。每2T单位时间内,任务群组内的每一项任务最多只能使用L时间的资源。T可以为10s(秒)、15s、20s等时间较短的数值。资源可为CPU、GPU、内存等。可以理解地,任务群组内的每个任务对应的预设的任务时间可以根据实际需要进行设定,不一定完全相同。
在一个实施例中,在步骤确定任务群组内的任务及与任务群组内的每个任务对应的预设的任务时间之前,还包括:建立任务群组,并根据预定的规则将特定的任务添加入该任务群组。
具体的,建立任务群组对任务进行管理,只有在该任务群组中的任务,才受任务群组的资源使用时间额度的限制。任务群组中的任务可为不需与用户进行交互的后台任务,例如邮件服务、讯息传递、自动保存等后台任务。将某些任务添加入任务群组中并进行资源使用限制,既可保证任务群组内的任务正常执行,也可避免任务群组内的任务无限制地与任务群组外 的其它任务抢占资源,造成资源浪费。可以理解地,还可以根据需要设定其它的规则,然后将符合规则的特定任务添加到任务群组中。
步骤S120,判断任务群组内所有任务对应的预设的任务时间之和是否小于预设的时间阈值,若是,则执行步骤S130,若否,则执行步骤S140。
具体的,时间阈值为预先设定的任务群组在每单位时间内的资源使用时间上限。单位时间、时间阈值、任务时间需可根据需求进行设定,三者的关系为单位时间大于时间阈值,时间阈值大于任务时间。比较任务群组内所有任务对应的预设的任务时间之和与时间阈值的大小,若任务群组内所有任务对应的预设的任务时间之和小于时间阈值,则确定任务群组在单位时间内的资源使用时间额度为任务群组内所有任务对应的预设的任务时间之和,若任务群组内所有任务对应的预设的任务时间之和不小于时间阈值,则确定任务群组在单位时间内的资源使用时间额度为时间阈值。如图2所示,包括任务群组外的任务20及任务群组10。其中,设定任务群组10内任务D、E对应的预设的任务时间均为L,时间阈值为T,在第一个2T单位时间内,任务群组10内的任务D、E对应的预设的任务时间之和为2L,小于预设的时间阈值T,则任务群组10的资源使用时间额度为2L。在第二个2T单位时间内,任务群组10包括任务D、E、F,设定任务群组10内任务D、E、F对应的预设的任务时间均为L,则任务群组10内的任务D、E、F对应的预设的任务时间之和为3L,大于时间阈值T,则任务群组10的资源使用时间额度为T。在单位时间内,任务群组内的所有任务所允许的运行时间之和小于或等于任务群组的资源使用时间额度。
步骤S130,确定任务群组的资源使用时间额度为任务群组内所有任务对应的预设的任务时间之和。
具体的,通过比较任务群组内所有任务对应的预设的任务时间之和和时间阈值来确定任务群组的资源使用时间额度,可避免当任务群组内的任 务数量太少时造成的资源浪费,将任务群组中的每个任务所获得的资源使用时间控制在合理范围内。例如,设定单位时间为2T,时间阈值为T,任务群组中只有一个任务,且该任务对应的预设的任务时间为T/4,若不通过比较任务群组内所有任务对应的预设的任务时间之和和时间阈值来确定任务群组的资源使用时间额度,则该任务在2T单位时间内可使用T时间的资源,此时可能会造成资源使用效率低等问题,而通过比较再确定任务群组的资源使用时间额度后,该任务在2T单位时间内最多只可使用T/4时间的资源,能提高资源的使用效率。
步骤S140,确定任务群组的资源使用时间额度为该时间阈值。
步骤S150,确定任务群组的各个任务在单位时间内所允许的运行时间。
具体的,将时间划分为连续的多个单位时间进行监测,任务群组的任务只在单位时间中的部分时段内才拥有资源使用权,即任务群组中的每个任务仅在与其对应的部分时段被运行,该部分时段的时长等于前述确定的所允许的运行时间。任务群组内的所有任务在单位时间内所允许的运行时间之和小于或等于前述确定的任务群组的资源使用时间额度。
步骤S160,在单位时间内,当任务群组的各个任务在对应的运行时段之外时,使任务群组的各个任务分别进入等待状态。
具体的,在单位时间内,只有在任务群组的各个任务对应的运行时段内时,才执行该任务,该运行时段的时长等于该任务在单位时间内所允许的运行时间。图3为一个实施例中任务群组的任务执行时的示意图,如图3所示,在第二个2T单位时间内时,假定任务群组10的资源使用时间额度为2L,任务E、F所允许的运行时间均为2L/3,在任务E、F各自对应的运行时段内,执行该任务,当在各自对应的运行时段之外时,任务E、F则分别处于等待状态。等待状态指该任务不会使用任何资源。任务E、F所允许的运行时间之和小于任务群组10的资源使用时间额度2L。在第三个2T单位时间 内,假定任务群组10的资源使用时间额度为T,任务E、F、G所允许的运行时间均为T/3,在任务E、F、G各自对应的运行时段内,执行该任务,当在各自对应的运行时段之外时,任务E、F、G则分别处于等待状态。任务E、F、G所允许的运行时间之和等于任务群组10的资源使用时间额度T。只需保证在单位时间内任务群组内所有的任务所允许的运行时间之和小于或等于任务群组的资源使用时间额度即可,而任务群组内的各个任务在单位时间的什么时段内运行则由操作系统的任务调度器的算法决定。在其它实施例中,任务群组内的任务在单位时间内,可先进入等待状态,再进行执行,例如2T单位时间内,任务群组内的所有任务先进入等待状态,T时间后,再按照任务群组内的各个任务所允许的运行时间执行各个任务,可以理解,其本质上与图3的资源管理方法是一致的。
上述资源管理方法,通过比较该任务群组内所有任务对应的预设的任务时间之和及预设的时间阈值大小,以此决定群组的资源使用时间额度,能够根据群组内的每个任务对应的预设的任务时间动态控制群组内的任务所能使用的资源,确保群组内每个任务所获得的资源使用时间在合理范围内,提高资源使用效率,节约资源。此外,群组内的各个任务在单位时间内只在其对应的运行时段内运行,既能保证群组内的工作完成,又能减少与群组外的任务资源竞争,使群组外的任务拥有更佳的资源使用效率。
如图4所示,在一个实施例中,步骤确定任务群组的各个任务在单位时间内所允许的运行时间,具体包括:
步骤S410,获取任务群组内的任务的优先级。
具体的,在单位时间内,任务群组内的任务可最多获得任务群组的资源使用时间额度的资源。若此时,无任务群组外的任务在执行,任务群组内的任务无需与任务群组外的其它任务竞争资源,任务群组内的任务所允许的运行时间可根据任务的优先级高低并按照预定的算法进行确定。通常, 任务群组内优先级高的任务比优先级低的任务会获得更多的所允许的运行时间。
步骤S420,判断任务群组内的任务的优先级是否相同,若任务群组内的任务的优先级相同且没有任务群组外的任务正在执行,则执行步骤S430,若否,则执行步骤S440。
具体的,若任务群组内的任务的优先级相同,则任务群组内的各个任务在单位时间内所允许的运行时间为任务群组的资源使用时间额度除以任务群组内的任务数量,若任务群组内的任务的优先级不同,则根据任务的优先级高低并按照预定的算法确定任务群组内各个任务在单位时间内所允许的运行时间。
步骤S430,确定任务群组内的各个任务在单位时间内所允许的运行时间为任务群组的资源使用时间额度除以任务群组内的任务数量。
具体的,例如,如图5所示,在第一个2T单位时间内,无任务群组外的任务正在执行,假定任务群组10的资源使用时间额度为2L,任务群组10内包括任务D和任务E,任务数量为2,则任务D和任务E各分得L的资源使用时间;在第二个2T单位时间内,无任务群组外的任务正在执行,假定任务群组的资源使用时间额度为T,任务群组10内包括任务D、E、F,则任务D、任务E和任务F各分得T/3的资源使用时间。在其它的实施例中,若还有任务群组外的任务正在执行,则任务群组内的任务所允许的运行时间将小于本实施例中获得的资源使用时间。
步骤S440,基于任务群组内的任务的优先级高低并按照预定的算法确定任务群组内的各个任务在单位时间内所允许的运行时间。
具体的,在单位时间内,若任务群组内的任务的优先级不同,则将任务群组内的任务按照优先级高低顺序进行排序,优先级高的任务排在优先级低的任务前面,任务群组内的任务的资源使用时间可根据任务优先级高 低并按照预定的算法进行确定。例如,2T单位时间内,无任务群组外的任务正在执行,假定任务群组的资源使用时间额度为2L,任务群组内包括任务D、E,任务D的优先级高于任务E,则任务D可分得4L/3的资源使用时间,任务E分得2L/3的资源使用时间。当任务群组内的任务不在对应的运行时段时,任务群组内的任务分别立即进入等待状态。
上述资源管理方法,群组内的各个任务在单位时间内只在其对应的运行时段内运行,且根据任务群组内的任务的优先级高低确定资源使用时间,能更好地运行任务,既能保证群组内的工作完成,又能减少与群组外的任务资源竞争,使群组外的任务拥有更佳的资源使用效率。
在另一个实施例中,步骤确定任务群组的各个任务在单位时间内所允许的运行时间,还包括以下步骤:
(1)获取正在执行的任务群组外的任务与任务群组内的任务的优先级。
具体的,若单位时间内,除任务群组内的任务,还有任务群组外的任务正在执行,则任务群组外的任务将与任务群组内的任务形成资源竞争。获取正在执行的任务群组外的任务及任务群组内的每个任务的优先级,并根据优先级的高低确定各个任务的资源使用时间。通常,优先级高的任务比优先级低的任务会获得更多的所允许的运行时间。
(2)判断任务群组外的任务与任务群组内的任务的优先级是否相同,若是,则执行(3),若否,则执行(4)。
(3)确定任务群组内的各个任务在单位时间内所允许的运行时间为任务群组的资源使用时间额度除以任务群组外的任务与任务群组内的任务的数量之和。
具体的,在单位时间内,若任务群组外的任务与任务群组内的任务的优先级相同,则任务群组内的各个任务在单位时间内所允许的运行时间为 任务群组的资源使用时间额度除以任务群组外的任务与任务群组内的任务的数量之和。例如,在图3中,第四个2T单位时间内,假定任务群组10的资源使用时间额度为T,共有一个任务群组外的任务C和三个任务群组内的任务E、H、I,则平均每个任务获得T/4的资源使用时间。而任务群组外的任务C还能获得单位时间内任务群组的资源使用时间额度外的时间T,则在单位时间内,任务群组外的任务C共能分到T+T/4的资源使用时间。在其它的实施例中,当任务群组外的任务与任务群组内的任务的优先级相同时,任务群组外的任务与任务群组内的任务可各分得一半的任务群组的资源使用时间额度,任务群组内的各个任务所允许的运行时间为一半的任务群组的资源使用时间额度除以任务群组内的任务数量。例如,在单位时间内,任务群组的资源使用时间为T,任务群组中包括任务E、F、G,则任务E、F、G总共获得T/2的资源使用时间,每个任务各获得T/6的资源使用时间,而任务群组外的任务则获得T+T/2的资源使用时间,分配方式与操作系统中的任务调度器算法相关。
(4)基于任务群组外的任务与任务群组内的任务的优先级高低并按照预定的算法确定任务群组内的各个任务在单位时间内所允许的运行时间。
具体的,在单位时间的资源使用时间内,若任务群组外的任务与任务群组内的任务的优先级高低不同,任务群组内的任务所允许的运行时间可根据任务群组外的任务和任务群组内的任务优先级高低并按照预定的算法进行确定。
上述资源管理方法,群组内的各个任务在单位时间内只在其对应的运行时段内运行,且根据任务优先级确定任务的资源使用时间,可以更好地进行资源调度,完成工作,当群组内的各个任务在对应的运行时段之外时,使各个任务分别进入等待状态,且群组内所有任务的所允许的运行时间之和不超过群组的资源使用时间额度,既能保证群组内的工作完成,又能减 少与群组外的任务资源竞争,使群组外的任务拥有更佳的资源使用效率。
如图6所示,在一个实施例中,在步骤在单位时间内,当任务群组的各个任务在对应的运行时段之外时,使任务群组的各个任务分别进入等待状态,还包括:
步骤S610,判断当任务群组的各个任务均进入等待状态时是否有任务群组外的任务正在执行,若是,则执行步骤S620,若否,则执行步骤S630。
具体的,单位时间内,当任务群组内的任务全部进入等待状态时,若有任务群组外的任务正在执行,则确定该正在执行的任务群组外的任务获得全部的资源使用时间,若无任务群组外的任务正在执行,则可进入休眠状态,其中,进入休眠状态指执行上述资源管理方法的设备进入休眠状态已达到省电的目的。例如,如图7所示,在第一个2T单位时间内,当任务群组10内的任务E运行达L时间后,其进入等待状态,而在此之前,任务群组10内的任务D已进入等待状态。在任务E进入等待状态后,只有任务群组外的任务A在执行,则任务A获得全部的资源使用时间,可以使任务群组外的任务有更佳的资源使用效率。在第二个2T单位时间内,当任务群组10内的任务D、E、F均进入等待状态后,且无任务群组外的任务正在执行,正进入休眠状态。
步骤S620,将确定任务群组外的任务获得全部的资源使用时间。
步骤S630,进入休眠状态。
上述资源管理方法,当群组内的所有任务均进入等待状态且无群组外的任务执行时,进入休眠状态,可减少设备电力消耗。
如图8所示,一种资源管理系统,包括任务确定模块810、第一判断模块820、群组时间确定模块830、运行时间确定模块840和等待模块850。
任务确定模块810,配置为确定任务群组内的任务及与任务群组内的每个任务对应的预设的任务时间。
具体的,预设的任务时间为预设的任务群组内的任务在单位时间内可获得的资源使用时间上限,即任务群组内的每一项任务在单位时间内的运行时间不超过与之对应的任务时间,在本实施方式中,可设定任务群组内所有任务对应的预设的任务时间是相同的。例如,假设单位时间为2T,任务时间为L,L可为T/2、T/4等。每2T单位时间内,任务群组内的每一项任务最多只能使用L时间的资源。T可以为10s(秒)、15s、20s等时间较短的数值。资源可为CPU、GPU、内存等。可以理解地,任务群组内的每个任务对应的预设的任务时间可以根据实际需要进行设定,不一定完全相同。
第一判断模块820,配置为判断任务群组内所有任务对应的预设的任务时间之和是否小于预设的时间阈值。
具体的,时间阈值为预先设定的任务群组在每单位时间内的资源使用时间上限。单位时间、时间阈值、任务时间需可根据需求进行设定,三者的关系为单位时间大于时间阈值,时间阈值大于任务时间。比较任务群组内所有任务对应的预设的任务时间之和与时间阈值的大小,若任务群组内所有任务对应的预设的任务时间之和小于时间阈值,则确定任务群组在单位时间内的资源使用时间额度为任务群组内所有任务对应的预设的任务时间之和,若任务群组内所有任务对应的预设的任务时间之和不小于时间阈值,则确定任务群组在单位时间内的资源使用时间额度为时间阈值。如图2所示,包括任务群组外的任务20及任务群组10。其中,设定任务群组10内任务D、E对应的预设的任务时间均为L,时间阈值为T,在第一个2T单位时间内,任务群组10内的任务D、E对应的预设的任务时间之和为2L,小于预设的时间阈值T,则任务群组10的资源使用时间额度为2L。在第二个2T单位时间内,任务群组10包括任务D、E、F,设定任务群组10内任务D、E、F对应的预设的任务时间均为L,则任务群组10内的任务D、E、F对应的预设的任务时间之和为3L,大于时间阈值T,则任务群组10的资源使用时间额度 为T。在单位时间内,任务群组内的所有任务所允许的运行时间之和小于或等于任务群组的资源使用时间额度。
群组时间确定模块830,配置为当任务群组内所有任务对应的预设的任务时间之和小于预设的时间阈值时,则确定任务群组的资源使用时间额度为任务群组内所有任务对应的预设的任务时间之和。
具体的,通过比较任务群组内所有任务对应的预设的任务时间之和和时间阈值来确定任务群组的资源使用时间额度,可避免当任务群组内的任务数量太少时造成的资源浪费,将任务群组中的每个任务所获得的资源使用时间控制在合理范围内。例如,设定单位时间为2T,时间阈值为T,任务群组中只有一个任务,且该任务对应的预设的任务时间为T/4,若不通过比较任务群组内所有任务对应的预设的任务时间之和和时间阈值来确定任务群组的资源使用时间额度,则该任务在2T单位时间内可使用T时间的资源,此时可能会造成资源使用效率低等问题,而通过比较再确定任务群组的资源使用时间额度后,该任务在2T单位时间内最多只可使用T/4时间的资源,能提高资源的使用效率。
群组时间确定模块830还配置为当任务群组内所有任务对应的预设的任务时间之和不小于预设的时间阈值时,则确定任务群组的资源使用时间额度为该时间阈值。
运行时间确定模块840,配置为确定任务群组的各个任务在单位时间内所允许的运行时间。
具体的,将时间划分为连续的多个单位时间进行监测,任务群组的任务只在单位时间中的部分时段内才拥有资源使用权,即任务群组中的每个任务仅在与其对应的部分时段被运行,该部分时段的时长等于前述确定的所允许的运行时间。任务群组内的所有任务在单位时间内所允许的运行时间之和小于或等于前述确定的任务群组的资源使用时间额度。
等待模块850,配置为在单位时间内,当任务群组的各个任务在对应的运行时段之外时,使任务群组的各个任务分别进入等待状态。
具体的,在单位时间内,只有在任务群组的各个任务对应的运行时段内时,才执行该任务,该运行时段的时长等于该任务在单位时间内所允许的运行时间。图3为一个实施例中任务群组的任务执行时的示意图,如图3所示,在第二个2T单位时间内时,假定任务群组10的资源使用时间额度为2L,任务E、F所允许的运行时间均为2L/3,在任务E、F各自对应的运行时段内,执行该任务,当在各自对应的运行时段之外时,任务E、F则分别处于等待状态。等待状态指该任务不会使用任何资源。任务E、F所允许的运行时间之和小于任务群组10的资源使用时间额度2L。在第三个2T单位时间内,假定任务群组10的资源使用时间额度为T,任务E、F、G所允许的运行时间均为T/3,在任务E、F、G各自对应的运行时段内,执行该任务,当在各自对应的运行时段之外时,任务E、F、G则分别处于等待状态。任务E、F、G所允许的运行时间之和等于任务群组10的资源使用时间额度T。只需保证在单位时间内任务群组内所有的任务所允许的运行时间之和小于或等于任务群组的资源使用时间额度即可,而任务群组内的各个任务在单位时间的什么时段内运行则由操作系统的任务调度器的算法决定。在其它实施例中,任务群组内的任务在单位时间内,可先进入等待状态,再进行执行,例如2T单位时间内,任务群组内的所有任务先进入等待状态,T时间后,再按照任务群组内的各个任务所允许的运行时间执行各个任务,可以理解,其本质上与图3的资源管理系统是一致的。
在一个实施例中,上述资源管理系统还包括建立模块。
建立模块,配置为建立任务群组,并根据预定的规则将特定的任务添加入该任务群组。
具体的,建立任务群组对任务进行管理,只有在该任务群组中的任务, 才受任务群组的资源使用时间额度的限制。任务群组中的任务可为不需与用户进行交互的后台任务,例如邮件服务、讯息传递、自动保存等后台任务。将某些任务添加入任务群组中并进行资源使用限制,既可保证任务群组内的任务正常执行,也可避免任务群组内的任务无限制地与任务群组外的其它任务抢占资源,造成资源浪费。可以理解地,还可以根据需要设定其它的规则,然后将符合规则的特定任务添加到任务群组中。
上述资源管理系统,通过比较该任务群组内所有任务对应的预设的任务时间之和及预设的时间阈值大小,以此决定群组的资源使用时间额度,能够根据群组内的每个任务对应的预设的任务时间动态控制群组内的任务所能使用的资源,确保群组内每个任务所获得的资源使用时间在合理范围内,提高资源使用效率,节约资源。此外,群组内的各个任务在单位时间内只在其对应的运行时段内运行,既能保证群组内的工作完成,又能减少与群组外的任务资源竞争,使群组外的任务拥有更佳的资源使用效率。
如图9所示,在一个实施例中,运行时间确定模块840包括获取单元842、判断单元844和确定单元846。
获取单元842,配置为获取任务群组内的任务的优先级。
具体的,在单位时间内,任务群组内的任务可最多获得任务群组的资源使用时间额度的资源。若此时,无任务群组外的任务在执行,任务群组内的任务无需与任务群组外的其它任务竞争资源,任务群组内的任务所允许的运行时间可根据任务的优先级高低并按照预定的算法进行确定。通常,任务群组内优先级高的任务比优先级低的任务会获得更多的所允许的运行时间。
判断单元844,配置为判断任务群组内的任务的优先级是否相同。
具体的,若任务群组内的任务的优先级相同,则任务群组内的各个任务在单位时间内所允许的运行时间为任务群组的资源使用时间额度除以任 务群组内的任务数量,若任务群组内的任务的优先级不同,则根据任务的优先级高低并按照预定的算法确定任务群组内各个任务在单位时间内所允许的运行时间。
确定单元846,配置为当任务群组内的任务的优先级相同且没有任务群组外的任务正在执行,则确定任务群组内的各个任务在单位时间内所允许的运行时间为任务群组的资源使用时间额度除以任务群组内的任务数量。
具体的,例如,如图5所示,在第一个2T单位时间内,无任务群组外的任务正在执行,假定任务群组10的资源使用时间额度为2L,任务群组10内包括任务D和任务E,任务数量为2,则任务D和任务E各分得L的资源使用时间;在第二个2T单位时间内,无任务群组外的任务正在执行,假定任务群组的资源使用时间额度为T,任务群组10内包括任务D、E、F,则任务D、任务E和任务F各分得T/3的资源使用时间。在其它的实施例中,若还有任务群组外的任务正在执行,则任务群组内的任务所允许的运行时间将小于本实施例中获得的资源使用时间。
确定单元846还配置为当任务群组内的任务的优先级不同,则基于任务群组内的任务的优先级高低并按照预定的算法确定任务群组内的各个任务在单位时间内所允许的运行时间。
具体的,在单位时间内,若任务群组内的任务的优先级不同,则将任务群组内的任务按照优先级高低顺序进行排序,优先级高的任务排在优先级低的任务前面,任务群组内的任务的资源使用时间可根据任务优先级高低并按照预定的算法进行确定。例如,2T单位时间内,无任务群组外的任务正在执行,假定任务群组的资源使用时间额度为2L,任务群组内包括任务D、E,任务D的优先级高于任务E,则任务D可分得4L/3的资源使用时间,任务E分得2L/3的资源使用时间。当任务群组内的任务不在对应的运行时段时,任务群组内的任务分别立即进入等待状态。
上述资源管理系统,群组内的各个任务在单位时间内只在其对应的运行时段内运行,且根据任务群组内的任务的优先级高低确定资源使用时间,能更好地运行任务,既能保证群组内的工作完成,又能减少与群组外的任务资源竞争,使群组外的任务拥有更佳的资源使用效率。
在另一个实施例中,获取单元842还配置为获取正在执行的任务群组外的任务与任务群组内的任务的优先级。
具体的,若单位时间内,除任务群组内的任务,还有任务群组外的任务正在执行,则任务群组外的任务将与任务群组内的任务形成资源竞争。获取正在执行的任务群组外的任务及任务群组内的每个任务的优先级,并根据优先级的高低确定各个任务的资源使用时间。通常,优先级高的任务比优先级低的任务会获得更多的所允许的运行时间。
判断单元844还配置为判断任务群组外的任务与任务群组内的任务的优先级是否相同。
确定单元846还配置为当任务群组外的任务与任务群组内的任务的优先级相同时,则确定任务群组内的各个任务在单位时间内所允许的运行时间为任务群组的资源使用时间额度除以任务群组外的任务与任务群组内的任务的数量之和。
具体的,在单位时间内,若任务群组外的任务与任务群组内的任务的优先级相同,则任务群组内的各个任务在单位时间内所允许的运行时间为任务群组的资源使用时间额度除以任务群组外的任务与任务群组内的任务的数量之和。例如,在图3中,第四个2T单位时间内,假定任务群组10的资源使用时间额度为T,共有一个任务群组外的任务C和三个任务群组内的任务E、H、I,则平均每个任务获得T/4的资源使用时间。而任务群组外的任务C还能获得单位时间内任务群组的资源使用时间额度外的时间T,则在单位时间内,任务群组外的任务C共能分到T+T/4的资源使用时间。在其它的 实施例中,当任务群组外的任务与任务群组内的任务的优先级相同时,任务群组外的任务与任务群组内的任务可各分得一半的任务群组的资源使用时间额度,任务群组内的各个任务所允许的运行时间为一半的任务群组的资源使用时间额度除以任务群组内的任务数量。例如,在单位时间内,任务群组的资源使用时间为T,任务群组中包括任务E、F、G,则任务E、F、G总共获得T/2的资源使用时间,每个任务各获得T/6的资源使用时间,而任务群组外的任务则获得T+T/2的资源使用时间,分配方式与操作系统中的任务调度器算法相关。
确定单元846还配置为当任务群组外的任务与任务群组内的任务的优先级不同时,则基于任务群组外的任务与任务群组内的任务的优先级高低并按照预定的算法确定任务群组内的各个任务在单位时间内所允许的运行时间。
具体的,在单位时间的资源使用时间内,若任务群组外的任务与任务群组内的任务的优先级高低不同,任务群组内的任务所允许的运行时间可根据任务群组外的任务和任务群组内的任务优先级高低并按照预定的算法进行确定。
上述资源管理系统,群组内的各个任务在单位时间内只在其对应的运行时段内运行,且根据任务优先级确定任务的资源使用时间,可以更好地进行资源调度,完成工作,当群组内的各个任务在对应的运行时段之外时,使各个任务分别进入等待状态,且群组内所有任务的所允许的运行时间之和不超过群组的资源使用时间额度,既能保证群组内的工作完成,又能减少与群组外的任务资源竞争,使群组外的任务拥有更佳的资源使用效率。
在一个实施例中,上述资源管理系统,除了包括任务确定模块810、第一判断模块820、群组时间确定模块830,运行时间确定模块840及等待模块850,还包括第二判断模块和休眠模块。
第二判断模块,配置为判断当任务群组的各个任务均进入等待状态时是否有任务群组外的任务正在执行。
具体的,单位时间内,当任务群组内的任务全部进入等待状态时,若有任务群组外的任务正在执行,则确定该正在执行的任务群组外的任务获得全部的资源使用时间,若无任务群组外的任务正在执行,则可进入休眠状态,其中,进入休眠状态指执行上述资源管理方法的设备进入休眠状态已达到省电的目的。例如,如图7所示,在第一个2T单位时间内,当任务群组10内的任务E运行达L时间后,其进入等待状态,而在此之前,任务群组10内的任务D已进入等待状态。在任务E进入等待状态后,只有任务群组外的任务A在执行,则任务A获得全部的资源使用时间,可以使任务群组外的任务有更佳的资源使用效率。在第二个2T单位时间内,当任务群组10内的任务D、E、F均进入等待状态后,且无任务群组外的任务正在执行,正进入休眠状态。
运行时间确定模块840还配置为当任务群组的各个任务均进入等待状态时有任务群组外的任务正在执行,将确定该任务群组外的任务获得全部的资源使用时间。
休眠模块,配置为当任务群组的各个任务均进入等待状态时没有任务群组外的任务正在执行,进入休眠状态。
上述资源管理系统,当群组内的所有任务均进入等待状态且无群组外的任务执行时,进入休眠状态,可减少设备电力消耗。
本发明实施例还提供一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,该计算机可执行指令配置为执行上述实施例中任一项所述的资源管理方法。
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只 要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。
以上所述实施例仅表达了本发明的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干变形和改进,这些都属于本发明的保护范围。因此,本发明专利的保护范围应以所附权利要求为准。
工业实用性
本发明实施例的资源管理方案,通过比较该任务群组内所有任务对应的预设的任务时间之和及预设的时间阈值大小,以此决定群组的资源使用时间额度,能够根据群组内的每个任务对应的预设的任务时间动态控制群组内的任务所能使用的资源,确保群组内每个任务所获得的资源使用时间在合理范围内,提高资源使用效率,节约资源。此外,群组内的各个任务在单位时间内只在其对应的运行时段内运行,既能保证群组内的工作完成,又能减少与群组外的任务资源竞争,使群组外的任务拥有更佳的资源使用效率。

Claims (11)

  1. 一种资源管理方法,包括:
    确定任务群组内的任务及与所述任务群组内的每个任务对应的预设的任务时间;
    判断所述任务群组内所有任务对应的预设的任务时间之和是否小于预设的时间阈值;
    若是,则确定所述任务群组的资源使用时间额度为所述任务群组内所有任务对应的预设的任务时间之和;
    若否,则确定所述任务群组的资源使用时间额度为所述时间阈值;
    确定所述任务群组的各个任务在单位时间内所允许的运行时间,所述任务群组的所有任务在单位时间内所允许的运行时间之和小于或等于所述任务群组的资源使用时间额度;
    在单位时间内,当所述任务群组的各个任务在对应的运行时段之外时,使所述任务群组的各个任务分别进入等待状态。
  2. 根据权利要求1所述的资源管理方法,其中,在所述确定任务群组内的任务及与所述任务群组内的每个任务对应的预设的任务时间的步骤之前,还包括以下步骤:
    建立任务群组,并根据预定的规则将特定的任务添加入所述任务群组。
  3. 根据权利要求1或2所述的资源管理方法,其中,所述确定所述任务群组的各个任务在单位时间内所允许的运行时间具体包括:
    获取所述任务群组内的任务的优先级;
    判断所述任务群组内的任务的优先级是否相同;
    若所述任务群组内的任务的优先级相同且没有任务群组外的任务正在执行,则确定所述任务群组内的各个任务在单位时间内所允许的运行时间为所述任务群组的资源使用时间额度除以所述任务群组内的任务数量;
    若否,则基于所述任务群组内的任务的优先级高低并按照预定的算法确定所述任务群组内的各个任务在单位时间内所允许的运行时间。
  4. 根据权利要求1或2所述的资源管理方法,其中,所述确定所述任务群组的各个任务在单位时间内所允许的运行时间具体包括:
    获取正在执行的任务群组外的任务与所述任务群组内的任务的优先级;
    判断所述任务群组外的任务与所述任务群组内的任务的优先级是否相同;
    若是,则确定所述任务群组内的各个任务在单位时间内所允许的运行时间为所述任务群组的资源使用时间额度除以所述任务群组外的任务与所述任务群组内的任务的数量之和;
    若否,则基于所述任务群组外的任务与所述任务群组内的任务的优先级高低并按照预定的算法确定所述任务群组内的各个任务在单位时间内所允许的运行时间。
  5. 根据权利要求4所述的资源管理方法,其中,在所述在单位时间内,当所述任务群组的各个任务在对应的运行时段之外时,使所述任务群组的各个任务分别进入等待状态的步骤之后,还包括:
    判断当所述任务群组的各个任务均进入等待状态时是否有任务群组外的任务正在执行;
    若是,则确定所述任务群组外的任务获得全部的资源使用时间;
    若否,则进入休眠状态。
  6. 一种资源管理系统,包括:
    任务确定模块,配置为确定任务群组内的任务及与所述任务群组内的每个任务对应的预设的任务时间;
    第一判断模块,配置为判断所述任务群组内所有任务对应的预设的任 务时间之和是否小于预设的时间阈值;
    群组时间确定模块,配置为当所述任务群组内所有任务对应的预设的任务时间之和小于预设的时间阈值时,则确定所述任务群组的资源使用时间额度为所述任务群组内所有任务对应的预设的任务时间之和;
    所述群组时间确定模块还配置为当所述任务群组内所有任务对应的预设的任务时间之和不小于预设的时间阈值时,则确定所述任务群组的资源使用时间额度为所述时间阈值;
    运行时间确定模块,配置为确定所述任务群组的各个任务在单位时间内所允许的运行时间,所述任务群组的所有任务在单位时间内所允许的运行时间之和小于或等于所述任务群组的资源使用时间额度;
    等待模块,配置为在单位时间内,当所述任务群组的各个任务在对应的运行时段之外时,使所述任务群组的各个任务分别进入等待状态。
  7. 根据权利要求6所述的资源管理系统,其中,所述系统还包括:
    建立模块,配置为建立任务群组,并根据预定的规则将特定的任务添加入所述任务群组。
  8. 根据权利要求6或7所述的资源管理系统,其中,所述运行时间确定模块包括:
    获取单元,配置为获取所述任务群组内的任务的优先级;
    判断单元,配置为判断所述任务群组内的任务的优先级是否相同;
    确定单元,配置为当所述任务群组内的任务的优先级相同且没有任务群组外的任务正在执行,则确定所述任务群组内的各个任务在单位时间内所允许的运行时间为所述任务群组的资源使用时间额度除以所述任务群组内的任务数量;
    所述确定单元还配置为当所述任务群组内的任务的优先级不同,则基于所述任务群组内的任务的优先级高低并按照预定的算法确定所述任务群 组内的各个任务在单位时间内所允许的运行时间。
  9. 根据权利要求8所述的资源管理系统,其中,所述获取单元还配置为获取正在执行的任务群组外的任务与所述任务群组内的任务的优先级;
    所述判断单元还配置为判断所述任务群组外的任务与所述任务群组内的任务的优先级是否相同;
    所述确定单元还配置为当所述任务群组外的任务与所述任务群组内的任务的优先级相同时,则确定所述任务群组内的各个任务在单位时间内所允许的运行时间为所述任务群组的资源使用时间额度除以所述任务群组外的任务与所述任务群组内的任务的数量之和;
    所述确定单元还配置为当所述任务群组外的任务与所述任务群组内的任务的优先级不同时,则基于所述任务群组外的任务与所述任务群组内的任务的优先级高低并按照预定的算法确定所述任务群组内的各个任务在单位时间内所允许的运行时间。
  10. 根据权利要求9所述的资源管理系统,其中,所述系统还包括:
    第二判断模块,配置为判断当所述任务群组的各个任务均进入等待状态时是否有任务群组外的任务正在执行;
    所述运行时间确定模块还配置为当所述任务群组的各个任务均进入等待状态时有任务群组外的任务正在执行,则确定所述任务群组外的任务获得全部的资源使用时间;
    休眠模块,配置为当所述任务群组的各个任务均进入等待状态时没有任务群组外的任务正在执行,进入休眠状态。
  11. 一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,该计算机可执行指令配置为执行权利要求1至5任一项所述的资源管理方法。
PCT/CN2016/095906 2015-11-09 2016-08-18 资源管理方法和系统、计算机存储介质 WO2017080276A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP16863454.1A EP3376381A4 (en) 2015-11-09 2016-08-18 Resource management method and system, and computer storage medium
US15/774,282 US10467054B2 (en) 2015-11-09 2016-08-18 Resource management method and system, and computer storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510756289.4 2015-11-09
CN201510756289.4A CN105320570B (zh) 2015-11-09 2015-11-09 资源管理方法和系统

Publications (1)

Publication Number Publication Date
WO2017080276A1 true WO2017080276A1 (zh) 2017-05-18

Family

ID=55247991

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/095906 WO2017080276A1 (zh) 2015-11-09 2016-08-18 资源管理方法和系统、计算机存储介质

Country Status (4)

Country Link
US (1) US10467054B2 (zh)
EP (1) EP3376381A4 (zh)
CN (1) CN105320570B (zh)
WO (1) WO2017080276A1 (zh)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105320561B (zh) * 2015-11-09 2019-03-08 深圳市万普拉斯科技有限公司 任务管理方法和系统
CN105320570B (zh) 2015-11-09 2019-01-29 深圳市万普拉斯科技有限公司 资源管理方法和系统
CN108270837B (zh) * 2017-01-04 2021-04-30 北京京东尚科信息技术有限公司 一种利用闲置资源的分布式任务调度方法及系统
CN106843047A (zh) * 2017-01-24 2017-06-13 苏州咖博士咖啡系统科技有限公司 一种咖啡机执行器控制方法
US10802880B2 (en) * 2017-09-19 2020-10-13 Huawei Technologies Co., Ltd. System and method for distributed resource requirement and allocation
CN110022337A (zh) * 2018-01-09 2019-07-16 阿里巴巴集团控股有限公司 资源调度方法、装置、设备和系统
CN109886548B (zh) * 2019-01-18 2024-05-07 平安科技(深圳)有限公司 派单方法、系统、装置及存储介质
US11972267B2 (en) * 2022-10-04 2024-04-30 International Business Machines Corporation Hibernation of computing device with faulty batteries

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2449849A1 (en) * 2009-06-29 2012-05-09 Nokia Corporation Resource allocation
CN103902364A (zh) * 2012-12-25 2014-07-02 腾讯科技(深圳)有限公司 一种物理资源管理方法、装置及智能终端设备
CN104838360A (zh) * 2012-09-04 2015-08-12 微软技术许可有限责任公司 基于配额的资源管理
CN105320561A (zh) * 2015-11-09 2016-02-10 深圳市万普拉斯科技有限公司 任务管理方法和系统
CN105320570A (zh) * 2015-11-09 2016-02-10 深圳市万普拉斯科技有限公司 资源管理方法和系统

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3610930B2 (ja) 2001-07-12 2005-01-19 株式会社デンソー オペレーティングシステム、プログラム、車両用電子制御装置
US7360216B2 (en) 2002-07-03 2008-04-15 Nvidia Corporation Method and system for real-time multitasking
JP3920818B2 (ja) * 2003-07-22 2007-05-30 株式会社東芝 スケジューリング方法および情報処理システム
JP4580845B2 (ja) * 2005-08-24 2010-11-17 パナソニック株式会社 タスク実行装置
CN102662743A (zh) * 2012-04-13 2012-09-12 南京信息工程大学 一种启发式粗粒度并行网格任务调度方法
US9602779B2 (en) * 2012-07-10 2017-03-21 Christopher DeJuliis System for passenger monitoring
CN103077086A (zh) * 2013-01-09 2013-05-01 苏州亿倍信息技术有限公司 一种任务分配控制的方法及系统

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2449849A1 (en) * 2009-06-29 2012-05-09 Nokia Corporation Resource allocation
CN104838360A (zh) * 2012-09-04 2015-08-12 微软技术许可有限责任公司 基于配额的资源管理
CN103902364A (zh) * 2012-12-25 2014-07-02 腾讯科技(深圳)有限公司 一种物理资源管理方法、装置及智能终端设备
CN105320561A (zh) * 2015-11-09 2016-02-10 深圳市万普拉斯科技有限公司 任务管理方法和系统
CN105320570A (zh) * 2015-11-09 2016-02-10 深圳市万普拉斯科技有限公司 资源管理方法和系统

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3376381A4 *

Also Published As

Publication number Publication date
CN105320570B (zh) 2019-01-29
EP3376381A4 (en) 2018-11-14
US10467054B2 (en) 2019-11-05
EP3376381A1 (en) 2018-09-19
CN105320570A (zh) 2016-02-10
US20180329750A1 (en) 2018-11-15

Similar Documents

Publication Publication Date Title
WO2017080276A1 (zh) 资源管理方法和系统、计算机存储介质
WO2017080273A1 (zh) 任务管理方法和系统、计算机存储介质
US9858115B2 (en) Task scheduling method for dispatching tasks based on computing power of different processor cores in heterogeneous multi-core processor system and related non-transitory computer readable medium
Kim et al. Utilization-aware load balancing for the energy efficient operation of the big. LITTLE processor
US20090320031A1 (en) Power state-aware thread scheduling mechanism
CN109766180B (zh) 负载均衡方法和装置、存储介质、计算设备及计算系统
US20130036423A1 (en) Systems and methods for bounding processing times on multiple processing units
US10089155B2 (en) Power aware work stealing
US20150378782A1 (en) Scheduling of tasks on idle processors without context switching
CN109491780B (zh) 多任务调度方法及装置
CN111459622B (zh) 调度虚拟cpu的方法、装置、计算机设备和存储介质
US20160291672A1 (en) Preformance state aware thread scheduling
Mascitti et al. Dynamic partitioned scheduling of real-time dag tasks on arm big. little architectures
US9229716B2 (en) Time-based task priority boost management using boost register values
Socci et al. Time-triggered mixed-critical scheduler on single and multi-processor platforms
US9612907B2 (en) Power efficient distribution and execution of tasks upon hardware fault with multiple processors
US11422857B2 (en) Multi-level scheduling
CN116244073A (zh) 混合关键分区实时操作系统的资源感知型任务分配方法
US9618988B2 (en) Method and apparatus for managing a thermal budget of at least a part of a processing system
CN112114967B (zh) 一种基于服务优先级的gpu资源预留方法
JP2008225641A (ja) コンピュータシステム、割り込み制御方法及びプログラム
US7603673B2 (en) Method and system for reducing context switch times
CN114035926A (zh) 应用线程调度方法、装置、存储介质及电子设备
US20190138364A1 (en) Multi-processor system and processor management method thereof
CN116893893B (zh) 一种虚拟机调度方法、装置、电子设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16863454

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 15774282

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

WWE Wipo information: entry into national phase

Ref document number: 2016863454

Country of ref document: EP