A thread acquisition method and device
An acquisition method and thread technology, applied in the field of communication, can solve the problem of reducing the efficiency of acquiring threads, and achieve the effects of reducing resource contention, improving efficiency, and enhancing scalability and robustness.
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0058] Such as figure 1 As shown, it is a schematic flow chart of a thread acquisition method proposed in the embodiment of the present application. The method specifically includes the following steps:
[0059] Step S101, when the application server starts, divide the thread pool into multiple thread sets.
[0060] In a specific application scenario, in order to implement subsequent thread processing, after the thread set division in this step, the following processing is also included:
[0061] First, the minimum number of threads and the maximum number of threads are set for each of the divided thread sets.
[0062] According to the setting result, create threads with a minimum number of threads for each of the thread sets, and then initialize each of the thread sets including the threads with the minimum number of threads.
[0063] It should be noted that, in the above processing, the reason why only threads with the minimum number of threads are created in the embodimen...
Embodiment 2
[0097] In order to further elaborate the technical solution of the present application, the technical solution of the present application is described in combination with specific application scenarios, as follows figure 2 As shown, a thread acquisition method proposed in this embodiment is applied to an application server, and the method specifically includes the following steps:
[0098] Step S201, create a thread pool when the application server is started, the thread pool is composed of a plurality of thread sets, create threads with a minimum number of threads for each thread set, and then initialize each thread pool containing the threads with the minimum number of threads The collection of threads.
[0099] In the preferred embodiment of this application, when the application service starts, creating a thread pool composed of multiple thread sets is equivalent to dividing the original large thread set into several small thread sets. The thread collections form a threa...
Embodiment 3
[0126] Based on the same application idea as the implementation process of the above-mentioned thread acquisition method, a thread acquisition device is also provided in the embodiment of the present application, such as image 3 As shown, the equipment includes:
[0127] A thread management module 31, configured to divide the thread pool into multiple thread sets when the application server starts;
[0128] The positioning module 32 is used to determine the thread to which each user task to be executed belongs to in each thread set divided by the thread management module 31 when it is confirmed that the user task needs to obtain a thread from the thread pool to perform an operation gather;
[0129] A judging module 33, configured to judge whether there are idle threads in each thread set determined by the positioning module 32;
[0130] The processing module 34 is configured to return the idle thread to the user task to be executed belonging to the current thread set when t...
PUM
Abstract
Description
Claims
Application Information
- R&D Engineer
- R&D Manager
- IP Professional
- Industry Leading Data Capabilities
- Powerful AI technology
- Patent DNA Extraction
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2024 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com