摘要 |
A task processing method and device, the method comprising: determining the number of unprocessed tasks within certain tasks in a system and the number of current threads processing the tasks, and on the basis of a size relationship between the number of unprocessed tasks and a preset task unprocessed threshold, and a size relationship between the number of current threads and a preset thread starting threshold, starting a different number of new threads, so that the new threads process the tasks. Compared to prior techniques of starting a certain fixed number of threads, and allocating fixed tasks to the threads to process, the present method utilises a preset unprocessed task threshold and a preset thread starting threshold, respectively determines the situation regarding unprocessed tasks in a system and the situation regarding the number of existing threads, and starts different numbers of new threads for different situations. The present method has a better task processing effect, and avoids imposing large thread maintenance pressures on systems. |