A task allocation method for use in a chip, the chip comprising processing cores, a microprocessor and a synchronization signal generator, wherein the method comprises:
- in response to receiving a synchronization signal, determining, by the microprocessor, whether allocation of a task segment to the processing core is required according to the synchronization signal, wherein the task segment is a part of a task, the task is a computing task executed by the microprocessor or processing cores;
- in response to the allocation of the task segment to the processing core being required, instructing, by the microprocessor, to allocate the task segment to the processing core;
- receiving, by the processing core, the task segment;
- and
- in response to satisfying a first preset condition, sending, by the processing core, a synchronization request signal, wherein the synchronization request signal is configured to trigger the generation of a synchronization signal, the synchronization signal is generated by the synchronization signal generator, wherein the synchronization signal generator is realized by hardware or software, wherein the first preset condition comprises the processing core has received the task segment or executing time taken by the processing core to receive the task segment reaches a preset time threshold;
- wherein in response to receiving a synchronization signal, determining, by the microprocessor, whether the allocation of the task segment to the processing core is required according to the synchronization signal, comprises:
- executing, by the microprocessor, its own program;
- in response to receiving a synchronization signal, counting, by the microprocessor, the number of synchronization signals received in a synchronization cycle;
- and
- determining, by the microprocessor, according to the number of synchronization signals received and a preloaded allocation strategy, the processing core that requires to be allocated the task segment, wherein the allocation strategy presets the processing core need to update the task segment that executes in the synchronization cycle;
- wherein the method further comprises:
- in response to the allocation of the task segment to the processing core not being required, executing, by the microprocessor, its own program;
- executing, by the processing core, a last received task segment that has not completed before;
- and
- in response to satisfying a second preset condition, sending, by the processing core, the synchronization request signal;
- wherein the second preset condition is that:
- the processing core executes a synchronization request signal sending instruction in the last received task segment, or time taken by the processing core to execute the last received task segment reaches a present time threshold.