Business-based double-layer thread pool distribution method, system, equipment and medium

By using a business-based two-layer thread pool allocation method to dynamically adjust thread resources, the problem of uneven resource allocation in existing technologies is solved, thereby improving the stability of critical business operations and resource utilization, and enhancing the system's responsiveness and troubleshooting efficiency.

CN121785752APending Publication Date: 2026-04-03TONGCHENG NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-06
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Existing technologies struggle to balance the resource demands of critical business operations with those of the overall system in high-concurrency, multi-service scenarios. This results in significant fluctuations in response latency for critical business operations, resource waste, or abnormally high loads that impact other business operations. Furthermore, the lack of effective thread lifecycle management and status monitoring leads to low efficiency in troubleshooting.

Method used

A business-based two-layer thread pool allocation method is adopted. By identifying the business type and priority, the first thread pool is used to reserve dedicated threads for critical business, and the second thread pool is used for shared threads for ordinary business. The number of threads is dynamically adjusted according to the load characteristics, and the thread pool status and indicators are monitored in real time to achieve resource isolation and elastic adaptation.

Benefits of technology

Prioritize the supply of resources for critical business operations, reduce response latency fluctuations, improve overall resource utilization, quickly restore thread pool capacity, improve troubleshooting efficiency, and ensure system stability and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121785752A_ABST
    Figure CN121785752A_ABST
Patent Text Reader

Abstract

The invention discloses a service-based double-layer thread pool distribution method and system, a medium and equipment, and relates to the technical field of distributed systems. The method comprises the steps of receiving a service request sent by a service application, wherein the service request comprises a service identifier; according to the service identifier, identifying corresponding service types and priorities, including a first priority and a second priority; aiming at the service request of the first priority, checking the availability of a first thread pool; executing the service request of the first priority; if the first thread pool is unavailable, checking the availability of the second thread pool; allocating a shared thread from the second thread pool, and executing the service request of the first priority, or directly allocating the shared thread of the second thread pool to the service request of the second priority to execute a task; and if the second thread pool is unavailable, refusing the service request. The double-layer thread pool is bound with the service priority, and the thread pool configuration is preset in combination with the service load characteristics, so that the stability of key service response is ensured, and the overall resource utilization rate is improved through the shared pool.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of distributed system technology, specifically to a business-based two-layer thread pool allocation method, system, device, and medium. Background Technology

[0002] As the complexity and scale of distributed system operations increase, the computational resource requirements of different types of business vary significantly. Critical tasks such as order creation, payment verification, and transaction execution have extremely high requirements for response latency and execution stability, necessitating priority resource allocation. Meanwhile, ordinary priority tasks such as user information queries, system log recording, and report generation can tolerate reasonable queuing. Furthermore, the overall system load often fluctuates dynamically with peak business periods, making it difficult for traditional thread resource allocation and scheduling methods to balance the needs of critical business operations with the overall system requirements.

[0003] Currently, thread resource scheduling for concurrent tasks in distributed systems mainly adopts the following four implementation methods: First, the single thread pool mode, where the system deploys only one general thread pool, all business types share the computing resources of this thread pool, and tasks enter the thread pool for execution according to the submission order or basic rules; Second, the fixed thread allocation mode, where a fixed number of threads are pre-allocated to each business type, and the number of threads remains fixed during system operation and does not change with business load; Third, the simple priority queue mode, where tasks are sorted through a task priority queue, and high-priority tasks enter the thread pool for execution first, with different businesses sharing the same thread pool resources; Fourth, the static configuration management mode, where the core parameters of the thread pool are set through a static configuration file.

[0004] However, the aforementioned existing technologies have significant shortcomings in real-world applications with high concurrency and multiple services, making it difficult to meet the system's technical requirements for stability, resource utilization, and scalability. In single-thread pool and simple priority queue modes, critical services and ordinary priority tasks share thread resources. Sudden high loads from ordinary priority tasks can easily preempt resources from critical services, leading to large fluctuations in response latency and even task timeouts. In fixed thread allocation modes, the number of threads cannot adapt to actual load fluctuations; threads allocated during off-peak hours are idle, resulting in resource waste, while insufficient threads during peak hours cause task blocking. Static configuration management modes require application restarts to adjust thread pool parameters, failing to respond in real-time to sudden load changes and severely impacting business continuity. Existing solutions do not achieve business-level resource isolation; abnormally high loads in a single service can consume a large amount of thread resources, thus affecting the normal execution of other services. Most existing solutions lack robust thread lifecycle management and status monitoring mechanisms, making it difficult to pinpoint performance bottlenecks and resulting in low troubleshooting efficiency. Summary of the Invention

[0005] This application provides a business-based two-layer thread pool allocation method, system, device, and medium to solve the problems of low business stability and low resource utilization in the prior art.

[0006] Firstly, this application provides a business-based two-layer thread pool allocation method, the method including: Receive business requests sent by business applications, including business identifiers; Based on the business identifier, identify the business type and priority corresponding to the business request, including first priority and second priority; For first-priority business requests, check the availability of the first thread pool, which is a set of reserved threads dedicated to first-priority business requests. If the first thread pool is available, a dedicated thread is allocated from the first thread pool to execute the first priority business request, and the processing result is returned to the business application after the task is completed; If the first thread pool is unavailable, check the availability of the second thread pool, which is a common set of threads shared by all second-priority services. If the second thread pool is available, a shared thread is allocated from the second thread pool to execute the first priority business request, or a shared thread from the second thread pool is directly allocated to execute the task for the second priority business request, and the processing result is returned to the business application after the task is completed; If the second thread pool is unavailable, the business request is rejected, and an insufficient resource exception is thrown to the business application.

[0007] By adopting the above technical solution, resource isolation of a two-layer thread pool based on business priority is achieved. Priority is given to ensuring the resource supply of the first priority business and preventing the second priority business from preempting resources. At the same time, the overall resource utilization is improved by sharing the thread pool, and an explicit rejection mechanism is implemented when resources are insufficient to reduce business response latency fluctuations.

