WO2021056277A1 - 一种执行程序的方法 - Google Patents

一种执行程序的方法 Download PDF

Info

Publication number
WO2021056277A1
WO2021056277A1 PCT/CN2019/107908 CN2019107908W WO2021056277A1 WO 2021056277 A1 WO2021056277 A1 WO 2021056277A1 CN 2019107908 W CN2019107908 W CN 2019107908W WO 2021056277 A1 WO2021056277 A1 WO 2021056277A1
Authority
WO
WIPO (PCT)
Prior art keywords
program
importance
program block
execution
execution cycle
Prior art date
Application number
PCT/CN2019/107908
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 CN201980100041.9A priority Critical patent/CN114450665A/zh
Priority to PCT/CN2019/107908 priority patent/WO2021056277A1/zh
Publication of WO2021056277A1 publication Critical patent/WO2021056277A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units

Definitions

  • the embodiments of the present disclosure generally relate to the computer field, and more specifically, to a method of executing a program in a controller.
  • Some program scheduling schemes have been proposed, but these schemes mainly focus on dividing the program into multiple program blocks, setting up a multi-core controller, and executing the program blocks in parallel, thereby improving the application or saving cycle time.
  • the traditional solution cannot complete the desired program within the configured short cycle time. If you need to further shorten the cycle, you need a controller with better hardware performance, but such a controller is usually more expensive.
  • the present invention provides a program for executing a program, which can increase the running speed of the program without increasing the cost and execution time of the controller, thereby at least partially solving the above-mentioned problems.
  • a method of executing a program includes: dividing at least one program into a plurality of program blocks; and determining a second execution period of the plurality of program blocks after the first execution period at least based on the execution state of the plurality of program blocks in the first execution period of the controller And based on the corresponding importance of the multiple program blocks, execute at least one of the multiple program blocks in the controller in the second execution cycle.
  • the execution sequence of the program blocks in each cycle can be dynamically adjusted to minimize the execution time of the program.
  • determining the corresponding importance of a plurality of program blocks includes: for a given program block among the plurality of program blocks, indicating that the given program block has been executed in the first execution cycle according to the execution status of the given program block. After being executed, the importance of the given program block in the first execution cycle is reduced as the importance of the given program block in the second execution cycle; and the given program block is indicated according to the execution status of the given program block If it is not completely executed in the first execution cycle, the importance of the given program block in the first execution cycle is increased, as the importance of the given program block in the second execution cycle. In this way, the importance of the unexecuted program blocks can be increased, thereby reducing the execution time of the program.
  • determining the corresponding importance of the multiple program blocks further includes: determining the dependency relationship between the multiple program blocks; and determining the corresponding importance of the multiple program blocks based on the execution status and the dependency relationship. In this way, the way of adjusting the importance degree is increased, and the accuracy of the adjustment is further improved.
  • the controller includes a first core and a second core, at least one program includes a first program allocated to the first core and a second program allocated to the second core, and a plurality of programs are determined therein
  • the dependency relationship between the blocks includes: according to determining that there is a program dependency relationship between the first program and the second program, determining at least one of the program blocks divided by the first program and the program block divided by the second program There is a dependency between at least another program block. In this way, the connection of the program blocks between the multiple cores is realized, so that the importance of the program blocks in each core in the multi-core is also affected by the program blocks in other cores, thereby realizing the optimization of the execution of multiple cores. .
  • the dependency relationship includes a control dependency relationship between a plurality of program blocks, and determining the corresponding importance of the plurality of program blocks based on the execution status and the dependency relationship includes: indicating the first of the plurality of program blocks according to the dependency relationship.
  • the program block controls the execution of the second program block among the plurality of program blocks, and indicates that the first program block has been executed in the first execution cycle according to the execution status of the first program block, reducing the importance of the second program block, As the importance of the second program method in the second execution cycle; and according to the execution status of the first program block to indicate that the first program block was not completely executed in the first execution cycle, the importance of the second program block is increased Large, as the importance of the second procedural method in the second execution cycle.
  • the control dependency between program blocks can be considered in the scheduling of program execution, which increases the accuracy of adjustment and improves the efficiency of program execution.
  • the dependency relationship includes the data dependency relationship between the multiple program blocks, and determining the corresponding importance of the multiple program blocks based on the execution status and the dependency relationship includes: indicating the first of the multiple program blocks according to the data dependency relationship.
  • the execution result of the three program blocks is the input of the fourth program block among the multiple program blocks.
  • the execution status of the third program block it indicates that the third program block has output the execution result in the first execution cycle, and the fourth program block is The importance of the first execution cycle is increased as the importance of the fourth program block in the second execution cycle; and according to the execution status of the third program block, it is indicated that the third program block has no output execution in the first execution cycle As a result, the importance of the fourth program block in the first execution cycle is reduced as the importance of the fourth program block in the second execution cycle. In this way, the data dependency between program blocks can be considered in the scheduling of program execution, which increases the accuracy of adjustment and improves the efficiency of program execution.
  • determining the corresponding importance of the plurality of program blocks further includes: obtaining a result output requirement associated with the fifth program block of the plurality of program blocks, and the result output request indicates the execution of the fifth program block.
  • the output speed requirement of the result based on whether the result output requirement of the fifth program block is met in the first execution cycle, the importance of the fifth program block is determined. In this way, the way of adjusting the importance degree is increased, and the accuracy of the adjustment is further improved.
  • an apparatus for executing a program includes: a controller; and a memory coupled with the controller.
  • the memory has instructions stored therein.
  • the instructions cause the device to perform actions when executed by the controller.
  • the actions include: dividing at least one program into a plurality of program blocks; at least Based on the execution status of the multiple program blocks in the first execution cycle of the controller, determine the corresponding importance of the multiple program blocks in the second execution cycle after the first execution cycle; and based on the corresponding importance of the multiple program blocks , Execute at least one of the multiple program blocks in the controller in the second execution cycle.
  • a computer-readable medium having computer-executable instructions stored thereon, and when executed, the computer-executable instructions cause at least one processor to perform various implementations of the method according to the first aspect. example.
  • the optimal configuration of program execution in the controller is realized, and the calculation speed is improved.
  • FIG. 1 shows a schematic diagram of an example environment in which an embodiment of the present disclosure can be implemented
  • Figure 2 shows a block diagram of a controller with program scheduling according to an embodiment of the present disclosure
  • Fig. 3 shows a schematic diagram of dynamically adjusting importance based on execution status according to an embodiment of the present disclosure
  • 4a and 4b show schematic diagrams of dynamically adjusting the importance of program blocks according to the control dependency relationship according to an embodiment of the present disclosure
  • 5a and 5b show schematic diagrams of dynamically adjusting the importance of program blocks according to data dependency relationships according to an embodiment of the present disclosure
  • FIG. 6 shows a block diagram of a controller with program scheduling according to another embodiment of the present disclosure
  • FIG. 7a and 7b show schematic diagrams of dynamically adjusting the importance of program blocks between different cores of a multi-core controller according to a control dependency relationship according to an embodiment of the present disclosure
  • FIG. 8a and 8b show schematic diagrams of dynamically adjusting the importance of program blocks between different cores of a multi-core controller according to a data dependency relationship according to an embodiment of the present disclosure
  • FIG. 9 shows a schematic diagram of determining the importance of a program block according to the execution state required by the result output of the program block according to an embodiment of the present disclosure
  • FIG. 10 shows a flowchart of a process of executing a program according to an embodiment of the present disclosure.
  • Figure 11 shows a block diagram of an example device that can be used to implement embodiments of the present disclosure.
  • T1 the first execution cycle
  • T2 the second execution cycle
  • FIG. 1 shows a schematic diagram of an example environment 100 in which embodiments of the present disclosure can be implemented.
  • the environment 100 includes a controller 1, and the controller 1 has a program 121 inside.
  • the controller 1 can execute the program 121.
  • the controller 1 may receive the input data 101 from the outside, call the program 121 to process the input data 101, and output the execution result 102 processed by the program 121.
  • the controller 1 may be a programmable logic controller (PLC), a multi-core PLC, and any other type of controller.
  • PLC programmable logic controller
  • the controller 1 may also include an I/O module port (not shown) for connecting with an external I/O module for data interaction.
  • the controller 1 may include a communication module port (not shown) for connecting with an external communication module for communication.
  • a part of the environment 100 shown in FIG. 1 may be implemented in an industrial application, for example, the controller 1 is included in a physical device such as a robot, a machine tool, and the like.
  • the controller 1 shown in FIG. 1 may be a single-core controller or a multi-core controller.
  • the input data 101 may be data collected by a sensor, such as a current sampling signal, a voltage sampling signal, and so on.
  • the execution result 102 may be a control signal, such as an actuator signal or a storage signal.
  • the program 121 may be, for example, a specific task to be performed by the controller, such as data sampling, signal conversion, calculation, data analysis, and so on.
  • the program 121 is usually executed according to the execution cycle of the controller 1, and in each execution cycle, part or all of the program 121 is executed. If a part of the program 121 is not executed in one execution cycle, the program 121 will continue to be executed from the part that has not been executed in the next execution cycle.
  • a program execution scheme is proposed.
  • the program is divided into multiple program blocks, and the execution sequence of the multiple program blocks is dynamically adjusted in cycles.
  • the corresponding importance of multiple program blocks is determined based at least on the execution status of these program blocks in the previous execution cycle. The determined importance will control the execution of the program block in the current execution cycle. Therefore, by dynamically adjusting the importance of each program block, the relatively important program blocks are executed first, which improves the execution efficiency of the program and reduces the execution time of the program.
  • FIG. 2 shows a block diagram of the controller 1 with program scheduling according to an embodiment of the present disclosure.
  • the controller 1 includes a dynamic scheduler 21 for the execution of the dynamic scheduler.
  • the program 121 to be executed by the controller 1 is divided into a plurality of program blocks C11, C12, ..., C16.
  • the division of the program 121 may be implemented according to steps in the tasks performed by the program. Any other program block division method is also feasible. It should be understood that although the figure shows that the program is divided into six program blocks, in other embodiments, any other number of program blocks is also possible.
  • the dynamic scheduler 21 determines that the program blocks C11-C16 are in the first execution cycle (referred to as the "first execution cycle") of the program blocks C11-C16 at least based on the execution status of the program blocks C11-C16 in one execution cycle of the controller.
  • the corresponding importance in another execution cycle (referred to as the "second execution cycle") after the execution cycle.
  • the importance of program blocks is continuously adjusted according to the execution cycle.
  • the importance of the program block can sometimes be called the weight of the program block.
  • the importance of a program block in an execution cycle will affect whether the program block can be scheduled for execution in the execution cycle. How to determine the importance based on the execution status will be described in detail below.
  • the initial importance of the program blocks C11-C16 can be determined based on experience. It should be understood that the "first execution cycle” and “second execution cycle” herein may be any two adjacent execution cycles during the execution of the program 121. The second execution cycle may immediately follow the first execution cycle. In some cases, there may be one or more other execution cycles in the second execution cycle and the first execution cycle.
  • the dynamic scheduler 21 may sort the importance of each program block, and based on the importance ranking, execute at least one of the program blocks C11-C16 in the controller in the second execution cycle.
  • the length of the execution cycle of the controller is related to the specific controller configuration.
  • the number of program blocks that can be executed in each execution cycle depends on the length of the execution cycle and the length of the program blocks. The scope of the embodiments of the present disclosure is not limited in this respect.
  • the program blocks in the program 121 are executed in the order of C11-C12-C13-C14-C15-C16. Assume that the program blocks C11-C16 have corresponding importance in the first execution cycle T1. In some embodiments, according to the execution status of a plurality of program blocks C11-C16, it is indicated that each program block has been executed or not executed in the first execution cycle T1, and these program blocks are executed in the first execution cycle T1. The importance is reduced or increased as the importance of these program blocks in the second execution cycle T2.
  • the dynamic scheduler 21 reduces the importance of the program block C13 (denoted as F) according to the execution status of the program block C13 As the importance of the program block C13 in the next execution cycle T2.
  • the dynamic scheduler 21 increases the importance F of the program block C16 as the program according to the execution state of the program block C16 The importance of block C16 in the next execution cycle T2.
  • the execution importance of F R Old is the execution importance in the first execution cycle T1
  • ⁇ R is the execution adjustment factor.
  • the execution adjustment factor ⁇ R may be a reward factor to increase the importance of execution, or it may be a penalty factor to reduce the importance of execution.
  • the penalty factor can be, for example, any number from 0-1, such as 0.9, 0.95, 0.8, 0.85, and so on.
  • the reward factor can be, for example, any number greater than 1, such as 1.2, 1.5, 1.8, 2, and so on.
  • the size of the penalty factor and the reward factor can be set based on experience.
  • the importance of each program block can be determined as the execution importance, or the final importance of the program block can be determined by referring to the importance of other aspects on the basis of the operational importance, which will be described in detail below.
  • the program blocks in the program 121 will be as C11-C12-C14-C13-C16
  • the sequence of -C15 is executed in the second execution cycle T2. It should be understood that the order here is only an example, and in some embodiments, other orders are also possible according to the result of the importance calculation.
  • the execution of a certain program block depends on the execution of other program blocks. Therefore, when determining the corresponding importance of multiple program blocks, it is also necessary to determine the dependency between the multiple program blocks, and determine the corresponding importance of the multiple program blocks based on the execution status and dependency of the multiple program blocks. In some embodiments, these dependencies include control dependencies, data dependencies, or both.
  • Figures 4a and 4b show some examples of dynamically adjusting the importance of program blocks according to the control dependency.
  • FIG 4a it is assumed that there is a control dependency relationship between the program blocks C12 and C13, that is, the execution result of the program block C12 controls the execution of the program block C13.
  • the program blocks in the program 121 are executed in the order of C11-C12-C13-C14-C15-C16.
  • the execution status of the program block C12 indicates that the execution of the program block C12 is completed, it means that the program block C13 is in a state that can be executed.
  • the dynamic scheduler 21 reduces the importance of the program block C12 as The importance of the program block C12 in the next execution cycle T2, and the importance of the program block C13 is increased according to the execution status of the program block C12 as the importance of the program block C13 in the next execution cycle T2. Therefore, in the second execution cycle T2 shown in FIG. 4a, the program blocks in the program 121 are executed in the order of C11-C13-C12-C14-C15-C16.
  • the dynamic scheduler 21 increases the importance of the program block C12 as the importance of the program block C12 in the next execution cycle T2 according to the execution status of the program block C12, and at the same time changes the importance of the program block C13 according to the execution status of the program block C12.
  • the decrease in importance is the importance of the program block C13 in the next execution cycle T2. Therefore, in the second execution cycle T2 shown in FIG. 4b, the program blocks in the program 121 are executed in the order of C12-C11-C14-C13-C15-C16.
  • two or more program blocks having a control dependency relationship may be combined together to be executed as one program block.
  • the control importance in T2, F C Old is the control importance in the first execution cycle T1
  • ⁇ C is the control adjustment factor.
  • the control adjustment factor ⁇ C may be a reward factor for increasing the importance of control, or it may be a penalty factor for reducing the importance of control.
  • the penalty factor can be, for example, any number from 0-1, such as 0.9, 0.95, 0.8, 0.85, and so on.
  • the reward factor can be, for example, any number greater than 1, such as 1.2, 1.5, 1.8, 2, and so on.
  • the size of the control adjustment factor can be set based on experience.
  • the importance of each program block can be determined as the control importance, or the final importance of the program block can be determined by referring to the importance of other aspects on the basis of the control importance.
  • Figures 5a and 5b show some examples of dynamically adjusting the importance of program blocks according to data dependency.
  • the execution result ie, the output
  • the program blocks in the program 121 are executed in the order of C11-C12-C13-C14-C15-C16.
  • the execution state of the program block C12 indicates that the execution of the program block C12 is completed in the first execution cycle, it means that the input of the program block C15 is ready, and the program block C15 is in a state that can be executed.
  • the dynamic scheduler 21 can reduce the importance of the program block C12 as the importance of the program block C12 in the next execution cycle T2 according to the execution status of the program block C12, and at the same time reduce the importance of the program block C15 according to the execution status of the program block C12
  • the importance degree increases as the importance degree of the program block C15 in the next execution cycle T2. Therefore, in the second execution cycle T2 shown in FIG. 5a, the program blocks in the program 121 are executed in the order of C11-C13-C12-C15-C14-C16.
  • the dynamic scheduler 21 increases the importance of the program block C12 as the importance of the program block C12 in the next execution cycle T2 according to the execution status of the program block C12, and at the same time changes the importance of the program block C15 according to the execution status of the program block C12.
  • the decrease in importance is regarded as the importance of the program block C15 in the next execution cycle T2. Therefore, in the second execution cycle T2 shown in FIG. 5b, the program blocks in the program 121 are executed in the order of C12-C11-C13-C14-C16-C15.
  • the data adjustment factor ⁇ D may be a reward factor to increase the importance of data, or it may be a penalty factor to reduce the importance of data.
  • the penalty factor can be, for example, any number from 0-1, such as 0.9, 0.95, 0.8, 0.85, and so on.
  • the reward factor can be, for example, any number greater than 1, such as 1.2, 1.5, 1.8, 2, and so on.
  • the size of the data adjustment factor can be set based on experience.
  • the importance of each program block can be determined as the data importance, or the final importance of the program block can be determined by referring to the importance of other aspects on the basis of the data importance.
  • Fig. 6 shows a block diagram of a controller with program scheduling according to another embodiment of the present disclosure.
  • the controller 1 is a multi-core controller, and includes, for example, a first core 12 and a second core 13.
  • the controller 1 may be a multi-core processor with more than two cores.
  • At least one program is allocated to the first core 12 and the second core 13.
  • the program 121 is allocated to the first core 12 for execution, and the other program 131 is allocated to the second core 13 for execution.
  • a core can be assigned to multiple programs.
  • the program 121 in the first core 12 is divided into a plurality of program blocks C11, C12...C16.
  • the program 131 in the first core 13 is also divided into a plurality of program blocks C21, C22...C26.
  • the dynamic scheduler 21 determines the plurality of program blocks C11 in the first core 12 -The corresponding importance of the multiple program blocks C21-C26 in the C16 and the second core 13 in the second execution cycle after the first execution cycle in the respective cores 12, 13.
  • each core 12, 13 of the controller In the execution cycle of each core 12, 13 of the controller, according to the magnitude of importance, at least one of the program blocks C11-C16 and the program block C21 are executed in the controller in the second execution cycle of each core 12, 13 -At least one of C26.
  • the division of the program 121 of the first core 12 and the program 131 of the second core 13 may be implemented according to steps in the tasks performed by the programs.
  • the division of the program 121 of the first core 12 and the program 131 of the second core 13 can also be implemented according to the program dependency between the program 121 and the program 131.
  • the control dependency and data dependency are shown in Figure 4a, Figure 4b, Figure 5a and Figure 5b.
  • FIGS. 7a, 7b, 8a, and 8b how to dynamically adjust the importance of multiple program blocks when there is a dependency between the program blocks between different cores of the multi-core controller will be described.
  • FIG. 7a and 7b illustrate how to dynamically adjust the importance of multiple program blocks when there is a control dependency between the program blocks between different cores of the multi-core controller.
  • the program 121 in the first core 12 is divided into program blocks C11, C12, C13, C14, C15, and C16
  • the program 131 in the second core 13 is divided into program blocks C21, C22, C23, C24, C25, C26, among them
  • the control dependence relationship between the program blocks C13 and C23 is determined through the program dependence relationship.
  • the program blocks of the program 121 are executed in the order of C11-C12-C13-C14-C15-C16.
  • the program 131 The program blocks are executed in the order of C21-C22-C23-C24-C25-C26.
  • the execution status of the program block C13 indicates that the execution of the program block C13 is completed, it means that the program block C23 is in a state where it can be executed.
  • the dynamic scheduler 21 reduces the importance of C13 according to the execution state of the program block C13 as the importance of the program block C13 in the next execution cycle T2, and at the same time, according to the execution state of the program block C13, the program block of the program 131
  • the importance of C23 increases as the importance of the program block C23 in the next execution cycle T2.
  • the program blocks in the first core 12 are in the order of C11-C12-C14-C15- C13-C16 are executed sequentially.
  • the program blocks in the second core 13 are executed in the order of C21-C23-C22-C24-C25-C26.
  • the dynamic scheduler 21 increases the importance of the program block C13 as the importance of the program block C13 in the next execution cycle T2 according to the execution status of the program block C13, and at the same time changes the importance of the program block C23 according to the execution status of the program block C13.
  • the decrease in importance is regarded as the importance of the program block C23 in the next execution cycle T2. Therefore, in the second execution cycle T2 of the first core 12 shown in FIG.
  • the program blocks in the first core 12 are executed in the order of C11-C13-C12-C14-C15-C16, and in the second core 13 In the second execution cycle T2, the program blocks in the second core 13 are executed in the order of C21-C22-C24-C23-C25-C26.
  • the control importance in T2, F C Old is the control importance in the first execution cycle T1
  • ⁇ C is the control adjustment factor.
  • the control adjustment factor ⁇ C may be a reward factor for increasing the importance of control, or it may be a penalty factor for reducing the importance of control.
  • the penalty factor can be, for example, any number from 0-1, such as 0.9, 0.95, 0.8, 0.85, and so on.
  • the reward factor can be, for example, any number greater than 1, such as 1.2, 1.5, 1.8, 2, and so on.
  • the size of the control adjustment factor can be set based on experience.
  • the importance of each program block can be determined as the control importance, or the final importance of the program block can be determined by referring to the importance of other aspects on the basis of the control importance.
  • FIG. 8a and 8b to illustrate how to dynamically adjust the importance of multiple program blocks when there is a data dependency between program blocks between different cores of the multi-core controller.
  • the program in the first core 12 is divided into program blocks C11, C12, C13, C14, C15, C16
  • the program in the second core 13 is divided into program blocks C21, C22, C23, C24, C25, C26.
  • There is a data dependency relationship between the program blocks C26 and C14 that is, the execution result of the program block C26 will be used as the input of the program block 14 for the program block 14 to continue processing.
  • the program blocks of the program 121 are executed in the order of C11-C12-C13-C14-C15-C16.
  • the program 131 The program blocks are executed in the order of C21-C22-C23-C24-C25-C26.
  • the execution status of the program block C26 indicates that the execution of the program block C26 is completed in the first execution cycle T1, it means that the input of the program block C14 is ready, and the program block C14 is in a state that can be executed.
  • the dynamic scheduler 21 reduces the importance of the program block C26 as the importance of the program block C26 in the next execution cycle T2 according to the execution state of the program block C26, and at the same time reduces the importance of the program block C14 according to the execution state of the program block C26.
  • the degree of importance increases as the importance of the program block C14 in the next execution cycle T2. Therefore, in the second execution cycle T2 of the first core 12 shown in FIG. 8a, depending on the order of the importance of each program block after adjustment, the program blocks in the first core 12 are in the order of C11-C12-C14-C15- The sequence of C13-C16 is executed. In the second execution cycle T2 of the second core 13, since the execution order of the program block C26 is already at the end, the order of execution of the program blocks in the second core 13 remains unchanged.
  • the dynamic scheduler 21 increases the importance of the program block C26 according to the execution state of the program block C26 as the importance of the program block C26 in the next execution cycle T2, and at the same time, according to the execution state of the program block C26 The importance of the block C14 is reduced as the importance of the program block C14 in the next execution cycle T2. Therefore, in the second execution cycle T2 of the first core 12 shown in FIG.
  • the program blocks in the first core 12 are executed in the order of C11-C12-C13-C15-C14-C16, and in the second core 13 In the second execution cycle T2, the program blocks in the second core 13 are executed in the order of C21-C22-C23-C24-C26-C25.
  • the data adjustment factor ⁇ D may be a reward factor to increase the importance of data, or it may be a penalty factor to reduce the importance of data.
  • the penalty factor can be, for example, any number from 0-1, such as 0.9, 0.95, 0.8, 0.85, and so on.
  • the reward factor can be, for example, any number greater than 1, such as 1.2, 1.5, 1.8, 2, and so on.
  • the size of the data adjustment factor can be set based on experience.
  • the importance of each program block can be determined as the data importance, or the final importance of the program block can be determined by referring to the importance of other aspects on the basis of the data importance.
  • the tasks executed by the controller have requirements on the output speed in the program block, for example, in certain high dynamic response occasions.
  • the result output requirements associated with one or some of the multiple program blocks can also be obtained, and the result output requirements indicate the results of the execution of the corresponding program blocks.
  • the dynamic scheduler 21 determines the importance of the program block(s) in the second execution cycle based on whether the result output requirement of the corresponding program block is met in the first execution cycle.
  • the result output requirement is satisfied means that the result of the execution of the program block is output at the required speed.
  • FIG. 9 shows an example of determining the importance of the program block based on whether the result output requirement of the program block is satisfied in the first execution cycle.
  • the program blocks in the program 121 are executed in the order of C11-C12-C13-C14-C15-C16.
  • the dynamic scheduler 21 reduces the importance of C13 as the importance of C13 in the next execution cycle T2 according to the execution status of the program block C13.
  • the dynamic scheduler 21 increases the importance of C13 as the importance of C13 in the next execution cycle T2 according to the execution status of the program block C13.
  • the self-importance in T2 F S Old is the self-importance in the first execution cycle T1
  • ⁇ S is the self-regulating factor.
  • the self-adjustment factor ⁇ S may be a reward factor used to increase its own importance, or it may be a penalty factor used to reduce its own importance.
  • the penalty factor can be, for example, any number from 0-1, such as 0.9, 0.95, 0.8, 0.85, and so on.
  • the reward factor can be, for example, any number greater than 1, such as 1.2, 1.5, 1.8, 2, and so on.
  • the size of the control adjustment factor can be set based on experience. The importance of each program block can be determined as its own importance, or the importance of other aspects can also be referred to on the basis of its own importance, which will be described in detail below.
  • FIG. 10 shows a flowchart of a method 1000 for executing a program according to an embodiment of the present disclosure.
  • the method 1000 may be executed by the controller 1 described above with reference to FIGS. 2 and 3.
  • At 1011 at least one program is divided into a plurality of program blocks; at least based on the execution state of the plurality of program blocks in the first execution cycle of the controller.
  • the corresponding importance of the plurality of program blocks in the second execution period after the first execution period is determined.
  • determining the corresponding importance of a plurality of program blocks includes: for a given program block among the plurality of program blocks, indicating that the given program block has been executed in the first execution cycle according to the execution status of the given program block. After being executed, the importance of the given program block in the first execution cycle is reduced as the importance of the given program block in the second execution cycle; and the given program block is indicated according to the execution status of the given program block If it is not completely executed in the first execution cycle, the importance of the given program block in the first execution cycle is increased, as the importance of the given program block in the second execution cycle.
  • determining the corresponding importance of the multiple program blocks further includes: determining the dependency relationship between the multiple program blocks; and determining the corresponding importance of the multiple program blocks based on the execution status and the dependency relationship.
  • the controller includes a first core and a second core, at least one program includes a first program allocated to the first core and a second program allocated to the second core, and a plurality of programs are determined therein
  • the dependency relationship between the blocks includes: according to determining that there is a program dependency relationship between the first program and the second program, determining at least one of the program blocks divided by the first program and the program block divided by the second program There is a dependency between at least another program block.
  • the dependency relationship includes a control dependency relationship between a plurality of program blocks, and determining the corresponding importance of the plurality of program blocks based on the execution status and the dependency relationship includes: indicating the first of the plurality of program blocks according to the dependency relationship.
  • the program block controls the execution of the second program block among the plurality of program blocks, and indicates that the first program block has been executed in the first execution cycle according to the execution status of the first program block, reducing the importance of the second program block, As the importance of the second program method in the second execution cycle; and according to the execution status of the first program block to indicate that the first program block was not completely executed in the first execution cycle, the importance of the second program block is increased Large, as the importance of the second procedural method in the second execution cycle.
  • the dependency relationship includes the data dependency relationship between the multiple program blocks, and determining the corresponding importance of the multiple program blocks based on the execution status and the dependency relationship includes: indicating the first of the multiple program blocks according to the data dependency relationship.
  • the execution result of the three program blocks is the input of the fourth program block among the multiple program blocks.
  • the execution status of the third program block it indicates that the third program block has output the execution result in the first execution cycle, and the fourth program block is The importance of the first execution cycle is increased as the importance of the fourth program block in the second execution cycle; and according to the execution status of the third program block, it is indicated that the third program block has no output execution in the first execution cycle As a result, the importance of the fourth program block in the first execution cycle is reduced as the importance of the fourth program block in the second execution cycle.
  • determining the corresponding importance of the plurality of program blocks further includes: obtaining a result output requirement associated with the fifth program block of the plurality of program blocks, and the result output request indicates the execution of the fifth program block.
  • the output speed requirement of the result based on whether the result output requirement of the fifth program block is met in the first execution cycle, the importance of the fifth program block is determined.
  • determining the importance of the fifth program block includes: according to the result of the fifth program block, the output requirement is met in the first execution cycle, and the importance of the fifth program block in the first execution cycle is reduced. , As the importance of the fifth program block in the second execution cycle; and according to the result of the fifth program block, the output requirement is not met in the first execution cycle, and the fifth program block is important in the first execution cycle. The degree is increased as the importance of the fifth program block in the second execution cycle.
  • Figure 11 shows a schematic block diagram of an example device 1100 that can be used to implement embodiments of the present disclosure.
  • the device 1100 may be used to implement the process 1000 of FIG. 10.
  • the device 1100 includes a controller 1101, which can operate according to computer program instructions stored in a read-only memory (ROM) 1102 or computer program instructions loaded from a storage unit 1108 to a random access memory (RAM) 1103. Perform various appropriate actions and processing.
  • the controller 1101 may be the controller 1 described above, for example.
  • various programs and data required for the operation of the device 1100 can also be stored.
  • the controller 1101, the ROM 1102, and the RAM 1103 are connected to each other through a bus 1104.
  • An input/output (I/O) interface 1105 is also connected to the bus 1104.
  • the I/O interface 1105 Multiple components in the device 1100 are connected to the I/O interface 1105, including: an input unit 1106, such as a keyboard, a mouse, etc.; an output unit 1107, such as various types of displays, speakers, etc.; a storage unit 1108, such as a magnetic disk, an optical disk, etc. ; And the communication unit 1109, such as a network card, a modem, a wireless communication transceiver, etc.
  • the communication unit 1109 allows the device 1100 to exchange information/data with other devices through a computer network such as the Internet and/or various telecommunication networks.
  • the controller 1101 executes the various methods and processes described above, such as the process 1000.
  • the process 1000 may be implemented as a computer software program or a computer program product, which is tangibly contained in a computer-readable medium, such as a non-transitory computer-readable medium (for example, the storage unit 1108).
  • part or all of the computer program may be loaded and/or installed on the device 1100 via the ROM 1102 and/or the communication unit 1109.
  • the controller 1101 may be configured to perform the process 1000 in any other suitable manner (for example, by means of firmware).
  • the various steps of the method of the present disclosure described above can be implemented by a general computing device. They can be concentrated on a single computing device or distributed on a network composed of multiple computing devices. In particular, they can be implemented by program codes executable by a computing device, so that they can be stored in a storage device for execution by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or The steps are implemented as a single integrated circuit module. In this way, the present disclosure is not limited to any specific combination of hardware and software.
  • certain embodiments of the present disclosure further include various program modules and/or integrated circuit modules for performing one or more steps of the process 1000 and/or one or more other steps described in other embodiments of the present disclosure . These program modules may be included or embodied in a device, such as the device 1100 in FIG. 11.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

