CN109684066A - A kind of thread scheduling method - Google Patents

A kind of thread scheduling method Download PDF

Info

Publication number
CN109684066A
CN109684066A CN201811614456.1A CN201811614456A CN109684066A CN 109684066 A CN109684066 A CN 109684066A CN 201811614456 A CN201811614456 A CN 201811614456A CN 109684066 A CN109684066 A CN 109684066A
Authority
CN
China
Prior art keywords
thread
scheduling
class
resource
exclusive
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.)
Pending
Application number
CN201811614456.1A
Other languages
Chinese (zh)
Inventor
金涛
江浩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
HANGZHOU MAGICFIRM NETWORK TECHNOLOGY Co Ltd
Original Assignee
HANGZHOU MAGICFIRM NETWORK TECHNOLOGY Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by HANGZHOU MAGICFIRM NETWORK TECHNOLOGY Co Ltd filed Critical HANGZHOU MAGICFIRM NETWORK TECHNOLOGY Co Ltd
Priority to CN201811614456.1A priority Critical patent/CN109684066A/en
Publication of CN109684066A publication Critical patent/CN109684066A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/48Indexing scheme relating to G06F9/48
    • G06F2209/484Precedence
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The present invention provides a kind of thread scheduling methods, comprising: obtains and describes collection, the corresponding thread description of each element that the thread description is concentrated to the thread of scheduling thread;Collection is described according to thread and divides scheduling time section, and the thread in identical scheduling time section has identical priority;Parallel Scheduling class and exclusive scheduling class will be divided into according to the resource that thread operation attribute and execution occupy to the thread in each scheduling time section;Execute the thread in the Parallel Scheduling class parallel in each scheduling time section;Obtain the scheduling rule of thread in exclusive scheduling class;After Parallel Scheduling, the thread in exclusive scheduling class is executed according to the scheduling rule.The present invention considers many aspects such as thread priority, resource consume and electric energy consume and obtains scheduling result the most reasonable, the high thread of priority can guaranteed by priority scheduling, also comprehensive energy consumption is smaller during capable of guaranteeing the sequential scheduling of the thread of equal priority, and it is lower to occupy resource.

Description