[0008] In a specific feasible implementation, the business types corresponding to the first priority include order processing business, payment processing business, and transaction execution business, while the business types corresponding to the second priority include user query business, log recording business, and report generation business. The number of dedicated threads in the first thread pool is preset based on the historical peak load of the first priority business, and the initial number of shared threads in the second thread pool is preset based on the average load of the second priority tasks.

[0009] By adopting the above technical solution, the thread pool configuration is bound to the actual load characteristics of the business. The first thread pool is preset based on historical peak values ​​to ensure the stability of critical businesses, and the second thread pool is preset based on average load to optimize the initial allocation of resources, thereby improving the rationality and pertinence of the thread pool configuration.

[0010] In a specific feasible implementation, methods for checking the availability of the first thread pool include: Get the first maximum number of threads for the first thread pool, and count the number of dedicated threads currently allocated and running in the first thread pool; If the number of currently running dedicated threads is less than the first maximum number of threads, then the first thread pool is determined to be available; If the number of currently running dedicated threads is greater than or equal to the first maximum number of threads, then the first thread pool is deemed unavailable.

[0011] By adopting the above technical solution, the availability status of the first thread pool can be accurately quantified. By comparing the number of running threads with the maximum number of threads, it can be quickly determined whether the dedicated resources are sufficient, ensuring that high-priority services can use the reserved resources first.

[0012] In a specific feasible implementation, methods for checking the availability of the second thread pool include: Get the second maximum number of threads for the second thread pool and the maximum number of tasks allowed to execute at the same time; Count the number of tasks currently executing concurrently in the second thread pool and the number of shared threads that have been allocated and are in a running state; If the number of concurrently executing tasks is less than the maximum number of tasks, and the number of currently running shared threads is less than the second maximum number of threads, then the second thread pool is determined to be available. If the number of concurrently executing tasks is greater than or equal to the maximum number of tasks, and the number of currently running shared threads is greater than or equal to the second maximum number of threads, then the second thread pool is deemed unavailable.

[0013] By adopting the above technical solution, the availability of the second thread pool is evaluated from the dual dimensions of the number of concurrent tasks and the number of running threads, avoiding resource overload caused by misjudgment of a single indicator and ensuring the operational stability of the shared thread pool.

[0014] In a specific feasible implementation, the methods for executing business requests include: Real-time collection of operational metrics for the first and second thread pools, including utilization rate, task queue length, and average task execution time; When the running metrics are greater than or equal to the preset high load range, increase the number of threads in the target thread pool, and the increased number of threads shall not exceed the corresponding maximum number of threads. When the performance metrics are below the preset low load range, reduce the number of threads in the target thread pool, and ensure that the reduced number of threads is not less than the corresponding minimum number of threads.

[0015] By adopting the above technical solutions, the thread pool can dynamically adjust the number of threads according to the real-time load, expand to increase processing capacity under high load, and shrink to reduce resource waste under low load, thereby achieving elastic adaptation and efficient utilization of resources.

[0016] In one specific feasible implementation, the method further includes: If an exception occurs while the assigned dedicated thread or shared thread is executing a task, the current task corresponding to the target thread that encountered the exception will be terminated. Create a new thread to supplement the thread pool where the exception occurred, so that the number of threads in the target thread pool is restored to the number before the exception occurred, and record the exception information, including the exception time, the exception thread identifier, and the business request identifier.

[0017] By adopting the above technical solution, tasks can be quickly terminated and threads replenished to restore pool capacity when a thread is abnormal, and abnormal information can be recorded to ensure the continuous and stable operation of the thread pool, while providing a basis for troubleshooting.

[0018] In one specific feasible implementation, the method further includes: Collect the running status of the first and second thread pools. The running status includes standby, running, paused, destroyed, and destroyed states. The system will synchronize the operating status and indicators to the system monitoring module. The system monitoring module will then trigger an alert when the operating status is abnormal, based on the preset alert rules.

[0019] By adopting the above technical solutions, the real-time collection of thread pool running status and indicators, along with linked monitoring and early warning, can promptly detect anomalies and trigger prompts, thereby improving system operation and maintenance efficiency and overall reliability.

[0020] A second aspect of this application provides a business-based two-tier thread pool allocation system, the system comprising: The advanced proxy component is configured to receive business requests and extract business identifiers; determine business priorities; initiate availability checks and thread allocation requests; and synchronize task processing results or resource shortage exceptions to business applications. The business module is configured to receive business identifiers, determine the business type according to a preset mapping relationship, determine the priority according to rules, and feed the results back to the advanced proxy component. The thread pool module is configured to respond to availability check requests and determine availability; and to receive allocation requests and allocate threads for services of different priorities.

[0021] A third aspect of this application provides an electronic device, comprising: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to execute the above-described method steps.

[0022] A fourth aspect of this application provides a computer storage medium storing a plurality of instructions adapted for loading by a processor and executing the method steps described above.

[0023] In summary, one or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages: 1. By binding a two-layer thread pool to business priority, resources are reserved for the first priority business to avoid preemption by ordinary business; at the same time, the thread pool configuration is preset according to the business load characteristics, which not only ensures the stable response of critical business, but also improves the overall resource utilization through the shared pool.

[0024] 2. By collecting load metrics in real time, the number of threads is dynamically adjusted, and the availability of the thread pool is accurately judged through dual dimensions to avoid resource overload or idleness, thereby achieving elastic adaptation and efficient utilization of thread resources.

[0025] 3. By terminating tasks, replenishing threads, and recording information when thread exceptions occur, the thread pool capacity can be quickly restored; at the same time, the thread pool status and indicators can be monitored in real time, and early warnings can be triggered when exceptions occur, thereby improving the efficiency of troubleshooting and ensuring the continuous and stable operation of the entire thread pool system. Attached Figure Description

