The invention relates to a method for realizing a
thread pool for executing a decomposable task, which comprises the following steps of: S1, defining attributes: defining the attributes required for creating the
thread pool, including Task, Job, MAXPOOLSIZE, MAXTaskSIZE, BLOCKTIMEOUT, TaskQueue, JobQueue, RunningTaskList and LastTaskIndex, and defining the attributes required for creating the
thread pool, including Task, Job, MAXPOOLSIZE, MAXTaskSIZE, BLOCKTIMEOUT, TaskQueue, JobQueue, RunningTaskList and LastTaskIndex; s2, initialization: S2.1, creating the thread
pool according to each attribute, completing initialization of each attribute, and setting a task scheduler, a Task scheduler and a
Job scheduler; s2.2, a plurality of threads are created in the thread
pool, the number of the threads is MAXPOOLSIZE, and all the threads are put into a thread array and started; s3, updating the array: when a new Task is submitted every time, adding the new Task into the TaskQueue; s4, executing the thread: obtaining a sub-task Job through a task scheduler, a Task scheduler and a
Job scheduler, and executing the sub-task Job; and S5, loop execution: after the execution of the sub-task Job is finished, the loop should be continued and repeated, so that the S3 is returned.