CN109284190A - A kind of task processing method and device - Google Patents

A kind of task processing method and device Download PDF

Info

Publication number
CN109284190A
CN109284190A CN201811100110.XA CN201811100110A CN109284190A CN 109284190 A CN109284190 A CN 109284190A CN 201811100110 A CN201811100110 A CN 201811100110A CN 109284190 A CN109284190 A CN 109284190A
Authority
CN
China
Prior art keywords
task
thread
processing
waiting
tasks
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201811100110.XA
Other languages
Chinese (zh)
Inventor
陈树宝
佟艳娟
张艳菊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Lang run innovation intellectual property operation Co.,Ltd.
Original Assignee
Chain Technology Co Ltd
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 Chain Technology Co Ltd filed Critical Chain Technology Co Ltd
Priority to CN201811100110.XA priority Critical patent/CN109284190A/en
Publication of CN109284190A publication Critical patent/CN109284190A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The present invention provides a kind of task processing method and devices, are related to computer data processing technology field.Method includes: that starting task provides thread and multiple tasks processing thread;It controls the task and thread acquisition waiting task is provided, and the waiting task that will acquire is sent in set of tasks thread;The multiple task processing thread parallel is controlled to handle the waiting task.The embodiment of the present invention handles thread using multiple tasks to handle parallel waiting task, take full advantage of task processing thread resources, interior at the same time it can send and handle more tasks, so that task access processing can be efficiently carried out in computer and internet, so that task process performance is improved.

Description