一种执行程序的方法。该方法包括:将至少一个程序划分为多个程序块(1011);至少基于多个程序块在控制器的第一执行周期中的执行状态,确定多个程序块在第一执行周期之后的第二执行周期中的相应重要度(1012);以及基于多个程序块的相应重要度,在第二执行周期中在控制器中执行多个程序块中的至少一个(1013)。上述执行程序的方法能够在不提高控制器成本和执行时间的基础上提高控制器的运行速度。

Description

一种执行程序的方法 技术领域
本公开的实施例总体上涉及计算机领域,并且更具体地,涉及一种在控制器中执行程序的方法。
背景技术
当今,数据处理任务在越来越多的领域中需要频繁执行。由于每个机器或系统的性能、数据存储和处理以及应用程序复杂性方面的个性化需求,以及现代自动化控制系统需要联网、获取更多数据、更加用户友好并能够相互通信,对控制器的运算速度的要求越来越高。
发明内容
目前已经提出了一些程序调度方案,但是这些方案主要着眼于将程序划分为多个程序块,设置多核控制器,并行地执行程序块,进而改进应用或节省周期时间。然而,在一些情况下,对于例如具有多次迭代计算的数据处理任务(诸如机器人控制或运动控制等),传统方案在配置的短周期时间内无法执行完期望的程序。如果需要进一步缩短周期,则需要硬件性能更好的控制器,但这样的控制器通常价格较高。
本发明提供了一种执行程序的方案,能够在不提高控制器成本和执行时间的基础上提高程序的运行速度,从而至少部分地解决上述问题。
在本公开的一个方面,提供了一种执行程序的方法。该方法包括:将至少一个程序划分为多个程序块;至少基于多个程序块在控制器的第一执行周期中的执行状态,确定多个程序块在第一执行周期之后的第二执行周期中的相应重要度;以及基于多个程序块的相应重要度,在第二执行周期中在控制器中执行多个程序块中的至少一个。由此,可以动态地调整每个周期内程序块的执行顺序,最小化程序的执行时间。
在某些实施例中,确定多个程序块的相应重要度包括:针对多个程序块中的给定程序块,根据给定程序块的执行状态指示给定程序块在第一执行周期中已经被执行 完成,将给定程序块在第一执行周期中的重要度降低,以作为给定程序块在第二执行周期中的重要度;以及根据给定程序块的执行状态指示给定程序块在第一执行周期中未被完全执行,将给定程序块在第一执行周期中的重要度增大,以作为给定程序块在第二执行周期中的重要度。以此方式,可以提高未执行程序块的重要度,从而减少程序的执行时间。
在某些实施例中,确定多个程序块的相应重要度还包括:确定多个程序块之间的依赖关系;以及基于执行状态和依赖关系来确定多个程序块的相应重要度。以此方式,增加了调节重要度的方式,进一步提高了调节的准确性。
在某些实施例中,控制器包括第一核和第二核,至少一个程序包括被分配到第一核的第一程序和被分配到第二核的第二程序,并且其中确定多个程序块之间的依赖关系包括:根据确定第一程序和第二程序之间存在程序依赖关系,确定由第一程序划分的程序块中的至少一个程序块与由第二程序划分的程序块中的至少另一个程序块之间存在依赖关系。以此方式,实现了多核之间的程序块的联系,使得多核中的每个核中的程序块的重要度还收到其他核中的程序块的影响,从而实现多个核的执行的优化。
在某些实施例中,依赖关系包括多个程序块之间的控制依赖关系,基于执行状态和依赖关系来确定多个程序块的相应重要度包括:根据依赖关系指示多个程序块的第一程序块控制多个程序块中的第二程序块的执行,根据第一程序块的执行状态指示第一程序块在第一执行周期中已经被执行完成,将第二程序块的重要度降低,以作为第二程序法在第二执行周期中的重要度;以及根据第一程序块的执行状态指示第一程序块在第一执行周期中未被完全执行,将第二程序块的重要度增大,以作为第二程序法在第二执行周期中的重要度。以此方式,程序块之间的控制依赖关系在程序执行的调度中得以被考虑,增加了调节的准确性、提高了程序执行效率。
在某些实施例中,依赖关系包括多个程序块之间的数据依赖关系,基于执行状态和依赖关系来确定多个程序块的相应重要度包括:根据数据依赖关系指示多个程序块的第三程序块的执行结果是多个程序块中的第四程序块的输入,根据第三程序块的执行状态指示第三程序块在第一执行周期中已经输出执行结果,将第四程序块在第一执行周期中的重要度增大,以作为第四程序块在第二执行周期中的重要度;以及根据第三程序块的执行状态指示第三程序块在第一执行周期中没有输出执行结果,将第四 程序块在第一执行周期中的重要度降低,以作为第四程序块在第二执行周期中的重要度。以此方式,程序块之间的数据依赖关系在程序执行的调度中得以被考虑,增加了调节的准确性、提高了程序执行效率。
在某些实施例中,确定多个程序块的相应重要度还包括:获得与多个程序块中的第五程序块相关联的结果输出要求,结果输出要求指示对第五程序块的执行的结果的输出速度要求;基于第五程序块的结果输出要求在第一执行周期中是否被满足,确定第五程序块的重要度。以此方式,增加了调节重要度的方式,进一步提高了调节的准确性。
在某些实施例中,确定第五程序块的重要度包括:根据第五程序块的结果输出要求在第一执行周期中被满足,将第五程序块在第一执行周期中的重要度降低,以作为第五程序块在第二执行周期中的重要度;以及根据第五程序块的结果输出要求在第一执行周期中未被满足,将第五程序块在第一执行周期中的重要度增大,以作为第五程序块在第二执行周期中的重要度。以此方式,程序块自身的要求在程序执行的调度中得以被考虑,进一步增加了调节的准确性、提高了程序执行效率。
在本公开的另一个方面,提供了一种用于执行程序的设备。该设备包括:控制器;以及与控制器耦合的存储器,存储器具有存储于其中的指令,指令在被控制器执行时使设备执行动作,动作包括:将至少一个程序划分为多个程序块;至少基于多个程序块在控制器的第一执行周期中的执行状态,确定多个程序块在第一执行周期之后的第二执行周期中的相应重要度;以及基于多个程序块的相应重要度,在第二执行周期中在控制器中执行多个程序块中的至少一个。
在本公开的又一个方面,提供了一种计算机可读介质,其上存储有计算机可执行指令,该计算机可执行指令在被执行时使至少一个处理器执行根据第一方面的方法的各个实施例。
根据本公开的实施例,通过动态调整各个程序块在每个执行周期中的重要度,实现了在控制器中程序执行的优化配置,提高了运算速度。
附图说明
下文将以明确易懂的方式通过对优选实施例的说明并结合附图来对本公开上述特性、技术特征、优点及其实现方式予以进一步说明,其中:
图1示出了本公开的实施例能够在其中实现的示例环境的示意图;
图2示出了根据本公开的一个实施例的具有程序调度的控制器的框图;
图3示出了根据本公开的一个实施例的基于执行状态动态调整重要度的示意图;
图4a和图4b示出了根据本公开的一个实施例的根据控制依赖关系对程序块的重要度进行动态调整的示意图;
图5a和图5b示出了根据本公开的一个实施例的根据数据依赖关系对程序块的重要度进行动态调整的示意图;
图6示出了根据本公开的另一个实施例的具有程序调度的控制器的框图;
图7a和图7b示出了根据本公开的一个实施例的根据控制依赖关系对多核控制器的不同核之间的程序块的重要度进行动态调整的示意图;
图8a和图8b示出了根据本公开的一个实施例的根据数据依赖关系对多核控制器的不同核之间的程序块的重要度进行动态调整的示意图;
图9示出了根据本公开的一个实施例的根据程序块的结果输出要求的执行状态确定该程序块的重要度的示意图;
图10示出了根据本公开的一个实施例的执行程序的过程的流程图;以及
图11示出了可以用来实施本公开的实施例的示例设备的框图。
附图标记列表:
1:控制器;
12:第一核;
13:第二核;
101:输入数据;
102:执行结果;
121:程序;
131:程序;
21:动态调度器;
C11-C16:程序块;
C21-C26:程序块;
T1:第一执行周期;
T2:第二执行周期;
1101:控制器;
1102:ROM;
1103:存储器;
1104:总线;
1105:I/O接口;
1106:输入单元;
1107:输出单元;
1108:存储单元;
1109:通信单元。
具体实施方式
下面将参考附图中示出的若干示例实施例来描述本公开的原理。虽然附图中显示了本公开的优选实施例,但应当理解,描述这些实施例仅是为了使本领域技术人员能够更好地理解进而实现本公开,而并非以任何方式限制本公开的范围。
在本文中使用的术语“包括”及其变形表示开放性包括,即“包括但不限于”。除非特别申明,术语“或”表示“和/或”。术语“基于”表示“至少部分地基于”。术语“一个示例实施例”和“一个实施例”表示“至少一个示例实施例”。术语“另一实施例”表示“至少一个另外的实施例”。术语“第一”、“第二”等等可以指代不同的或相同的对象。下文还可能包括其他明确的和隐含的定义。
以下参考附图来描述本公开的一些示例实施例。图1示出了本公开的实施例能够在其中实现的示例环境100的示意图。如图1所示,环境100包括控制器1,控制器1内部具有程序121。控制器1能够执行程序121。例如,控制器1可以从外部接收输入数据101,调用程序121对输入数据101进行处理,并且输出由程序121处理后的执行结果102。在某些实施例中,控制器1可以是可编程逻辑控制器(PLC)、多核PLC、以及任何其他类型的控制器。
在某些实施例中,控制器1还可以包括I/O模块端口(未示出),用于与外部I/O模块连接,以进行数据交互。在某些实施例中,控制器1可以包括通信模块端口(未 示出),用于与外部通信模块连接,以进行通信。
在一些示例中,图1中所示的环境100的一部分可以实现在工业应用中,例如控制器1被包括在诸如机器人、机床等物理设备中。图1中所示的控制器1可以是单核控制器,也可以是多核控制器。输入数据101可以是传感器采集到的数据,例如电流采样信号、电压采样信号等。执行结果102可以是控制信号,例如致动器信号、存储信号。程序121例如可以是要由控制器执行的特定任务,如数据采样、信号转换、计算、数据分析,等等。程序121通常按照控制器1的执行周期来执行,在每个执行周期中,程序121的部分或全部被执行。如果在一个执行周期中程序121的部分未被执行,则在下一个执行周期中从未被执行的部分起继续执行程序121。
已有的程序调度方法通常将控制器中程序划分成更小的程序块,通过执行程序块来提高执行程序的速度。然而,多个程序块的执行顺序固定不变。因此,控制器在各个执行周期内按顺序执行这些程序块。在某些情况下,例如某个程序块的执行影响其他程序块的执行,但该程序块在顺序上又是在后执行时,程序的执行速度并没有明显提高。
根据本公开的实施例,提出了一种程序执行的方案。根据该方案,程序被划分为多个程序块,并且多个程序块的执行顺序按周期动态调整。在当前执行周期中,多个程序块的相应重要度至少基于这些程序块在上一个执行周期中的执行状态来确定。所确定的重要度将控制程序块在当前执行周期中的执行。由此,通过动态地调整各个程序块的重要度,将相对较重要的程序块先执行,提高了程序的执行效率,降低了程序的执行时间。下文中将参考附图来详细描述本公开的示例实施例。
图2示出了根据本公开的一个实施例的具有程序调度的控制器1的框图。如图2所示,控制器1包括动态调度器21,用于动态调度程序的执行。
具体地,要由控制器1执行的程序121被划分为多个程序块C11、C12、…、C16。在某些实施例中,对程序121的划分可以根据程序所执行的任务中的步骤来实现。任何其他程序块划分方式也是可行的。应当理解,虽然图中示出了将程序划分为六个程序块,在其他实施例中,任何其他数目的程序块也是可能的。
根据本公开的实施例,动态调度器21至少基于程序块C11-C16在控制器的一个执行周期(被称为“第一执行周期”)中的执行状态,确定程序块C11-C16在第一执行周期之后的另一执行周期(被称为“第二执行周期”)中的相应重要度。换言之, 程序块的重要度是按执行周期不断调整的。程序块的重要度有时也可称为程序块的权重。一个程序块在一个执行周期中的重要度将会影响该程序块是否能够在该执行周期中被调度执行。如何基于执行状态来确定重要度将在下文详细描述。在某些实施例中,程序块C11-C16的初始重要度可以根据经验来确定。应当理解,此处的“第一执行周期”和“第二执行周期”可以是程序121执行过程中的任何两个相邻执行周期。第二执行周期可以紧接着第一执行周期。在一些情况下,在第二执行周期与第一执行周期中还可以存着一个或多个其他执行周期。
然后,动态调度器21可以对各个程序块的重要度的大小进行排序,并且基于重要度的排序,在第二执行周期中在控制器中执行程序块C11-C16中的至少一个。可以理解,控制器的执行周期的长度与具体控制器配置有关。在每个执行周期中所能执行的程序块的数目取决于执行周期的长度以及程序块的长度。本公开的实施例的范围在此方面不受限制。
参照图3对基于执行状态动态地调整重要度进行说明。如图3所示,在控制器的第一执行周期T1中,程序121中的程序块按C11-C12-C13-C14-C15-C16的顺序执行。假设程序块C11-C16在第一执行周期T1中具有相应的重要度。在一些实施例中,根据多个程序块C11-C16的执行状态指示各个程序块在第一执行周期T1中已经被执行完成或者未被执行完成,将这些程序块在第一执行周期T1中的重要度降低或升高,以作为这些程序块在第二执行周期T2中的重要度。
例如,当程序块C13的执行状态指示程序块C13在第一执行周期T1中已经执行完成时,动态调度器21根据程序块C13的执行状态将程序块C13的重要度(被表示为F)降低作为程序块C13在下一个执行周期T2中的重要度。又例如,当程序块C16的执行状态指示程序块C16在第一执行周期T1中未被完全执行时,动态调度器21根据程序块C16的执行状态将程序块C16的重要度F增大作为程序块C16在下一个执行周期T2中的重要度。
在某些实施例中,在考虑程序块的执行状态时,可以基于公式F R New=η R·F R Old来计算每个程序块的重要度,其中F R New为第二执行周期T2中的执行重要度,F R Old为第一执行周期T1中的执行重要度,η R为执行调节因子。执行调节因子η R可以是奖励因子,用于增大执行重要度,或者可以是惩罚因子,用于降低执行重要度。在某些实施例中,惩罚因子例如可以是0-1中的任何数,例如0.9、0.95、0.8、0.85,等 等。在某些实施例中,奖励因子例如可以是大于1的任何数,例如1.2、1.5、1.8、2,等等。在某些实施例中,惩罚因子和奖励因子的大小可以根据经验来设置。每个程序块的重要度可以被确定为执行重要度,或者在运行重要度基础上还参考其他方面的重要度来确定程序块的最终重要度,这在下文中将详细描述。
在图3所示的第二执行周期T2中,根据所确定的程序块C11-C16在第二执行周期T2中的重要度,程序121中的程序块将按C11-C12-C14-C13-C16-C15的顺序在第二执行周期T2中执行。应当理解,这里的顺序只是一个示例,在某些实施例中,根据对重要度的计算的结果,其他顺序也是可能的。
在一些实施例中,由于多个程序块中某些程序块之间存在着特殊的关系,导致其中某一个程序块的执行依赖于其他程序块的执行。因此,在确定多个程序块的相应重要度时,还需要确定多个程序块之间的依赖关系,并且基于多个程序块的执行状态和依赖关系来确定多个程序块的相应重要度。在某些实施例中,这些依赖关系包括控制依赖关系、数据依赖关系或其两者。
图4a和图4b示出了根据控制依赖关系对程序块的重要度进行动态调整的一些示例。如图4a所示,假设在程序块C12和C13之间存在控制依赖关系,即,程序块C12的执行结果控制程序块C13的执行。在控制器的第一执行周期T1中,程序121中的程序块按C11-C12-C13-C14-C15-C16的顺序执行。当程序块C12的执行状态指示程序块C12执行完成时,说明程序块C13处于已经可以被执行的状态,此时,动态调度器21根据程序块C12的执行状态将程序块C12的重要度降低作为程序块C12在下一个执行周期T2中的重要度,同时根据程序块C12的执行状态将程序块C13的重要度增大作为程序块C13在下一个执行周期T2中的重要度。因此,在图4a所示的第二执行周期T2中,程序121中的程序块按C11-C13-C12-C14-C15-C16的顺序执行。
当程序块C12的执行状态指示程序块C12在第一执行周期T1中未被完全执行时,说明程序块C13还处于尚未准备被执行的状态。此时,动态调度器21根据程序块C12的执行状态将程序块C12的重要度增大作为程序块C12在下一个执行周期T2中的重要度,同时根据程序块C12的执行状态将程序块C13的重要度降低作为程序块C13在下一个执行周期T2中的重要度。因此,在图4b所示的第二执行周期T2中,程序121中的程序块按C12-C11-C14-C13-C15-C16的顺序执行。
在某些实施例中,具有控制依赖关系的两个或多个程序块可以被结合在一起作为一个程序块被执行。
在某些实施例中,在考虑程序块的控制依赖关系时,可以基于公式F C New=η C·F C Old来计算每个程序块的控制重要度,其中F C New为第二执行周期T2中的控制重要度,F C Old为第一执行周期T1中的控制重要度,η C为控制调节因子。控制调节因子η C可以是奖励因子,用于增大控制重要度,或者可以是惩罚因子,用于降低控制重要度。在某些实施例中,惩罚因子例如可以是0-1中的任何数,例如0.9、0.95、0.8、0.85,等等。在某些实施例中,奖励因子例如可以是大于1的任何数,例如1.2、1.5、1.8、2,等等。在某些实施例中,控制调节因子的大小可以根据经验来设置。每个程序块的重要度可以被确定为控制重要度,或者在控制重要度基础上还参考其他方面的重要度来确定程序块的最终重要度。
图5a和图5b示出了根据数据依赖关系对程序块的重要度进行动态调整的一些示例。如图5a所示,假设在程序块C12和C15之间存在数据依赖关系,即,程序块C12的执行结果(即输出)是程序块C15的输入,以供程序块15继续处理。在控制器1的第一执行周期T1中,程序121中的程序块按C11-C12-C13-C14-C15-C16的顺序执行。当程序块C12的执行状态指示程序块C12在第一执行周期中执行完成时,说明程序块C15的输入已经准备好,程序块C15处于可以被执行的状态。由此,动态调度器21可以根据程序块C12的执行状态将程序块C12的重要度降低作为程序块C12在下一个执行周期T2中的重要度,同时根据程序块C12的执行状态将程序块C15的重要度增大作为程序块C15在下一个执行周期T2中的重要度。因此,在图5a所示的第二执行周期T2中,程序121中的程序块按C11-C13-C12-C15-C14-C16的顺序执行。
当程序块C12的执行状态指示程序块C12在第一执行周期T1中未被完全执行时,说明程序块C15的输入尚未准备好,程序块C15还处于尚未准备被执行的状态。此时,动态调度器21根据程序块C12的执行状态将程序块C12的重要度增大作为程序块C12在下一个执行周期T2中的重要度,同时根据程序块C12的执行状态将程序块C15的重要度降低作为程序块C15在下一个执行周期T2中的重要度。因此,在图5b所示的第二执行周期T2中,程序121中的程序块按C12-C11-C13-C14-C16-C15的顺序执行。
在某些实施例中,在考虑程序块的数据依赖关系时,可以基于公式F D New=η D·F D Old来计算每个程序块的数据重要度,其中F D New为第二执行周期T2中的数据重要度,F D Old为第一执行周期T1中的数据重要度,η D为数据调节因子。数据调节因子η D可以是奖励因子,用于增大数据重要度,或者可以是惩罚因子,用于降低数据重要度。在某些实施例中,惩罚因子例如可以是0-1中的任何数,例如0.9、0.95、0.8、0.85,等等。在某些实施例中,奖励因子例如可以是大于1的任何数,例如1.2、1.5、1.8、2,等等。在某些实施例中,数据调节因子的大小可以根据经验来设置。每个程序块的重要度可以被确定为数据重要度,或者在数据重要度基础上还参考其他方面的重要度来确定程序块的最终重要度。
图6示出了根据本公开的另一个实施例的具有程序调度的控制器的框图。在图6所示的示例中,控制器1是多核控制器,例如包括第一核12和第二核13。在其他实施例中,控制器1可以是多于两个核的多核处理器。至少一个程序被分配到第一核12和第二核13。例如,在图6所示的示例中,程序121被分配到第一核12执行,而另一程序131被分配到第二核13执行。当然,在某些实施例中,一个核可以被分配多个程序。
第一核12中的程序121被划分为多个程序块C11、C12…C16。第一核13中的程序131也被划分为多个程序块C21、C22…C26。至少基于程序块C11-C16和程序块C21-C26在控制器1的各自核12、13中的第一执行周期中的执行状态,动态调度器21确定第一核12中的多个程序块C11-C16和第二核13中的多个程序块C21-C26在各自核12、13中的第一执行周期之后的第二执行周期中的相应重要度。在控制器的各个核12、13的执行周期中,按照重要度的大小,在各个核12、13的第二执行周期中在控制器中执行程序块C11-C16中的至少一个和程序块C21-C26中的至少一个。在某些实施例中,对第一核12的程序121和第二核13的程序131的划分可以根据程序所执行的任务中的步骤来实现。
在某些实施例中,对第一核12的程序121和第二核13的程序131的划分也可以根据程序121和程序131之间的程序依赖关系来实现。在一些实施例中,对于多核控制器而言,不同核内的程序之间也可能存在着程序依赖关系,当分别对这些核中的程序进行划分时,划分之后的程序块之间也会存在着如图4a、图4b、图5a和图5b所示的控制依赖关系和数据依赖关系。下面参照图7a、图7b、图8a和图8b,对当 多核控制器的不同核之间的程序块之间的依赖关系时,如何动态调整多个程序块的重要度进行说明。
参照图7a和图7b说明在多核控制器的不同核之间的程序块之间存在控制依赖关系时如何动态调整多个程序块的重要度。如图7a所示,假设第一核12中程序121被分为程序块C11、C12、C13、C14、C15、C16,第二核13中的程序131被分为程序块C21、C22、C23、C24、C25、C26,其中通过程序依赖关系确定程序块C13和C23之间存在着控制依赖关系。在第一核12的第一执行周期T1中,程序121的程序块按C11-C12-C13-C14-C15-C16的顺序执行,在第二核13的第一执行周期T1中,程序131的程序块按C21-C22-C23-C24-C25-C26的顺序执行。当程序块C13的执行状态指示程序块C13执行完成时,说明程序块C23处于已经可以被执行完成的状态。此时,动态调度器21根据程序块C13的执行状态将C13的重要度降低作为程序块C13在下一个执行周期T2中的重要度,同时还根据程序块C13的执行状态,将程序131的程序块C23的重要度增大作为程序块C23在下一个执行周期T2中的重要度。因此,在图7a所示的第一核12的第二执行周期T2中,取决于调整后各个程序块的重要度的排序,第一核12中的程序块按C11-C12-C14-C15-C13-C16的顺序执行,在第二核13的第二执行周期T2中,第二核13中的程序块按C21-C23-C22-C24-C25-C26的顺序执行。
当程序块C13的执行状态指示程序块C13在第一执行周期T1中未被完全执行时,说明程序块C23还处于尚未准备被执行的状态。此时,动态调度器21根据程序块C13的执行状态将程序块C13的重要度增大作为程序块C13在下一个执行周期T2中的重要度,同时根据程序块C13的执行状态将程序块C23的重要度降低作为程序块C23在下一个执行周期T2中的重要度。因此,在图7b所示的第一核12的第二执行周期T2中,第一核12中的程序块按C11-C13-C12-C14-C15-C16的顺序执行,在第二核13的第二执行周期T2中,第二核13中的程序块按C21-C22-C24-C23-C25-C26的顺序执行。
在某些实施例中,在考虑程序块的控制依赖关系时,可以基于公式F C New=η C·F C Old来计算每个程序块的控制重要度,其中F C New为第二执行周期T2中的控制重要度,F C Old为第一执行周期T1中的控制重要度,η C为控制调节因子。控制调节因子η C可以是奖励因子,用于增大控制重要度,或者可以是惩罚因子,用于降低 控制重要度。在某些实施例中,惩罚因子例如可以是0-1中的任何数,例如0.9、0.95、0.8、0.85,等等。在某些实施例中,奖励因子例如可以是大于1的任何数,例如1.2、1.5、1.8、2,等等。在某些实施例中,控制调节因子的大小可以根据经验来设置。每个程序块的重要度可以被确定为控制重要度,或者在控制重要度基础上还参考其他方面的重要度来确定程序块的最终重要度。
参照图8a和图8b来说明在多核控制器的不同核之间的程序块之间存在数据依赖关系时如何动态调整多个程序块的重要度。如图8a所示,假设第一核12中程序被分为程序块C11、C12、C13、C14、C15、C16,第二核13中的程序被分为程序块C21、C22、C23、C24、C25、C26。程序块C26和C14之间存在着数据依赖关系,即程序块C26的执行结果将作为程序块14的输入,以供程序块14继续处理。
在第一核12的第一执行周期T1中,程序121的程序块按C11-C12-C13-C14-C15-C16的顺序执行,在第二核13的第一执行周期T1中,程序131的程序块按C21-C22-C23-C24-C25-C26的顺序执行。当程序块C26的执行状态指示程序块C26在第一执行周期T1中执行完成时,说明程序块C14的输入已经准备好,程序块C14处于可以被执行的状态。此时,动态调度器21根据程序块C26的执行状态将程序块C26的重要度降低作为程序块C26在下一个执行周期T2中的重要度,同时根据程序块C26的执行状态将程序块C14的重要度增大作为程序块C14在下一个执行周期T2中的重要度。因此,在图8a所示的第一核12的第二执行周期T2中,取决于调整后各个程序块的重要度的排序,第一核12中的程序块按C11-C12-C14-C15-C13-C16的顺序执行。在第二核13的第二执行周期T2中,由于程序块C26的执行顺序已经是在最后,所以,第二核13中的程序块的顺序执行未发生改变。
当程序块C26的执行状态指示程序块C26在第一执行周期T1中未被完全执行时,说明程序块C14的输入尚未准备好,程序块C14还处于尚未准备被执行的状态。在这种情况下,动态调度器21根据程序块C26的执行状态将程序块C26的重要度增大作为程序块C26在下一个执行周期T2中的重要度,同时根据程序块C26的执行状态将程序块C14的重要度降低作为程序块C14在下一个执行周期T2中的重要度。因此,在图8b所示的第一核12的第二执行周期T2中,第一核12中的程序块按C11-C12-C13-C15-C14-C16的顺序执行,在第二核13的第二执行周期T2中,第二核 13中的程序块按C21-C22-C23-C24-C26-C25的顺序执行。
在某些实施例中,在考虑程序块的数据依赖关系时,可以基于公式F D New=η D·F D Old来计算每个程序块的数据重要度,其中F D New为第二执行周期T2中的数据重要度,F D Old为第一执行周期T1中的数据重要度,η D为数据调节因子。数据调节因子η D可以是奖励因子,用于增大数据重要度,或者可以是惩罚因子,用于降低数据重要度。在某些实施例中,惩罚因子例如可以是0-1中的任何数,例如0.9、0.95、0.8、0.85,等等。在某些实施例中,奖励因子例如可以是大于1的任何数,例如1.2、1.5、1.8、2,等等。在某些实施例中,数据调节因子的大小可以根据经验来设置。每个程序块的重要度可以被确定为数据重要度,或者在数据重要度基础上还参考其他方面的重要度来确定程序块的最终重要度。
在一些实施例中,控制器执行的任务会对程序块中的输出速度有要求,例如在某些高动态响应的场合。对应的,在确定多个程序块的相应重要度时,还可以获得与多个程序块中的某个或某些程序块相关联的结果输出要求,结果输出要求指示对应程序块的执行的结果的输出速度要求。动态调度器21基于对应程序块的结果输出要求在第一执行周期中是否被满足,来确定这个或这些程序块在第二执行周期中的重要度。在此,结果输出要求被满足指的是程序块的执行的结果按所要求的速度被输出。
图9示出了基于程序块的结果输出要求在第一执行周期中是否被满足来确定程序块的重要度的示例。如图9所示,在控制器1的第一执行周期T1中,程序121中的程序块按C11-C12-C13-C14-C15-C16的顺序执行。当程序块C13的结果输出要求在第一执行周期T1中被满足时,动态调度器21根据程序块C13的执行状态将C13的重要度降低作为C13在下一个执行周期T2中的重要度。当程序块C13的结果输出要求在第一执行周期T1中未被满足时,动态调度器21根据程序块C13的执行状态将C13的重要度增大作为C13在下一个执行周期T2中的重要度。
在某些实施例中,在考虑程序块的结果输出要求时,可以基于公式F S New=η S·F S Old来计算每个程序块的自身重要度,其中F S New为第二执行周期T2中的自身重要度,F S Old为第一执行周期T1中的自身重要度,η S为自身调节因子。自身调节因子η S可以是奖励因子,用于增大自身重要度,或者可以是惩罚因子,用于降低自身重要度。在某些实施例中,惩罚因子例如可以是0-1中的任何数,例如0.9、0.95、0.8、0.85,等等。在某些实施例中,奖励因子例如可以是大于1的任何数,例如1.2、1.5、1.8、 2,等等。在某些实施例中,控制调节因子的大小可以根据经验来设置。每个程序块的重要度可以被确定为自身重要度,或者在自身重要度基础上还参考其他方面的重要度,这在下文中将详细描述。
上文描述了基于各个因素来确定程序块在下一执行周期中的重要度。在某些实施例中,可以根据上述各种重要度调整方式的任何组合来对程序块的重要度进行调节。例如,可以考虑全部因素,通过公式F New=η R·F R OldC·F C OldD·F D OldS·F S Old来计算一个程序块在下一执行周期中的重要度。在某些实施例中,也可以针对其中的若干项进行计算。在这种情况下,只需要将相应的因子设置为0即可。例如,只针对运行重要度F R和控制重要度F C进行调节,则将数据调节因子η D和自身调节因子η S设置为0。以此类推。
图10示出了根据本公开的实施例的执行程序的方法1000的流程图。方法1000可以由以上参考图2和图3所描述的控制器1执行。
在1011,将至少一个程序划分为多个程序块;至少基于多个程序块在控制器的第一执行周期中的执行状态。在1012,确定多个程序块在第一执行周期之后的第二执行周期中的相应重要度。在1013,基于多个程序块的相应重要度,在第二执行周期中在控制器中执行多个程序块中的至少一个。
在某些实施例中,确定多个程序块的相应重要度包括:针对多个程序块中的给定程序块,根据给定程序块的执行状态指示给定程序块在第一执行周期中已经被执行完成,将给定程序块在第一执行周期中的重要度降低,以作为给定程序块在第二执行周期中的重要度;以及根据给定程序块的执行状态指示给定程序块在第一执行周期中未被完全执行,将给定程序块在第一执行周期中的重要度增大,以作为给定程序块在第二执行周期中的重要度。
在某些实施例中,确定多个程序块的相应重要度还包括:确定多个程序块之间的依赖关系;以及基于执行状态和依赖关系来确定多个程序块的相应重要度。
在某些实施例中,控制器包括第一核和第二核,至少一个程序包括被分配到第一核的第一程序和被分配到第二核的第二程序,并且其中确定多个程序块之间的依赖关系包括:根据确定第一程序和第二程序之间存在程序依赖关系,确定由第一程序划分的程序块中的至少一个程序块与由第二程序划分的程序块中的至少另一个程序块之间存在依赖关系。
在某些实施例中,依赖关系包括多个程序块之间的控制依赖关系,基于执行状态和依赖关系来确定多个程序块的相应重要度包括:根据依赖关系指示多个程序块的第一程序块控制多个程序块中的第二程序块的执行,根据第一程序块的执行状态指示第一程序块在第一执行周期中已经被执行完成,将第二程序块的重要度降低,以作为第二程序法在第二执行周期中的重要度;以及根据第一程序块的执行状态指示第一程序块在第一执行周期中未被完全执行,将第二程序块的重要度增大,以作为第二程序法在第二执行周期中的重要度。
在某些实施例中,依赖关系包括多个程序块之间的数据依赖关系,基于执行状态和依赖关系来确定多个程序块的相应重要度包括:根据数据依赖关系指示多个程序块的第三程序块的执行结果是多个程序块中的第四程序块的输入,根据第三程序块的执行状态指示第三程序块在第一执行周期中已经输出执行结果,将第四程序块在第一执行周期中的重要度增大,以作为第四程序块在第二执行周期中的重要度;以及根据第三程序块的执行状态指示第三程序块在第一执行周期中没有输出执行结果,将第四程序块在第一执行周期中的重要度降低,以作为第四程序块在第二执行周期中的重要度。
在某些实施例中,确定多个程序块的相应重要度还包括:获得与多个程序块中的第五程序块相关联的结果输出要求,结果输出要求指示对第五程序块的执行的结果的输出速度要求;基于第五程序块的结果输出要求在第一执行周期中是否被满足,确定第五程序块的重要度。
在某些实施例中,确定第五程序块的重要度包括:根据第五程序块的结果输出要求在第一执行周期中被满足,将第五程序块在第一执行周期中的重要度降低,以作为第五程序块在第二执行周期中的重要度;以及根据第五程序块的结果输出要求在第一执行周期中未被满足,将第五程序块在第一执行周期中的重要度增大,以作为第五程序块在第二执行周期中的重要度。
图11示出了可以用来实施本公开的实施例的示例设备1100的示意性框图。设备1100可以用于实现图10的过程1000。
如图所示,设备1100包括控制器1101,其可以根据存储在只读存储器(ROM)1102中的计算机程序指令或者从存储单元1108加载到随机访问存储器(RAM)1103中的计算机程序指令,来执行各种适当的动作和处理。控制器1101例如可以是以上 描述的控制器1。在RAM 1103中,还可存储设备1100操作所需的各种程序和数据。控制器1101、ROM 1102以及RAM 1103通过总线1104彼此相连。输入/输出(I/O)接口1105也连接至总线1104。
设备1100中的多个部件连接至I/O接口1105,包括:输入单元1106,例如键盘、鼠标等;输出单元1107,例如各种类型的显示器、扬声器等;存储单元1108,例如磁盘、光盘等;以及通信单元1109,例如网卡、调制解调器、无线通信收发机等。通信单元1109允许设备1100通过诸如因特网的计算机网络和/或各种电信网络与其他设备交换信息/数据。
控制器1101执行上文所描述的各个方法和处理,例如过程1000。例如,在某些实施例中,过程1000可被实现为计算机软件程序或计算机程序产品,其被有形地包含于计算机可读介质,诸如非瞬态计算机可读介质(例如存储单元1108)。在某些实施例中,计算机程序的部分或者全部可以经由ROM 1102和/或通信单元1109而被载入和/或安装到设备1100上。当计算机程序加载到RAM 1103并由控制器1101执行时,可以执行上文描述的过程1000的一个或多个步骤。备选地,在其他实施例中,控制器1101可以通过其他任何适当的方式(例如,借助于固件)而被配置为执行过程1000。
本领域的技术人员应当理解,上述本公开的方法的各个步骤可以通过通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而可以将它们存储在存储装置中由计算装置来执行,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本公开不限制于任何特定的硬件和软件结合。例如,本公开的某些实施例还包括各个程序模块和/或集成电路模块,用于执行过程1000的一个或多个步骤和/或本公开的其他实施例中描述的一个或多个其他步骤。这些程序模块可以被包括或被体现在一个设备中,诸如图11的设备1100中。
应当理解,尽管在上文的详细描述中提及了设备的若干装置或子装置,但是这种划分仅仅是示例性而非强制性的。实际上,根据本公开的实施例,上文描述的两个或更多装置的特征和功能可以在一个装置中具体化。反之,上文描述的一个装置的特征和功能可以进一步划分为由多个装置来具体化。
以上所述仅为本公开的可选实施例,并不用于限制本公开,对于本领域的技术人员来说,本公开可以有各种更改和变化。凡在本公开的精神和原则之内,所作的任何修改、等效替换、改进等,均应包含在本公开的保护范围之内。