A kind of thread scheduling method
Technical field
The present invention relates to computer field more particularly to a kind of thread scheduling methods.
Background technique
Thread, sometimes referred to as lightweight process (Lightweight Process, LWP) are the minimum lists that program executes stream Member, different threads can execute different tasks.The operation of thread needs to consume storage resource, computing resource and electric energy, because This, needs in processed scene existing compared with multithreading, the various resource losses and electricity that different thread scheduling methods generates Amount loss is also different, therefore, it is necessary to design a kind of Thread Scheduling Algorithms, reduces the synthesis expense of thread scheduling.
Summary of the invention
In order to solve the above-mentioned technical problem, the invention proposes a kind of thread scheduling methods.The present invention is specifically with as follows What technical solution was realized:
A kind of thread scheduling method, comprising:
It obtains and describes collection to the thread of scheduling thread, the corresponding thread of each element that the thread description is concentrated is retouched It states;
Collection is described according to thread and divides scheduling time section, and the thread in identical scheduling time section has identical preferential Grade;
Thread in each scheduling time section will be divided into parallel according to the resource that thread operation attribute and execution occupy Dispatch class and exclusive scheduling class;
Execute the thread in the Parallel Scheduling class parallel in each scheduling time section;
Obtain the scheduling rule of thread in exclusive scheduling class;
After Parallel Scheduling, the thread in exclusive scheduling class is executed according to the scheduling rule.
Further, thread describes the relevant parameter for characterizing thread scheduling, comprising: thread priority, thread operation Attribute, the resource of thread suspension consumption;Thread executes the resource occupied;The clock cycle that thread occupies;The unit time of thread Comprehensive energy consumption value.
Further, the method divided to thread includes:
Extract the concurrency thread collection in the scheduling time section;
It concentrates to obtain subject thread collection from the concurrency thread;
Parallel Scheduling class is constituted by the thread that subject thread is concentrated, is made of solely other threads in the scheduling time section Account for scheduling class.
Further, the subject thread collection has the following properties:
The summation that the thread that the subject thread is concentrated executes the resource occupied is less than preset threshold.
The concurrency thread concentrates the comprehensive of the unit time for removing other threads except the thread that subject thread is concentrated The total value for closing power consumption values is minimum.
Further, the thread monopolized in scheduling class that executes according to the scheduling rule includes:
Obtain in exclusive scheduling class to scheduling thread set;
Judgement it is described to scheduling thread set whether be it is empty, if it is not, then from described to obtain in scheduling thread set wait arrange Sequence composite set;
The First Eigenvalue κ and Second Eigenvalue λ to ordered set is obtained, the First Eigenvalue is group to be sorted The total value of the hang-up consumption resource of element in conjunction, the Second Eigenvalue are to execute occupancy wait the element in combination of sorting The total value of resource;
The comprehensive characteristics value of each combination to be sorted is calculated, the comprehensive characteristics value is ν=a κ+b λ, wherein a, and b is power Value;
Selection comprehensive characteristics value is highest to be scheduled wait sort combination as objective cross;
It by the thread in objective cross from described to be rejected in scheduling thread set, and returns to step: obtaining exclusive Dispatch class in scheduling thread set.
Further, each group to be sorted, which is combined into, has the feature that
The element wait in combination of sorting is belonged to scheduling thread set.
The total value of the resource of the occupancy wait the element in combination of sorting is less than preset threshold.
The embodiment of the present invention provides a kind of thread scheduling method, can be scheduled deployment from multiple angles for thread, It considers many aspects such as thread priority, resource consume and electric energy consume and obtains scheduling result the most reasonable, can protect The high thread of priority is demonstrate,proved by priority scheduling, can also guarantee comprehensive energy consumption during the sequential scheduling of the thread of equal priority It is smaller, it is lower to occupy resource.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with Other attached drawings are obtained according to these attached drawings.
Fig. 1 is a kind of thread scheduling method flow chart provided in an embodiment of the present invention;
Fig. 2 is the method flow diagram provided in an embodiment of the present invention divided to thread;
Fig. 3 is the multi-threaded approach process provided in an embodiment of the present invention executed in exclusive scheduling class according to the scheduling rule Figure.
Specific embodiment
In order to enable those skilled in the art to better understand the solution of the present invention, below in conjunction in the embodiment of the present invention Attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is only The embodiment of a part of the invention, instead of all the embodiments.Based on the embodiments of the present invention, ordinary skill people The model that the present invention protects all should belong in member's every other embodiment obtained without making creative work It encloses.
It should be noted that description and claims of this specification and term " first " in above-mentioned attached drawing, " Two " etc. be to be used to distinguish similar objects, without being used to describe a particular order or precedence order.It should be understood that using in this way Data be interchangeable under appropriate circumstances, so as to the embodiment of the present invention described herein can in addition to illustrating herein or Sequence other than those of description is implemented.In addition, term " includes " and " having " and their any deformation, it is intended that cover Cover it is non-exclusive include, for example, the process, method, system, product or equipment for containing a series of steps or units are not necessarily limited to Step or unit those of is clearly listed, but may include be not clearly listed or for these process, methods, product Or other step or units that equipment is intrinsic.
The embodiment of the present invention discloses a kind of thread scheduling method, as shown in Figure 1, which comprises
S101. the thread description collection to scheduling thread is obtained, each element that the thread description is concentrated is one corresponding Thread description.
Specifically, thread describes the relevant parameter for characterizing thread scheduling.Specifically, in the embodiment of the present invention for into The parameter of row scheduling includes: thread priority, and thread runs attribute, the resource of thread suspension consumption;Thread executes the money occupied Source;The clock cycle that thread occupies;The comprehensive energy consumption value of the unit time of thread.
Specifically, the resource can refer to storage resource and computing resource, i.e. memory consumption and/or CPU consumption.
S102. collection is described according to thread and divides scheduling time section, the thread in identical scheduling time section has identical Priority.
The clock cycle number of the scheduling time section is the total value of the clock cycle of thread in the scheduling time section.
S103. the thread in each scheduling time section will be divided into according to the resource that thread operation attribute and execution occupy Parallel Scheduling class and exclusive scheduling class.
S104. the thread in the Parallel Scheduling class is executed parallel in each scheduling time section.
S105. the scheduling rule of thread in exclusive scheduling class is obtained.
Thread in Parallel Scheduling class can be with Parallel Scheduling.
Step S104 and step S105 can be executed parallel or sequence executes.
S106. after Parallel Scheduling, the thread in exclusive scheduling class is executed according to the scheduling rule.
Specifically, in the embodiment of the present invention priority scheduling highest priority thread, the minimum line of last dispatching priority Journey.And the thread of same priority is divided in a scheduling time section, essence is carried out according to the method for step S103-S106 Fine tuning degree.
Specifically, the method divided in step of embodiment of the present invention S103 to thread is as shown in Figure 2, comprising:
S1031. the concurrency thread collection in the scheduling time section is extracted.
Specifically, the concurrency thread is the thread that thread operation attribute is 0, correspondingly, exclusivity thread is thread Run the thread that attribute is 1.
S1032. it concentrates to obtain subject thread collection from the concurrency thread.
The subject thread collection has the following properties:
(1) summation that the thread that the subject thread is concentrated executes the resource occupied is less than preset threshold.
(2) the concurrency thread concentrates the unit time for removing other threads except the thread that subject thread is concentrated The total value of comprehensive energy consumption value is minimum.
S1033. Parallel Scheduling class is constituted by the thread that subject thread is concentrated, by other threads in the scheduling time section Constitute exclusive scheduling class.
Further, the invention discloses the method for obtaining the scheduling rule of thread in exclusive scheduling class, the method energy Enough reach comprehensive energy consumption minimum, occupies the lower effect of resource.
Specifically, the method is as shown in Figure 3, comprising:
S1. obtain in exclusive scheduling class to scheduling thread set.
Specifically, the thread in scheduling thread set belongs to exclusive scheduling class and was not scheduled.
Whether it to scheduling thread set is empty that S2. judgement is described, if it is not, then from it is described to obtained in scheduling thread set to Sort composite set.
Specifically, each group to be sorted, which is combined into, has the feature that
(1) element wait in combination of sorting is belonged to scheduling thread set.
(2) total value of the resource of the occupancy wait the element in combination of sorting is less than preset threshold.
S3. the First Eigenvalue κ and Second Eigenvalue λ to ordered set is obtained, the First Eigenvalue is wait arrange The total value of the hang-up consumption resource of element in sequence combination, the Second Eigenvalue are the execution wait the element in combination of sorting Occupy the total value of resource.
S4. the comprehensive characteristics value of each combination to be sorted is calculated, the comprehensive characteristics value is ν=a κ+b λ, and wherein a, b are Weight.
Specifically, the value of a, b can sets itselfs according to actual needs.
S5. selection comprehensive characteristics value is highest is scheduled wait sort combination as objective cross.
Specifically, when being scheduled, can to the thread in objective cross according to the unit time comprehensive energy consumption value into The arrangement of row descending, and be successively scheduled according to rank results.
S6. by the thread in objective cross from described to be rejected in scheduling thread set, and return to step S1.
The embodiment of the present invention provides a kind of thread scheduling method, can be scheduled deployment from multiple angles for thread, It considers many aspects such as thread priority, resource consume and electric energy consume and obtains scheduling result the most reasonable, can protect The high thread of priority is demonstrate,proved by priority scheduling, can also guarantee comprehensive energy consumption during the sequential scheduling of the thread of equal priority It is smaller, it is lower to occupy resource.
It should be understood that referenced herein " multiple " refer to two or more."and/or", description association The incidence relation of object indicates may exist three kinds of relationships, for example, A and/or B, can indicate: individualism A exists simultaneously A And B, individualism B these three situations.Character "/" typicallys represent the relationship that forward-backward correlation object is a kind of "or".
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
Those of ordinary skill in the art will appreciate that realizing that all or part of the steps of above-described embodiment can pass through hardware It completes, relevant hardware can also be instructed to complete by program, the program can store in a kind of computer-readable In storage medium, storage medium mentioned above can be read-only memory, disk or CD etc..
The foregoing is merely presently preferred embodiments of the present invention, is not intended to limit the invention, it is all in spirit of the invention and Within principle, any modification, equivalent replacement, improvement and so on be should all be included in the protection scope of the present invention.