[0026] Figure 1 This is a flowchart illustrating a business-based two-layer thread pool allocation method provided in an embodiment of this application; Figure 2 This is another flowchart illustrating a business-based two-layer thread pool allocation method provided in this application embodiment; Figure 3 This is a timing diagram of a business-based two-layer thread pool allocation system provided in an embodiment of this application. Detailed Implementation

[0027] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.

[0028] In the description of the embodiments of this application, the words "for example" or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design that is described as "for example" or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design options. Rather, the use of the words "for example" or "for instance" is intended to present the relevant concepts in a specific manner.

[0029] In the description of the embodiments of this application, the term "multiple" means two or more. For example, multiple systems means two or more systems, and multiple screen terminals means two or more screen terminals. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, a feature defined with "first" or "second" may explicitly or implicitly include one or more of that feature. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.

[0030] Please refer to Figure 1 A flowchart illustrating a business-based two-level thread pool allocation method is presented. This method can be implemented using a computer program, a microcontroller, or run on a business-based two-level thread pool allocation system. The computer program can be integrated into a computer device or run as a standalone utility application. Specifically, the method includes steps S100 to S700, as follows: S100: Receive a service request sent by a service application, the service request including a service identifier; refer to Figure 1 and Figure 2 In some embodiments, the advanced proxy component in the business-based two-layer thread pool allocation system (hereinafter referred to as the system) receives business requests sent by business applications, which carry a business identifier.

[0031] In this embodiment of the application, a business application refers to an application that initiates business processing requests, such as an order management application for an e-commerce platform or a transaction processing application for a financial system.

[0032] In this embodiment of the application, a business request refers to an operation request initiated by a business application that requires system processing, such as an order creation request or a user information query request.

[0033] In this embodiment of the application, the business identifier is a unique mark used to distinguish different business types. For example, the identifier for order processing business can be set to a specific combination of characters used to identify order processing, and the identifier for payment processing business can be set to a specific combination of characters used to identify payment processing.

[0034] In this embodiment, the advanced proxy component is the core component of the system responsible for receiving business requests and performing preliminary processing. It can establish stable communication connections with various business applications to ensure that business requests can be received accurately and in a timely manner.

[0035] S200. Based on the service identifier, identify the service type and priority corresponding to the service request. The priority includes first priority and second priority. In some embodiments, after the advanced proxy component obtains the business identifier in the business request, it calls the business type identification module to determine the business type corresponding to the business request, and then calls the priority determination module to determine the priority corresponding to the business type. The priority includes the first priority and the second priority.

[0036] In this embodiment of the application, the business type is a category divided according to the processing purpose and importance of the business request, such as order processing business, payment processing business, transaction execution business, user query business, log recording business, report generation business, etc.

[0037] In this embodiment of the application, the first priority refers to the business priority that has extremely high requirements for response time and processing stability and requires priority to ensure resources, corresponding to high-priority business.

[0038] In this embodiment of the application, the second priority refers to the business priority with relatively low response time requirements and acceptable queuing waiting time, corresponding to ordinary priority business.

[0039] In some embodiments, the service type identification module pre-sets a mapping relationship between service identifiers and service types, and the service type corresponding to the service request can be matched through this mapping relationship; the priority determination module pre-sets a correspondence rule between service types and priorities, and the corresponding priority can be matched according to the determined service type, thereby completing the identification of the service type and priority of the service request.

[0040] In some embodiments, the mapping relationship between business identifiers and business types may include: a specific order processing identifier corresponds to an order processing business, a specific payment processing identifier corresponds to a payment processing business, and a specific user query identifier corresponds to a user query business; the correspondence rule between business types and priorities may include: order processing business, payment processing business, and transaction execution business correspond to the first priority, and user query business, log recording business, and report generation business correspond to the second priority.

[0041] Based on the above embodiments, as another optional embodiment, the business types corresponding to the first priority include order processing business, payment processing business, and transaction execution business; the business types corresponding to the second priority include user query business, log recording business, and report generation business. The number of dedicated threads in the first thread pool is preset based on the historical peak load of the first priority business, and the initial number of shared threads in the second thread pool is preset based on the average load of the second priority tasks.

[0042] In this embodiment of the application, the first thread pool is a set of reserved threads exclusively allocated for the first priority service, used to ensure the stable processing of the first priority service, i.e., the line pool.

[0043] In this embodiment, the number of dedicated threads is the total number of threads pre-configured in the first thread pool that are used only for processing first-priority services.

[0044] In this embodiment of the application, historical peak load refers to the highest load level reached by the first priority service over a period of time, such as a month or a quarter. The load level is usually measured by the number of service requests per unit time.

[0045] In this embodiment of the application, the second thread pool is a general-purpose thread set shared by all second-priority services, used to process second-priority services, i.e., a public thread pool.

[0046] In this embodiment, the initial number of shared threads is the total number of threads preset by the second thread pool at system startup and shared by second priority services.

[0047] In some embodiments, during the initialization phase, the system calculates and presets the number of dedicated threads in the first thread pool corresponding to each first priority service by statistically analyzing the historical peak load of each first priority service. For example, the highest number of requests per unit time for the order processing service is 500 times per second, the historical peak load for the payment processing service is 300 times per second, and the historical peak load for the transaction execution service is 400 times per second. The system also calculates and presets the number of dedicated threads in the first thread pool corresponding to each first priority service by combining the number of service requests that a single thread can handle per unit time. For example, the number of dedicated threads in the first thread pool corresponding to the order processing service is preset to ten, the number of dedicated threads in the first thread pool corresponding to the payment processing service is preset to six, and the number of dedicated threads in the first thread pool corresponding to the transaction execution service is preset to eight.

[0048] Furthermore, by statistically analyzing the average load of the second-priority tasks in the system and combining it with the number of second-priority task requests that a single thread can process per unit time, the initial number of shared threads in the second thread pool is calculated and preset.