Claims (17)

  1. 一种执行程序的方法(1000),包括:
    将至少一个程序划分(1011)为多个程序块;
    至少基于所述多个程序块在控制器的第一执行周期中的执行状态,确定(1012)所述多个程序块在所述第一执行周期之后的第二执行周期中的相应重要度;以及
    基于所述多个程序块的所述相应重要度,在所述第二执行周期中在所述控制器中执行(1013)所述多个程序块中的至少一个。
  2. 根据权利要求1所述的方法(1000),其中确定(1012)所述多个程序块的所述相应重要度包括:针对所述多个程序块中的给定程序块,
    根据所述给定程序块的所述执行状态指示所述给定程序块在所述第一执行周期中已经被执行完成,将所述给定程序块在所述第一执行周期中的重要度降低,以作为所述给定程序块在所述第二执行周期中的重要度;以及
    根据所述给定程序块的所述执行状态指示所述给定程序块在所述第一执行周期中未被完全执行,将所述给定程序块在所述第一执行周期中的重要度增大,以作为所述给定程序块在所述第二执行周期中的重要度。
  3. 根据权利要求1所述的方法(1000),其中确定(1012)所述多个程序块的所述相应重要度还包括:
    确定所述多个程序块之间的依赖关系;以及
    基于所述执行状态和所述依赖关系来确定所述多个程序块的所述相应重要度。
  4. 根据权利要求3所述的方法(1000),其中所述控制器包括第一核和第二核,所述至少一个程序包括被分配到所述第一核的第一程序和被分配到所述第二核的第二程序,并且其中确定所述多个程序块之间的所述依赖关系包括:
    根据确定所述第一程序和所述第二程序之间存在程序依赖关系,确定由所述第一程序划分的程序块中的至少一个程序块与由所述第二程序划分的程序块中的至少另一个程序块之间存在依赖关系。
  5. 根据权利要求3所述的方法(1000),其中所述依赖关系包括所述多个程序块之间的控制依赖关系,基于所述执行状态和所述依赖关系来确定所述多个程序块的所述相应重要度包括:
    根据所述依赖关系指示所述多个程序块的第一程序块控制所述多个程序块中的第二程序块的执行,
    根据所述第一程序块的所述执行状态指示所述第一程序块在所述第一执行周期中已经被执行完成,将所述第二程序块的重要度增大,以作为所述第二程序法在所述第二执行周期中的重要度;以及
    根据所述第一程序块的所述执行状态指示所述第一程序块在所述第一执行周期中未被完全执行,将所述第二程序块的重要度降低,以作为所述第二程序法在所述第二执行周期中的重要度。
  6. 根据权利要求3所述的方法(1000),其中所述依赖关系包括所述多个程序块之间的数据依赖关系,基于所述执行状态和所述依赖关系来确定所述多个程序块的所述相应重要度包括:
    根据所述数据依赖关系指示所述多个程序块的第三程序块的执行结果是所述多个程序块中的第四程序块的输入,
    根据所述第三程序块的所述执行状态指示所述第三程序块在所述第一执行周期中已经输出所述执行结果,将所述第四程序块在所述第一执行周期中的重要度增大,以作为所述第四程序块在所述第二执行周期中的重要度;以及
    根据所述第三程序块的所述执行状态指示所述第三程序块在所述第一执行周期中没有输出所述执行结果,将所述第四程序块在所述第一执行周期中的重要度降低,以作为所述第四程序块在所述第二执行周期中的重要度。
  7. 根据权利要求1所述的方法(1000),其中确定(1012)所述多个程序块的所述相应重要度还包括:
    获得与所述多个程序块中的第五程序块相关联的结果输出要求,所述结果输出要求指示对所述第五程序块的执行的结果的输出速度要求;
    基于所述第五程序块的所述结果输出要求在所述第一执行周期中是否被满足,确定(1012)所述第五程序块的所述重要度。
  8. 根据权利要求7所述的方法(1000),其中确定(1012)所述第五程序块的所述重要度包括:
    根据所述第五程序块的所述结果输出要求在所述第一执行周期中被满足,将所述第五程序块在所述第一执行周期中的重要度降低,以作为所述第五程序块在所述第二执行周期 中的重要度;以及
    根据所述第五程序块的所述结果输出要求在所述第一执行周期中未被满足,将所述第五程序块在所述第一执行周期中的重要度增大,以作为所述第五程序块在所述第二执行周期中的重要度。
  9. 一种用于执行程序的设备(1100),包括:
    控制器(1101);以及
    与所述控制器(1101)耦合的存储器(1103),所述存储器(1103)具有存储于其中的指令,所述指令在被控制器(1101)执行时使所述设备(1100)执行动作,所述动作包括:
    将至少一个程序划分(1011)为多个程序块;
    至少基于所述多个程序块在控制器的第一执行周期中的执行状态,确定(1012)所述多个程序块在所述第一执行周期之后的第二执行周期中的相应重要度;以及
    基于所述多个程序块的所述相应重要度,在所述第二执行周期中在所述控制器中执行(1013)所述多个程序块中的至少一个。
  10. 根据权利要求9的设备(1100),其中确定(1012)所述多个程序块的所述相应重要度包括:针对所述多个程序块中的给定程序块,
    根据所述给定程序块的所述执行状态指示所述给定程序块在所述第一执行周期中已经被执行完成,将所述给定程序块在所述第一执行周期中的重要度降低,以作为所述给定程序块在所述第二执行周期中的重要度;以及
    根据所述给定程序块的所述执行状态指示所述给定程序块在所述第一执行周期中未被完全执行,将所述给定程序块在所述第一执行周期中的重要度增大,以作为所述给定程序块在所述第二执行周期中的重要度。
  11. 根据权利要求9的设备(1100),其中确定(1012)所述多个程序块的所述相应重要度还包括:
    确定所述多个程序块之间的依赖关系;以及
    基于所述执行状态和所述依赖关系来确定所述多个程序块的所述相应重要度。
  12. 根据权利要求11的设备(1100),其中所述控制器包括第一核和第二核,所述至少一个程序包括被分配到所述第一核的第一程序和被分配到所述第二核的第二程序,并且其中确定所述多个程序块之间的所述依赖关系包括:
    根据确定所述第一程序和所述第二程序之间存在程序依赖关系,确定由所述第一程序划分的程序块中的至少一个程序块与由所述第二程序划分的程序块中的至少另一个程序块之间存在依赖关系。
  13. 根据权利要求11的设备(1100),其中所述依赖关系包括所述多个程序块之间的控制依赖关系,基于所述执行状态和所述依赖关系来确定所述多个程序块的所述相应重要度包括:
    根据所述依赖关系指示所述多个程序块的第一程序块控制所述多个程序块中的第二程序块的执行,
    根据所述第一程序块的所述执行状态指示所述第一程序块在所述第一执行周期中已经被执行完成,将所述第二程序块的重要度增大,以作为所述第二程序法在所述第二执行周期中的重要度;以及
    根据所述第一程序块的所述执行状态指示所述第一程序块在所述第一执行周期中未被完全执行,将所述第二程序块的重要度降低,以作为所述第二程序法在所述第二执行周期中的重要度。
  14. 根据权利要求11的设备(1100),其中所述依赖关系包括所述多个程序块之间的数据依赖关系,基于所述执行状态和所述依赖关系来确定所述多个程序块的所述相应重要度包括:
    根据所述数据依赖关系指示所述多个程序块的第三程序块的执行结果是所述多个程序块中的第四程序块的输入,
    根据所述第三程序块的所述执行状态指示所述第三程序块在所述第一执行周期中已经输出所述执行结果,将所述第四程序块在所述第一执行周期中的重要度增大,以作为所述第四程序块在所述第二执行周期中的重要度;以及
    根据所述第三程序块的所述执行状态指示所述第三程序块在所述第一执行周期中没有输出所述执行结果,将所述第四程序块在所述第一执行周期中的重要度降低,以作为所述第四程序块在所述第二执行周期中的重要度。
  15. 根据权利要求9的设备(1100),其中确定(1012)所述多个程序块的所述相应重要度还包括:
    获得与所述多个程序块中的第五程序块相关联的结果输出要求,所述结果输出要求指示对所述第五程序块的执行的结果的输出速度要求;
    基于所述第五程序块的所述结果输出要求在所述第一执行周期中是否被满足,确定(1012)所述第五程序块的所述重要度。
  16. 根据权利要求15的设备(1100),其中确定(1012)所述第五程序块的所述重要度包括:
    根据所述第五程序块的所述结果输出要求在所述第一执行周期中被满足,将所述第五程序块在所述第一执行周期中的重要度降低,以作为所述第五程序块在所述第二执行周期中的重要度;以及
    根据所述第五程序块的所述结果输出要求在所述第一执行周期中未被满足,将所述第五程序块在所述第一执行周期中的重要度增大,以作为所述第五程序块在所述第二执行周期中的重要度。
  17. 一种计算机可读介质,其上存储有计算机可执行指令,所述计算机可执行指令在被执行时使至少一个控制器(1101)执行根据权利要求1-8中的任一项所述的方法。