A kind of task processing method and device
Technical field
The present invention relates to computer data processing technology field more particularly to a kind of task processing methods and device.
Background technique
Currently, with the development of computer, internet and big data technology, the data volume of computer and internet processing Increase year by year, this to computer and internet processing task hardware and method more stringent requirements are proposed.Currently in computer In internet, the mode of task access processing access, the access of data etc. of task (such as transaction) there are process performance compared with The problem of difference, such as the scheme that has is by computer handle due to being limited prevent the primary task quantity issued is from excessive, It is difficult to make full use of the process performance of computer, and uses polling scheme, this all virtually increases follow-up work processing institute It takes time, it is relatively low so as to cause performance.And another scheme is due to similarly making performance using Node.js environment It is not ideal enough.
Especially for currently more popular block chain technology, when accessing task into block catenary system, only with Task is accessed block catenary system by single access thread, so as to obtain task more slow for block catenary system, which results in The poor problem of the performance of task processing.
As it can be seen that causing the generally existing process performance of the processing of task lower due to the access processing mode of current task The problem of, in face of the task of a large amount of high concurrents, task access processing can not be efficiently carried out in computer and internet.
Summary of the invention
The embodiment of the present invention provides a kind of task processing method and device, generally existing with the processing for solving current task Process performance is lower, in face of the task of a large amount of high concurrents, can not efficiently carry out at task access in computer and internet The problem of reason.
In order to achieve the above objectives, the present invention adopts the following technical scheme:
A kind of task processing method, comprising:
Starting task provides thread and multiple tasks handle thread;
It controls the task and thread acquisition waiting task is provided, and the waiting task that will acquire is sent to and appoints In business set thread;
The multiple task processing thread parallel is controlled to handle the waiting task.
Optionally, after the waiting task that will acquire is sent in set of tasks thread, the method Include:
The waiting task that will acquire is stored into spare set of tasks thread;
When the set of tasks thread breaks down, using the spare set of tasks thread as the task-set zygonema Journey.
Optionally, after the waiting task that will acquire is sent in set of tasks thread, the method Further include:
It controls the set of tasks thread multiple waiting tasks are sequentially placed into pre-set channel, so that one is logical Road is put into a waiting task every time;
The step of the multiple task processing thread parallel of control handles the waiting task, comprising:
Each task processing thread parallel operation is controlled, detects the channel with the presence or absence of waiting task;
In the channel, there are any a task processing thread when waiting task, controlled in each task processing thread is logical Cross the waiting task that the channel is seized in channel;
The task processing thread that control gets waiting task handles the waiting task.
Optionally, the step that the multiple task processing thread parallel of the control handles the waiting task Suddenly, further includes:
Thread, which is handled, for the multiple task in advance distributes thread number;
The multiple task processing thread parallel operation is controlled, and according to the sequence of the thread number successively by task-set Waiting task in zygonema journey distributes to each task processing thread;
The task processing thread that control gets waiting task handles the waiting task.
Optionally, the step that the multiple task processing thread parallel of the control handles the waiting task Suddenly, further includes:
Thread, which is handled, for the multiple task in advance distributes thread number;
Control the multiple task processing thread parallel operation;
According to the thread number, random number is generated, and the random number generated each time corresponds to a task processing line Journey;
The task that a waiting task distributes to the corresponding random number is handled into thread every time;
The task processing thread that control gets waiting task handles the waiting task.
Optionally, the step of the multiple task processing thread parallel of the control handles the waiting task Later, which comprises
Control task handles thread and returns to processing result in the set of tasks thread;
Each task offer thread is provided and obtains the corresponding processing result of each waiting task from set of tasks thread.
Optionally, processing and institute are carried out to the waiting task in the multiple task processing thread parallel of the control Control task processing thread is stated by processing result back between the step in the set of tasks thread, which comprises
Control task handles thread dispatching Software Development Kit, and the waiting task be linked into block chain It is handled;
Control task processing thread receives processing result of the waiting task in block chain.
Optionally, the method also includes:
Duration after a waiting task is obtained by task processing thread in the set of tasks thread reaches to be set in advance When the overtime duration set, control task set thread provides thread to the corresponding task of waiting task and returns to time-out information;
It controls the task and thread is provided and is inquired in duration one and judge whether the set of tasks thread receives this wait locate The processing result of reason task;
When the set of tasks thread receives the processing result of the waiting task in the inquiry duration, determine to The processing result of processing task is delayed by return, and controls the task and provide thread from described in set of tasks thread reception Processing result;
When the set of tasks thread does not receive the processing result of the waiting task in the inquiry duration, control The task provides thread using unique transaction number identical with the waiting task again to the set of tasks thread Send waiting task;
If the task provides the time-out information that thread receives the waiting task again, it is determined that described to be processed Business processing failure;
Judge whether the processing result of the task offer thread succeeds;If the processing result is failed, determine The waiting task processing failure;If the processing result success, determines that the waiting task is handled successfully;
Control the task provide thread according to each processing result count it transmitted by waiting task success rate, at The processing institute elapsed time of function number, failure number and each waiting task;
Control the processing number that the set of tasks thread counts the waiting task of each task processing thread.
A kind of Task Processing Unit, comprising:
Thread start unit provides thread and multiple tasks processing thread for starting task;
Waiting task obtaining unit provides thread acquisition waiting task for controlling the task, and will acquire The waiting task be sent in set of tasks thread;
Waiting task processing unit, for control the multiple task processing thread parallel to the waiting task into Row processing.
A kind of non-transient computer readable storage medium is stored thereon with an at least executable instruction, the executable finger Order makes processor execute the corresponding operation of above-mentioned task processing method.
A kind of computer equipment, comprising: processor, memory, communication interface and communication bus, it is the processor, described Memory and the communication interface complete mutual communication by the communication bus, and the memory is for storing at least one Executable instruction, the executable instruction make the processor execute the corresponding operation of above-mentioned task processing method.
A kind of task processing method and device provided in an embodiment of the present invention can start task and provide thread and multiple Business processing thread, and control task provides thread and obtains waiting task, and the waiting task that will acquire is sent to task Gather in thread, then controls multiple tasks processing thread parallel and waiting task is handled.In this way, the embodiment of the present invention Thread is handled to handle parallel waiting task using multiple tasks, takes full advantage of task processing thread resources, energy It is enough interior at the same time to send and handle more tasks, it is connect so that can efficiently carry out task in computer and internet Enter processing, so that task process performance is improved.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of invention without any creative labor, may be used also for those of ordinary skill in the art To obtain other drawings based on these drawings.
Fig. 1 is a kind of flow chart one of task processing method provided in an embodiment of the present invention;
Fig. 2 is the thread architecture schematic diagram one of the task processing method in the embodiment of the present invention;
Fig. 3 is a kind of flowchart 2 of task processing method provided in an embodiment of the present invention;
Fig. 4 is the thread architecture schematic diagram two of the task processing method in the embodiment of the present invention;
Fig. 5 is a kind of structural schematic diagram one of Task Processing Unit provided in an embodiment of the present invention;
Fig. 6 is a kind of structural schematic diagram two of Task Processing Unit provided in an embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.
As shown in Figure 1, the embodiment of the present invention provides a kind of task processing method, comprising:
Step 101, starting task provide thread and multiple tasks handle thread.
Step 102, control task provide thread and obtain waiting task, and the waiting task that will acquire is sent to and appoints In business set thread.
The task, which provides thread 13, can one or more, such as (providing thread in Fig. 2 with multiple tasks is shown in Fig. 2 Example), the multiple tasks offer acquisition of thread 13 waiting task (such as transaction task, data query task or data store tasks Deng), the waiting task that will acquire is sent in set of tasks thread 11 later.In Fig. 2, the set of tasks thread 11 Thread 12 can be handled with multiple tasks respectively and multiple tasks are provided thread 13 and connect using multi-thread concurrent mode.
Step 103, control multiple tasks processing thread parallel handle waiting task.
Later, as shown in Fig. 2, multiple tasks processing thread 12 can obtain to be processed from set of tasks thread 11 parallel Business, and waiting task is handled.For example, waiting task can be carried out access processing by task processing thread 12, such as connect Enter to carry out transaction task, data query task, data in the computer to rear end, Internet Server or block catenary system to deposit Store up task dispatching.It is quick using above-mentioned steps 101 to step 103 task that will can largely trade especially in block catenary system Ground is linked into block catenary system, and transaction task is avoided not to be linked into block catenary system for a long time, cause process performance compared with It is low, the problem of processing not in time.
As shown in Fig. 2, in embodiments of the present invention, multiple tasks provide thread 13 can be simultaneously to set of tasks thread 11 Waiting task is sent, ensure that concurrent while multitask, improves task generation efficiency, while multiple tasks handle thread 12 can parallel processing task simultaneously, improve the performance of whole system, and when in task processing thread 12 some performance it is lower or When person does not work, other tasks processing thread 12 can be fully used, and not will cause the waste of resource, will not be because of some The performance of business processing thread 12 and seriously affect the performance of whole system.Theoretically, the number of task processing thread 12 is more, The issued transaction amount per second (Transaction Per Second, abbreviation tps) of whole system is higher, and performance is better.
In addition, as shown in Fig. 2, the set of tasks thread 11 may be provided with a transmission interface 111 and a broadcast interface 112; Multiple tasks are provided thread 13 and are connect with set of tasks thread 11 using multi-thread concurrent mode by transmission interface 111, and can It is communicated using gRPC (a kind of RPC (remote procedure call, Remote Procedure Call) frame of Google's open source). Multiple tasks are handled thread 12 and are connect with set of tasks thread 11 using multi-thread concurrent mode by broadcast interface 112, and can It is communicated using gRPC, but is not only limited to this.
A kind of task processing method provided in an embodiment of the present invention can start task and provide thread and multiple tasks processing Thread, and control task provides thread and obtains waiting task, and the waiting task that will acquire is sent to task-set zygonema Then Cheng Zhong controls multiple tasks processing thread parallel and handles waiting task.In this way, the embodiment of the present invention is using more A task handles thread to handle parallel waiting task, takes full advantage of task processing thread resources, can be in phase It sends in the same time and handles more tasks, so that can efficiently be carried out at task access in computer and internet Reason, so that task process performance is improved.
In order to make those skilled in the art be better understood by the present invention, a more detailed embodiment is set forth below, The present embodiment is illustrated for accessing task in block catenary system (but is not only limited to this, the present invention can also count Task processing is carried out in other environment such as calculation machine, internet, is no longer illustrated one by one herein), as shown in figure 3, the embodiment of the present invention A kind of task processing method is provided, comprising:
Step 201, starting task provide thread and multiple tasks handle thread.
Step 202, control task provide thread and obtain waiting task, and the waiting task that will acquire is sent to and appoints In business set thread.
After step 202, step 203 or step 205 are executed.
Step 203, the waiting task that will acquire are stored into spare set of tasks thread.
Step 204, task assembly line journey break down when, using spare set of tasks thread as set of tasks thread.
For example, as shown in figure 4, entire framework can have one or more spare set of tasks thread 14;Spare set of tasks Thread 14 can be connect with set of tasks thread 11.When task assembly line journey 11 breaks down, a spare set of tasks can be established Thread 14 is connect with the multi-thread concurrent mode that multiple tasks handle thread 12 and multiple tasks offer thread 13.It can protect in this way When set of tasks thread 11 breaks down, other spare set of tasks threads 14 can replace it and work on card, guarantee The stability and safety of system.
Step 205 is executed after step 204.
Step 205, control multiple tasks processing thread parallel handle waiting task.
Herein, which can be there are many mode:
For example, one of first carry out step S1 before step 205, extremely walked when then carrying out step 205 by step S2 Rapid S4 is handled:
Step S1, multiple waiting tasks are sequentially placed into pre-set channel by control task set thread, so that One channel is put into a waiting task every time.
Step S2, each task processing thread parallel operation is controlled, sense channel whether there is waiting task.
Step S3, in channel, there are any a task processing lines when waiting task, controlled in each task processing thread Journey seizes the waiting task in channel by the channel.Specifically, the task processing thread that carry out task is seized can be not The thread for thering is task to handle, if task processing thread has 5, wherein 3 are handling task, then remaining two progress tasks Seize operation;If five all processing task, then temporarily just without task processing thread carry out task seize operation, up to etc. Start to seize to there is task to handle thread.
Step S4, the task processing thread that control gets waiting task handles the waiting task.
Herein, the embodiment of the present invention can be realized using go language (open source of Google becomes language), be deposited in go language It is since the performance of the communication in go language is higher than Node.js ring here using channel in the concept of channel (channel) Border and Java language.It should be noted that and each waiting task is placed into the channel one by one, for multiple tasks processing Thread is seized, after a waiting task is preempted, will continue to for another waiting task to be put into the channel for It seizes.It is not in that multiple tasks processing thread robs the feelings for accounting for the same waiting task due to the atom mechanism of computer Condition.
In another example another way are as follows:
Step S5, thread is handled for multiple tasks in advance distribute thread number.
For example, there are 5 task processing threads, it is respectively allocated 1 to 5 thread number.
Step S6, control multiple tasks processing thread parallel operation, and according to the sequence of thread number successively by task-set Waiting task in zygonema journey distributes to each task processing thread.
Such as waiting task has 5, then by this 5 waiting tasks successively (as according to reach set of tasks thread The task processing thread of thread number 1 to 5 sequentially) is distributed to, but is not only limited to this, if such as having to be processed more Business then can handle thread distribution waiting task to recycle with thread number for each task.
Step S7, the task processing thread that control gets waiting task handles the waiting task.
For another example there are also a kind of modes are as follows:
Step S8, thread is handled for multiple tasks in advance distribute thread number.
Step S9, control multiple tasks processing thread parallel operation.
Step S10, according to thread number, random number is generated, and the random number generated each time corresponds at a task Lineation journey.
Step S11, the task that a waiting task distributes to the corresponding random number is handled into thread every time.
Step S12, the task processing thread that control gets waiting task handles the waiting task.
For example, thread number is 1 to 5, the range of the random number of generation may be 1 to 5, then generates random number every time Afterwards, corresponding thread number can be determined according to the value of random number, so that waiting task be distributed at corresponding task Lineation journey.Generating random number such as first time is 1, and a waiting task is distributed to the task that thread number is 1 and handles thread, It is 4 that second, which generates random number, and next waiting task is distributed to the task that thread number is 4 and handles thread.Due to The range of machine number and the range of thread number are identical, therefore each task processing thread obtains the general of waiting task herein Rate is equal.
Certainly, since there may be differences for task processing thread process speed, can appoint faster for processing speed Business processing thread distributes more waiting tasks.For example, thread number is 1 to 5, and the range of the random number generated can be big In 5, for example, 1 to 20, it is assumed herein that the processing speed of the task processing thread of thread number 4,5 is higher, and thread number 1, 2, the processing speed of 3 task processing thread is lower, then the task processing thread that thread number 4,5 can be set is corresponding random Number is more, as the task processing thread of thread number 4,5 has respectively corresponded 7 random number (such as random numbers in 20 random numbers 1,3,5,7,9,11,13 corresponding thread number 4, the corresponding thread number 5 of random number 2,4,6,8,10,12,14), and thread number 1,2,3 task processing thread has respectively corresponded 2 random numbers (corresponding thread volume of such as random number 15,18 in 20 random numbers Number 1, the corresponding thread number 2 of random number 16,19, the corresponding thread number 3 of random number 17,20).It can be seen that thread number 4,5 is corresponding The probability that task processing thread obtains waiting task is significantly larger than the corresponding task processing thread of thread number 1,2,3.This hair Bright embodiment can increase and decrease the quantity of the corresponding random number of task processing thread according to the speed of thread process speed, So that the distribution of waiting task is more flexible.
Step 206, control task handle thread dispatching Software Development Kit, and waiting task is carried out to be linked into block It is handled in chain.
Step 207, control task processing thread receive processing result of the waiting task in block chain.Specifically, exist Operation in block chain can be determined according to received task type, such as be can be and carried out depositing card, assets in block chain The processing operations such as transaction.
Step 208 or step 210 are executed after step 207.
Step 208, control task processing thread return to processing result in set of tasks thread.
Step 209, each task of control provide thread and obtain the corresponding processing of each waiting task from set of tasks thread As a result.
Step 215 is continued to execute after step 209.
Step 210, in task assembly line journey a waiting task by task processing thread obtain after duration reach pre- When the overtime duration being first arranged, control task set thread provides thread to the corresponding task of waiting task and returns to time-out letter Breath.
For example, after the waiting task in set of tasks thread is obtained by task processing thread, control task set Thread starts timing, when reaching pre-set overtime duration (such as can be set as according to demand second grade, minute grade when Between, such as 5 seconds, 10 seconds or 1 minute), then control task set thread provides thread to the corresponding task of waiting task and returns Time-out information.
Step 211, control task provide thread and judge whether set of tasks thread receives this wait locate in an inquiry duration The processing result of reason task.
Step 212 or step 213 are executed after step 211.
Step 212, task assembly line journey inquire duration in receive the processing result of the waiting task when, determine to The processing result of processing task is delayed by return, and control task provides thread and receives processing result from set of tasks thread.
Step 215 is continued to execute after step 212.
Step 213, task assembly line journey inquire duration in do not receive the processing result of the waiting task when, control Task provides thread and sends to be processed to set of tasks thread again using unique transaction number identical with waiting task Business.
The mode sent again by using identical unique transaction number, it is ensured that the success rate of waiting task.
If step 214, task provide the time-out information that thread receives the waiting task again, it is determined that be processed Business processing failure.
Step 216 is executed after step 214.
Step 215 judges whether the processing result of task offer thread succeeds;If processing result is failed, determine Waiting task processing failure;If processing result success, determines that waiting task is handled successfully.
Step 216 is executed after step 215.
Step 216, control task provide thread according to each processing result count it transmitted by waiting task success The processing institute elapsed time of rate, success number, failure number and each waiting task, and control task set thread statistics is each Task handles the processing number of the waiting task of thread.
Processing by counting the success rate, success number, failure number and each waiting task of waiting task is disappeared Time-consuming can know the disposition of waiting task.Additionally by the waiting task for counting each task processing thread Processing number can compare the height of the process performance of each task processing thread.
A kind of task processing method provided in an embodiment of the present invention can start task and provide thread and multiple tasks processing Thread, and control task provides thread and obtains waiting task, and the waiting task that will acquire is sent to task-set zygonema Then Cheng Zhong controls multiple tasks processing thread parallel and handles waiting task.In this way, the embodiment of the present invention is using more A task handles thread to handle parallel waiting task, takes full advantage of task processing thread resources, can be in phase It sends in the same time and handles more tasks, so that can efficiently be carried out at task access in computer and internet Reason, so that task process performance is improved.
Corresponding to embodiment of the method corresponding to above-mentioned Fig. 1 and Fig. 3, as shown in figure 5, the embodiment of the present invention also provides one kind Task Processing Unit, comprising:
Thread start unit 31 provides thread and multiple tasks processing thread for starting task.
Waiting task obtaining unit 32 provides thread for control task and obtains waiting task, and will acquire Waiting task is sent in set of tasks thread.
Waiting task processing unit 33, for control multiple tasks processing thread parallel to waiting task at Reason.
Optionally, as shown in fig. 6, the device further include:
Spare set of tasks threaded processing element 34, the waiting task for will acquire are stored to spare set of tasks In thread;When task assembly line journey breaks down, using spare set of tasks thread as set of tasks thread.
Optionally, as shown in fig. 6, the device further include:
Multiple waiting tasks are sequentially placed into pre-set by task placement unit 35 for control task set thread In channel, so that a channel is put into a waiting task every time.
As shown in fig. 6, the waiting task processing unit 33, is specifically used for:
Each task processing thread parallel operation is controlled, sense channel whether there is waiting task;Exist in channel wait locate When reason task, control any a task processing thread in each task processing thread seized by the channel it is to be processed in channel Task;The task processing thread that control gets waiting task handles the waiting task.
Optionally, the waiting task processing unit 33, specifically can be also used for:
Thread, which is handled, for multiple tasks in advance distributes thread number;Control multiple tasks processing thread parallel operation, and root The waiting task in set of tasks thread is successively distributed into each task according to the sequence of thread number and handles thread;Control obtains Task processing thread to waiting task handles the waiting task.
Optionally, the waiting task processing unit 33, specifically can be also used for: handle thread point in advance for multiple tasks With thread number;Control multiple tasks processing thread parallel operation;According to thread number, random number is generated, and is generated each time Random number correspond to task processing thread;The task that a waiting task distributes to the corresponding random number is handled every time Thread;The task processing thread that control gets waiting task handles the waiting task.
Optionally, as shown in fig. 6, the device further include:
Processing result is returned to set of tasks thread for control task processing thread by processing result return unit 36 In.
Processing result acquiring unit 37, for control each task provide thread obtained from set of tasks thread it is each to be processed The corresponding processing result of task.
Optionally, as shown in fig. 6, the device further include:
Access processing unit 38, for control task handle thread dispatching Software Development Kit, by waiting task into Row, which is linked into block chain, to be handled.
Processing result receiving unit 39 receives processing of the waiting task in block chain for control task processing thread As a result.
Optionally, as shown in fig. 6, the device further include:
Time-out information return unit 40 is used for a waiting task in task assembly line journey and is obtained by task processing thread When duration afterwards reaches pre-set overtime duration, control task set thread provides line to the corresponding task of waiting task Journey returns to time-out information.
Processing result query unit 41 judges set of tasks thread in an inquiry duration for control task offer thread Whether the processing result of the waiting task is received.
Delay returns to processing unit 42, for receiving the place of the waiting task in inquiry duration in task assembly line journey When managing result, determine that the processing result of waiting task is delayed by return, and control task provides thread from set of tasks thread Receive processing result;
Task retransmission unit 43, for not receiving the processing of the waiting task in inquiry duration in task assembly line journey When as a result, control task is provided thread and is sent out again to set of tasks thread using unique transaction number identical with waiting task Send waiting task.
Task result determination unit 44, for providing the time-out information that thread receives the waiting task again in task When, determine waiting task processing failure;Judge whether the processing result of task offer thread succeeds;If processing result not at Function determines waiting task processing failure;If processing result success, determines that waiting task is handled successfully.
Statistic unit 45, for control task provide thread according to each processing result count it transmitted by waiting task Success rate, success number, failure number and each waiting task processing institute elapsed time;Control task set thread statistics The processing number of the waiting task of each task processing thread.
In addition, the embodiment of the present invention also provides a kind of non-transient computer readable storage medium, it is stored thereon at least one Executable instruction, the executable instruction make processor execute the corresponding operation of above-mentioned task processing method.
In addition, the embodiment of the present invention also provides a kind of computer equipment, comprising: processor, memory, communication interface and logical Believe bus, the processor, the memory and the communication interface complete mutual communication, institute by the communication bus State memory for store an at least executable instruction, the executable instruction makes the processor execute above-mentioned task to handle The corresponding operation of method.
A kind of Task Processing Unit provided in an embodiment of the present invention can start task and provide thread and multiple tasks processing Thread, and control task provides thread and obtains waiting task, and the waiting task that will acquire is sent to task-set zygonema Then Cheng Zhong controls multiple tasks processing thread parallel and handles waiting task.In this way, the embodiment of the present invention is using more A task handles thread to handle parallel waiting task, takes full advantage of task processing thread resources, can be in phase It sends in the same time and handles more tasks, so that can efficiently be carried out at task access in computer and internet Reason, so that task process performance is improved.
It should be understood by those skilled in the art that, the embodiment of the present invention can provide as method, system or computer program Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the present invention Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the present invention, which can be used in one or more, The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces The form of product.
The present invention be referring to according to the method for the embodiment of the present invention, the process of equipment (system) and computer program product Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates, Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one The step of function of being specified in a box or multiple boxes.
Specific embodiment is applied in the present invention, and principle and implementation of the present invention are described, above embodiments Explanation be merely used to help understand method and its core concept of the invention;At the same time, for those skilled in the art, According to the thought of the present invention, there will be changes in the specific implementation manner and application range, in conclusion in this specification Appearance should not be construed as limiting the invention.

Claims (11)

1. a kind of task processing method characterized by comprising
Starting task provides thread and multiple tasks handle thread;
It controls the task and thread acquisition waiting task is provided, and the waiting task that will acquire is sent to task-set In zygonema journey;
The multiple task processing thread parallel is controlled to handle the waiting task.
2. task processing method according to claim 1, which is characterized in that the waiting task that will acquire After being sent in set of tasks thread, which comprises
The waiting task that will acquire is stored into spare set of tasks thread;
When the set of tasks thread breaks down, using the spare set of tasks thread as the set of tasks thread.
3. task processing method according to claim 1, which is characterized in that the waiting task that will acquire After being sent in set of tasks thread, the method also includes:
It controls the set of tasks thread multiple waiting tasks are sequentially placed into pre-set channel, so that a channel is every It is secondary to be put into a waiting task;
The step of the multiple task processing thread parallel of control handles the waiting task, comprising:
Each task processing thread parallel operation is controlled, detects the channel with the presence or absence of waiting task;
In the channel, there are any a task processing threads when waiting task, controlled in each task processing thread by being somebody's turn to do The waiting task in channel is seized in channel;
The task processing thread that control gets waiting task handles the waiting task.
4. task processing method according to claim 1, which is characterized in that the multiple task of control handles thread The step of waiting task is handled parallel, further includes:
Thread, which is handled, for the multiple task in advance distributes thread number;
The multiple task processing thread parallel operation is controlled, and according to the sequence of the thread number successively by task-set zygonema Waiting task in journey distributes to each task processing thread;
The task processing thread that control gets waiting task handles the waiting task.
5. task processing method according to claim 1, which is characterized in that the multiple task of control handles thread The step of waiting task is handled parallel, further includes:
Thread, which is handled, for the multiple task in advance distributes thread number;
Control the multiple task processing thread parallel operation;
According to the thread number, random number is generated, and the random number generated each time corresponds to a task processing thread;
The task that a waiting task distributes to the corresponding random number is handled into thread every time;
The task processing thread that control gets waiting task handles the waiting task.
6. according to the described in any item task processing methods of claim 3 to 5, which is characterized in that the multiple of the control After the step of business processing thread parallel handles the waiting task, which comprises
Control task handles thread and returns to processing result in the set of tasks thread;
Each task offer thread is provided and obtains the corresponding processing result of each waiting task from set of tasks thread.
7. task processing method according to claim 6, which is characterized in that handle line in the multiple task of control Cheng Binghang carries out processing and control task processing thread to the waiting task and processing result is returned to the task Gather between the step in thread, which comprises
Control task handles thread dispatching Software Development Kit, the waiting task be linked into block chain carries out Processing;
Control task processing thread receives processing result of the waiting task in block chain.
8. task processing method according to claim 1, which is characterized in that the method also includes:
Duration after a waiting task is obtained by task processing thread in the set of tasks thread reaches pre-set When overtime duration, control task set thread provides thread to the corresponding task of waiting task and returns to time-out information;
It controls the task and thread is provided and is inquired in duration one and judge whether the set of tasks thread receives this to be processed The processing result of business;
When the set of tasks thread receives the processing result of the waiting task in the inquiry duration, determine to be processed The processing result of task is delayed by return, and controls the task and provide thread from the set of tasks thread reception processing As a result;
When the set of tasks thread does not receive the processing result of the waiting task in the inquiry duration, described in control Task is provided thread and is sent again to the set of tasks thread using unique transaction number identical with the waiting task Waiting task;
If the task provides the time-out information that thread receives the waiting task again, it is determined that at the waiting task Reason failure;
Judge whether the processing result of the task offer thread succeeds;If the processing result is failed, described in determination Waiting task processing failure;If the processing result success, determines that the waiting task is handled successfully;
Control the task provide thread according to each processing result count it transmitted by the success rate of waiting task, success The processing institute elapsed time of number, failure number and each waiting task;
Control the processing number that the set of tasks thread counts the waiting task of each task processing thread.
9. a kind of Task Processing Unit characterized by comprising
Thread start unit provides thread and multiple tasks processing thread for starting task;
Waiting task obtaining unit provides thread acquisition waiting task, and the institute that will acquire for controlling the task Waiting task is stated to be sent in set of tasks thread;
Waiting task processing unit, for control the multiple task processing thread parallel to the waiting task at Reason.
10. a kind of non-transient computer readable storage medium is stored thereon with an at least executable instruction, which is characterized in that institute Stating executable instruction makes processor execute such as the corresponding operation of task processing method described in any item of the claim 1 to 8.
11. a kind of computer equipment, comprising: processor, memory, communication interface and communication bus, the processor described are deposited Reservoir and the communication interface complete mutual communication by the communication bus, which is characterized in that the memory is used for An at least executable instruction is stored, the executable instruction executes the processor as described in any one of claims 1 to 8 The corresponding operation of task processing method.
CN201811100110.XA 2018-09-20 2018-09-20 A kind of task processing method and device Pending CN109284190A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811100110.XA CN109284190A (en) 2018-09-20 2018-09-20 A kind of task processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811100110.XA CN109284190A (en) 2018-09-20 2018-09-20 A kind of task processing method and device

Publications (1)

Publication Number Publication Date
CN109284190A true CN109284190A (en) 2019-01-29

Family

ID=65181153

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811100110.XA Pending CN109284190A (en) 2018-09-20 2018-09-20 A kind of task processing method and device

Country Status (1)

Country Link
CN (1) CN109284190A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110535658A (en) * 2019-09-02 2019-12-03 紫光展锐(重庆)科技有限公司 Block chain data processing method, apparatus and system
CN110580188A (en) * 2019-09-05 2019-12-17 珠海格力电器股份有限公司 multithreading network distribution method and storage medium
CN114363336A (en) * 2021-12-31 2022-04-15 支付宝(杭州)信息技术有限公司 Method and device for starting/closing block link point service

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102209100A (en) * 2011-03-15 2011-10-05 厦门亿力吉奥信息科技有限公司 Task scheduling cloud processing system and method
CN107291534A (en) * 2016-04-13 2017-10-24 平安科技(深圳)有限公司 Asynchronous task concurrent processing method and system
CN107291547A (en) * 2016-03-31 2017-10-24 阿里巴巴集团控股有限公司 A kind of task scheduling processing method, apparatus and system
WO2018104799A1 (en) * 2016-12-07 2018-06-14 Tata Consultancy Services Limited Systems and methods for scheduling tasks and managing computing resource allocation for closed loop control systems

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102209100A (en) * 2011-03-15 2011-10-05 厦门亿力吉奥信息科技有限公司 Task scheduling cloud processing system and method
CN107291547A (en) * 2016-03-31 2017-10-24 阿里巴巴集团控股有限公司 A kind of task scheduling processing method, apparatus and system
CN107291534A (en) * 2016-04-13 2017-10-24 平安科技(深圳)有限公司 Asynchronous task concurrent processing method and system
WO2018104799A1 (en) * 2016-12-07 2018-06-14 Tata Consultancy Services Limited Systems and methods for scheduling tasks and managing computing resource allocation for closed loop control systems

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110535658A (en) * 2019-09-02 2019-12-03 紫光展锐(重庆)科技有限公司 Block chain data processing method, apparatus and system
CN110580188A (en) * 2019-09-05 2019-12-17 珠海格力电器股份有限公司 multithreading network distribution method and storage medium
CN110580188B (en) * 2019-09-05 2023-09-26 珠海格力电器股份有限公司 Multithreading network allocation method and storage medium
CN114363336A (en) * 2021-12-31 2022-04-15 支付宝(杭州)信息技术有限公司 Method and device for starting/closing block link point service

Similar Documents

Publication Publication Date Title
CN109783229B (en) Thread resource allocation method and device
CN110018893B (en) Task scheduling method based on data processing and related equipment
EP3675434B1 (en) Distributed system resource allocation method, device and system
CN110888721A (en) Task scheduling method and related device
CN110113387A (en) A kind of processing method based on distributed batch processing system, apparatus and system
CN112416585B (en) Deep learning-oriented GPU resource management and intelligent scheduling method
CN108304260B (en) Virtualization operation scheduling system based on high-performance cloud computing and implementation method thereof
CN106557363A (en) A kind of system and method for big data task scheduling
CN103235835B (en) For the inquiry implementation method and device of data-base cluster
CN105389209A (en) Asynchronous batch task processing method and system
CN109284190A (en) A kind of task processing method and device
CN106257893A (en) Storage server task response method, client, server and system
CN105373426B (en) A kind of car networking memory aware real time job dispatching method based on Hadoop
CN105740085B (en) Fault-tolerance processing method and device
CN111651864B (en) Event centralized emission type multi-heterogeneous time queue optimization simulation execution method and system
CN101452404A (en) Task scheduling apparatus and method for embedded operating system
CN103500119B (en) A kind of method for allocating tasks based on pre-scheduling
CN104820616B (en) A kind of method and device of task scheduling
WO2015127668A1 (en) Task centric resource scheduling framework
CN110336859A (en) Task scheduling system under multi-tenant environment
US20150113542A1 (en) Knapsack-based sharing-aware scheduler for coprocessor-based compute clusters
CN109408216A (en) Task creating method, device, equipment and storage medium
CN103023980A (en) Method and system for processing user service request by cloud platform
US7219345B2 (en) System and method for terminating processes in a distributed computing system
CN102929929A (en) Method and device for data summarization

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20210121

Address after: 215163 No. 9 Xuesen Road, Science and Technology City, Suzhou High-tech Zone, Jiangsu Province

Applicant after: Suzhou Lang run innovation intellectual property operation Co.,Ltd.

Address before: 100034 4008, 4 floor, 9 building, 56 half moon street, Xicheng District, Beijing.

Applicant before: SINOCHAIN TECHNOLOGY Co.,Ltd.

TA01 Transfer of patent application right
RJ01 Rejection of invention patent application after publication

Application publication date: 20190129

RJ01 Rejection of invention patent application after publication