Thread pool unified scheduling monitoring method and system
A monitoring system and thread pool technology, applied in the field of thread pool, can solve problems such as unbalanced CPU core load and low reliability of individual threads, and achieve the effects of ensuring full utilization, avoiding waste of thread resources, and improving flexibility
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0043] Such as figure 1 As shown, the present invention provides a thread pool unified scheduling monitoring method, including:
[0044] S1, obtain the number of processor cores, and determine the number of threads to be created according to the number of processor cores;
[0045] S2, establish a corresponding queue according to the number of threads to be created, for storing tasks to be processed;
[0046] S3, calculate the remainder of the first attribute value of the task and the total number of threads, and schedule the corresponding thread to execute the task according to the result of the remainder calculation;
[0047] S4, the running clock cycle of the thread is monitored between adjacent threads.
[0048] Wherein, in step S1, the number of threads to be created is not greater than the number of processor cores. When the number of created threads is less than the number of CPU cores, if there are other additional task processes that need to occupy CPU resources and ...
Embodiment 2
[0066] Such as Figure 4 As shown, the technical solution of the present invention also provides a thread pool unified scheduling monitoring method, including:
[0067] S1, obtain the number of processor cores, and determine the number of threads to be created according to the number of processor cores;
[0068] S2, establish a corresponding queue according to the number of threads to be created, for storing tasks to be processed;
[0069] S3, calculate the remainder of the first attribute value of the task and the total number of threads, and schedule the corresponding thread to execute the task according to the result of the remainder calculation;
[0070] S4, the thread pool creates a callback function, which is used to complete the scheduling task when polling the task;
[0071] S5, monitor the running clock cycles of the threads between adjacent threads.
[0072] In step S4, the thread pool creates a callback function (callback_function), which is used to call the call...
Embodiment 3
[0076] Such as Figure 5 As shown, the technical solution of the present invention also provides a thread pool unified scheduling monitoring system, including:
[0077] The acquisition unit 101 acquires the number of processor cores, and determines the number of threads to be created according to the number of processor cores;
[0078] The queue establishment unit 102 establishes a corresponding queue according to the number of threads to be created for storing tasks to be processed;
[0079] The calculation unit 103 performs a remainder calculation on the first attribute value of the task and the total number of threads, and schedules the corresponding thread to execute the task according to the result of the remainder calculation;
[0080] The monitoring unit 104 monitors the running clock cycles of the threads between adjacent threads.
[0081] The invention effectively solves the problems of unbalanced CPU core load and low reliability of setting individual threads in th...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 