[0049] For example, a single thread can process 50 first-priority business requests per second per unit of time, and 60 second-priority business requests per second per unit of time; the number of dedicated threads in the first thread pool corresponding to order processing business can be 10, the number of dedicated threads in the first thread pool corresponding to payment processing business can be 6, and the number of dedicated threads in the first thread pool corresponding to transaction execution business can be 8; the initial number of shared threads in the second thread pool can be 10.

[0050] S300. For first-priority business requests, check the availability of the first thread pool. The first thread pool is a set of reserved threads dedicated to first-priority business requests. In some embodiments, after determining that a business request is a first-priority business request, the advanced proxy component sends an availability check request to the first thread pool management module to check the availability of the first thread pool. The first thread pool management module is responsible for managing the creation, thread allocation, and status monitoring of the first thread pool. Upon receiving the availability check request, the first thread pool management module initiates the availability check process for the first thread pool to determine whether the current first thread pool can allocate a dedicated thread for the first-priority business request.

[0051] Based on the above embodiments, as another optional embodiment, the method for checking the availability of the first thread pool includes: S301. Obtain the first maximum number of threads for the first thread pool, and count the number of dedicated threads currently allocated and running in the first thread pool; In some embodiments, the first maximum number of threads for the first thread pool is obtained from the system configuration library by the first thread pool management module, and the thread state statistics module is called to count the number of dedicated threads currently allocated and running in the first thread pool.

[0052] In this embodiment of the application, the first maximum number of threads is the maximum number of dedicated threads that can be accommodated in the first thread pool, which is equal to the sum of the number of dedicated threads for each first priority service.

[0053] In this embodiment of the application, the system configuration library is a database used to store various configuration parameters of the system, which can provide stable configuration parameter reading services for each component.

[0054] S302. If the number of currently running dedicated threads is less than the first maximum number of threads, then the first thread pool is determined to be available. In some embodiments, the first thread pool management module compares the number of currently running dedicated threads with the first maximum number of threads. If the number of currently running dedicated threads is less than the first maximum number of threads, it means that there are still idle dedicated threads in the first thread pool that can be allocated to new first priority business requests. Therefore, the first thread pool management module determines that the first thread pool is available and feeds back the availability status information to the advanced proxy component.

[0055] S303. If the number of currently running dedicated threads is greater than or equal to the first maximum number of threads, then the first thread pool is determined to be unavailable.

[0056] In some embodiments, if the number of currently running dedicated threads is greater than or equal to the first maximum number of threads, it means that all dedicated threads in the first thread pool have been allocated and are in a running state, and there are no idle dedicated threads that can be allocated to new first priority business requests. Therefore, the first thread pool management module determines that the first thread pool is unavailable and feeds back the unavailable status information to the advanced proxy component.

[0057] S400. If the first thread pool is available, allocate a dedicated thread from the first thread pool to execute the first priority business request, and return the processing result to the business application after the task is completed. In some embodiments, if the first thread pool is available, the advanced proxy component sends a dedicated thread allocation request to the first thread pool management module. This request carries the identification information of the first priority business request to be processed. After receiving the dedicated thread allocation request, the first thread pool management module selects a dedicated thread from the idle dedicated threads of the first thread pool and allocates it to the first priority business request. It also establishes an association between the dedicated thread and the business request identification information to track the execution status of the business request later. The first thread pool management module sends a task execution instruction to the allocated dedicated thread. The instruction includes the specific processing data of the first priority business request. After receiving the task execution instruction, the dedicated thread calls the corresponding business processing module to execute the first priority business request. After the business request is executed, the dedicated thread generates a processing result and sends the processing result to the first thread pool management module. The first thread pool management module forwards the processing result to the advanced proxy component, which then sends the processing result to the business application that initiated the business request, completing the processing flow of the first priority business request.

[0058] S500 If the first thread pool is unavailable, check the availability of the second thread pool. The second thread pool is a common set of threads shared by all second-priority services. Based on the above embodiments, as another optional embodiment, a method for checking the availability of the second thread pool is as follows: S501. Obtain the second maximum number of threads for the second thread pool and the maximum number of tasks allowed to be executed at the same time; In some embodiments, the second thread pool management module obtains the second maximum number of threads for the second thread pool and the maximum number of tasks allowed to be executed at the same time from the system configuration library.

[0059] In this embodiment of the application, the second maximum number of threads is the maximum total number of shared threads that can be accommodated in the second thread pool; the maximum number of tasks that can be executed at the same time refers to the total number of tasks that the second thread pool can process at the same time. This number is used to control the concurrent execution scale of the second thread pool and avoid exhausting system resources due to too many concurrent tasks, i.e., the shared concurrency.

[0060] S502. Count the number of tasks currently being executed concurrently in the second thread pool and the number of shared threads that have been allocated and are in the running state; In some embodiments, the second thread pool management module calls the task status statistics module to count the number of tasks currently being executed concurrently in the second thread pool, and at the same time calls the thread status statistics module to count the number of shared threads currently allocated and running in the second thread pool.

[0061] S503. If the number of concurrently executed tasks is less than the maximum number of tasks, and the number of currently running shared threads is less than the second maximum number of threads, then the second thread pool is determined to be available. In some embodiments, the second thread pool management module compares the number of currently concurrently executing tasks with the maximum number of tasks allowed to execute at the same time, and also compares the number of currently running shared threads with the second maximum number of threads. If the number of currently concurrently executing tasks is less than the maximum number of tasks allowed to execute at the same time, and the number of currently running shared threads is less than the second maximum number of threads, it indicates that the second thread pool has both concurrent space to accommodate new tasks and available idle shared threads. Therefore, the second thread pool management module determines that the second thread pool is available and feeds back the availability status information to the high-level agent component.

[0062] S504. If the number of concurrently executing tasks is greater than or equal to the maximum number of tasks, and the number of currently running shared threads is greater than or equal to the second maximum number of threads, then the second thread pool is deemed unavailable.