PCT/CN2019/107908 2019-09-25 2019-09-25 一种执行程序的方法 WO2021056277A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201980100041.9A CN114450665A (zh) 2019-09-25 2019-09-25 一种执行程序的方法
PCT/CN2019/107908 WO2021056277A1 (zh) 2019-09-25 2019-09-25 一种执行程序的方法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/107908 WO2021056277A1 (zh) 2019-09-25 2019-09-25 一种执行程序的方法

Publications (1)

Publication Number Publication Date
WO2021056277A1 true WO2021056277A1 (zh) 2021-04-01

Family

ID=75165507

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/107908 WO2021056277A1 (zh) 2019-09-25 2019-09-25 一种执行程序的方法

Country Status (2)

Country Link
CN (1) CN114450665A (zh)
WO (1) WO2021056277A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020199177A1 (en) * 2001-06-22 2002-12-26 Matsushita Electric Industrial Co., Ltd. Compiler device and compile program
CN100392596C (zh) * 2001-09-20 2008-06-04 松下电器产业株式会社 编译装置及编译方法
US20110276787A1 (en) * 2009-05-28 2011-11-10 Panasonic Corporation Multithread processor, compiler apparatus, and operating system apparatus
CN102265257A (zh) * 2008-12-25 2011-11-30 松下电器产业株式会社 程序变换装置及程序变换方法

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005092780A (ja) * 2003-09-19 2005-04-07 Matsushita Electric Ind Co Ltd リアルタイムプロセッサシステム及び制御方法
EP2612235A4 (en) * 2010-09-03 2014-03-05 Siemens Ag METHOD FOR PARALLELIZING AUTOMATIC CONTROL PROGRAMS AND COMPILER

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020199177A1 (en) * 2001-06-22 2002-12-26 Matsushita Electric Industrial Co., Ltd. Compiler device and compile program
CN100392596C (zh) * 2001-09-20 2008-06-04 松下电器产业株式会社 编译装置及编译方法
CN102265257A (zh) * 2008-12-25 2011-11-30 松下电器产业株式会社 程序变换装置及程序变换方法
US20110276787A1 (en) * 2009-05-28 2011-11-10 Panasonic Corporation Multithread processor, compiler apparatus, and operating system apparatus