Claims (6)

1. a kind of thread scheduling method characterized by comprising
It obtains and describes collection, the corresponding thread description of each element that the thread description is concentrated to the thread of scheduling thread;
Collection is described according to thread and divides scheduling time section, and the thread in identical scheduling time section has identical priority;
Parallel Scheduling will be divided into according to the resource that thread operation attribute and execution occupy to the thread in each scheduling time section Class and exclusive scheduling class;
Execute the thread in the Parallel Scheduling class parallel in each scheduling time section;
Obtain the scheduling rule of thread in exclusive scheduling class;
After Parallel Scheduling, the thread in exclusive scheduling class is executed according to the scheduling rule.
2. according to the method described in claim 1, it is characterized by:
Thread describes the relevant parameter for characterizing thread scheduling, comprising: thread priority, thread run attribute, thread suspension The resource of consumption;Thread executes the resource occupied;The clock cycle that thread occupies;The comprehensive energy consumption value of the unit time of thread.
3. the method according to claim 1, wherein the method divided to thread includes:
Extract the concurrency thread collection in the scheduling time section;
It concentrates to obtain subject thread collection from the concurrency thread;
Parallel Scheduling class is constituted by the thread that subject thread is concentrated, constitutes exclusive tune by other threads in the scheduling time section Spend class.
4. according to the method described in claim 1, it is characterized by:
The subject thread collection has the following properties:
The summation that the thread that the subject thread is concentrated executes the resource occupied is less than preset threshold.
The concurrency thread concentrates the synthesis energy for removing the unit time of other threads except the thread that subject thread is concentrated The total value of consumption value is minimum.
5. according to the method described in claim 1, it is characterized by:
It is described to execute the thread in exclusive scheduling class according to the scheduling rule and include:
Obtain in exclusive scheduling class to scheduling thread set;
Judgement it is described to scheduling thread set whether be it is empty, if it is not, then from described to obtain group to be sorted in scheduling thread set Intersection is closed;
The First Eigenvalue κ and Second Eigenvalue λ to ordered set is obtained, the First Eigenvalue is wait in combination of sorting Element hang-up consumption resource total value, the Second Eigenvalue be wait sort combination in element execution occupy resource Total value;
The comprehensive characteristics value of each combination to be sorted is calculated, the comprehensive characteristics value is ν=a κ+b λ, and wherein a, b are weight;
Selection comprehensive characteristics value is highest to be scheduled wait sort combination as objective cross;
It by the thread in objective cross from described to be rejected in scheduling thread set, and returns to step: obtaining exclusive scheduling In class to scheduling thread set.
6. according to the method described in claim 5, it is characterized by:
Each group to be sorted, which is combined into, to be had the feature that
The element wait in combination of sorting is belonged to scheduling thread set.
The total value of the resource of the occupancy wait the element in combination of sorting is less than preset threshold.
CN201811614456.1A 2018-12-27 2018-12-27 A kind of thread scheduling method Pending CN109684066A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811614456.1A CN109684066A (en) 2018-12-27 2018-12-27 A kind of thread scheduling method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811614456.1A CN109684066A (en) 2018-12-27 2018-12-27 A kind of thread scheduling method