[0063] In some embodiments, if the number of concurrently executed tasks is greater than or equal to the maximum number of tasks allowed to be executed at the same time, and the number of currently running shared threads is greater than or equal to the second maximum number of threads, it indicates that the number of concurrent tasks in the second thread pool has reached its limit, and all shared threads are in a running state. There are no idle shared threads available for allocation, and no additional concurrent space to accommodate new tasks. Therefore, the second thread pool management module determines that the second thread pool is unavailable and feeds back the unavailable status information to the advanced proxy component.

[0064] S600. If the second thread pool is available, allocate a shared thread from the second thread pool to execute the first priority business request, or directly allocate a shared thread from the second thread pool to execute the task for the second priority business request, and return the processing result to the business application after the task is completed. In some embodiments, if a second thread pool is available, the advanced proxy component first determines the type of business request to be processed.

[0065] If the business request to be processed is a first-priority business request, that is, a business request that is redirected to the second thread pool because the first thread pool is unavailable, the advanced proxy component sends a shared thread allocation request to the second thread pool management module, and the request carries the identification information of the first-priority business request.

[0066] If the business request to be processed is a second-priority business request, the advanced proxy component directly sends a shared thread allocation request to the second thread pool management module, and the request carries the identification information of the second-priority business request.

[0067] After receiving a shared thread allocation request, the second thread pool management module selects a shared thread from the idle shared threads in the second thread pool and assigns it to the corresponding business request, establishing an association between the shared thread and the business request identification information. The second thread pool management module sends a task execution instruction to the allocated shared thread, which contains the specific processing data for the business request. After receiving the task execution instruction, the shared thread calls the corresponding business processing module to execute the business request. After the business request is executed, the shared thread generates a processing result and sends the result to the second thread pool management module. After receiving the processing result, the second thread pool management module forwards the result to the advanced proxy component, which then sends the result to the business application that initiated the request, completing the processing flow of the business request.

[0068] Based on the above embodiments, as another optional embodiment, the method for executing a business request includes: S601: Real-time collection of operational metrics for the first and second thread pools, including utilization rate, task queue length, and average task execution time; Based on the above embodiments, as another optional embodiment, the method for executing business requests includes the following: The thread pool monitoring component in the system collects real-time operational metrics of the first and second thread pools. These metrics include utilization rate, task queue length, and average task execution time. The operational metrics are parameters used to measure the operational status and load level of the first or second thread pool. Utilization rate refers to the percentage of allocated and running threads in the thread pool relative to the maximum number of threads in the pool; the formula is: utilization rate equals the number of running threads divided by the maximum number of threads multiplied by 100%. Task queue length refers to the total number of tasks waiting to be executed in the thread pool; the task queue is a queue structure used to temporarily store tasks awaiting processing. Average task execution time refers to the average execution time of all completed tasks in the thread pool over a period of time, such as five or ten minutes. The thread pool monitoring component establishes a real-time communication connection with the first and second thread pool management modules, enabling it to obtain various basic data required for calculating operational metrics, such as the number of running threads, the maximum number of threads, the number of tasks awaiting execution, and the execution time of completed tasks, and calculates the corresponding operational metrics based on this basic data.

[0069] S602. When the running metrics are greater than or equal to the preset high load range, increase the number of threads in the target thread pool, and the increased number of threads shall not exceed the corresponding maximum number of threads. In some embodiments, when the running metrics of the target thread pool collected by the thread pool monitoring component are greater than or equal to the preset high load range, the thread pool monitoring component sends a thread increase instruction to the management module of the target thread pool. After receiving the instruction, the management module of the target thread pool increases the number of threads in the target thread pool, and the increased number of threads is not greater than the corresponding maximum number of threads in the target thread pool.

[0070] Specifically, the thread pool monitoring component compares the collected operational metrics with the high-load interval. If the utilization rate is greater than or equal to the utilization rate threshold corresponding to the high-load interval, or the task queue length is greater than or equal to the task queue length threshold corresponding to the high-load interval, or the average task execution time is greater than or equal to the average task execution time threshold corresponding to the high-load interval, then the operational metrics are determined to be greater than or equal to the preset high-load interval. At this time, the target thread pool is in a high-load state and the number of threads needs to be increased to improve processing capacity. After receiving the thread increase instruction, the target thread pool management module creates new threads according to the suggestions contained in the instruction and adds the new threads to the target thread pool. At the same time, it counts the number of threads after the increase to ensure that it does not exceed the corresponding maximum number of threads.

[0071] S603. When the running indicators are less than the preset low load range, reduce the number of threads in the target thread pool, and the reduced number of threads shall not be less than the corresponding minimum number of threads.

[0072] In some embodiments, when the running metrics of the target thread pool collected by the thread pool monitoring component are less than the preset low load range, the thread pool monitoring component sends a thread reduction instruction to the management module of the target thread pool. After receiving the instruction, the management module of the target thread pool reduces the number of threads in the target thread pool, and the reduced number of threads is not less than the corresponding minimum number of threads in the target thread pool.

[0073] Specifically, the thread pool monitoring component compares the collected runtime metrics with the low-load interval. If the utilization rate is less than the utilization rate threshold corresponding to the low-load interval, and the task queue length remains zero for a preset duration, it is determined that the runtime metrics are less than the preset low-load interval. At this time, the target thread pool is in a low-load state with a large number of idle threads, and the number of threads needs to be reduced to release system resources. After receiving the thread reduction instruction, the target thread pool management module selects idle threads for destruction according to the suggested reduction in the instruction, and counts the number of threads after the reduction to ensure that it is not lower than the corresponding minimum number of threads.

