Summary of the invention
In view of this, the embodiment of the present application provides a kind of method and device of multitasking, calculates equipment and calculating
Machine readable storage medium storing program for executing, to solve technological deficiency existing in the prior art.
The embodiment of the present application discloses a kind of method of multitasking, described for the system including multiple processors
Method includes:
Goal task is split as multiple tasks according to timing;
It determines the corresponding task execution function of each task, and is determined according to the corresponding task execution function of each processor
Execute the corresponding processor of each task;
The calling sequence of multiple processors is determined according to the timing of multiple tasks;
The processor is successively called according to the calling of the multiple processor sequence, executes the goal task.
Optionally, the task includes multiple subtasks;
It determines and executes the corresponding task execution function of each task, it is true according to the corresponding task execution function of each processor
Surely the corresponding processor of each task is executed, comprising:
It determines the corresponding task execution function in each subtask, is determined according to the corresponding task execution function of each processor
Execute the corresponding processor in each subtask.
Optionally, it is determined according to the corresponding task execution function of each processor and executes the corresponding processing in each subtask
Device, comprising: in the case where at least two processors correspond to same task execution function, select any processor should as execution
The corresponding processor in subtask.
Optionally, each processor corresponds to multiple tasks and executes function;
It is determined according to the corresponding task execution function of each processor and executes the corresponding processor in each subtask, comprising:
In the case that at least two adjacent subtasks, corresponding task execution function corresponds to same processor, which is executed
The adjacent corresponding processor at least two subtasks.
Optionally, the calling sequence of multiple processors is determined according to the timing of multiple tasks, comprising: according to multiple institutes
The timing for stating subtask determines the calling sequence of multiple processors.
Optionally, the method also includes:
In the case where the corresponding processor of the task breaks down, check that the corresponding task execution function of the task is
Other processors of no correspondence;
If so, selecting other any described processors as the corresponding processor of the task, and update the multiple processing
The calling sequence of device;
If it is not, stopping executing the goal task.
Optionally, the method also includes:
In the case that corresponding processor breaks down in the subtask, the corresponding task execution letter in the subtask is checked
Whether number corresponds to other processors;
If so, selecting other any described processors as the corresponding processor in the subtask, and update the multiple place
Manage the calling sequence of device;
If it is not, stopping executing the goal task.
The embodiment of the present application discloses a kind of device of multitasking, is set to the system including multiple processors, institute
Stating device includes:
Module is split, is configured as goal task being split as multiple tasks according to timing;
Processor determining module is configured to determine that the corresponding task execution function of each task, and according to each processing
The corresponding task execution function of device, which determines, executes the corresponding processor of each task;
Calling sequence determining module is configured as determining that the calling of multiple processors is suitable according to the timing of multiple tasks
Sequence;
Task execution module is configured as successively calling the processor according to the calling sequence of the multiple processor,
Execute the goal task.
The embodiment of the present application discloses a kind of calculating equipment, including memory, processor and storage are on a memory and can
The computer instruction run on a processor, the processor realize the side of multitasking as described above when executing described instruction
The step of method.
The embodiment of the present application discloses a kind of computer readable storage medium, is stored with computer instruction, the instruction quilt
The step of processor realizes the method for multitasking as described above when executing.
The method and device of multitasking provided by the present application, by the way that goal task is split as multiple according to timing
Business;It determines the corresponding task execution function of each task, and is determined and executed according to the corresponding task execution function of each processor
The corresponding processor of each task;The calling sequence of multiple processors is determined according to the timing of multiple tasks, it can be ensured that running
In the case where, each processor obtains correct calling sequence, and it is adaptable with it to can ensure that each processor undertakes in this way
Task, and the processor is successively called according to the calling of multiple processors sequence, performance objective task not only ensure that task
Operation order, and each processor is made to undertake matched task, to realize multitasking efficiency most
Optimization.
Specific embodiment
Many details are explained in the following description in order to fully understand the application.But the application can be with
Much it is different from other way described herein to implement, those skilled in the art can be without prejudice to the application intension the case where
Under do similar popularization, therefore the application is not limited by following public specific implementation.
The term used in this specification one or more embodiment be only merely for for the purpose of describing particular embodiments,
It is not intended to be limiting this specification one or more embodiment.In this specification one or more embodiment and appended claims
The "an" of singular used in book, " described " and "the" are also intended to including most forms, unless context is clearly
Indicate other meanings.It is also understood that term "and/or" used in this specification one or more embodiment refers to and includes
One or more associated any or all of project listed may combine.
It will be appreciated that though may be retouched using term first, second etc. in this specification one or more embodiment
Various information are stated, but these information should not necessarily be limited by these terms.These terms are only used to for same type of information being distinguished from each other
It opens.For example, first can also be referred to as second, class in the case where not departing from this specification one or more scope of embodiments
As, second can also be referred to as first.Depending on context, word as used in this " if " can be construed to
" ... when " or " when ... " or " in response to determination ".
Firstly, the vocabulary of terms being related to one or more embodiments of the invention explains.
Multi-core processor: multi-core processor refers to integrates two or more complete computing engines in one piece of processor
(kernel), multi-core processor can support multiple single core processors on system bus at this time, be provided by bus control unit all total
Line control signal and command signal.Wherein, multiple single core processors may be performed simultaneously the same task, if one of single
Core processor crashes, and other single core processors can continue to execute task, not influence the processing progress of task.
In this application, it provides a kind of method and device of multitasking, calculate equipment and computer-readable storage
Medium is described in detail one by one in the following embodiments.
The method of the present embodiment is used in the system including multiple processors, is formed for the associated multiple tasks of having time
Goal task, so that each processor is undertaken being adapted to it for task, and successively execute by operation timing, to realize at multitask
Manage the optimization of efficiency.
To achieve the goals above, the embodiment of the present application discloses a kind of method of multitasking, referring to Fig. 1, including
Following step 101~104:
101, goal task is split as multiple tasks according to timing.
By taking goal task is the modeling of threedimensional model as an example, including establishing the triangle gridding of threedimensional model, generating three-dimensional table
Surface model, texture mapping, model rendering generate 4 steps of two dimensional image.Each step can also be split as multiple sub-steps, example
The triangle gridding for such as establishing threedimensional model includes indicating grid and index two sub-steps of triangle gridding, and texture mapping includes definition
Texture object generates texture object array, defines texture object, load four sub-steps of texture.
As it can be seen that the step of having only includes a step, there is no the sub-step of subdivision, the step of having may include multiple sons
Step.It so, can be and corresponding as the task using sub-step using each step as a task when actually splitting
Subtask.Such as goal task is split as 1~task of task 4 according to timing, wherein task 2 includes that subtask 21 and son are appointed
Business 22, task 3 include subtask 31, subtask 32, subtask 33 and subtask 34.
102, the corresponding task execution function of each task is determined, and according to the corresponding task execution function of each processor
It determines and executes the corresponding processor of each task.
It should be noted that the corresponding one or more task execution functions of each processor, such as processor
Core1, corresponding UpdateUI function and CollectInput function, can handle interface (UI) task and simulation respectively
(simulate) task;For processor Core2, corresponding BuildUIDrawList function and
InterpolateUIAnimation function can handle threedimensional model (3D) task and simulation (simulate) task respectively,
Processor Core3 corresponds to DrawToScreen function, can handle threedimensional model (3D) task.
The corresponding relationship of processor and task execution function and executable task is as shown in table 1.
Table 1
It does not include the situation of subtask for task, step 102 includes: to directly determine the corresponding task execution letter of the task
Number.
It include the situation of multiple subtasks for task, step 102 comprises determining that the corresponding task execution in each subtask
Function determines according to the corresponding task execution function of each processor and executes the corresponding processor in each subtask.
It is further to note that the corresponding task execution function of each processor can be different from each other, there may also be
Multiple processors correspond to the situation of same task execution function.
In the case where at least two processors correspond to same task execution function, according to the corresponding task of each processor
It executes function and determines the corresponding processor in each subtask of execution, comprising: select any processor as the execution subtask pair
The processor answered.
For example, in the system for including multiple processors at one, including processor Core1, processor Core2, processor
Core3 and processor Core4.Wherein, the corresponding task execution function of processor Core1 is 100, processor Core2 is corresponded to
Task execution function be 150, the corresponding task execution function of processor Core3 is 200, processor Core4 is corresponding
Task execution function is 50.Wherein, processor Core2, processor Core3 and the corresponding task execution of processor Core4
Function has 5.So, determine the corresponding task execution function of subtasking be 5 task execution functions wherein it
In the case where one, any processor in selection processor Core2, processor Core3 and processor Core4 is as the execution son
The corresponding processor of task.
In addition, it is necessary to explanation, do not include the situation of subtask for task, in step 102 according to each processing
The corresponding task execution function of device, which determines, executes the corresponding processor in each subtask, comprising: at least two adjacent tasks
In the case that corresponding task execution function corresponds to same processor, which is executed into at least two adjacent tasks
Corresponding processor.
It include the situation of subtask for task, for former and later two adjacent subtasks, the basis in step 102 is each
The corresponding task execution function of processor, which determines, executes the corresponding processor in each subtask, comprising: adjacent at least two
In the case that the corresponding task execution function in subtask corresponds to same processor, which is executed described adjacent at least two
The corresponding processor in a subtask.
Such as current subtask, corresponding processor is Core1, task execution corresponding for next subtask
Function can be the task execution function in processor Core1, or the task execution function in processor Core4, that
Preferably using processor Core1 as the corresponding processor in next subtask.In this way, processor Core1 can execute it is adjacent
Two subtasks avoid that two adjacent subtasks are gone that different processors is called to go to handle again, thus ensure that son
Under the premise of the operation order of task, optimize the treatment effeciency of multitask.
103, the calling sequence of multiple processors is determined according to the timing of multiple tasks.
Include the situation of subtask for task, determines that the calling of multiple processors is suitable according to the timing of multiple tasks
Sequence, comprising: the calling sequence of multiple processors is determined according to the timing of multiple subtasks.
Table 2 shows the calling that the multiple tasks of goal task or the timing of subtask are determined with 4 processors
The result of sequence.
Table 2
It should be noted that corresponding task execution function both can be Core1 pairs with processor for subtask 22
It answers, it can also be corresponding with processor Core2.In the case where the corresponding processor in subtask 21 is Core2, then it is preferred that son is appointed
Corresponding processor be engaged in as Core2.
104, the processor is successively called according to the calling of the multiple processor sequence, executes the goal task.
The method of multitasking provided by the present application, by the way that goal task is split as multiple tasks according to timing;Really
Determine the corresponding task execution function of each task, and is determined according to the corresponding task execution function of each processor and execute each appoint
It is engaged in corresponding processor;The calling sequence of multiple processors is determined according to the timing of multiple tasks, it can be ensured that the case where running
Under, each processor obtains correct calling sequence, it can ensure that each processor undertakes the task adaptable with it in this way, and
The processor is successively called according to the calling of multiple processors sequence, performance objective task not only ensure that the operation of task
Sequentially, and each processor is made to undertake matched task, to realize the optimization of multitasking efficiency.
One embodiment of the application discloses a kind of method of multitasking, referring to fig. 2, include the following steps 201~
211:
201, goal task is split as multiple tasks according to timing.
Wherein, some tasks do not include subtask, and some tasks include multiple subtasks.
202, judge whether current task includes subtask, if so, step 203 is executed, if it is not, executing step 204.
203, the corresponding task execution function of the task is determined, and according to the corresponding task execution function of each processor
It determines and executes the corresponding processor of current task.
204, the corresponding task execution function in each subtask is determined, according to the corresponding task execution function of each processor
It determines and executes the corresponding processor in each subtask.
Wherein, in the case where at least two processors correspond to same task execution function, select any processor as
Execute the corresponding processor in the subtask.
205, the calling sequence of multiple processors is determined according to the timing of multiple tasks and subtask.
206, processor is successively called according to the calling of the multiple processor sequence, executes the goal task.
207, in the case where the corresponding processor of current task breaks down, the corresponding task execution letter of the task is checked
Whether number corresponds to other processors, if so, step 208 is executed, if it is not, executing step 211.
208, it selects other any described processors as the corresponding processor of the task, and updates the multiple processor
Calling sequence.
209, in the case that corresponding processor breaks down in current subtask, check that the corresponding task in the subtask is held
Whether line function corresponds to other processors, if so, step 210 is executed, if it is not, executing step 211.
210, it selects other any described processors as the corresponding processor in the subtask, and updates the multiple processing
The calling sequence of device.
211, stop executing the goal task.
The method of the present embodiment can ensure that in the case where operation, each processor obtains correct calling sequence, this
Sample can ensure that each processor undertakes the task adaptable with it, and according to the calling of multiple processors sequence successively calling
Processor, performance objective task not only ensure that the operation order of task, and it is matched to undertake each processor
Task, to realize the optimization of multitasking efficiency.
Secondly, whether checking the corresponding task execution function in the subtask in the case where a certain processor breaks down
Other corresponding processors, and select other any processors as the corresponding processor in the subtask, and update multiple processors
Calling sequence, so that make the processing of multitask is not influenced by processor failure, ensure that the normal operation of multitask.
In order to further schematically be illustrated to the embodiment of the present application, it is real that the application one is shown referring to Fig. 3, Fig. 3
The method for applying the multitasking of example, for the system including processor Core1, Core2 and Core3.Wherein, including in Fig. 3
Number, first indicates that the corresponding processor in the subtask, second indicate the corresponding task in the subtask, and line indicates chronologically
Formation executes sequence.
The described method includes:
S1, goal task is split as 1~task of multiple tasks 4 according to timing.
Wherein, task 1 is split as subtask 11 and subtask 12, and task 2 is split as subtask 21 and subtask 22, task
3 are split as subtask 31 and subtask 32, and task 4 is split as subtask 41 and subtask 42.
S2, the corresponding task execution function in each subtask is determined, according to the corresponding task execution function of each processor
It determines and executes the corresponding processor in each subtask.
Wherein, in the case where at least two processors correspond to same task execution function, select any processor as
Execute the corresponding processor in the subtask.
In the case that at least two adjacent subtasks, corresponding task execution function corresponds to same processor, at this
Reason device executes the adjacent corresponding processor at least two subtasks.
S3, the calling sequence that multiple processors are determined according to the timing of multiple subtasks.
In the present embodiment, confirm that the calling sequence of multiple processors is Core1-Core2-Core3-Core2-
Core1—Core2—Core3—Core2—Core1。
S4, the processor is successively called according to the calling sequence of the multiple processor, executes the goal task.
By calling sequence, a complete task call period is just run, can satisfy each task for each
The calling timing requirements of a processor.
Specifically, the corresponding task execution function of processor Core1, Core2 and Core3, execution subtask and hold
Row sequence is referring to table 3.
Table 3
Processor |
Task |
Subtask |
Execute sequence |
Task execution function |
Core1 |
Task 1 |
Subtask 11 |
1 |
Function 1 |
Core2 |
Task 1 |
Subtask 12 |
2 |
Function 2 |
Core3 |
Task 2 |
Subtask 21 |
3 |
Function 3 |
Core2 |
Task 2 |
Subtask 22 |
4 |
Function 4 |
Core1 |
Task 3 |
Subtask 31 |
5 |
Function 5 |
Core2 |
Task 3 |
Subtask 32 |
6 |
Function 6 |
Core3 |
Task 4 |
Subtask 41 |
7 |
Function 7 |
Core2 |
Task 4 |
Subtask 42 |
8 |
Function 8 |
Core1 |
Task 1 |
Subtask 11 |
9 |
Function 1 |
One embodiment of the application discloses a kind of device of multitasking, referring to fig. 4, is set to including multiple processors
System, described device includes:
Module 401 is split, is configured as goal task being split as multiple tasks according to timing;
Processor determining module 402 is configured to determine that the corresponding task execution function of each task, and according to each place
It manages the corresponding task execution function of device and determines the corresponding processor of each task of execution;
Calling sequence determining module 403 is configured as determining the tune of multiple processors according to the timing of multiple tasks
With sequence;
Task execution module 404 is configured as successively calling the processing according to the calling sequence of the multiple processor
Device executes the goal task.
Optionally, the task includes multiple subtasks, and processor determining module 402 is specifically configured to: being determined each
The corresponding task execution function in subtask determines according to the corresponding task execution function of each processor and executes each subtask pair
The processor answered.
Optionally, processor determining module 402 is specifically configured to: corresponding to same task execution at least two processors
In the case where function, select any processor as the corresponding processor in the execution subtask.
Optionally, each processor corresponds to multiple tasks and executes function, and processor determining module 402 is specifically configured to:
In the case that at least two adjacent subtasks, corresponding task execution function corresponds to same processor, which is executed
The adjacent corresponding processor at least two subtasks.
Optionally, calling sequence determining module 403 is specifically configured to: more according to the determination of the timing of multiple subtasks
The calling sequence of a processor.
Optionally, described device further include:
First checks module, is configured as checking this in the case where the corresponding processor of the task breaks down
Whether corresponding task execution function of being engaged in corresponds to other processors, if so, executing first choice module, stops mould if it is not, executing
Block;
First choice module is configured as selecting other any described processors as the corresponding processor of the task, and
Update the calling sequence of the multiple processor;
Stopping modular is configured as stopping executing the goal task.
Optionally, described device further include:
Second checks module, is configured as checking this in the case where the corresponding processor in the subtask breaks down
Whether the corresponding task execution function in subtask corresponds to other processors, if so, executing the second selecting module, stops if it is not, executing
Only module;
Second selecting module is configured as selecting other any described processors as the corresponding processor in the subtask,
And update the calling sequence of the multiple processor;
Stopping modular is configured as stopping executing the goal task.
The device of multitasking provided by the present application, by the way that goal task is split as multiple tasks according to timing;Really
Determine the corresponding task execution function of each task, and is determined according to the corresponding task execution function of each processor and execute each appoint
It is engaged in corresponding processor;The calling sequence of multiple processors is determined according to the timing of multiple tasks, it can be ensured that the case where running
Under, each processor obtains correct calling sequence, it can ensure that each processor undertakes the task adaptable with it in this way, and
The processor is successively called according to the calling of multiple processors sequence, performance objective task not only ensure that the operation of task
Sequentially, and each processor is made to undertake matched task, to realize the optimization of multitasking efficiency.
A kind of exemplary scheme of the device of above-mentioned multitasking for the present embodiment.It should be noted that the device
Technical solution and the technical solution of method of above-mentioned multitasking belong to same design, the technical solution of device is not detailed
The detail content of description may refer to the description of the technical solution of the method for above-mentioned multitasking.
One embodiment of the application discloses a kind of calculating equipment, including memory, processor and storage are on a memory simultaneously
The computer instruction that can be run on a processor, the processor realize multitasking as described above when executing described instruction
Method the step of.
Fig. 5 is to show the structural block diagram of the calculating equipment 500 according to one embodiment of this specification.The calculating equipment 500
Component include but is not limited to memory 510 and processor 520.Processor 520 is connected with memory 510 by bus 530,
Database 550 is for saving data.
Calculating equipment 500 further includes access device 540, access device 540 enable calculate equipment 500 via one or
Multiple networks 560 communicate.The example of these networks includes public switched telephone network (PSTN), local area network (LAN), wide area network
(WAN), the combination of the communication network of personal area network (PAN) or such as internet.Access device 540 may include wired or wireless
One or more of any kind of network interface (for example, network interface card (NIC)), such as IEEE802.11 wireless local area
Net (WLAN) wireless interface, worldwide interoperability for microwave accesses (Wi-MAX) interface, Ethernet interface, universal serial bus (USB) connect
Mouth, cellular network interface, blue tooth interface, near-field communication (NFC) interface, etc..
In one embodiment of this specification, other unshowned portions in the above-mentioned component and Fig. 5 of equipment 500 are calculated
Part can also be connected to each other, such as pass through bus.It should be appreciated that calculating device structure block diagram shown in fig. 5 merely for the sake of
Exemplary purpose, rather than the limitation to this specification range.Those skilled in the art can according to need, and increases or replaces it
His component.
Calculating equipment 500 can be any kind of static or mobile computing device, including mobile computer or mobile meter
Calculate equipment (for example, tablet computer, personal digital assistant, laptop computer, notebook computer, net book etc.), movement
Phone (for example, smart phone), wearable calculating equipment (for example, smartwatch, intelligent glasses etc.) or other kinds of shifting
Dynamic equipment, or the static calculating equipment of such as desktop computer or PC.Calculating equipment 500 can also be mobile or state type
Server.
One embodiment of the application also provides a kind of computer readable storage medium, is stored with computer instruction, the instruction
The step of method of multitasking as previously described is realized when being executed by processor.
A kind of exemplary scheme of above-mentioned computer readable storage medium for the present embodiment.It should be noted that this is deposited
The technical solution of the technical solution of storage media and the method for above-mentioned multitasking belongs to same design, the technology of storage medium
The detail content that scheme is not described in detail may refer to the description of the technical solution of the method for above-mentioned multitasking.
The computer instruction includes computer program code, the computer program code can for source code form,
Object identification code form, executable file or certain intermediate forms etc..The computer-readable medium may include: that can carry institute
State any entity or device, recording medium, USB flash disk, mobile hard disk, magnetic disk, CD, the computer storage of computer program code
Device, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory),
Electric carrier signal, telecommunication signal and software distribution medium etc..It should be noted that the computer-readable medium include it is interior
Increase and decrease appropriate can be carried out according to the requirement made laws in jurisdiction with patent practice by holding, such as in certain jurisdictions of courts
Area does not include electric carrier signal and telecommunication signal according to legislation and patent practice, computer-readable medium.
It should be noted that for the various method embodiments described above, describing for simplicity, therefore, it is stated as a series of
Combination of actions, but those skilled in the art should understand that, the application is not limited by the described action sequence because
According to the application, certain steps can use other sequences or carry out simultaneously.Secondly, those skilled in the art should also know
It knows, the embodiments described in the specification are all preferred embodiments, and related actions and modules might not all be this Shen
It please be necessary.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, there is no the portion being described in detail in some embodiment
Point, it may refer to the associated description of other embodiments.
The application preferred embodiment disclosed above is only intended to help to illustrate the application.There is no detailed for alternative embodiment
All details are described, are not limited the invention to the specific embodiments described.Obviously, according to the content of this specification,
It can make many modifications and variations.These embodiments are chosen and specifically described to this specification, is in order to preferably explain the application
Principle and practical application, so that skilled artisan be enable to better understand and utilize the application.The application is only
It is limited by claims and its full scope and equivalent.