CN107391243A - Thread task processing equipment, device and method - Google Patents
Thread task processing equipment, device and method Download PDFInfo
- Publication number
- CN107391243A CN107391243A CN201710522332.XA CN201710522332A CN107391243A CN 107391243 A CN107391243 A CN 107391243A CN 201710522332 A CN201710522332 A CN 201710522332A CN 107391243 A CN107391243 A CN 107391243A
- Authority
- CN
- China
- Prior art keywords
- task
- thread
- waiting list
- tank node
- basic
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/4881—Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
- G06F9/5038—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
Abstract
The present invention discloses a kind of thread task processing equipment, device and method.The thread task processing equipment, including:Processor, by the worker thread of basic thread tank node task is obtained from corresponding waiting list, wherein described task is added into according to task priority in the waiting list of the basic thread tank node in corresponding task priority section, wherein different basic thread tank node executing tasks parallellies, perform being obtained from the waiting list for task;Memory, store the worker thread and waiting list of the basic thread tank node.The solution of the present invention, the time delay of low priority task can be lowered and prevent low priority task from dying of hunger.
Description
Technical field
The present invention relates to mobile internet technical field, and in particular to a kind of thread task processing equipment, device and method.
Background technology
At present in related application service, thread pool can be set, it is a number of by pre-creating by thread pool
Worker thread, reuse existing worker thread and perform task, reach the purpose for reducing establishment and destroying threads expense.Thread pool
The effective quantity for limiting worker thread, it can prevent from consuming excessive system resource according to system and application scenarios.
In the system with priority scheduling, task is typically provided respective priority, has the task of high priority
It can be performed earlier by worker thread, and the task of low priority needs the tasks carrying of higher priority is complete just to have an opportunity to be worked
Thread performs.Therefore, in the related art, easily the occurring a low priority under priority scheduling of the task all the time cannot
The problem of execution.Although some solutions are to prevent task by lifting the priority of cannot performing for a long time for task
Died of hunger, but be also that the task of low priority is required for just having an opportunity to be performed after waiting for a period of time the defects of this method, it is real
The time delay (latency) that all generic tasks are may result in the scene application of border is higher.
The content of the invention
In order to solve the above technical problems, the present invention provides a kind of thread task processing equipment, device and method, can lower low
The time delay of priority tasks and prevent low priority task from dying of hunger.
According to an aspect of the present invention, there is provided a kind of thread task processing equipment, including:
Processor, task is obtained from corresponding waiting list by the worker thread of basic thread tank node, wherein described
Task is added into according to task priority in the waiting list of the basic thread tank node in corresponding task priority section, wherein
Different basic thread tank node executing tasks parallellies, perform being obtained from the waiting list for task;
Memory, store the worker thread and waiting list of the basic thread tank node.
According to another aspect of the present invention, there is provided a kind of computer equipment, including:
Processor;And
Memory, executable code is stored thereon with, when the executable code is by the computing device, made described
Computing device method described below:
Obtain task from corresponding waiting list by the worker thread of basic thread tank node, wherein the task according to
Task priority is added into the waiting list of the basic thread tank node in corresponding task priority section, wherein different bases
Thread pool nodal parallel performs task;
Perform being obtained from the waiting list for task.
According to another aspect of the present invention, there is provided a kind of non-transitory machinable medium, being stored thereon with can
Code is performed, when computing device of the executable code by electronic equipment, makes the computing device as described below
Method:
Obtain task from corresponding waiting list by the worker thread of basic thread tank node, wherein the task according to
Task priority is added into the waiting list of the basic thread tank node in corresponding task priority section, wherein different bases
Thread pool nodal parallel performs task;
Perform being obtained from the waiting list for task.
According to another aspect of the present invention, there is provided a kind of thread Task Processing Unit, including:
Task acquisition module, obtain and appoint from corresponding waiting list for the worker thread by basic thread tank node
Business, wherein the task is added into the wait of the basic thread tank node in corresponding task priority section according to task priority
In queue, wherein different basic thread tank node executing tasks parallellies;
Task execution module, being obtained for performing task acquisition module from the waiting list for task.
Optionally, described device also includes:
Task application module, in the task acquisition module by the worker thread of basic thread tank node from corresponding
Task is obtained in waiting list as in the case of empty, the basic thread tank node application to high one-level task priority section from etc.
Treat that queue obtains task.
Optionally, described device also includes:
Thread pool configuration module, for creating as the level thread tank node between nonleaf node management role priority area
Basic thread tank node with waiting list and worker thread is managed as leaf node, forms binary tree structure;For the basis
Between thread tank node configuration task priority area, worker thread and waiting list, wherein worker thread it is corresponding with waiting list.
Optionally, described device also includes:
Task add module, for according to the binary tree structure by level thread tank node according to the preferential of the task
Level, the basic thread tank node in corresponding task priority section is found, the task is added to the basic thread tank node
Waiting list in;
The task acquisition module obtains the task and adds the wait team that module is added to the basic thread tank node
Task in row.
Optionally, described device also includes:
Adjusting module is configured, for being adjusted to the worker thread quantity and waiting list of the basic thread tank node configuration
Size.
According to another aspect of the present invention, there is provided a kind of thread task processing method, including:
Task is obtained from corresponding waiting list by the worker thread of basic thread tank node, wherein the task is being created
It is added into after building according to task priority in the waiting list of the basic thread tank node in corresponding task priority section, wherein
Different basic thread tank node executing tasks parallellies;
Perform being obtained from the waiting list for task.
Optionally, methods described also includes:
In the case where task is obtained from corresponding waiting list by the worker thread of basic thread tank node as sky, to
The basic thread tank node application in high one-level task priority section obtains task from waiting list.
Optionally, the worker thread by basic thread tank node is from corresponding waiting list before acquisition task,
Also include:
Create as the level thread tank node between nonleaf node management role priority area and as leaf node management etc.
The basic thread tank node of queue and worker thread is treated, forms binary tree structure;
Between the basic thread tank node configuration task priority area, worker thread and waiting list, wherein active line
Journey is corresponding with waiting list.
Optionally, the task is added into the basis in corresponding task priority section according to task priority after creation
In the waiting list of thread tank node, including:
Priority according to the binary tree structure by level thread tank node according to the task, it is excellent to find corresponding task
The basic thread tank node in first level section;
The task is added in the waiting list of the basic thread tank node.
Optionally, methods described also includes:
It is adjusted to the worker thread quantity of the basic thread tank node configuration and the size of waiting list.
It can be found that in the technical scheme of the embodiment of the present invention, task can be added according to task priority after creation
Enter into the waiting list of the basic thread tank node in corresponding task priority section, and different ground line journey tank nodes possess solely
Vertical waiting list and worker thread, can be with executing tasks parallelly, and the worker thread of basic thread tank node is from corresponding wait
Can performs after acquisition task in queue, then even the task of low priority, can also be added into other thread pools
Waiting list wait performed by worker thread, without being waited always in a waiting list, thus reduce this
The time delay of generic task, it is also possible to prevent low priority task and dies of hunger.
Further, the embodiment of the present invention obtains in the worker thread by basic thread tank node from corresponding waiting list
In the case of task is taken as sky, the basic thread tank node application to high one-level task priority section obtains from waiting list appoints
Business, that is to say, that low priority worker thread can utilize to higher priority worker thread application task so as to improve thread
Rate, improve resource utilization.
Further, the embodiment of the present invention is created as the level thread pool between nonleaf node management role priority area
Node and the basic thread tank node that waiting list and worker thread are managed as leaf node, form binary tree structure, can be by
Priority according to binary tree structure by level thread tank node according to the task, find the basis in corresponding task priority section
Thread tank node;The task is added in the waiting list of the basic thread tank node, that is, can be by tree-like
Structure, improve basic thread pool search efficiency.
Further, the embodiment of the present invention can be adjusted to the basic thread tank node configuration worker thread quantity and
The size of waiting list, such as according to business model and system load situation, the waiting list for adjusting basic thread tank node is big
Small and worker thread quantity so that configuration is more efficient and has versatility.
Brief description of the drawings
Disclosure illustrative embodiments are described in more detail in conjunction with the accompanying drawings, the disclosure above-mentioned and its
Its purpose, feature and advantage will be apparent, wherein, in disclosure illustrative embodiments, identical reference number
Typically represent same parts.
Fig. 1 is a kind of schematic block diagram of thread task processing equipment according to an embodiment of the invention;
Fig. 2 is a kind of schematic block diagram of computer equipment according to an embodiment of the invention;
Fig. 3 is a kind of schematic block diagram of thread Task Processing Unit according to an embodiment of the invention;
Fig. 4 is a kind of another schematic block diagram of thread Task Processing Unit according to an embodiment of the invention;
Fig. 5 is a kind of indicative flowchart of thread task processing method according to an embodiment of the invention;
Fig. 6 is a kind of another indicative flowchart of thread task processing method according to an embodiment of the invention.
Fig. 7 is the binary tree structure application schematic diagram of thread task processing method according to an embodiment of the invention.
Embodiment
The preferred embodiment of the disclosure is more fully described below with reference to accompanying drawings.Although the disclosure is shown in accompanying drawing
Preferred embodiment, however, it is to be appreciated that may be realized in various forms the disclosure without the embodiment party that should be illustrated here
Formula is limited.On the contrary, these embodiments are provided so that the disclosure is more thorough and complete, and can be by the disclosure
Scope is intactly communicated to those skilled in the art.
The present invention provides a kind of thread task processing equipment, device and method, when can lower the delay of low priority task
Between and prevent low priority task from dying of hunger.
The technical scheme of the embodiment of the present invention is described in detail below in conjunction with accompanying drawing.
Fig. 1 is a kind of schematic block diagram of thread task processing equipment according to an embodiment of the invention.
Reference picture 1, in a kind of thread task processing equipment 10, including:Processor 11, memory 12.
Processor 11, task is obtained from corresponding waiting list by the worker thread of basic thread tank node, wherein institute
In the waiting list for stating the basic thread tank node that task is added into corresponding task priority section according to task priority, its
The middle basic thread tank node executing tasks parallelly of difference, perform being obtained from the waiting list for task;
Memory 12, store the worker thread and waiting list of the basic thread tank node.
Fig. 2 is a kind of schematic block diagram of computer equipment according to an embodiment of the invention.
Reference picture 2, in a kind of computer equipment 20, including:Processor 21 and memory 22.
Memory 22, is stored thereon with executable code, when the executable code is performed by the processor 21, makes
The processor 21 performs method described below:
Obtain task from corresponding waiting list by the worker thread of basic thread tank node, wherein the task according to
Task priority is added into the waiting list of the basic thread tank node in corresponding task priority section, wherein different bases
Thread pool nodal parallel performs task;
Perform being obtained from the waiting list for task.
The embodiment of the present invention also provides a kind of non-transitory machinable medium, is stored thereon with executable code,
When computing device of the executable code by electronic equipment, make the computing device method described below:
Obtain task from corresponding waiting list by the worker thread of basic thread tank node, wherein the task according to
Task priority is added into the waiting list of the basic thread tank node in corresponding task priority section, wherein different bases
Thread pool nodal parallel performs task;
Perform being obtained from the waiting list for task.
It should be noted that the processor in the said equipment, apparatus structure that can be independent as one, the independent dress
Put structure and be properly termed as a kind of thread Task Processing Unit, the thread Task Processing Unit can include multiple submodule, hereafter
The structure of thread Task Processing Unit will be described in detail with reference to Fig. 3 to Fig. 4.
Fig. 3 is a kind of schematic block diagram of thread Task Processing Unit according to an embodiment of the invention.
Reference picture 3, in a kind of thread Task Processing Unit 30, including:Task acquisition module 31, task execution module
32。
Task acquisition module 31, obtain and appoint from corresponding waiting list for the worker thread by basic thread tank node
Business, wherein the task is added into the wait of the basic thread tank node in corresponding task priority section according to task priority
In queue, wherein different basic thread tank node executing tasks parallellies.
Wherein described task is added into the ground line in corresponding task priority section according to task priority after creation
In the waiting list of journey tank node, including:According to the binary tree structure by level thread tank node according to the excellent of the task
First level, find the basic thread tank node in corresponding task priority section;The task is added to the basic thread pool section
In the waiting list of point.
Task execution module 32, being obtained for performing task acquisition module 31 from the waiting list for task.
From the embodiment, in the technical scheme of the embodiment of the present invention, task after creation can be according to priority of task
Level is added into the waiting list of the basic thread tank node in corresponding task priority section, and different ground line journey tank nodes
Possess independent waiting list and worker thread, can be with executing tasks parallelly, the worker thread of basic thread tank node is from correspondingly
Waiting list in after acquisition task can perform, then even the task of low priority, other can also be added into
The waiting list of thread pool is waited and performed by worker thread, without being waited always in a waiting list, is thus subtracted
The low time delay of the generic task, it is also possible to prevent low priority task and dies of hunger.
Fig. 4 is a kind of another schematic block diagram of thread Task Processing Unit according to an embodiment of the invention.
As shown in figure 4, in a kind of thread Task Processing Unit 40, including:Task acquisition module 31, task execution module
32nd, task application module 33, thread pool configuration module 34, task add module 35, configuration adjusting module 36.
Wherein, task acquisition module 31, the function of task execution module 32 may refer to shown in Fig. 3.
Wherein, task application module 33, for the worker thread in the task acquisition module by basic thread tank node
In the case of task is obtained from corresponding waiting list as sky, to the basic thread tank node in high one-level task priority section
Application obtains task from waiting list.
Thread pool configuration module 34, for creating as the level thread pool section between nonleaf node management role priority area
Point and the basic thread tank node that waiting list and worker thread are managed as leaf node, form binary tree structure;For the base
Between plinth thread tank node configuration task priority area, worker thread and waiting list, wherein worker thread it is relative with waiting list
Should.
Task add module 35, for according to the binary tree structure by level thread tank node according to the excellent of the task
First level, the basic thread tank node in corresponding task priority section is found, the task is added to the basic thread pool section
In the waiting list of point;The task acquisition module 31 obtains the task addition module 35 and is added to the basic thread pool section
Task in the waiting list of point.
Adjusting module 36 is configured, for being adjusted to the worker thread quantity of the basic thread tank node configuration and waiting team
The size of row.
It can be found that time delay of the embodiment of the present invention except that can lower low priority generic task, prevents low preferential
Outside level task is hungry to death, task can also be obtained from corresponding waiting list in the worker thread by basic thread tank node is
In the case of sky, the basic thread tank node application to high one-level task priority section obtains task from waiting list, also
Be say low priority worker thread can to higher priority worker thread application task, so as to improve worker thread utilization rate,
Improve resource utilization.Basic thread pool search efficiency can be improved by tree structure in addition;And ground line can be adjusted
The waiting list size and worker thread quantity of journey tank node so that configuration is more efficient and has versatility.
It is above-mentioned describe in detail the present invention a kind of thread task processing equipment, device, it is introduced below the present invention corresponding to
Thread task processing method.
Fig. 5 is a kind of indicative flowchart of thread task processing method according to an embodiment of the invention.
Methods described can apply in thread Task Processing Unit, and the thread Task Processing Unit can be located at service
In device, or in client device.
Reference picture 5, methods described includes:
In step 501, task is obtained from corresponding waiting list by the worker thread of basic thread tank node, wherein
The task be added into after creation according to task priority the basic thread tank node in corresponding task priority section etc.
Treat in queue, wherein different basic thread tank node executing tasks parallellies.
In the step, the task is added into the base in corresponding task priority section according to task priority after creation
In the waiting list of plinth thread tank node, including:According to the binary tree structure by level thread tank node according to the task
Priority, find the basic thread tank node in corresponding task priority section;The task is added to the basic thread
In the waiting list of tank node.
In step 502, being obtained from the waiting list for task is performed.
In the step, worker thread is after waiting list acquisition task, it is possible to performs the task of acquisition.
From the embodiment, in the technical scheme of the embodiment of the present invention, task after creation can be according to priority of task
Level is added into the waiting list of the basic thread tank node in corresponding task priority section, and different ground line journey tank nodes
Possess independent waiting list and worker thread, can be with executing tasks parallelly, the worker thread of basic thread tank node is from correspondingly
Waiting list in after acquisition task can perform, then even the task of low priority, other can also be added into
The waiting list of thread pool is waited and performed by thread, without being waited always in a waiting list, is thus reduced
The time delay of the generic task, it is also possible to prevent low priority task and dies of hunger.
Fig. 6 is a kind of another indicative flowchart of thread task processing method according to an embodiment of the invention.
Technical scheme of the embodiment of the present invention is described in more detail relative to Fig. 5 in Fig. 6.
A kind of multipriority thread pool based on binary tree structure of conceptual design of the embodiment of the present invention is low preferential to solve
The defects of level task time delay is higher, also it can prevent low priority task from dying of hunger simultaneously.Scheme of the embodiment of the present invention introduces
Multipriority waiting list, the waiting list of more worker threads is managed by binary tree structure, and each waiting list correspond to one
Individual or one group of worker thread, two class nodes, including HP (Hierarchy Pool, level thread are contained wherein in binary tree structure
Pond) node, BP (Base Pool, basic thread pool) node.Wherein HP nodes manage binary tree subtree as nonleaf node
Between priority area;BP nodes manage waiting list and worker thread group, while safeguard and point to higher priority as leaf node
The pointer of BP nodes.
Scheme of the embodiment of the present invention is directed to newly submitting for task, and the BP sections of matching priority can be found by binary tree
Point, the waiting list in BP nodes do not have priority ranking, and new task is added directly to the ending of waiting list.BP nodes
Worker thread performed task after new task is extracted from waiting list.If waiting list in BP nodes without waiting for
Task, BP nodes can be to the task in the waiting list of the BP nodes application high priority BP nodes of higher priority.
That is, low priority thread can go to perform the task in higher priority section in having performed this section of the task, so as to
Shared by the worker thread between waiting list, the task of high priority can be held by the worker thread of more Low Priority Queuing
OK, while the low priority task high latency time is avoided, the purpose for improving resource utilization is reached.
It is described below in conjunction with Fig. 6, reference picture 6, methods described includes:
In step 601, level thread pool node (HP nodes) and basic thread tank node (BP nodes) are created, forms two
Pitch tree construction, and between configuration task priority area, worker thread and waiting list.
In the step, initialization model work is carried out, creates HP nodes and BP nodes, configures the priority area of BP nodes
Between, and the waiting list size and worker thread quantity in corresponding section are configured, so as to establish the tree structure of binary tree, Ran Houchu
Worker thread corresponding to beginningization.It should be noted that the preferential of different BP nodes can be manually set or adjusted according to business scenario
The worker thread quantity of level and corresponding BP nodes.
The binary tree structure application schematic diagram of reference picture 7, it can set between BP1 priority area to be excellent less than 20, BP2
First level section is more than or equal to 20 and less than 50;To be more than or equal to 50 and excellent less than 70, BP4 between BP3 priority area
First level section is that wherein priority value is smaller more than or equal to 70, represents that priority level is higher, therefore BP1, BP2 in Fig. 7,
BP3, BP4 priority gradually reduce from high priority;Respectively BP1, BP2, BP3, BP4 configuration work number of threads and wait
Queue size, such as BP1 configure a worker thread and a corresponding waiting list.Wherein, the node of adjacent priority can
Node with combination of two into upper strata, such as BP1 with BP2 combination of two is into HP2, BP3 and the BP4 combination of two on upper strata into upper strata
HP3, HP2 and HP3 combination of two into upper strata HP1.Wherein between priority area of the HP nodes as nonleaf node management subtree,
Such as HP1 is separation with priority 50, priority is managed less than 50 by HP2, and priority is managed more than or equal to 50 by HP3.
In step 602, task is created, task is added to the base in corresponding task priority section according to task priority
In the waiting list of plinth thread tank node.
In the step, for newly creating for task, corresponding BP nodes are found in binary tree by the priority of task,
Such as priority is 60 task in Fig. 7, it is more than 50 according to priority by HP1, finds HP3, HP3 is more than 50 according to priority,
BP nodes corresponding to finding are BP3 (being more than or equal to 50 and less than 70 between BP3 priority area), are then added to task
In the waiting list of corresponding BP nodes.If waiting list is full, error message is returned.
In step 603, task is obtained from corresponding waiting list by the worker thread of basic thread tank node.
In the step, the worker thread of BP nodes extracts new task from waiting list.By between priority area, from most
Top mode successively toward lower floor's matched and searched, each branch line have corresponding priority ratio compared with.Such as priority is 60 in Fig. 7
Task, be more than 50 according to new task priority by top-most node HP1, find next layer of HP3, HP3 is big according to priority
In 50, it is BP3 (being more than or equal to 50 and less than 70 between BP3 priority area) to find BP nodes corresponding to next layer.
In step 604, being obtained from the waiting list for task is performed.
In the step, the worker thread of BP nodes performs extracts new task from waiting list.
In step 605, task is obtained from corresponding waiting list in the worker thread by basic thread tank node is
In the case of sky, the basic thread tank node application to high one-level task priority section obtains task from waiting list.
In the step, if the waiting list of current BP nodes is sky, the BP node applications to higher priority section
Task, until the wait task of no higher priority.That is low priority worker thread can be to higher priority work
Make thread application task, so as to improve worker thread utilization rate while the low priority task high latency time is avoided, improve
Resource utilization.
In step 606, the waiting list application from the basic thread tank node in high one-level task priority section is performed
The task of acquisition.
In step 607, be adjusted to the basic thread tank node configuration worker thread quantity and waiting list it is big
It is small.
It should be noted that step 607 and step before be without inevitable ordinal relation, the adjustment of step 607 is handled can be with
Handled as needed during setting.
The embodiment of the present invention, the waiting list size of BP nodes according to business model and system load situation, can be adjusted
With the quantity of worker thread.Because the task scale of different business different priorities is different, therefore can be according to business
The quantity of worker thread in the corresponding BP nodes of adjustment.
It can be found that the embodiment of the present invention can improve BP search efficiency by tree structure;In the embodiment of the present invention
BP nodes, possess independent waiting list and worker thread, the time delay of low priority generic task can be lowered, prevented low
Priority tasks are died of hunger;Task can also be obtained from corresponding waiting list in the worker thread by basic thread tank node is
In the case of sky, the basic thread tank node application to high one-level task priority section obtains task from waiting list, also
It is to say that low priority worker thread can be to higher priority worker thread application task, so as to avoid low priority task height
Worker thread utilization rate is improved while time delay, improves resource utilization.Basis can be improved by tree structure in addition
Thread pool search efficiency;And the waiting list size and worker thread quantity of basic thread tank node can be adjusted so that configuration
More efficiently and there is versatility.
The method of the embodiment of the present invention, can apply in priority dispatch systems, can not only prevent low priority from appointing
Business is hungry to death, while reduces the time delay of the generic task.The embodiment of the present invention can be that BP nodes configure according to business model
Between different priority areas, while different BP nodes can distribute different waiting list size and worker thread quantity, because
This has very strong versatility.
Technique according to the invention scheme above is described in detail by reference to accompanying drawing.
In addition, the method according to the invention is also implemented as a kind of computer program or computer program product, the meter
The calculating of the above steps limited in the above method that calculation machine program or computer program product include being used to perform the present invention
Machine code instructions.
Or the present invention can also be embodied as a kind of (or the computer-readable storage of non-transitory machinable medium
Medium or machinable medium), executable code (or computer program or computer instruction code) is stored thereon with,
When the executable code (or computer program or computer instruction code) is by electronic equipment (or computing device, server
Deng) computing device when, make the computing device according to the present invention the above method each step.
Those skilled in the art will also understand is that, the various illustrative logical blocks with reference to described by disclosure herein, mould
Block, circuit and algorithm steps may be implemented as the combination of electronic hardware, computer software or both.
Flow chart and block diagram in accompanying drawing show that the possibility of the system and method for multiple embodiments according to the present invention is real
Existing architectural framework, function and operation.At this point, each square frame in flow chart or block diagram can represent module, a journey
A part for sequence section or code, a part for the module, program segment or code is comprising one or more defined for realizing
The executable instruction of logic function.It should also be noted that at some as in the realization replaced, the function of being marked in square frame also may be used
With with different from the order marked in accompanying drawing generation.For example, two continuous square frames can essentially perform substantially in parallel,
They can also be performed in the opposite order sometimes, and this is depending on involved function.It is also noted that block diagram and/or stream
The combination of each square frame and block diagram in journey figure and/or the square frame in flow chart, function or operation as defined in performing can be used
Special hardware based system realize, or can be realized with the combination of specialized hardware and computer instruction.
It is described above various embodiments of the present invention, described above is exemplary, and non-exclusive, and
It is not limited to disclosed each embodiment.In the case of without departing from the scope and spirit of illustrated each embodiment, for this skill
Many modifications and changes will be apparent from for the those of ordinary skill in art field.The selection of term used herein, purport
The principle of each embodiment, practical application or improvement to the technology in market are best being explained, or is making the art
Other those of ordinary skill are understood that each embodiment disclosed herein.
Claims (13)
- A kind of 1. thread task processing equipment, it is characterised in that including:Processor, task is obtained from corresponding waiting list by the worker thread of basic thread tank node, wherein the task It is added into according to task priority in the waiting list of the basic thread tank node in corresponding task priority section, wherein different Basic thread tank node executing tasks parallelly, perform being obtained from the waiting list for task;Memory, store the worker thread and waiting list of the basic thread tank node.
- 2. a kind of computer equipment, including:Processor;AndMemory, executable code is stored thereon with, when the executable code is by the computing device, makes the processing Device performs method described below:Task is obtained from corresponding waiting list by the worker thread of basic thread tank node, wherein the task is according to task Priority is added into the waiting list of the basic thread tank node in corresponding task priority section, wherein different basic threads Tank node executing tasks parallelly;Perform being obtained from the waiting list for task.
- 3. a kind of non-transitory machinable medium, is stored thereon with executable code, when the executable code is electric During the computing device of sub- equipment, make the computing device method described below:Task is obtained from corresponding waiting list by the worker thread of basic thread tank node, wherein the task is according to task Priority is added into the waiting list of the basic thread tank node in corresponding task priority section, wherein different basic threads Tank node executing tasks parallelly;Perform being obtained from the waiting list for task.
- A kind of 4. thread Task Processing Unit, it is characterised in that including:Task acquisition module, task is obtained from corresponding waiting list for the worker thread by basic thread tank node, its Described in task be added into according to task priority corresponding task priority section basic thread tank node waiting list In, wherein different basic thread tank node executing tasks parallellies;Task execution module, being obtained for performing task acquisition module from the waiting list for task.
- 5. device according to claim 4, it is characterised in that described device also includes:Task application module, in the task acquisition module by the worker thread of basic thread tank node from corresponding wait Task is obtained in queue as in the case of empty, the basic thread tank node application to high one-level task priority section is from waiting team Row acquisition task.
- 6. the device according to claim 4 or 5, it is characterised in that described device also includes:Thread pool configuration module, for creating as the level thread tank node and work between nonleaf node management role priority area The basic thread tank node of waiting list and worker thread is managed for leaf node, forms binary tree structure;For the basic thread Between tank node configuration task priority area, worker thread and waiting list, wherein worker thread it is corresponding with waiting list.
- 7. the device according to claim 4 or 5, it is characterised in that described device also includes:Task adds module, for the priority according to the binary tree structure by level thread tank node according to the task, Find the basic thread tank node in corresponding task priority section, by the task be added to the basic thread tank node etc. Treat in queue;The task acquisition module obtains the task addition module and is added in the waiting list of the basic thread tank node Task.
- 8. the device according to claim 4 or 5, it is characterised in that described device also includes:Configure adjusting module, for be adjusted to the basic thread tank node configuration worker thread quantity and waiting list it is big It is small.
- A kind of 9. thread task processing method, it is characterised in that including:Task is obtained from corresponding waiting list by the worker thread of basic thread tank node, wherein the task is after creation It is added into according to task priority in the waiting list of the basic thread tank node in corresponding task priority section, wherein different Basic thread tank node executing tasks parallelly;Perform being obtained from the waiting list for task.
- 10. according to the method for claim 9, it is characterised in that methods described also includes:In the case where task is obtained from corresponding waiting list by the worker thread of basic thread tank node as sky, Xiang Gaoyi Basic thread tank node application between level task priority area obtains task from waiting list.
- 11. the method according to claim 9 or 10, it is characterised in that the worker thread by basic thread tank node From corresponding waiting list before acquisition task, in addition to:Create as the level thread tank node between nonleaf node management role priority area and wait team as leaf node management The basic thread tank node of row and worker thread, form binary tree structure;Between the basic thread tank node configuration task priority area, worker thread and waiting list, wherein worker thread with Waiting list is corresponding.
- 12. according to the method for claim 11, it is characterised in that the task is added according to task priority after creation Enter into the waiting list of the basic thread tank node in corresponding task priority section, including:Priority according to the binary tree structure by level thread tank node according to the task, find corresponding task priority The basic thread tank node in section;The task is added in the waiting list of the basic thread tank node.
- 13. according to the method for claim 11, it is characterised in that methods described also includes:It is adjusted to the worker thread quantity of the basic thread tank node configuration and the size of waiting list.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710522332.XA CN107391243B (en) | 2017-06-30 | 2017-06-30 | Thread task processing equipment, device and method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710522332.XA CN107391243B (en) | 2017-06-30 | 2017-06-30 | Thread task processing equipment, device and method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107391243A true CN107391243A (en) | 2017-11-24 |
CN107391243B CN107391243B (en) | 2020-10-16 |
Family
ID=60334812
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710522332.XA Active CN107391243B (en) | 2017-06-30 | 2017-06-30 | Thread task processing equipment, device and method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107391243B (en) |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108572865A (en) * | 2018-04-04 | 2018-09-25 | 国家计算机网络与信息安全管理中心 | A kind of task queue treating method and apparatus |
CN108595249A (en) * | 2018-05-02 | 2018-09-28 | 联想(北京)有限公司 | A kind of virtual machine method for scheduling task and electronic equipment |
CN108984283A (en) * | 2018-06-25 | 2018-12-11 | 复旦大学 | A kind of adaptive dynamic pipeline parallel method |
CN109144694A (en) * | 2018-08-09 | 2019-01-04 | 北京城市网邻信息技术有限公司 | Information system configuration method, device, equipment and computer readable storage medium |
CN109345443A (en) * | 2018-10-19 | 2019-02-15 | 珠海金山网络游戏科技有限公司 | Data processing method and device calculate equipment and storage medium |
CN110046038A (en) * | 2019-03-12 | 2019-07-23 | 平安普惠企业管理有限公司 | A kind of task processing method and device based on thread pool |
CN110413390A (en) * | 2019-07-24 | 2019-11-05 | 深圳市盟天科技有限公司 | Thread task processing method, device, server and storage medium |
CN110716797A (en) * | 2019-09-10 | 2020-01-21 | 无锡江南计算技术研究所 | DDR4 performance balance scheduling structure and method for multiple request sources |
CN111400010A (en) * | 2020-03-18 | 2020-07-10 | 中国建设银行股份有限公司 | Task scheduling method and device |
CN111782295A (en) * | 2020-06-29 | 2020-10-16 | 珠海豹趣科技有限公司 | Application program running method and device, electronic equipment and storage medium |
CN112445614A (en) * | 2020-11-03 | 2021-03-05 | 华帝股份有限公司 | Thread data storage management method, computer equipment and storage medium |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101252455A (en) * | 2008-03-25 | 2008-08-27 | 上海文广科技发展有限公司 | Grouping broadcast control method based on broadcast |
CN101739293A (en) * | 2009-12-24 | 2010-06-16 | 航天恒星科技有限公司 | Method for scheduling satellite data product production tasks in parallel based on multithread |
CN102541653A (en) * | 2010-12-24 | 2012-07-04 | 新奥特(北京)视频技术有限公司 | Method and system for scheduling multitasking thread pools |
US20130322275A1 (en) * | 2012-05-31 | 2013-12-05 | Telefonaktiebolaget L M Ericsson (Publ) | Monitoring and allocation of interface resources in a wireless communication system |
CN103716256A (en) * | 2013-12-30 | 2014-04-09 | 北京瑞汛世纪科技有限公司 | Method and device for selecting basic devices for network content services |
CN104159316A (en) * | 2013-05-14 | 2014-11-19 | 北京化工大学 | Scheduling method for multiple users in upper layer of LTE (Long Term Evolution) base station |
CN106020954A (en) * | 2016-05-13 | 2016-10-12 | 深圳市永兴元科技有限公司 | Thread management method and device |
-
2017
- 2017-06-30 CN CN201710522332.XA patent/CN107391243B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101252455A (en) * | 2008-03-25 | 2008-08-27 | 上海文广科技发展有限公司 | Grouping broadcast control method based on broadcast |
CN101739293A (en) * | 2009-12-24 | 2010-06-16 | 航天恒星科技有限公司 | Method for scheduling satellite data product production tasks in parallel based on multithread |
CN102541653A (en) * | 2010-12-24 | 2012-07-04 | 新奥特(北京)视频技术有限公司 | Method and system for scheduling multitasking thread pools |
US20130322275A1 (en) * | 2012-05-31 | 2013-12-05 | Telefonaktiebolaget L M Ericsson (Publ) | Monitoring and allocation of interface resources in a wireless communication system |
CN104159316A (en) * | 2013-05-14 | 2014-11-19 | 北京化工大学 | Scheduling method for multiple users in upper layer of LTE (Long Term Evolution) base station |
CN103716256A (en) * | 2013-12-30 | 2014-04-09 | 北京瑞汛世纪科技有限公司 | Method and device for selecting basic devices for network content services |
CN106020954A (en) * | 2016-05-13 | 2016-10-12 | 深圳市永兴元科技有限公司 | Thread management method and device |
Cited By (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108572865A (en) * | 2018-04-04 | 2018-09-25 | 国家计算机网络与信息安全管理中心 | A kind of task queue treating method and apparatus |
CN108595249A (en) * | 2018-05-02 | 2018-09-28 | 联想(北京)有限公司 | A kind of virtual machine method for scheduling task and electronic equipment |
CN108984283A (en) * | 2018-06-25 | 2018-12-11 | 复旦大学 | A kind of adaptive dynamic pipeline parallel method |
CN109144694A (en) * | 2018-08-09 | 2019-01-04 | 北京城市网邻信息技术有限公司 | Information system configuration method, device, equipment and computer readable storage medium |
CN109345443A (en) * | 2018-10-19 | 2019-02-15 | 珠海金山网络游戏科技有限公司 | Data processing method and device calculate equipment and storage medium |
CN110046038A (en) * | 2019-03-12 | 2019-07-23 | 平安普惠企业管理有限公司 | A kind of task processing method and device based on thread pool |
CN110413390A (en) * | 2019-07-24 | 2019-11-05 | 深圳市盟天科技有限公司 | Thread task processing method, device, server and storage medium |
CN110716797A (en) * | 2019-09-10 | 2020-01-21 | 无锡江南计算技术研究所 | DDR4 performance balance scheduling structure and method for multiple request sources |
CN111400010A (en) * | 2020-03-18 | 2020-07-10 | 中国建设银行股份有限公司 | Task scheduling method and device |
CN111782295A (en) * | 2020-06-29 | 2020-10-16 | 珠海豹趣科技有限公司 | Application program running method and device, electronic equipment and storage medium |
CN111782295B (en) * | 2020-06-29 | 2023-08-29 | 珠海豹趣科技有限公司 | Application program running method and device, electronic equipment and storage medium |
CN112445614A (en) * | 2020-11-03 | 2021-03-05 | 华帝股份有限公司 | Thread data storage management method, computer equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN107391243B (en) | 2020-10-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107391243A (en) | Thread task processing equipment, device and method | |
CN106445675B (en) | B2B platform distributed application scheduling and resource allocation method | |
US20150323916A1 (en) | Fast change planning system, fast change planning method, and fast change planning program | |
CN107087019A (en) | A kind of end cloud cooperated computing framework and task scheduling apparatus and method | |
CN106406905B (en) | Configuration method and system for SETUP option of BIOS of server | |
CN110187960A (en) | A kind of distributed resource scheduling method and device | |
CN103365718A (en) | Thread scheduling method, thread scheduling device and multi-core processor system | |
CN104391750B (en) | A kind of mixing isomery host computer system based on software definition | |
WO2017054650A1 (en) | Task distribution method, device and system | |
CN109660569A (en) | A kind of Multi-task Concurrency executes method, storage medium, equipment and system | |
CN107832125A (en) | Method for processing business and device under a kind of distributed environment | |
CN111158800B (en) | Method and device for constructing task DAG based on mapping relation | |
Komarasamy et al. | A novel approach for Dynamic Load Balancing with effective Bin Packing and VM Reconfiguration in cloud | |
Fotohi et al. | A cluster based job scheduling algorithm for grid computing | |
Sharma et al. | A Dynamic optimization algorithm for task scheduling in cloud computing with resource utilization | |
CN110570158A (en) | power grid standing book electronic transfer method and system and computer readable storage medium | |
CN111290842A (en) | Task execution method and device | |
CN104933110B (en) | A kind of data prefetching method based on MapReduce | |
WO2016197858A1 (en) | Method and device for message notification | |
CN107145585A (en) | The automated import of data method and system of Hadoop data warehouses | |
CN104036141A (en) | Open computing language (OpenCL)-based red-black tree acceleration algorithm | |
CN104636205A (en) | Task seizing method and device | |
CN114595041A (en) | Resource scheduling system and method | |
CN113032092B (en) | Distributed computing method, device and platform | |
CN104572304B (en) | The Cluster Rendering task dimension pipe method of intelligent equalization |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
TA01 | Transfer of patent application right |
Effective date of registration: 20200813 Address after: 310052 room 508, floor 5, building 4, No. 699, Wangshang Road, Changhe street, Binjiang District, Hangzhou City, Zhejiang Province Applicant after: Alibaba (China) Co.,Ltd. Address before: 510627 Guangdong city of Guangzhou province Whampoa Tianhe District Road No. 163 Xiping Yun Lu Yun Ping square B radio tower 13 layer self unit 01 Applicant before: Guangdong Shenma Search Technology Co.,Ltd. |
|
TA01 | Transfer of patent application right | ||
GR01 | Patent grant | ||
GR01 | Patent grant |