[0074] For example, the high-load range for the first thread pool can be set to a utilization rate greater than or equal to 80%, or a task queue length greater than or equal to 10%, or an average task execution time greater than or equal to 500 milliseconds; the low-load range can be set to a utilization rate less than or equal to 30%, with a preset duration of three minutes and a minimum number of threads of three. The high-load range for the second thread pool can be set to a utilization rate greater than or equal to 85%, or a task queue length greater than or equal to 15%, or an average task execution time greater than or equal to 600 milliseconds; the low-load range can be set to a utilization rate less than or equal to 25%, with a preset duration of five minutes and a minimum number of threads of four. It is recommended to add two threads at a time and to reduce one thread at a time.

[0075] Based on the above embodiments, as another optional embodiment, the method further includes: S604 If an exception occurs while the allocated dedicated thread or shared thread is executing a task, the current task corresponding to the target exception thread is terminated. In some embodiments, if an exception occurs while the allocated dedicated thread or shared thread is executing a task, the thread pool management module to which the target exception thread belongs sends a task termination instruction to the target exception thread, and the target exception thread terminates the corresponding current task after receiving the instruction.

[0076] In this embodiment of the application, an exception refers to an error state that occurs during the execution of a task, which prevents the thread from continuing to execute the task normally, such as code execution error, resource access failure, network connection interruption, etc.; an exception thread refers to a dedicated thread or shared thread that has an exception.

[0077] In some embodiments, when an exception occurs during the execution of a task, the thread's own exception detection module will capture the exception signal and send it to the thread pool management module to which it belongs. After receiving the exception signal, the thread pool management module generates a task termination instruction and sends it to the target thread that is experiencing the exception. After receiving the instruction, the target thread that is experiencing the exception will immediately stop the execution of the current task and release the system resources occupied during the execution of the task, such as memory and file handles, to avoid resource leaks.

[0078] S605. Create a new thread to supplement the thread pool where the exception occurred, so that the number of threads in the target thread pool is restored to the number before the exception occurred, and record the exception information, including the exception occurrence time, the exception thread identifier, and the business request identifier.

[0079] In some embodiments, after terminating the current task, the thread pool management module to which the target abnormal thread belongs calls the thread creation module to create a new thread and adds the new thread to the thread pool where the abnormal occurred, so that the number of threads in the target thread pool is restored to the number before the abnormality occurred. At the same time, the abnormal information recording module is called to record the abnormal information.

[0080] In some embodiments, the thread pool management module counts the total number of threads in the target thread pool before the exception occurred, and then determines the number of new threads to be created based on the difference between the current number of threads in the target thread pool and the total number of threads before the exception occurred, typically one. The thread creation module creates new threads according to the determined number and adds the new threads to the thread pool where the exception occurred, restoring the number of threads in the target thread pool to the level before the exception occurred. The thread pool management module calls the exception information recording module, which obtains the exception occurrence time from the system clock, obtains the exception thread identifier from the attribute information of the target exception thread, and obtains the business request identifier from the attribute information of the terminated current task. This information is then integrated into exception information and stored in the system's exception log database for subsequent troubleshooting and system optimization.

[0081] S700: If the second thread pool is unavailable, the business request will be rejected, and an exception message indicating insufficient resources will be thrown to the business application.

[0082] In some embodiments, if the second thread pool is unavailable, the advanced proxy component determines that the current system cannot allocate thread resources for the pending business request. At this time, the advanced proxy component generates a business request rejection instruction including a resource shortage exception message and sends the instruction to the business application that initiated the business request, thereby rejecting the business request and throwing a resource shortage exception message to the business application.

[0083] Furthermore, when sending a business request rejection instruction, the advanced proxy component will also record relevant information about the rejected business request, such as the business request identifier, rejection time, and rejection reason, in the system's request rejection log for subsequent analysis of the reasons for insufficient system resources and optimization of system configuration.

[0084] Based on the above embodiments, as another optional embodiment, the method further includes: S701: Collect the running status of the first and second thread pools. The running status includes standby, running, paused, destroyed, and destroyed. In some embodiments, the thread pool status acquisition component in the system acquires the running status of the first thread pool and the second thread pool in real time. The running status includes standby state, running state, paused state, destruction state, and destroyed state.

[0085] In this embodiment, the running state refers to the overall running status of the first or second thread pool; the standby state refers to the state where the thread pool has been created but has not yet received any business requests, and all threads are in an idle state; the running state refers to the state where the thread pool is processing business requests, and some or all threads are in a running state; the paused state refers to the state where the thread pool has temporarily stopped receiving new business requests, but the tasks being processed continue to be executed until completion; the destruction state refers to the state where the thread pool is releasing all resources and destroying all threads; the destroyed state refers to the state where the thread pool has completed the release of all resources and the destruction of all threads, and no longer has the ability to process business requests.

[0086] In some embodiments, the thread pool status acquisition component establishes a real-time communication connection with the first thread pool management module and the second thread pool management module, and is able to acquire overall operation data of the thread pool and determine the current operation status of the thread pool according to the preset operation status judgment criteria.

[0087] S702. Synchronize the operating status and operating indicators to the system monitoring module. The system monitoring module will trigger an early warning when the operating status is abnormal, according to the preset early warning rules.

[0088] In some embodiments, the thread pool status acquisition component sends the acquired running status to the thread pool monitoring component. The thread pool monitoring component integrates the running status with its own acquired running metrics and then synchronizes it to the system monitoring module. After receiving the running status and running metrics, the system monitoring module calls the early warning judgment module to analyze the running status according to preset early warning rules. If the running status is determined to be abnormal, an early warning is triggered.

[0089] The preset warning rules in this application embodiment are rules used to determine whether a warning needs to be triggered, and are usually set based on abnormal conditions of the running status.

[0090] In some embodiments, the system monitoring module stores the received running status and running indicators in the monitoring database. The early warning determination module reads the running status from the monitoring database and compares it with the preset early warning rules. If an abnormal running status is detected, such as the thread pool being in a paused state for a long time, frequently switching to the destruction state, or entering the destroyed state without a destruction instruction, the early warning determination module sends an early warning trigger signal to the system monitoring module.