Also Published As

Publication number Publication date
CN114450665A (zh) 2022-05-06

Similar Documents

Publication Publication Date Title
US10810051B1 (en) Autoscaling using file access or cache usage for cluster machines
US20180095738A1 (en) Method, device, and system for creating a massively parallilized executable object
Tan et al. Coupling task progress for mapreduce resource-aware scheduling
JP5887418B2 (ja) ストリームデータ多重処理方法
JP2007034414A5 (zh)
KR20140080434A (ko) 맵리듀스 프레임워크에서 데이터 프로세싱의 최적화를 위한 디바이스 및 방법
JP2010079622A (ja) マルチコアプロセッサシステム、および、そのタスク制御方法
CN111738446A (zh) 深度学习推理引擎的调度方法、装置、设备和介质
US9389923B2 (en) Information processing device and method for controlling information processing device
US9471387B2 (en) Scheduling in job execution
JP4381459B1 (ja) 情報処理装置、粒度調整方法およびプログラム
US10083066B2 (en) Processing data by using simultaneous multithreading
CN113407352A (zh) 用于处理任务的方法、处理器、设备和可读存储介质
CN111176806A (zh) 一种业务处理方法、装置及计算机可读存储介质
JP2016091555A (ja) データステージング管理システム
KR102496115B1 (ko) 강화학습 기반 이타적 스케줄링 장치 및 방법
CN116755851A (zh) 基于异构优先级及关键任务复制的任务调度方法及系统
JP2012181578A (ja) 更新制御装置及びプログラム
EP3401784A1 (en) Multicore processing system
WO2021056277A1 (zh) 一种执行程序的方法
JP2005092780A (ja) リアルタイムプロセッサシステム及び制御方法
US20220300322A1 (en) Cascading of Graph Streaming Processors
WO2021002054A1 (ja) 計算機システム及びプログラム実行方法
JP2012203911A (ja) 非同期のデバイスによって実行されるタスクのスケジューリングの向上
CN107832255B (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: 19947117

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19947117

Country of ref document: EP

Kind code of ref document: A1