Publications (1)

Publication Number Publication Date
CN109684066A true CN109684066A (en) 2019-04-26

Family

ID=66190655

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811614456.1A Pending CN109684066A (en) 2018-12-27 2018-12-27 A kind of thread scheduling method

Country Status (1)

Country Link
CN (1) CN109684066A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112286198A (en) * 2020-11-04 2021-01-29 安徽仓擎机器人有限公司 Port AGV fleet and manual truck mixed scheduling system and method
CN113127208A (en) * 2021-05-06 2021-07-16 杭州天宽科技有限公司 Method for limiting user access service based on thread

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101743534A (en) * 2007-07-16 2010-06-16 微软公司 By increasing and shrinking resources allocation and dispatch
US20100169892A1 (en) * 2008-12-29 2010-07-01 Advanced Micro Devices, Inc. Processing Acceleration on Multi-Core Processor Platforms

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101743534A (en) * 2007-07-16 2010-06-16 微软公司 By increasing and shrinking resources allocation and dispatch
US20100169892A1 (en) * 2008-12-29 2010-07-01 Advanced Micro Devices, Inc. Processing Acceleration on Multi-Core Processor Platforms

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王力: "基于动态规划的异构多核任务分配与调度算法研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112286198A (en) * 2020-11-04 2021-01-29 安徽仓擎机器人有限公司 Port AGV fleet and manual truck mixed scheduling system and method
CN113127208A (en) * 2021-05-06 2021-07-16 杭州天宽科技有限公司 Method for limiting user access service based on thread
CN113127208B (en) * 2021-05-06 2023-08-04 杭州天宽科技有限公司 Method for limiting user to access service based on thread