[0091] After receiving the early warning trigger signal, the system monitoring module generates an early warning message and sends it to the technical personnel through preset notification methods, such as SMS, email, and system pop-ups, to remind them to promptly investigate and handle abnormal situations and ensure the stable operation of the system.

[0092] For example, preset warning rules can be used to determine that a thread pool is in a paused state for more than 30 minutes as an abnormal running state, and a thread pool is determined to be in a destruction state more than twice within one hour as an abnormal running state; the warning message can be "The first thread pool has been in a paused state for more than 30 minutes, please investigate the cause in time"; the notification methods can include sending text messages to the mobile phones of technical personnel, sending emails to the work email addresses of technical personnel, and popping up warning pop-ups on the system monitoring interface.

[0093] Based on the above embodiments, as another optional embodiment, this application also provides a business-based two-layer thread pool allocation system, the system comprising: The advanced proxy component is configured to receive business requests and extract business identifiers; determine business priorities; initiate availability checks and thread allocation requests; and synchronize task processing results or resource shortage exceptions to business applications. The business module is configured to receive business identifiers, determine the business type according to a preset mapping relationship, determine the priority according to rules, and feed the results back to the advanced proxy component. The thread pool module is configured to respond to availability check requests and determine availability; and to receive allocation requests and allocate threads for services of different priorities.

[0094] In some embodiments, the business module includes: a business type identification module, which presets a mapping relationship between business identifiers and business types, and determines the business type based on the business identifier; and a priority determination module, which presets a correspondence rule between business types and priorities, and determines the priority based on the business type.

[0095] In some embodiments, the thread pool module includes: a first thread pool management module, which manages the first thread pool and is responsible for checking its availability and allocating dedicated threads for first priority services; and a second thread pool management module, which manages the second thread pool and is responsible for checking its availability and allocating shared threads for services.

[0096] In some embodiments, the system further includes a statistics module. The statistics module includes: a thread status statistics module, which counts in real time the number of threads allocated and running in the thread pool; and a task status statistics module, which counts in real time the number of tasks currently executing concurrently in the thread pool.

[0097] In some embodiments, the system further includes a monitoring and allocation module. The monitoring and allocation module includes: a thread pool monitoring component, which collects real-time operating metrics of the first and second thread pools to support dynamic allocation; a thread dynamic allocation module, which sends thread increase / decrease instructions to the thread pool management module based on the operating metrics; a thread pool status acquisition component, which collects real-time operating status of the first and second thread pools; a system monitoring module, which receives and stores operating status and operating metrics, and calls the early warning determination module to trigger early warnings; and an early warning determination module, which determines whether the operating status is abnormal according to preset early warning rules and sends an early warning trigger signal to the system monitoring module.

[0098] refer to Figure 3 In some embodiments, the business application sends a business request to the advanced proxy component; after receiving the request, the advanced proxy component checks the business priority corresponding to the business request.

[0099] If the business request is a first-priority business, the advanced proxy component allocates a reserved thread to the first thread pool; the first thread pool executes the business task, and after the task is completed, it returns the processing result to the advanced proxy component; after receiving the result, the advanced proxy component returns the processing result to the business application that initiated the request.

[0100] If the business request is a second-priority business, the advanced proxy component allocates a shared thread to the second thread pool; the second thread pool executes the business task, and after the task is completed, it returns the processing result to the advanced proxy component; after receiving the result, the advanced proxy component returns the processing result to the business application that initiated the request.

[0101] The monitoring and allocation module dynamically monitors the first and second thread pools, collecting operational metrics such as thread pool utilization and analyzing thread pool load. Specifically, if the monitoring system determines that a thread pool is overloaded, it sends an instruction to increase the number of worker threads to the corresponding thread pool; if it determines that the thread pool is underloaded, it sends an instruction to decrease the number of worker threads to the corresponding thread pool, thus achieving elastic resource allocation of the thread pools.

[0102] In some embodiments, the system further includes an exception handling module. The exception handling module includes: an exception detection module, a module carried by the thread itself, used to capture exception signals when the thread executes a task; a thread creation module, which creates a new thread to supplement the corresponding thread pool and restores the number of threads when a thread exception occurs; and an exception information recording module, which records exception information and stores it in an exception log database.

[0103] In some embodiments, the system further includes a data storage module. The data storage module includes: a system configuration library, storing various system configuration parameters for each module to read; an exception log database, storing exception data statistically collected by the exception information recording module for subsequent troubleshooting; and a monitoring database, storing operating status and performance indicator data received by the system monitoring module.

[0104] It should be noted that the system provided in the above embodiments is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the system and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.

[0105] Based on the above embodiments, as another optional embodiment, the present application embodiment may further include a computer storage medium, which may store multiple instructions adapted for loading by a processor and executing a method of the above embodiments. For the specific execution process, please refer to the detailed description of the above embodiments, which will not be repeated here.

[0106] Based on the above embodiments, as another optional embodiment, this application embodiment may further include an electronic device. The electronic device may include: at least one processor, at least one communication bus, a user interface, at least one network interface, and a memory.

[0107] The communication bus is used to enable communication between these components.

[0108] The user interface may include a display screen and a camera. Optional user interfaces may also include standard wired interfaces and wireless interfaces.

[0109] The network interface may include standard wired interfaces and wireless interfaces (such as Wi-Fi interfaces).

[0110] The processor may include one or more processing cores. It connects to various parts of the server via various interfaces and lines, executing instructions, programs, code sets, or instruction sets stored in memory, and accessing data stored in memory to perform various server functions and process data. Optionally, the processor may be implemented using at least one of the following hardware forms: Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor may integrate one or more of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content displayed on the screen; and the modem handles wireless communication. It is understood that the modem may also be implemented as a separate chip without being integrated into the processor.

[0111] The memory may include random access memory (RAM) or read-only memory. Optionally, the memory may include a non-transitory computer-readable storage medium. The memory can be used to store instructions, programs, code, code sets, or instruction sets. The memory may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor. As a computer storage medium, the memory may include an operating system, a network communication module, a user interface module, and an application program of one method.

[0112] In electronic devices, the user interface is primarily used to provide an input interface for users and to acquire user input data; while the processor can be used to call an application program stored in memory that represents a method. When executed by one or more processors, this causes the electronic device to perform one or more methods as described in the above embodiments. It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps can be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0113] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0114] In the various embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some service interface; the indirect coupling or communication connection between apparatuses or units may be electrical or other forms.

[0115] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0116] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0117] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as USB flash drives, portable hard drives, magnetic disks, or optical disks.

[0118] The above are merely exemplary embodiments of this disclosure and should not be construed as limiting the scope of this disclosure. Any equivalent changes and modifications made in accordance with the teachings of this disclosure shall still fall within the scope of this disclosure. Other embodiments of this disclosure will readily conceive of those skilled in the art upon consideration of the specification and the disclosure of practical truths.

[0119] This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not described in this disclosure. The specification and embodiments are to be considered exemplary only, and the scope and spirit of this disclosure are defined by the claims.

Claims

1. A business-based two-layer thread pool allocation method, characterized in that, The method includes: Receive a service request sent by a service application, the service request including a service identifier; Based on the service identifier, identify the service type and priority corresponding to the service request, wherein the priority includes a first priority and a second priority; For the first priority business request, check the availability of the first thread pool, which is a set of reserved threads dedicated to the first priority business; If the first thread pool is available, a dedicated thread is allocated from the first thread pool to execute the business request of the first priority, and the processing result is returned to the business application after the task is completed; If the first thread pool is unavailable, then check the availability of the second thread pool, which is a common set of threads shared by all second-priority services. If the second thread pool is available, a shared thread is allocated from the second thread pool to execute the business request of the first priority, or a shared thread of the second thread pool is directly allocated to the business request of the second priority to execute the task, and the processing result is returned to the business application after the task is completed; If the second thread pool is unavailable, the business request is rejected, and a resource shortage exception is thrown to the business application.

2. The business-based two-layer thread pool allocation method according to claim 1, characterized in that, The business types corresponding to the first priority include order processing business, payment processing business, and transaction execution business; the business types corresponding to the second priority include user query business, log recording business, and report generation business. The number of dedicated threads in the first thread pool is preset based on the historical peak load of the first priority service, and the initial number of shared threads in the second thread pool is preset based on the average load of the second priority task.

3. The business-based two-layer thread pool allocation method according to claim 1, characterized in that, The methods for checking the availability of the first thread pool include: Obtain the first maximum number of threads for the first thread pool, and count the number of dedicated threads currently allocated and running in the first thread pool; If the number of currently running dedicated threads is less than the first maximum number of threads, then the first thread pool is determined to be available; If the number of currently running dedicated threads is greater than or equal to the first maximum number of threads, then the first thread pool is determined to be unavailable.

4. The business-based two-layer thread pool allocation method according to claim 3, characterized in that, Methods for checking the availability of the second thread pool include: Obtain the second maximum number of threads for the second thread pool and the maximum number of tasks allowed to be executed at the same time; Count the number of tasks currently being executed concurrently in the second thread pool and the number of shared threads that have been allocated and are in a running state; If the number of concurrently executing tasks is less than the maximum number of tasks, and the number of currently running shared threads is less than the second maximum number of threads, then the second thread pool is determined to be available. If the number of concurrently executing tasks is greater than or equal to the maximum number of tasks, and the number of currently running shared threads is greater than or equal to the second maximum number of threads, then the second thread pool is determined to be unavailable.

5. The business-based two-layer thread pool allocation method according to claim 4, characterized in that, The methods for executing the business request include: Real-time collection of operational metrics for the first and second thread pools, including utilization rate, task queue length, and average task execution time; When the operating metric is greater than or equal to the preset high load range, the number of threads in the target thread pool is increased, and the increased number of threads is not greater than the corresponding maximum number of threads. When the operating metrics are less than the preset low load range, the number of threads in the target thread pool is reduced, and the reduced number of threads is not less than the corresponding minimum number of threads.

6. The business-based two-layer thread pool allocation method according to claim 5, characterized in that, Also includes: If an exception occurs while the assigned dedicated thread or shared thread is executing a task, the current task corresponding to the target thread that encountered the exception will be terminated. Create a new thread to supplement the thread pool where the exception occurred, so that the number of threads in the target thread pool is restored to the number before the exception occurred, and record the exception information, including the exception occurrence time, the exception thread identifier, and the business request identifier.

7. The business-based two-layer thread pool allocation method according to claim 6, characterized in that, Also includes: The running status of the first and second thread pools is collected, including standby, running, paused, destroyed, and destroyed states. The operating status and operating indicators are synchronized to the system monitoring module, and the system monitoring module triggers an early warning prompt when the operating status is abnormal according to preset early warning rules.

8. A business-based two-layer thread pool allocation system, characterized in that, The system includes: The advanced proxy component is configured to receive business requests and extract business identifiers; determine business priorities; initiate availability checks and thread allocation requests; and synchronize task processing results or resource shortage exceptions to business applications. The business module is configured to receive a business identifier, determine the business type according to a preset mapping relationship, determine the priority according to rules, and feed the result back to the advanced proxy component. The thread pool module is configured to respond to availability check requests and determine availability; and to receive allocation requests and allocate threads for services of different priorities.

9. An electronic device, characterized in that, It includes a processor, a memory, a user interface, and a network interface. The memory is used to store instructions, the user interface and the network interface are used to communicate with other devices, and the processor is used to execute the instructions stored in the memory to cause the electronic device to perform the method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted to be loaded by a processor and executed as described in any one of claims 1-7.