Similar Documents

Publication Publication Date Title
Zhao et al. Scheduling multiple DAGs onto heterogeneous systems
CN106844314B (en) A kind of duplicate checking method and device of article
Novovičová et al. Conditional mutual information based feature selection for classification task
CN109144699A (en) Distributed task dispatching method, apparatus and system
CN104035818A (en) Multiple-task scheduling method and device
CN102541640A (en) Cluster GPU (graphic processing unit) resource scheduling system and method
CN109684066A (en) A kind of thread scheduling method
CN106790529B (en) Dispatching method, control centre and the scheduling system of computing resource
CN106201676A (en) Task allocation method and device
CN107533479A (en) Power knows scheduling and power manager
CN109766470A (en) Image search method, device and processing equipment
CN110362391A (en) Resource regulating method, device, electronic equipment and storage medium
CN109739897A (en) A kind of increment type Mining Frequent Itemsets based on Spark frame
CN114064296B (en) Kubernetes scheduling method, Kubernetes scheduling device and storage medium
Al-Radaideh et al. An approach for Arabic text categorization using association rule mining
CN109709806A (en) A kind of self-adapting data acquisition system
CN115827237A (en) Storm task scheduling method based on cost performance
Al-Fareed et al. Simulator for Scheduling Real-Time Systems with Reduced Power Consumption.
CN111176847B (en) Method and device for optimizing performance of big data cluster on physical core ultra-multithreading server
CN109522112A (en) A kind of data collection system
CN109885383A (en) A kind of non-unity time task scheduling method of with constraint conditions
Lucarelli et al. Online non-preemptive scheduling to minimize maximum weighted flow-time on related machines
Seethalakshmi et al. Job scheduling in big data-a survey
Yang et al. Tias: Two-level information-agnostic job scheduling in gpu clusters
CN116757388B (en) Electric power market clearing method and device based on redundancy constraint screening

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20190426

RJ01 Rejection of invention patent application after publication