[go: up one dir, main page]

CN108549574A - Threading scheduling management method, device, computer equipment and storage medium - Google Patents

Threading scheduling management method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN108549574A
CN108549574A CN201810200639.2A CN201810200639A CN108549574A CN 108549574 A CN108549574 A CN 108549574A CN 201810200639 A CN201810200639 A CN 201810200639A CN 108549574 A CN108549574 A CN 108549574A
Authority
CN
China
Prior art keywords
thread
processor
threads
running
outgoing
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
Application number
CN201810200639.2A
Other languages
Chinese (zh)
Other versions
CN108549574B (en
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.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Oneplus Technology Shenzhen 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 Oneplus Technology Shenzhen Co Ltd filed Critical Oneplus Technology Shenzhen Co Ltd
Priority to CN201810200639.2A priority Critical patent/CN108549574B/en
Publication of CN108549574A publication Critical patent/CN108549574A/en
Application granted granted Critical
Publication of CN108549574B publication Critical patent/CN108549574B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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 OR CALCULATING; 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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation 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/505Allocation 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 load

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multi Processors (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

This application involves a kind of threading scheduling management method, device, computer equipment and storage mediums.The method includes:Selection, which is moved out, processor and moves into processor, and judgement, which is moved out, processor and moves into whether processor meets thread migration condition;Wherein, the processor of moving out includes one or more thread queues;If so, searching the thread run in the thread queue moved out on processor, the corresponding residue load capacity to be migrated of the thread found is calculated;According to remaining load capacity selection target thread to be migrated, the subject thread is dispatched to and moves into processor.The threads load amount of scheduling can be avoided excessive using this method, to the problem of scheduling occurred.

Description

线程调度管理方法、装置、计算机设备和存储介质Thread scheduling management method, device, computer equipment and storage medium

技术领域technical field

本申请涉及计算机技术领域,特别是涉及一种线程调度管理方法、装置、计算机设备和存储介质。The present application relates to the field of computer technology, in particular to a thread scheduling management method, device, computer equipment and storage medium.

背景技术Background technique

随着计算机技术的发展,计算机设备在运行过程中,可动态的对处理器上的线程进行调度,以使得线程在各处理器上达到负载均衡,提高线程的执行效率。对于处理器上的线程,存在优先级的差别,现有的线程调度方法中,仅根据线程的优先级选择线程进行调度,而由于不同的线程拥有不同的负载量,采用这种线程调度方法可能导致将线程调度后出现负载不均衡的情形,即出现过调度的问题。因此,如何解决线程调度过程中过调度的问题成为目前需要解决的一个技术问题。With the development of computer technology, computer equipment can dynamically schedule threads on processors during operation, so that threads can achieve load balance on each processor and improve the execution efficiency of threads. For the threads on the processor, there is a difference in priority. In the existing thread scheduling method, the thread is only selected according to the priority of the thread for scheduling. Since different threads have different loads, it may be possible to use this thread scheduling method. As a result, the load is unbalanced after the thread is scheduled, that is, the problem of over-scheduling occurs. Therefore, how to solve the problem of overscheduling in the thread scheduling process has become a technical problem to be solved at present.

发明内容Contents of the invention

基于此,有必要针对上述技术问题,提供一种能够解决线程调度过程中过调度问题的线程调度管理方法、装置、计算机设备和存储介质。Based on this, it is necessary to provide a thread scheduling management method, device, computer equipment and storage medium capable of solving the problem of overscheduling in the thread scheduling process, aiming at the above technical problems.

一种线程调度管理方法,所述方法包括:A thread scheduling management method, the method comprising:

选择迁出处理器和迁入处理器,判断迁出处理器和迁入处理器是否满足线程迁移条件;其中,所述迁出处理器包括一个或多个线程队列;Selecting the outgoing processor and the incoming processor, and judging whether the outgoing processor and the incoming processor meet the thread migration condition; wherein, the outgoing processor includes one or more thread queues;

若是,查找运行于迁出处理器上的线程队列内的线程,计算查找到的线程对应的剩余待迁移负载量;If yes, find the threads running in the thread queue on the outgoing processor, and calculate the remaining load to be migrated corresponding to the found threads;

根据剩余待迁移负载量选择目标线程,将所述目标线程调度至迁入处理器。A target thread is selected according to the remaining load to be migrated, and the target thread is scheduled to the transfer-in processor.

在其中一个实施例中,所述查找运行于迁出处理器上的线程队列内的步骤包括:获取所述迁出处理器所在的处理器核群信息和迁入处理器所在的处理器核群信息;当所述迁出处理器与所述迁入处理器在同一处理器核群时,获取迁出处理器上优先级最高的线程队列内的线程个数;若所述线程个数为多个,则按照优先级从高至低的顺序查找线程队列;若所述线程个数为一个,则按照优先级从低至高的顺序查找线程队列。In one of the embodiments, the step of searching for the thread queue running on the outgoing processor includes: acquiring information about the processor core group where the outgoing processor is located and the processor core group where the outgoing processor is located information; when the processor that moves out and the processor that moves in are in the same processor core group, obtain the number of threads in the thread queue with the highest priority on the processor that moves out; if the number of threads is more If the number of threads is one, the thread queue is searched in order of priority from high to low; if the number of threads is one, the thread queue is searched in order of priority from low to high.

在其中一个实施例中,所述方法还包括:当所述迁出处理器所在的处理器核群为小核群,迁入处理器所在的处理器核群为大核群时,执行下列步骤:若迁入处理器上无执行预定任务的线程运行,则按照负载量从高至低的顺序查找执行预定任务线程的线程队列;若迁出处理器上无执行预定任务的线程运行且迁入处理器上运行有执行预定任务的线程,则结束查找。In one of the embodiments, the method further includes: when the processor core group where the outgoing processor is located is a small core group, and the processor core group where the incoming processor is located is a large core group, perform the following steps : If there is no thread executing the scheduled task running on the moving-in processor, search for the thread queue of the thread executing the scheduled task in the order of load from high to low; if there is no thread executing the scheduled task running on the moving-out processor and move in If there are threads executing scheduled tasks running on the processor, the search ends.

在其中一个实施例中,所述方法还包括:当所述迁出处理器所在的处理器核群为大核群,迁入处理器所在的处理器核群为小核群时,执行下列步骤:若迁出处理器上执行预定任务的线程的总负载量为大核群中最大的,则根据线程的负载量从小至大的顺序查找执行预定任务的线程队列;否则结束查找执行预定任务的线程队列。In one of the embodiments, the method further includes: when the processor core group where the outgoing processor is located is a large core group, and the processor core group where the incoming processor is located is a small core group, perform the following steps : If the total load of the threads executing the scheduled tasks on the outgoing processor is the largest in the large core group, search for the thread queues for executing the scheduled tasks according to the thread load in ascending order; otherwise, end the search for the thread queues for executing the scheduled tasks thread queue.

在其中一个实施例中,所述方法还包括:获取正在运行的线程所对应的存储资源信息;利用所述存储资源信息统计所述正在运行的线程在预设时间内访问输入输出设备的次数;若所述访问输入输出设备的次数大于第一阈值,则将所述正在运行的线程记录为第一类型线程。In one of the embodiments, the method further includes: acquiring storage resource information corresponding to the running thread; using the storage resource information to count the number of times the running thread accesses the input and output device within a preset time; If the number of accesses to the input and output device is greater than a first threshold, record the running thread as a first type thread.

在其中一个实施例中,所述方法还包括:获取正在运行的线程所对应的存储资源信息;利用所述存储资源信息统计所述正在运行的线程在预设时间内访问内存的次数;若所述访问内存的次数大于第二阈值,则将所述正在运行的线程记录为第二类型线程。In one of the embodiments, the method further includes: obtaining the storage resource information corresponding to the running thread; using the storage resource information to count the number of times the running thread accesses the memory within a preset time; if the If the number of memory access times is greater than a second threshold, the running thread is recorded as a second type thread.

一种线程调度管理装置,所述装置包括:A thread scheduling management device, the device comprising:

选择模块,用于选择迁出处理器和迁入处理器,判断迁出处理器和迁入处理器是否满足线程迁移条件;其中,所述迁出处理器包括一个或多个线程队列;The selection module is used to select the outgoing processor and the incoming processor, and judge whether the outgoing processor and the incoming processor meet the thread migration condition; wherein, the outgoing processor includes one or more thread queues;

查找模块,用于若满足迁移条件,查找运行于迁出处理器上的线程队列内的线程,计算查找到的线程对应的剩余待迁移负载量;A search module, configured to search for threads running in the thread queue on the outgoing processor if the migration conditions are met, and calculate the remaining load to be migrated corresponding to the found threads;

调度模块,用于根据剩余待迁移负载量选择目标线程,将所述目标线程调度至迁入处理器。A scheduling module, configured to select a target thread according to the remaining load to be migrated, and schedule the target thread to the transfer-in processor.

一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现以下步骤:选择迁出处理器和迁入处理器,判断迁出处理器和迁入处理器是否满足线程迁移条件;其中,所述迁出处理器包括一个或多个线程队列;若是,查找运行于迁出处理器上的线程队列内的线程,计算查找到的线程对应的剩余待迁移负载量;根据剩余待迁移负载量选择目标线程,将所述目标线程调度至迁入处理器。A computer device, comprising a memory, a processor, and a computer program stored on the memory and operable on the processor, when the processor executes the computer program, the following steps are implemented: selecting a moving-out processor and a moving-in processor , judging whether the moving-out processor and the moving-in processor meet the thread migration condition; wherein, the moving-out processor includes one or more thread queues; if so, searching for threads running in the thread queue on the moving-out processor, Calculate the remaining load to be migrated corresponding to the found thread; select a target thread according to the remaining load to be migrated, and schedule the target thread to the migration-in processor.

一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现以下步骤:选择迁出处理器和迁入处理器,判断迁出处理器和迁入处理器是否满足线程迁移条件;其中,所述迁出处理器包括一个或多个线程队列;若是,查找运行于迁出处理器上的线程队列内的线程,计算查找到的线程对应的剩余待迁移负载量;根据剩余待迁移负载量选择目标线程,将所述目标线程调度至迁入处理器。A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: selecting a moving-out processor and a moving-in processor, and judging whether the moving-out processor and the moving-in processor are Satisfy the thread migration condition; wherein, the outgoing processor includes one or more thread queues; if so, search for threads running in the thread queues on the outgoing processor, and calculate the remaining load to be migrated corresponding to the found thread ; Select a target thread according to the remaining load to be migrated, and schedule the target thread to the transfer-in processor.

上述线程调度管理方法、装置、计算机设备和存储介质,终端通过计算线程的剩余待迁移负载量,根据剩余待迁移负载量选择目标线程,将目标线程调度至迁入处理器,使得能够选择负载量最合适的线程进行调度,避免了调度的线程负载量过大,从而出现过调度的问题,提高了线程调度的可靠性。In the above thread scheduling management method, device, computer equipment and storage medium, the terminal calculates the remaining load to be migrated of the thread, selects the target thread according to the remaining load to be migrated, and schedules the target thread to the incoming processor, so that the load can be selected The most suitable thread is scheduled, avoiding the excessive load of the scheduled thread, resulting in the problem of over-scheduling, and improving the reliability of thread scheduling.

附图说明Description of drawings

图1为一个实施例中线程调度管理方法的流程示意图;Fig. 1 is a schematic flow diagram of a thread scheduling management method in an embodiment;

图2为一个实施例中的线程状态图;Fig. 2 is a thread state diagram in an embodiment;

图3为一个实施例中查找运行于迁出处理器上的线程队列内的步骤的流程示意图;Fig. 3 is a schematic flow chart of the steps of searching the thread queue running on the outgoing processor in one embodiment;

图4a为一个实施例的正在运行的线程的状态示意图;Figure 4a is a schematic diagram of the state of the running thread of an embodiment;

图4b为图4a的线程迁移状态示意图;Fig. 4b is a schematic diagram of the thread migration state of Fig. 4a;

图5为一个实施例中线程调度管理装置的结构框图;Fig. 5 is a structural block diagram of a thread scheduling management device in an embodiment;

图6为一个实施例中计算机设备的内部结构图。Figure 6 is an internal block diagram of a computer device in one embodiment.

具体实施方式Detailed ways

为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solution and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present application, and are not intended to limit the present application.

在一个实施例中,如图1所示,提供了一种线程调度管理方法,以该方法应用于终端为例进行说明,包括以下步骤:In one embodiment, as shown in FIG. 1 , a thread scheduling management method is provided, and the method is applied to a terminal as an example for illustration, including the following steps:

步骤102,选择迁出处理器和迁入处理器,判断迁出处理器和迁入处理器是否满足线程迁移条件;其中,迁出处理器包括一个或多个线程队列。Step 102, select the outgoing processor and the incoming processor, and judge whether the outgoing processor and the incoming processor meet the thread migration condition; wherein, the outgoing processor includes one or more thread queues.

终端的处理器可以为中央处理器(Central Processing Unit,CPU),图形处理器(Graphics Processing Unit,GPU)、视频处理单元(Video Processing Unit,VPU)等中的至少一种。终端的处理器可以为单核架构,也可以为多核架构,当为多核架构时,多核架构中的一个核心视为一个处理器。本实施例以终端的处理器为多核架构为例,其中,迁入处理器和迁出处理器分别为一个核心。The processor of the terminal may be at least one of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU), a video processing unit (Video Processing Unit, VPU), and the like. The processor of the terminal may be a single-core architecture or a multi-core architecture. When the multi-core architecture is used, one core in the multi-core architecture is regarded as one processor. In this embodiment, the processor of the terminal is taken as an example with a multi-core architecture, wherein the transfer-in processor and the transfer-out processor are each a core.

终端在运行过程中的任意时刻,各处理器上处理的线程可能会处于负载不均衡的情况,当负载不均衡时,则会出现一些处理器上处于就绪队列等待处理器时间的线程过多,而另一些处理器上运行的线程过少,导致整体线程处理效率低。为了提高线程处理效率,需要对线程在各处理器之间进行调度使各处理器达到负载均衡。At any moment during the operation of the terminal, the processing threads on each processor may be in an unbalanced load. When the load is unbalanced, there will be too many threads in the ready queue waiting for processor time on some processors. Other processors run too few threads, resulting in inefficient overall thread processing. In order to improve thread processing efficiency, it is necessary to schedule threads among processors to achieve load balance among processors.

终端选择迁出处理器和迁入处理器。终端可以随机选择两个处理器分别作为迁出处理器和迁入处理器,终端还可以根据处理器的地址信息依序选择两个处理器分别作为迁出处理器和迁入处理器。进一步地,终端判断迁出处理器和迁入处理器是否满足线程迁移条件。具体地,终端获取迁出处理器的剩余可负载量以及迁入处理器的剩余可负载量,计算迁入处理器的剩余可负载量与迁出处理器的剩余可负载量的差值,当该差值大于预设值时,则判断满足线程迁移条件。其中,处理器拥有固定的总负载量,总负载量为处理器最大可处理的线程的负载量,处理器的剩余负载量为处理器的总负载量与当前运行在处理器上的线程负载量的差值。The terminal selects the migration-out processor and the migration-in processor. The terminal may randomly select two processors as the transfer-out processor and the transfer-in processor, respectively, and the terminal may also sequentially select two processors as the transfer-out processor and the transfer-in processor according to the address information of the processors. Further, the terminal judges whether the moving-out processor and the moving-in processor meet the thread migration condition. Specifically, the terminal obtains the remaining loadable capacity of the outgoing processor and the remaining loadable capacity of the incoming processor, and calculates the difference between the remaining loadable amount of the incoming processor and the remaining loadable amount of the outgoing processor. When the difference is greater than the preset value, it is determined that the thread migration condition is met. Among them, the processor has a fixed total load, the total load is the load of the maximum thread that the processor can handle, and the remaining load of the processor is the total load of the processor and the load of the threads currently running on the processor difference.

迁出处理器包括一个或多个线程队列。同一个线程队列内的多个线程拥有相同的优先级,不同的线程队列内的线程分别拥有不同的优先级。本实施例中,将执行预定任务的线程记为第一线程,将第一线程唤醒的线程记为第二线程。终端将第一线程分配第一优先级,将第二线程分配第二优先级。其中,第一优先级可以为最高的优先级,第二优先级可以为最高的优先级,也可以为仅次于最高的优先级,还可以为最低的优先级。本实施例中,第一优先级为最高的优先级,第二优先级为仅次于最高的优先级。进一步地,终端将执行其他任务的线程分配最低的优先级。例如终端将执行预定任务的线程的优先级分配为1,将由执行预定任务的线程唤醒的线程的优先级分配为2,将执行其他任务的线程的优先级分配为3,其中,1、2、3为依次降低的优先级。Egress processors include one or more thread queues. Multiple threads in the same thread queue have the same priority, and threads in different thread queues have different priorities. In this embodiment, a thread executing a predetermined task is recorded as a first thread, and a thread awakened by the first thread is recorded as a second thread. The terminal assigns the first priority to the first thread, and assigns the second priority to the second thread. Wherein, the first priority may be the highest priority, and the second priority may be the highest priority, or the second highest priority, or the lowest priority. In this embodiment, the first priority is the highest priority, and the second priority is the second highest priority. Further, the terminal assigns the lowest priority to threads performing other tasks. For example, the terminal assigns the priority of the thread executing the scheduled task as 1, assigns the priority of the thread awakened by the thread executing the scheduled task as 2, and assigns the priority of the thread executing other tasks as 3, wherein, 1, 2, 3 is a descending priority.

预定任务包括绘制画面、播出声音、响应回馈等任务。预定任务是预先通过判断正在终端的处理器上运行的线程的处理器内是否存在预定标记来识别确定的。其中,一个预定任务具有对应的预定任务标识,预定任务标识被预记录在文件中。记录预定任务标识的文件,可以称为线程标识文件,线程标识文件可以采用数据库表的形式。线程标识文件存储于终端的存储资源内,存储资源包括但不限于寄存器、高速缓存、内存和外部存储设备等。Scheduled tasks include tasks such as drawing pictures, playing sounds, and responding to feedback. The scheduled task is identified and determined in advance by judging whether there is a scheduled flag in the processor of the thread running on the terminal processor. Wherein, a scheduled task has a corresponding scheduled task identifier, and the scheduled task identifier is pre-recorded in the file. The file recording the scheduled task ID may be called a thread ID file, and the thread ID file may be in the form of a database table. The thread identification file is stored in the storage resources of the terminal, and the storage resources include but not limited to registers, caches, internal memory, and external storage devices.

线程包括多个状态,新建状态、就绪状态、运行状态、阻塞状态以及死亡状态。如图2所示,线程从创建、运行到结束总是处于其中一个状态。线程运行过程中,可能由于各种原因进入阻塞状态,处于阻塞状态的线程没有运行结束,会暂时让出处理器,进入等待队列。处于阻塞状态的线程并不自动开始运行,可以通过唤醒使其恢复运行。线程运行过程中,还可能由于执行结束正常退出或者由于异常导致执行终止而进入死亡状态。一个执行预定任务的线程在运行过程中,可以唤醒多个线程。执行预定任务的线程所唤醒的线程标识也被预记录在线程标识文件中。具体地,被唤醒的线程的标识与唤醒其的执行预定任务的线程标识相对应的记录在线程标识文件中。Threads include multiple states, new state, ready state, running state, blocked state, and dead state. As shown in Figure 2, a thread is always in one of the states from creation, execution to termination. During the running of the thread, it may enter the blocked state due to various reasons. If the thread in the blocked state has not finished running, it will temporarily give up the processor and enter the waiting queue. A thread in a blocked state does not start running automatically, and can be resumed by waking it up. During the running process of the thread, it may also enter the death state due to the normal exit of the execution end or the execution termination due to an exception. A thread that executes a scheduled task can wake up multiple threads while it is running. The thread identification awakened by the thread executing the scheduled task is also pre-recorded in the thread identification file. Specifically, the identifier of the awakened thread is recorded in the thread identifier file corresponding to the identifier of the thread that wakes it up and executes the predetermined task.

步骤104,若是,查找运行于迁出处理器上的线程队列,计算查找的线程对应的剩余待迁移负载量。Step 104, if yes, search for the thread queue running on the outgoing processor, and calculate the remaining load to be migrated corresponding to the searched thread.

若迁出处理器和迁入处理器满足线程迁移条件,则终端查找运行于迁出处理器上的线程队列。其中,线程迁移条件包括当前待迁移负载量大于预设值,当前待迁移负载量为迁入处理器的剩余可负载量与迁出处理器的剩余可负载量的差值。本实施例中,终端首先查找优先级最高的线程队列。进一步地,终端每查找到一个线程,计算查找到的线程对应的剩余待迁移负载量。其中,剩余待迁移负载量为若将该线程调度至迁入处理器后,迁入处理器的剩余可负载量和迁出处理器的剩余可负载量的差值。例如,若当前迁入处理器的剩余可负载量为m,迁出处理器的剩余可负载量为n,终端查找到的线程的负载量为p,则该线程对应的剩余待迁移负载量为(m-p)-(n+p)=m-n-2p。If the moving-out processor and the moving-in processor meet the thread migration condition, the terminal searches for the thread queue running on the moving-out processor. Wherein, the thread migration condition includes that the current load to be migrated is greater than a preset value, and the current load to be migrated is the difference between the remaining loadable capacity of the incoming processor and the remaining loadable amount of the outgoing processor. In this embodiment, the terminal first searches for the thread queue with the highest priority. Further, each time the terminal finds a thread, it calculates the remaining load to be migrated corresponding to the found thread. Wherein, the remaining load to be migrated is the difference between the remaining loadable capacity of the incoming processor and the remaining loadable amount of the outgoing processor after the thread is scheduled to the incoming processor. For example, if the remaining loadable capacity of the currently migrating processor is m, the remaining loadable capacity of the migrating processor is n, and the load capacity of the thread found by the terminal is p, then the remaining load to be migrated corresponding to the thread is (m-p)-(n+p)=m-n-2p.

步骤106,根据剩余待迁移负载量选择目标线程,将目标线程调度至迁入处理器。Step 106, selecting a target thread according to the remaining load to be migrated, and scheduling the target thread to the migration-in processor.

终端查找线程队列时,对查找到的线程判断是否选择该线程为目标线程。具体地,终端根据线程的负载量和对应的剩余待迁移负载量判断是否选择该线程为目标线程。更具体地,当该线程的负载量小于两倍的剩余待迁移负载量时,终端选择该线程为目标线程。进一步地,终端的调度器将目标线程调度至迁入处理器。When the terminal searches the thread queue, it judges whether to select the found thread as the target thread. Specifically, the terminal judges whether to select the thread as the target thread according to the thread load and the corresponding remaining load to be migrated. More specifically, when the load of the thread is less than twice the remaining load to be migrated, the terminal selects the thread as the target thread. Further, the scheduler of the terminal schedules the target thread to the transfer-in processor.

本实施例中,终端通过计算线程的剩余待迁移负载量,根据剩余待迁移负载量选择目标线程,将目标线程调度至迁入处理器,使得能够选择负载量最合适的线程进行调度,避免了调度的线程负载量过大,从而出现过调度的问题,提高了线程调度的可靠性。In this embodiment, the terminal calculates the remaining load to be migrated of the thread, selects the target thread according to the remaining load to be migrated, and schedules the target thread to the migration processor, so that the thread with the most appropriate load can be selected for scheduling, avoiding the The scheduled thread load is too large, resulting in the problem of over-scheduling, which improves the reliability of thread scheduling.

在其中一个实施例中,线程调度管理方法还包括:判断当前查找的线程队列所对应的线程是否在迁出处理器和迁入处理器上达到负载均衡;若是,则查找下一个线程队列;若否,则继续查找当前线程队列。In one of the embodiments, the thread scheduling management method also includes: judging whether the thread corresponding to the currently searched thread queue has reached load balance on the outgoing processor and the incoming processor; if so, searching for the next thread queue; if If not, continue to search the current thread queue.

由于不同的线程对处理器的需求不同,例如执行预定任务的线程需要被高效地执行,以保证预定任务的执行效率,因而需要保证执行预定任务的线程始终获得更优的处理器。不同的线程占用的处理器时间也不同,例如执行优先级为A的A线程占用的处理器时间为a,执行优先级为B的B线程占用的处理器时间为b,若三个A线程的负载量和一个A线程四个B线程的负载量相同,在负载均衡的前提下,将三个A线程分配在一个处理器上运行,一个A线程和四个B线程分配在另一个处理器上运行,对于运行三个A线程的处理器,一个A线程等待处理器的时间为运行两个A线程的时间,即等待时间为2a,而对于运行一个A线程四个B线程的处理器,A线程等待处理器的时间为运行四个B线程的时间,即等待时间为4b,由于运行两个A线程的时间可能与运行四个B线程的时间不同,则对于两个处理器上的A线程,等待处理器的时间不同,则A线程的执行效率也不同,即A线程在执行效率上并未在各处理器上达到均衡,因此有必要针对不同优先级的线程在各处理器上均衡调度,使得各优先级的线程分别在各处理器上达到均衡。Since different threads have different requirements on processors, for example, threads executing scheduled tasks need to be executed efficiently to ensure the execution efficiency of scheduled tasks, and thus it is necessary to ensure that threads executing scheduled tasks always obtain better processors. The processor time occupied by different threads is also different. For example, the processor time occupied by the A thread with the execution priority of A is a, and the processor time occupied by the B thread with the execution priority of B is b. If three A threads The load is the same as the load of one A thread and four B threads. Under the premise of load balancing, three A threads are allocated to run on one processor, and one A thread and four B threads are allocated to another processor. Running, for a processor running three A threads, the time for one A thread to wait for the processor is the time for running two A threads, that is, the waiting time is 2a, while for a processor running one A thread and four B threads, A The time a thread waits for a processor is the time it takes to run four B threads, that is, the waiting time is 4b. Since the time to run two A threads may be different from the time to run four B threads, then for A threads on two processors , the waiting time for the processor is different, the execution efficiency of the A thread is also different, that is, the execution efficiency of the A thread is not balanced on each processor, so it is necessary to balance the scheduling of threads with different priorities on each processor , so that the threads of each priority are balanced on each processor.

终端判断当前查找的线程队列所对应的线程是否在迁出处理器和迁入处理器上达到负载均衡。具体地,终端获取迁出处理器上该线程队列的线程个数以及迁入处理器上该线程队列的线程个数的差值,当该差值的绝对值小于或等于预设阈值时,则判断当前查找的线程队列所对应的线程在迁出处理器和迁入处理器上已达到负载均衡,当该差值的绝对值大于预设阈值时,则判断当前查找的线程队列所对应的线程在迁出处理器和迁入处理器上未达到负载均衡。The terminal judges whether the thread corresponding to the currently searched thread queue achieves load balance on the outgoing processor and the incoming processor. Specifically, the terminal obtains the difference between the number of threads in the thread queue on the outgoing processor and the number of threads in the thread queue on the incoming processor, and when the absolute value of the difference is less than or equal to the preset threshold, then Judging that the thread corresponding to the currently searched thread queue has reached load balance on the outgoing processor and the incoming processor, when the absolute value of the difference is greater than the preset threshold, then judge the thread corresponding to the currently searched thread queue Load balancing is not achieved on the outgoing and incoming processors.

进一步地,若当前查找的线程队列所对应的线程在迁出处理器和迁入处理器上未达到负载均衡,则终端继续查找当前线程队列。具体地,终端按照优先级队列中线程的存储顺序依次查找当前线程队列,对查找到的线程执行步骤104。若当前查找的线程队列所对应的线程在迁出处理器和迁入处理器上已达到负载均衡,则终端查找下一个线程队列。具体地,终端查找下一个优先级对应的线程队列,执行步骤104。Further, if the threads corresponding to the currently searched thread queue do not achieve load balance between the outgoing processor and the incoming processor, the terminal continues to search for the current thread queue. Specifically, the terminal sequentially searches the current thread queue according to the order in which the threads are stored in the priority queue, and performs step 104 on the found threads. If the threads corresponding to the currently searched thread queue have reached load balance between the outgoing processor and the incoming processor, the terminal searches for the next thread queue. Specifically, the terminal searches for the thread queue corresponding to the next priority, and performs step 104 .

进一步地,终端判断迁出处理器和迁入处理器是否达到负载均衡,若是则结束对线程的查找,即结束对线程的调度,否则继续查找线程队列。具体地,终端将目标线程调度至迁入处理器后,计算当前待迁移负载量,若当前待迁移负载量小于预设值,则结束迁移。Further, the terminal judges whether the outgoing processor and the incoming processor have reached load balance, and if so, ends the thread search, that is, ends the thread scheduling, otherwise, continues to search the thread queue. Specifically, after the terminal schedules the target thread to the transfer-in processor, it calculates the current load to be migrated, and ends the migration if the current load to be migrated is less than a preset value.

本实施例中,若当前查找的线程队列所对应的线程在迁出处理器和迁入处理器上达到负载均衡,终端则查找下一个线程队列进行线程调度,否则继续查找当前线程队列进行线程调度,使得不同优先级的线程在迁出处理器和迁入处理器上达到负载均衡,从而有效提高了线程的执行效率和处理器的利用率。In this embodiment, if the threads corresponding to the currently searched thread queue reach load balance between the outgoing processor and the incoming processor, the terminal will search for the next thread queue for thread scheduling, otherwise continue to search for the current thread queue for thread scheduling , so that the threads of different priorities can achieve load balancing on the outgoing processor and the incoming processor, thereby effectively improving the execution efficiency of the thread and the utilization rate of the processor.

在一个实施例中,判断迁出处理器和迁入处理器是否满足线程迁移条件的步骤包括:当迁出处理器和迁入处理器满足下列条件之一时:1)迁入处理器上运行有执行预定任务的线程;2)迁出处理器上可选的待迁移线程为执行预定任务的线程,且迁入处理器不处于闲置状态;则判断为不满足线程迁移条件;否则判断为满足线程迁移条件。In one embodiment, the step of judging whether the moving-out processor and the moving-in processor meet the thread migration condition includes: when the moving-out processor and the moving-in processor meet one of the following conditions: 1) running on the moving-in processor Threads that execute scheduled tasks; 2) The optional threads to be migrated on the outgoing processor are threads that execute scheduled tasks, and the incoming processor is not in an idle state; then it is judged that the thread migration condition is not met; otherwise, it is judged that the thread is satisfied Migration conditions.

本实施例中,进一步根据执行预定任务的线程对线程迁移条件进行限定,使得执行预定任务的线程在迁移最少的前提下获得最优的处理器,以提高执行预定任务的线程的执行效率。具体地,终端判断迁出处理器和迁入处理器是否满足下列两个条件之一:In this embodiment, the thread migration condition is further limited according to the thread executing the scheduled task, so that the thread executing the scheduled task obtains the optimal processor on the premise of the least migration, so as to improve the execution efficiency of the thread executing the scheduled task. Specifically, the terminal judges whether the outgoing processor and the incoming processor meet one of the following two conditions:

1)迁入处理器上运行有执行预定任务的线程。进一步地,迁入处理器上运行有预定任务线程且在终端所有处理器中执行预定任务的线程的个数非最少。为了保证执行预定任务的线程能够被高效地执行,降低其等待处理器的时间是必要的,当执行预定任务的线程的处理器上线程增多时,执行预定任务的线程等待处理器的时间将增加,因此,可以将在迁入处理器上运行的执行预定任务的线程的个数为终端所有处理器中非最少作为不满足线程迁移的条件。1) There are threads executing scheduled tasks running on the incoming processor. Further, there are scheduled task threads running on the incoming processor and the number of threads executing scheduled tasks among all processors of the terminal is not the minimum. In order to ensure that the thread executing the scheduled task can be executed efficiently, it is necessary to reduce the time it waits for the processor. When the number of threads on the processor of the thread executing the scheduled task increases, the waiting time of the thread executing the scheduled task will increase. , therefore, the number of threads executing scheduled tasks running on the incoming processor is not the least among all processors of the terminal as the condition for not satisfying the thread migration.

2)迁出处理器上可选的待迁移线程仅有一个且为执行预定任务的线程,且迁入处理器不处于闲置状态。其中,可选的待迁移线程为处于处理器的就绪队列上的线程,若处于就绪队列上的线程有且仅有一个且为执行预定任务的线程,而迁入处理器不处于闲置状态,即该执行预定任务的线程若被调度至迁入处理器,无法立即被执行,该线程等待的最少时间为迁入处理器执行完正在占用处理器时间的线程所用的时间,而该线程若不被调度至迁入处理器,也仅需等待当前占用迁出处理器的线程被执行完毕,而终端的调度器在对线程进行调度时需要占用终端的资源和一定的处理时间,影响线程执行效率,因而在此种情况下,可以不作线程调度,即条件2)可以作为不满足线程迁移的条件。2) There is only one optional thread to be migrated on the outgoing processor, which is a thread that executes a predetermined task, and the incoming processor is not in an idle state. Among them, the optional thread to be migrated is the thread on the ready queue of the processor. If there is only one thread on the ready queue and it is a thread executing a predetermined task, and the migrating processor is not in an idle state, that is If the thread executing the scheduled task is scheduled to the transfer-in processor, it cannot be executed immediately. The minimum time for the thread to wait is the time it takes for the transfer-in processor to finish executing the thread that is occupying the processor time. If the thread is not scheduled Scheduling to the moving-in processor only needs to wait for the thread currently occupying the moving-out processor to be executed, while the scheduler of the terminal needs to occupy the resources of the terminal and a certain amount of processing time when scheduling the thread, which affects the thread execution efficiency. Therefore, in this case, thread scheduling may not be performed, that is, condition 2) may be regarded as a condition for not satisfying thread migration.

终端判断迁出处理器和迁入处理器是否满足条件1)的步骤具体为:终端查找迁入处理器,获取迁入处理器上运行的线程的标识,根据线程的标识查找线程标识文件,判断获取的线程的标识是否记录在线程标识文件中,若是,则迁入处理器上运行有执行预定任务的线程,即满足条件1),若否,则不满足。The terminal judges whether the moving-out processor and the moving-in processor meet the condition 1), and the specific steps are: the terminal searches for the moving-in processor, obtains the identifier of the thread running on the moving-in processor, searches for the thread identification file according to the thread identifier, and determines Whether the obtained thread identification is recorded in the thread identification file, if so, then move into the processor and run the thread that executes the scheduled task, that is, satisfy condition 1), if not, then not satisfied.

终端判断迁出处理器和迁入处理器是否满足条件2)的步骤具体为:终端查找迁出处理器,获取迁出处理器的就绪队列上的线程的标识,根据线程的标识查找线程标识文件,判断获取的线程的标识是否记录在线程标识文件中,进一步地,终端获取迁出处理器就绪队列上的线程的标识记录在线程标识文件中的个数。终端查找迁入处理器上的线程,获取迁入处理器上的线程个数。若迁出处理器就绪队列上的线程的标识记录在线程标识文件中的个数为一个,且迁入处理器上的线程个数为一个或多个,则判断满足条件2),否则不满足。The terminal judges whether the moving-out processor and the moving-in processor meet the condition 2), and the specific steps are: the terminal searches for the moving-out processor, obtains the thread ID on the ready queue of the moving-out processor, and searches for the thread ID file according to the thread ID , judging whether the acquired thread identifiers are recorded in the thread identifier file, and further, the terminal obtains the number of thread identifiers recorded in the thread identifier file on the ready queue of the outgoing processor. The terminal searches for threads on the incoming processor, and obtains the number of threads on the incoming processor. If the number of thread identifiers recorded in the thread identifier file on the ready queue of the outgoing processor is one, and the number of threads on the incoming processor is one or more, it is judged that condition 2) is satisfied, otherwise it is not satisfied .

若迁出处理器和迁入处理器满足条件1)或条件2),则终端判断迁出处理器和迁入处理器不满足线程迁移的条件,终端结束线程的迁移。若迁条件1)和条件2)均不满足,则终端判断迁出处理器和迁入处理器满足线程迁移的条件,终端执行步骤102。If the moving-out processor and the moving-in processor meet condition 1) or condition 2), the terminal judges that the moving-out processor and the moving-in processor do not satisfy the thread migration condition, and the terminal ends the thread migration. If both condition 1) and condition 2) are not met, the terminal judges that the outgoing processor and the incoming processor meet the thread migration condition, and the terminal executes step 102 .

本实施例中,当迁入处理器上运行有执行预定任务的线程,或者迁出处理器上可选的待迁移线程仅有一个且为执行预定任务的线程、迁入处理器不处于闲置状态时,结束线程的迁移,从而降低执行预定任务的线程的处理器竞争,使得执行预定任务的线程能够被高效的执行。In this embodiment, when there is a thread executing a predetermined task running on the moving-in processor, or there is only one optional thread to be migrated on the outgoing processor and it is a thread performing a predetermined task, the moving-in processor is not in an idle state When , the migration of the thread is ended, thereby reducing the processor contention of the thread executing the scheduled task, so that the thread executing the scheduled task can be executed efficiently.

在一个实施例中,如图3所示,查找运行于迁出处理器上的线程队列内的步骤包括:In one embodiment, as shown in FIG. 3 , the step of finding the thread queue running on the outgoing processor includes:

步骤302,获取迁出处理器所在的处理器核群信息和迁入处理器所在的处理器核群信息。In step 302, information about a processor core group where the outgoing processor is located and information about a processor core group where the incoming processor is located are acquired.

对于多处理器的终端,处理器可能是同质共构的架构,还可能是异质共构的架构。其中,同质共构是指多个处理器处于相同的处理器核群,同一处理器核群中的多个处理器拥有相同的结构和性能,即拥有相同的时钟频率,也即多个处理线程的效率相同。异质共构是指多个处理器处于多个不同的处理器核群,不同的处理器核群中的处理器拥有不同的结构和性能,其时钟频率也不同,即处理线程的效率不同。因此,有必要针对处理器所在的处理器核群对线程进行调度,从而使得优先级较高的线程优先被调度至处理效率更高的处理器。For a multi-processor terminal, the processor may have a homogeneous co-structure architecture or a heterogeneous co-structure architecture. Among them, homogeneous co-construction means that multiple processors are in the same processor core group, and multiple processors in the same processor core group have the same structure and performance, that is, have the same clock frequency, that is, multiple processors Threads are equally efficient. Heterogeneous co-construction means that multiple processors are located in multiple different processor core groups. The processors in different processor core groups have different structures and performances, and their clock frequencies are also different, that is, the efficiency of processing threads is different. Therefore, it is necessary to schedule threads according to the processor core group where the processor is located, so that threads with higher priority are preferentially scheduled to processors with higher processing efficiency.

本实施例中,终端获取迁出处理器所在的处理器核群信息和迁入处理器所在的处理器核群信息。具体地,终端获取迁出处理器的信息,分析迁出处理器的信息,得到迁出处理器所在的处理器核群信息。同样的,终端获取迁入处理器所在的处理器核群信息。进一步地,终端根据迁出处理器所在的处理器核群信息和迁入处理器所在的处理器核群信息判断迁出处理器所在的处理器核群和迁入处理器所在的处理器核群是否为同一个。In this embodiment, the terminal obtains the processor core group information where the outgoing processor is located and the processor core group information where the incoming processor is located. Specifically, the terminal acquires the information of the outgoing processor, analyzes the information of the outgoing processor, and obtains the information of the processor core group where the outgoing processor is located. Similarly, the terminal acquires information about the processor core group where the incoming processor is located. Further, the terminal judges the processor core group where the outgoing processor is located and the processor core group where the incoming processor is located according to the information about the processor core group where the outgoing processor is located and the information about the processor core group where the incoming processor is located. Is it the same.

步骤304,当迁出处理器与迁入处理器在同一处理器核群时,获取迁出处理器上优先级最高的线程队列内的线程个数;若线程个数为多个,则按照优先级从高至低的顺序查找线程队列,若线程个数为一个,则按照优先级从低至高的顺序查找线程队列。Step 304, when the moving-out processor and the moving-in processor are in the same processor core group, obtain the number of threads in the thread queue with the highest priority on the moving-out processor; Search the thread queue in order of priority from high to low. If the number of threads is one, search the thread queue in order of priority from low to high.

当迁出处理器与迁入处理器在同一处理器核群时。进一步地,终端获取迁出处理器上优先级最高的线程队列内的线程个数,当该线程个数为多个时,终端按照优先级从高至低的顺序查找线程队列。具体地,终端选取优先级最高的线程队列,执行步骤104。若该线程个数为一个,则终端按照优先级从低至高的顺序查找线程队列,执行步骤104。When the moving-out processor and the moving-in processor are in the same processor core group. Further, the terminal acquires the number of threads in the thread queue with the highest priority on the transfer-out processor, and when there are multiple threads, the terminal searches the thread queue in descending order of priority. Specifically, the terminal selects the thread queue with the highest priority, and performs step 104 . If the number of threads is one, the terminal searches the thread queue in order of priority from low to high, and executes step 104 .

本实施例中,当迁出处理器上优先级最高的线程为多个时,从优先级最高的线程队列内的线程开始查找并进一步调度,可以保证优先级最高的线程能够在迁出处理器和迁入处理器上达到负载均衡保证其执行效率,而当迁出处理器上优先级最高的线程仅为一个时,优先从优先级最低的线程队列进行查找,进而进行调度,可以保证在优先级最高的线程在迁出处理器和迁入处理器上负载均衡的前提下不被调度,使得其可以保留在迁出处理器上执行,从而避免了调度过程带来的线程执行效率降低,使得优先级最高的线程始终拥有最高的执行效率。In this embodiment, when there are multiple threads with the highest priority on the outgoing processor, the threads in the thread queue with the highest priority are searched and further scheduled to ensure that the thread with the highest priority can be transferred to the outgoing processor. To achieve load balancing on the incoming processor and to ensure its execution efficiency, and when there is only one thread with the highest priority on the outgoing processor, it will be searched from the thread queue with the lowest priority first, and then scheduled, which can ensure that the thread with the highest priority The thread with the highest level is not scheduled under the premise of load balancing between the outgoing processor and the incoming processor, so that it can be reserved for execution on the outgoing processor, thereby avoiding the reduction in thread execution efficiency caused by the scheduling process, making The thread with the highest priority always has the highest execution efficiency.

在一个实施例中,查找运行于迁出处理器上的线程队列内的步骤包括还包括:步骤306,当迁出处理器所在的处理器核群为小核群,迁入处理器所在的处理器核群为大核群时,执行下列步骤:若迁入处理器上无执行预定任务的线程运行,则按照负载量从高至低的顺序查找执行预定任务线程的线程队列;若迁出处理器上无执行预定任务的线程运行且迁入处理器上运行有执行预定任务的线程,则结束查找。In one embodiment, the step of searching for the thread queue running on the outgoing processor includes: step 306, when the processor core group where the outgoing processor is located is a small core group, the process where the incoming processor is located When the processor core group is a large core group, perform the following steps: If there is no thread running on the scheduled task on the moving-in processor, search for the thread queue of the thread performing the scheduled task in the order of load from high to low; If there is no thread executing the scheduled task running on the processor and there is a thread executing the scheduled task running on the transfer-in processor, the search ends.

其中,对于处理器为异质共构架构的终端,终端内的处理器一般分为大核和小核,大核和小核均具有各自固定的逻辑结构,包括缓存、执行单元、指令级单元和总线接口等逻辑单元。由多个大核组成的核群为大核群,由小核组成的核群为小核群。大核的逻辑单元拥有比小核更优的性能,例如大核的时钟频率比小核的时钟频率大,即大核群的线程执行效率高于小核群的线程执行效率,为保证优先级较高的线程拥有较高的处理效率,有必要考虑小核群和大核群的处理效率来对线程进行调度。Among them, for a terminal with a heterogeneous co-architecture processor, the processor in the terminal is generally divided into a large core and a small core. Both the large core and the small core have their own fixed logical structures, including caches, execution units, and instruction-level units. and logic units such as bus interfaces. A nuclear group composed of multiple large nuclei is called a large nuclear group, and a nuclear group composed of small nuclei is called a small nuclear group. The logic unit of the large core has better performance than the small core. For example, the clock frequency of the large core is higher than that of the small core, that is, the thread execution efficiency of the large core group is higher than that of the small core group. To ensure the priority Higher threads have higher processing efficiency, and it is necessary to consider the processing efficiency of small core groups and large core groups to schedule threads.

本实施例中,当迁出处理器所在的处理器核群为小核群,迁入处理器所在的处理器核群为大核群时,即迁出处理器的线程处理效率低于迁入处理器的线程处理效率时,进一步地,终端判断迁入处理器上是否存在执行预定任务的线程。具体地,终端获取迁入处理器上的线程,查找线程标识文件,判断迁入处理器上的线程的标识是否记录于线程标识文件中,获取迁入处理器上的执行预定任务线程的个数。进一步地,若迁入处理器上无执行预定任务的线程,则终端按照负载量从高至低的顺序查找迁出处理器上的执行预定任务线程的线程队列。具体地,终端获取迁出处理器上的执行预定任务线程及其负载量,根据负载量的大小对执行预定任务的线程进行排序,进一步地,终端按照负载量由大至小的顺序查找执行预定任务线程的线程队列,执行步骤104。若迁出处理器上无执行预定任务的线程运行且迁入处理器上运行有执行预定任务的线程,则结束查找。In this embodiment, when the processor core group where the outgoing processor is located is a small core group, and the processor core group where the incoming processor is located is a large core group, that is, the thread processing efficiency of the outgoing processor is lower than that of the incoming processor. When processing thread processing efficiency of the processor, further, the terminal judges whether there is a thread executing a predetermined task on the incoming processor. Specifically, the terminal acquires the threads on the incoming processor, searches for the thread identification file, determines whether the identification of the thread on the incoming processor is recorded in the thread identification file, and obtains the number of threads executing scheduled tasks on the incoming processor. . Further, if there is no thread executing the scheduled task on the moving-in processor, the terminal searches for the thread queue of the thread executing the scheduled task on the moving-out processor in descending order of load. Specifically, the terminal acquires the scheduled task execution threads and their load on the outgoing processor, sorts the threads for executing the scheduled tasks according to the load, and further, the terminal searches for the scheduled task threads in descending order of the load. For the thread queue of the task thread, go to step 104. If there is no thread executing the scheduled task running on the outgoing processor and there is a thread executing the scheduled task running on the incoming processor, the search ends.

本实施例中,当迁入处理器上执行预定任务的线程时,优先将迁出处理器上负载量最大的执行预定任务的线程调度至迁入处理器,使得能够在调度最少的情况下将执行预定任务的线程在迁出处理器和迁入处理器上达到负载均衡,而当迁入处理器上有执行预定任务的线程而迁出处理器上无执行预定任务的线程时,结束查找,即结束迁出处理器和迁入处理器之间的线程调度,保障执行预定任务的线程能够最大效率的在迁入处理器上执行,从而进一步提高了执行预定任务的效率。In this embodiment, when a thread that executes a scheduled task on the incoming processor, the thread that performs the scheduled task with the largest load on the outgoing processor is preferentially scheduled to the incoming processor, so that the thread can be scheduled with the least amount of scheduling. The thread that executes the scheduled task is load-balanced on the outgoing processor and the incoming processor, and when there is a thread that executes the scheduled task on the incoming processor and there is no thread that executes the scheduled task on the outgoing processor, the search ends. That is, thread scheduling between the outgoing processor and the incoming processor is terminated to ensure that the thread executing the scheduled task can be executed on the incoming processor with maximum efficiency, thereby further improving the efficiency of executing the scheduled task.

在一个实施例中,查找运行于迁出处理器上的线程队列内的步骤包括还包括:步骤308,当迁出处理器所在的处理器核群为大核群,迁入处理器所在的处理器核群为小核群时,执行下列步骤:若迁出处理器上执行预定任务的线程的总负载量为大核群中最大的,则根据线程的负载量从小至大的顺序查找执行预定任务的线程队列;否则结束查找执行预定任务的线程队列。In one embodiment, the step of finding the thread queue running on the outgoing processor includes: step 308, when the processor core group where the outgoing processor is located is a large core group, the process where the incoming processor is located When the processor core group is a small core group, perform the following steps: If the total load of the threads executing scheduled tasks on the outgoing processor is the largest in the large core group, search for the execution schedule according to the order of thread load from small to large. The task's thread queue; otherwise, end looking up the thread queue for executing the scheduled task.

本实施例中,当迁出处理器所在的处理器核群为大核群,迁入处理器所在的处理器核群为小核群时,即迁出处理器的线程处理效率高于迁入处理器的线程处理效率时,进一步地,终端判断迁入处理器上是否存在执行预定任务的线程。具体地,终端获取迁出处理器上执行预定任务的线程及各线程的负载量,将各执行预定任务的线程的负载量求和,得到执行预定任务的线程的总负载量,进一步地,终端获取终端内其他处理器上执行预定任务的线程的总负载量,判断迁出处理器上执行预定任务的线程的总负载量是否为终端内所有处理器上执行预定任务的线程的总负载量中最大的,若是,则终端根据线程的负载量从小至大的顺序查找执行预定任务的线程队列。否则终端结束查找执行预定任务的线程队列,进一步地,终端按照优先级由低至高的顺序查找线程队列,执行步骤104。In this embodiment, when the processor core group where the outgoing processor is located is a large core group, and the processor core group where the incoming processor is located is a small core group, the thread processing efficiency of the outgoing processor is higher than that of the incoming processor. When processing thread processing efficiency of the processor, further, the terminal judges whether there is a thread executing a predetermined task on the incoming processor. Specifically, the terminal acquires the threads executing the scheduled tasks on the outgoing processor and the loads of each thread, and sums the loads of the threads executing the scheduled tasks to obtain the total load of the threads executing the scheduled tasks. Further, the terminal Obtain the total load of threads executing scheduled tasks on other processors in the terminal, and determine whether the total load of threads executing scheduled tasks on the outgoing processor is among the total loads of threads executing scheduled tasks on all processors in the terminal If it is the largest, then the terminal searches the thread queue for executing the scheduled task according to the order of thread load from small to large. Otherwise, the terminal finishes searching the thread queue for executing the predetermined task, further, the terminal searches the thread queue in order of priority from low to high, and executes step 104 .

本实施例中,当迁出处理器上执行预定任务的线程的总负载量最大时,则选择负载量最大的执行预定任务的线程调度至迁入处理器,否则不调度执行预定任务的线程,使得执行预定任务的线程能够最大限度的保留在执行效率更高的迁出处理器上,保证预定任务能够被更高效地执行。In this embodiment, when the total load of the threads executing the scheduled tasks on the outgoing processor is the largest, the thread with the largest load for executing the scheduled tasks is selected and dispatched to the incoming processor; otherwise, the thread executing the scheduled tasks is not scheduled, The thread that executes the scheduled task can be reserved on the outgoing processor with higher execution efficiency to the maximum extent, ensuring that the scheduled task can be executed more efficiently.

在一个实施例中,线程调度管理方法还包括:获取正在运行的线程所对应的存储资源信息;利用存储资源信息统计正在运行的线程在预设时间内访问输入输出设备的次数;若访问输入输出设备的次数大于第一阈值,则将正在运行的线程记录为第一类型线程。In one embodiment, the thread scheduling management method further includes: obtaining the storage resource information corresponding to the running thread; using the storage resource information to count the number of times the running thread accesses the input and output device within a preset time; if accessing the input and output If the number of times of the device is greater than the first threshold, the running thread is recorded as the first type thread.

线程执行的任务存在输入输出(Input/Output,I/O)密集型任务。涉及到网络、磁盘I/O的任务都是I/O密集型任务,这类任务的特点是处理器消耗很少,因为I/O的速度远远低于处理器和内存的速度,任务的大部分时间都在等待I/O操作完成。对于这类任务线程,有必要将其识别出来以便进一步地针对性管理,以提高终端运行速率。There are input/output (Input/Output, I/O) intensive tasks in the tasks performed by threads. Tasks involving network and disk I/O are all I/O-intensive tasks. This type of task is characterized by low processor consumption, because the speed of I/O is far lower than the speed of the processor and memory. Most of the time is spent waiting for I/O operations to complete. For this type of task thread, it is necessary to identify it for further targeted management, so as to improve the operating speed of the terminal.

线程处于运行状态时,线程运行所需要的原始数据来自内存。在线程运行过程中,有些数据可能被频繁读取,这些数据将被存储在寄存器和高速缓存中。当线程运行结束,这些缓存的数据在适当的时候应该写回内存。处于运行状态的线程使用的存储资源可以包括寄存器、高速缓存、内存和外部存储设备等。存储资源的信息可包括线程所使用的存储资源的地址空间。When the thread is in the running state, the original data needed for the thread to run comes from the memory. During thread running, some data may be frequently read, and these data will be stored in registers and caches. When the thread finishes running, these cached data should be written back to memory when appropriate. The storage resources used by threads in the running state may include registers, caches, memory, and external storage devices. The information of the storage resource may include the address space of the storage resource used by the thread.

终端可以根据线程标识文件中记录的线程标识访问线程的存储资源,获取正在运行的线程所使用的存储资源的信息。The terminal can access the storage resource of the thread according to the thread identification recorded in the thread identification file, and obtain the information of the storage resource used by the running thread.

线程的存储资源信息包含有线程运行时的运算数据,包括每一次访问I/O设备的数据,具体包括每一次访问I/O设备时I/O设备的地址信息,以及每一次访问I/O设备的访问时间。终端通过访问线程的存储资源,截取存储资源信息记录的某一个或多个线程持续执行的时间段,即预设时间,统计在此预设时间内存储资源信息中包含的I/O设备的地址信息的数目,该数目即为线程在预设时间内运行时,访问I/O设备的次数。其中,I/O设备的地址信息的种类可以为一种或多种。预设时间仅包括线程持续运行的时间段。The storage resource information of the thread includes the calculation data when the thread is running, including the data of each access to the I/O device, specifically including the address information of the I/O device when each access to the I/O device, and each access to the I/O device The access time of the device. By accessing the storage resource of the thread, the terminal intercepts the time period during which one or more threads are continuously executed in the storage resource information record, that is, the preset time, and counts the addresses of the I/O devices contained in the storage resource information within the preset time The number of messages, which is the number of times the thread accesses the I/O device when it runs within the preset time. Wherein, the types of the address information of the I/O device may be one or more. The preset time includes only the period of time that the thread is running continuously.

本实施例中,终端将统计的正在运行的线程访问I/O设备的次数,与第一阈值进行比较,当访问I/O设备的次数大于第一阈值时,在线程标识文件中增添第一类型线程,并将该正在运行的线程标识与之对应记录。其中,第一阈值为一预设的大于0的常量,本领域技术人员可根据具体的终端标准对其取值。第一类型线程即为执行I/O密集型任务的线程。In this embodiment, the terminal compares the counted number of times the running thread accesses the I/O device with the first threshold, and when the number of accesses to the I/O device is greater than the first threshold, the terminal adds the first threshold to the thread identification file. Type thread, and record the running thread ID corresponding to it. Wherein, the first threshold is a preset constant greater than 0, and those skilled in the art can set the value according to specific terminal standards. The first type of thread is a thread that performs I/O-intensive tasks.

在多处理器的终端中,同时正在运行的线程可能为多个,此时,终端将访问所有正在运行的线程的存储资源,分别获取正在运行的线程所对应的存储资源信息,并统计各个正在运行的线程在预设时间内访问输入输出设备的次数,分别与第一阈值进行比较,识别记录下所有正在运行的线程中的第一类型线程。In a multi-processor terminal, there may be multiple threads running at the same time. At this time, the terminal will access the storage resources of all running threads, respectively obtain the storage resource information corresponding to the running threads, and count each running thread. The number of times the running thread accesses the input and output device within the preset time is compared with the first threshold, and the first type of thread among all the running threads is identified and recorded.

进一步地,终端对处理器上的线程设置优先级。具体地,终端将线程优先级设为四个等级,即1、2、3、4,其中1为最高优先级,2、3、4依次降低。终端将执行预定任务的线程的优先级设为1,将第一类型线程的优先级设为2,其他线程的优先级设为3,除执行预定任务的线程和第一类型线程以外的其他线程的优先级设为4。终端的线程调度器根据优先级对线程进行调度。Further, the terminal sets priorities for threads on the processor. Specifically, the terminal sets thread priorities to four levels, namely 1, 2, 3, and 4, wherein 1 is the highest priority, and 2, 3, and 4 are successively lowered. The terminal sets the priority of the thread executing the scheduled task as 1, sets the priority of the first type of thread as 2, and sets the priority of other threads as 3, and sets the priority of other threads except the thread executing the scheduled task and the first type of thread The priority is set to 4. The terminal's thread scheduler schedules threads according to priority.

如图4a所示,第一处理器(CPU0)上执行的有线程A,其中线程A为执行预定任务的执行预定任务的线程,线程A的优先级为1,第二处理器(CPU1)上执行的有线程B1和线程B2,线程B1和线程B2的优先级均已被设置为3。其中,线程B2为线程A所唤醒的线程,线程B1不是由线程A所唤醒的线程,如图4b所示,当CPU0的性能优于CPU1的性能,终端需要从CPU1上调度线程至CPU0时,终端临时将线程B2的优先级设置为2,线程调度器在CPU1上选择优先级更高的线程B2,将线程B2调度至CPU0,使得线程B2能够优先获得唤醒其的线程A所在的第一处理器,从而保障线程A执行的预定任务高效地执行。As shown in Figure 4a, thread A is executed on the first processor (CPU0), wherein thread A is a thread for performing a predetermined task, and the priority of thread A is 1, and thread A is executed on the second processor (CPU1). There are thread B1 and thread B2 being executed, and the priorities of thread B1 and thread B2 have been set to 3. Among them, thread B2 is a thread awakened by thread A, and thread B1 is not a thread awakened by thread A. As shown in Figure 4b, when the performance of CPU0 is better than that of CPU1, and the terminal needs to schedule threads from CPU1 to CPU0, The terminal temporarily sets the priority of thread B2 to 2, and the thread scheduler selects thread B2 with a higher priority on CPU1, and schedules thread B2 to CPU0, so that thread B2 can preferentially obtain the first processing of thread A that wakes it up. device, so as to ensure that the scheduled tasks executed by thread A are executed efficiently.

通过本实施例的线程调度管理方法,终端统计正在运行的线程在预设时间内访问I/O设备的次数,与第一阈值进行比较,识别出并记录下线程中的I/O密集型任务线程,对执行I/O密集型任务的线程设置高于其他线程的优先级,使得执行I/O密集型任务的线程能够获得比其他线程更优的处理器,从而进一步提高了预定任务的执行效率。Through the thread scheduling management method of this embodiment, the terminal counts the number of times the running thread accesses the I/O device within the preset time, compares it with the first threshold, identifies and records the I/O-intensive tasks in the thread Threads, which set the priority of threads that perform I/O-intensive tasks higher than other threads, so that threads that perform I/O-intensive tasks can obtain better processors than other threads, thereby further improving the execution of scheduled tasks efficiency.

在一个实施例中,线程调度管理方法还包括:获取正在运行的线程所对应的存储资源信息;利用存储资源信息统计正在运行的线程在预设时间内访问内存的次数;若访问内存的次数大于第二阈值,则将正在运行的线程记录为第二类型线程。In one embodiment, the thread scheduling management method further includes: obtaining the storage resource information corresponding to the running thread; using the storage resource information to count the number of times the running thread accesses the memory within a preset time; if the number of accesses to the memory is greater than second threshold, the running thread is recorded as the second type of thread.

线程执行的任务还存在计算密集型任务。计算密集型任务的特点是要进行大量的计算,消耗处理器,例如计算圆周率、对视频进行高清解码等等。对于执行计算密集型任务的线程,其运行效率十分依赖于获得处理器的概率,因此,识别出计算密集型任务以对其进一步针对性管理有利于提高终端的运行速率。There are also computationally intensive tasks performed by threads. Computation-intensive tasks are characterized by a large number of calculations that consume processors, such as calculating pi, decoding high-definition videos, and so on. For threads that execute computation-intensive tasks, their operating efficiency is very dependent on the probability of obtaining a processor. Therefore, identifying computation-intensive tasks for further targeted management is beneficial to improving the operating speed of the terminal.

当线程对处理器发出指令请求运算时,这些指令和数据暂存在内存里,在处理器空闲时传送给处理器,即线程每一次对处理器发出指令时,都会访问内存以暂存指令和相关数据。因此,统计线程在一定时间内访问内存的次数即可获得线程在一定时间内请求处理器的次数,从而判断其是否为执行计算密集型任务的线程。When a thread issues instructions to the processor to request operations, these instructions and data are temporarily stored in the memory and sent to the processor when the processor is idle, that is, each time the thread issues an instruction to the processor, it will access the memory to temporarily store instructions and related data. data. Therefore, by counting the number of times a thread accesses memory within a certain period of time, the number of times the thread requests the processor within a certain period of time can be obtained, so as to determine whether it is a thread performing a computationally intensive task.

本实施例中,终端根据文件中记录的线程标识访问线程的存储资源,获取正在运行的线程所使用的存储资源的信息。In this embodiment, the terminal accesses the storage resource of the thread according to the thread identifier recorded in the file, and obtains information about the storage resource used by the running thread.

线程的存储资源信息包括线程运行时的运算数据,运算数据包括每一次访问内存操作的数据,具体包括每一次访问内存时内存的地址信息,内存中每一条内存的地址信息均对应有一个访问时间。终端通过访问线程的存储资源,截取存储资源信息记录的某一个或多个线程持续执行的时间段,即预设时间,统计在此预设时间内存储资源信息中包含的内存的地址信息的数目,该数目即为线程在运行预设时间内访问内存的次数。其中,内存的地址信息的种类可以为一种或多种。The storage resource information of the thread includes the operation data when the thread is running. The operation data includes the data of each memory access operation, specifically including the address information of the memory each time the memory is accessed. Each piece of memory address information in the memory corresponds to an access time. . By accessing the storage resource of the thread, the terminal intercepts the time period during which one or more threads are continuously executed in the storage resource information record, that is, the preset time, and counts the number of address information of the memory contained in the storage resource information within the preset time , the number is the number of times the thread accesses the memory within the running preset time. Wherein, the types of the address information of the memory may be one or more.

终端将统计的正在运行的线程访问内存的次数,与第二阈值进行比较,当访问内存的次数大于第二阈值时,在线程标识文件中增添第二类型线程,并将该正在运行的线程标识与之对应记录。其中,第二阈值为一预设的大于0的常量,本领域技术人员可根据具体的终端标准对其取值。第二类型线程即为执行计算密集型任务的线程。The terminal compares the counted number of times the running thread accesses the memory with the second threshold, and when the number of accesses to the memory is greater than the second threshold, adds the second type of thread in the thread identification file, and marks the running thread as record corresponding to it. Wherein, the second threshold is a preset constant greater than 0, and those skilled in the art can set the value according to specific terminal standards. The second type of thread is a thread that performs computationally intensive tasks.

在多处理器的终端中,同时正在运行的线程可能为多个,此时,终端将访问所有正在运行的线程的存储资源,分别获取正在运行的线程所对应的存储资源信息,并分别统计各个正在运行的线程在预设时间内访问内存的次数,分别与第二阈值进行比较,识别记录下所有正在运行的线程中的第二类型线程。In a multi-processor terminal, there may be multiple running threads at the same time. At this time, the terminal will access the storage resources of all running threads, respectively obtain the storage resource information corresponding to the running threads, and count each The number of times the running threads access the memory within the preset time is compared with the second threshold, and the second type of thread among all the running threads is identified and recorded.

进一步地,终端对处理器上的线程设置优先级。具体地,终端将线程优先级设为四个等级,即1、2、3、4,其中1为最高优先级,2、3、4依次降低。终端将执行预定任务的线程的优先级设为1,将第二类型线程的优先级设为2,其他线程的优先级设为3,除执行预定任务的线程和第二类型线程以外的其他线程的优先级设为4。终端的线程调度器根据优先级对线程进行调度。Further, the terminal sets priorities for threads on the processor. Specifically, the terminal sets thread priorities to four levels, that is, 1, 2, 3, and 4, wherein 1 is the highest priority, and 2, 3, and 4 are successively lowered. The terminal sets the priority of the thread executing the scheduled task to 1, sets the priority of the second type thread to 2, and sets the priority of other threads to 3, and sets the priority of other threads except the thread executing the scheduled task and the second type thread The priority is set to 4. The terminal's thread scheduler schedules threads according to priority.

通过本实施例的线程调度管理方法,终端统计正在运行的线程在预设时间内访问内存的次数,与第二阈值进行比较,识别出并记录下线程中的计算密集型任务线程,对执行计算密集型任务的线程设置高于其他线程的优先级,使得执行计算密集型任务的线程能够获得比其他线程更优的处理器,从而进一步提高了预定任务的执行效率。Through the thread scheduling management method of this embodiment, the terminal counts the number of times the running thread accesses the memory within a preset time, compares it with the second threshold, identifies and records the calculation-intensive task thread in the thread, and executes the calculation. The priority of the threads of intensive tasks is set higher than that of other threads, so that the threads executing calculation-intensive tasks can obtain better processors than other threads, thereby further improving the execution efficiency of scheduled tasks.

应该理解的是,虽然图1和图3的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,图1和图3中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the various steps in the flowcharts of FIG. 1 and FIG. 3 are shown sequentially as indicated by the arrows, these steps are not necessarily executed sequentially in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least some of the steps in FIG. 1 and FIG. 3 may include multiple sub-steps or multiple stages, these sub-steps or stages are not necessarily executed at the same time, but may be executed at different times, these sub-steps or The execution order of the stages is not necessarily performed sequentially, but may be executed alternately or alternately with at least a part of other steps or substeps of other steps or stages.

在一个实施例中,如图5所示,提供了一种线程调度管理装置,包括:选择模块510、查找模块520和调度模块530,其中:In one embodiment, as shown in FIG. 5 , a thread scheduling management device is provided, including: a selection module 510, a search module 520 and a scheduling module 530, wherein:

选择模块510,用于选择迁出处理器和迁入处理器,判断迁出处理器和迁入处理器是否满足线程迁移条件;其中,迁出处理器包括一个或多个线程队列。The selection module 510 is configured to select a transfer-out processor and a transfer-in processor, and determine whether the transfer-out processor and the transfer-in processor meet the thread migration condition; wherein, the transfer-out processor includes one or more thread queues.

查找模块520,用于若满足迁移条件,查找运行于迁出处理器上的线程队列内的线程,计算查找到的线程对应的剩余待迁移负载量。The search module 520 is configured to search for threads running in the thread queue on the outgoing processor if the migration condition is satisfied, and calculate the remaining load to be migrated corresponding to the found threads.

调度模块530,用于根据剩余待迁移负载量选择目标线程,将目标线程调度至迁入处理器。The scheduling module 530 is configured to select a target thread according to the remaining load to be migrated, and schedule the target thread to the migrating processor.

在一个实施例中,选择模块还用于当迁出处理器和迁入处理器满足下列条件之一时:迁入处理器上运行有执行预定任务的线程;迁出处理器上可选的待迁移线程仅有一个且为执行预定任务的线程,迁入处理器不处于闲置状态;则判断为不满足线程迁移条件;否则判断为满足线程迁移条件。In one embodiment, the selection module is also used to meet one of the following conditions when the outgoing processor and the incoming processor meet one of the following conditions: the incoming processor runs threads that perform predetermined tasks; If there is only one thread and it is a thread executing a predetermined task, and the transfer-in processor is not in an idle state; then it is judged that the thread migration condition is not satisfied; otherwise, it is judged that the thread migration condition is satisfied.

在一个实施例中,查找模块还用于获取迁出处理器所在的处理器核群信息和迁入处理器所在的处理器核群信息;当迁出处理器与迁入处理器在同一处理器核群时,获取迁出处理器上优先级最高的线程队列内的线程个数;若线程个数为多个,则按照优先级从高至低的顺序查找线程队列;若线程个数为一个,则按照优先级从低至高的顺序查找线程队列。In one embodiment, the search module is also used to obtain the processor core group information where the outgoing processor is located and the processor core group information where the incoming processor is located; when the outgoing processor and the incoming processor are in the same processor When the core group is used, obtain the number of threads in the thread queue with the highest priority on the outgoing processor; if there are multiple threads, search the thread queue in order of priority from high to low; if the number of threads is one , search the thread queue in order of priority from low to high.

在一个实施例中,查找模块还用于当迁出处理器所在的处理器核群为小核群,迁入处理器所在的处理器核群为大核群时,执行下列步骤:若迁入处理器上无执行预定任务的线程运行,则按照负载量从高至低的顺序查找执行预定任务线程的线程队列;若迁出处理器上无执行预定任务的线程运行且迁入处理器上运行有执行预定任务的线程,则结束查找。In one embodiment, the search module is also used to perform the following steps when the processor core group where the outgoing processor is located is a small core group and the processor core group where the incoming processor is located is a large core group: If there is no thread executing the scheduled task running on the processor, search for the thread queue of the thread executing the scheduled task in the order of the load from high to low; If there are threads executing scheduled tasks, the search ends.

在一个实施例中,查找模块还用于当迁出处理器所在的处理器核群为大核群,迁入处理器所在的处理器核群为小核群时,执行下列步骤:若迁出处理器上执行预定任务的线程的总负载量为大核群中最大的,则根据线程的负载量从小至大的顺序查找执行预定任务的线程队列;否则结束查找执行预定任务的线程队列。In one embodiment, the search module is also used to perform the following steps when the processor core group where the outgoing processor is located is a large core group and the processor core group where the incoming processor is located is a small core group: If the total load of threads executing scheduled tasks on the processor is the largest in the large core group, search for thread queues for executing scheduled tasks according to the order of thread loads from small to large; otherwise, end the search for thread queues for executing scheduled tasks.

在一个实施例中,线程调度管理装置还包括:分类模块,用于获取正在运行的线程所对应的存储资源信息;利用存储资源信息统计正在运行的线程在预设时间内访问输入输出设备的次数;若访问输入输出设备的次数大于第一阈值,则将正在运行的线程记录为第一类型线程。In one embodiment, the thread scheduling management device further includes: a classification module, configured to acquire storage resource information corresponding to the running thread; use the storage resource information to count the number of times the running thread accesses the input and output device within a preset time ; If the number of accesses to the input and output devices is greater than the first threshold, record the running thread as the first type thread.

在一个实施例中,分类模块还用于获取正在运行的线程所对应的存储资源信息;利用存储资源信息统计正在运行的线程在预设时间内访问内存的次数;若访问内存的次数大于第二阈值,则将正在运行的线程记录为第二类型线程。In one embodiment, the classification module is also used to obtain the storage resource information corresponding to the running thread; use the storage resource information to count the number of times the running thread accesses the memory within a preset time; if the number of accesses to the memory is greater than the second threshold, the running thread is recorded as a second type thread.

关于线程调度管理装置的具体限定可以参见上文中对于线程调度管理方法的限定,在此不再赘述。上述线程调度管理装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。For the specific limitations of the thread scheduling management device, please refer to the above definition of the thread scheduling management method, which will not be repeated here. Each module in the above-mentioned thread scheduling management device can be fully or partially realized by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, and can also be stored in the memory of the computer device in the form of software, so that the processor can invoke and execute the corresponding operations of the above-mentioned modules.

在一个实施例中,提供了一种计算机设备,该计算机设备可以是终端,其内部结构图可以如图6所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口、显示屏和输入装置。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统和计算机程序。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种线程调度管理方法。该计算机设备的显示屏可以是液晶显示屏或者电子墨水显示屏,该计算机设备的输入装置可以是显示屏上覆盖的触摸层,也可以是计算机设备外壳上设置的按键、轨迹球或触控板,还可以是外接的键盘、触控板或鼠标等。In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure may be as shown in FIG. 6 . The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Wherein, the processor of the computer device is used to provide calculation and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a thread scheduling management method is realized. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covered on the display screen, or a button, a trackball or a touch pad provided on the casing of the computer device , and can also be an external keyboard, touchpad, or mouse.

本领域技术人员可以理解,图6中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art can understand that the structure shown in FIG. 6 is only a block diagram of a part of the structure related to the solution of this application, and does not constitute a limitation on the computer equipment to which the solution of this application is applied. The specific computer equipment can be More or fewer components than shown in the figures may be included, or some components may be combined, or have a different arrangement of components.

在一个实施例中,提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行计算机程序时实现以下步骤:选择迁出处理器和迁入处理器,判断迁出处理器和迁入处理器是否满足线程迁移条件;其中,迁出处理器包括一个或多个线程队列;若是,查找运行于迁出处理器上的线程队列内的线程,计算查找到的线程对应的剩余待迁移负载量;根据剩余待迁移负载量选择目标线程,将目标线程调度至迁入处理器。In one embodiment, a computer device is provided, which includes a memory, a processor, and a computer program stored on the memory and operable on the processor. When the processor executes the computer program, the following steps are implemented: selecting the outgoing processor and Move-in processor, judge whether the move-out processor and the move-in processor meet the thread migration condition; wherein, the move-out processor includes one or more thread queues; if so, find the threads running in the thread queue on the move-out processor Thread, calculate the remaining load to be migrated corresponding to the found thread; select the target thread according to the remaining load to be migrated, and schedule the target thread to the migration processor.

在一个实施例中,处理器执行计算机程序时还实现以下步骤:当迁出处理器和迁入处理器满足下列条件之一时:迁入处理器上运行有执行预定任务的线程;迁出处理器上可选的待迁移线程仅有一个且为执行预定任务的线程,迁入处理器不处于闲置状态;则判断为不满足线程迁移条件;否则判断为满足线程迁移条件。In one embodiment, when the processor executes the computer program, the following steps are also implemented: when the moving-out processor and the moving-in processor meet one of the following conditions: the moving-in processor runs a thread for performing a predetermined task; the moving-out processor If there is only one optional thread to be migrated and it is a thread that executes a predetermined task, and the transfer-in processor is not in an idle state; then it is judged that the thread migration condition is not satisfied; otherwise, it is judged that the thread migration condition is satisfied.

在一个实施例中,处理器执行计算机程序时还实现以下步骤:获取迁出处理器所在的处理器核群信息和迁入处理器所在的处理器核群信息;当迁出处理器与迁入处理器在同一处理器核群时,获取迁出处理器上优先级最高的线程队列内的线程个数;若线程个数为多个,则按照优先级从高至低的顺序查找线程队列;若线程个数为一个,则按照优先级从低至高的顺序查找线程队列。In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining the processor core group information where the outgoing processor is located and the processor core group information where the incoming processor is located; When the processor is in the same processor core group, obtain the number of threads in the thread queue with the highest priority on the outgoing processor; if there are multiple threads, search the thread queue in order of priority from high to low; If the number of threads is one, search the thread queue in order of priority from low to high.

在一个实施例中,处理器执行计算机程序时还实现以下步骤:当迁出处理器所在的处理器核群为小核群,迁入处理器所在的处理器核群为大核群时,执行下列步骤:若迁入处理器上无执行预定任务的线程运行,则按照负载量从高至低的顺序查找执行预定任务线程的线程队列;若迁出处理器上无执行预定任务的线程运行且迁入处理器上运行有执行预定任务的线程,则结束查找。In one embodiment, when the processor executes the computer program, the following steps are also implemented: when the processor core group where the outgoing processor is located is a small core group, and the processor core group where the incoming processor is located is a large core group, execute The following steps: if there is no thread executing the scheduled task on the moving-in processor, search for the thread queue of the thread executing the scheduled task in the order of load from high to low; if there is no thread executing the scheduled task running on the moving-out processor and If there are threads executing scheduled tasks running on the incoming processor, the search ends.

在一个实施例中,处理器执行计算机程序时还实现以下步骤:当迁出处理器所在的处理器核群为大核群,迁入处理器所在的处理器核群为小核群时,执行下列步骤:若迁出处理器上执行预定任务的线程的总负载量为大核群中最大的,则根据线程的负载量从小至大的顺序查找执行预定任务的线程队列;否则结束查找执行预定任务的线程队列。In one embodiment, when the processor executes the computer program, the following steps are also implemented: when the processor core group where the outgoing processor is located is a large core group, and the processor core group where the incoming processor is located is a small core group, execute The following steps: if the total load of the thread that performs the scheduled task on the outgoing processor is the largest in the large core group, then search for the thread queue that performs the scheduled task according to the load of the thread from small to large; otherwise, end the search and execute the scheduled task A thread queue for tasks.

在一个实施例中,处理器执行计算机程序时还实现以下步骤:获取正在运行的线程所对应的存储资源信息;利用存储资源信息统计正在运行的线程在预设时间内访问输入输出设备的次数;若访问输入输出设备的次数大于第一阈值,则将正在运行的线程记录为第一类型线程。In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining the storage resource information corresponding to the running thread; using the storage resource information to count the number of times the running thread accesses the input and output device within a preset time; If the number of accesses to the input and output devices is greater than the first threshold, the running thread is recorded as the first type thread.

在一个实施例中,处理器执行计算机程序时还实现以下步骤:获取正在运行的线程所对应的存储资源信息;利用存储资源信息统计正在运行的线程在预设时间内访问内存的次数;若访问内存的次数大于第二阈值,则将正在运行的线程记录为第二类型线程。In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining the storage resource information corresponding to the running thread; using the storage resource information to count the number of times the running thread accesses the memory within a preset time; If the memory count is greater than the second threshold, the running thread is recorded as the second type thread.

在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现以下步骤:选择迁出处理器和迁入处理器,判断迁出处理器和迁入处理器是否满足线程迁移条件;其中,迁出处理器包括一个或多个线程队列;若是,查找运行于迁出处理器上的线程队列内的线程,计算查找到的线程对应的剩余待迁移负载量;根据剩余待迁移负载量选择目标线程,将目标线程调度至迁入处理器。In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: selecting a moving-out processor and a moving-in processor, determining whether the moving-out processor and whether the migrating-in processor meets the thread migration condition; wherein, the migrating-out processor includes one or more thread queues; if so, find the threads running in the thread queue on the migrating-out processor, and calculate the remaining thread corresponding to the found thread The amount of load to be migrated; the target thread is selected according to the remaining load to be migrated, and the target thread is scheduled to the migration processor.

在一个实施例中,计算机程序被处理器执行时还实现以下步骤:当迁出处理器和迁入处理器满足下列条件之一时:迁入处理器上运行有执行预定任务的线程;迁出处理器上可选的待迁移线程仅有一个且为执行预定任务的线程,迁入处理器不处于闲置状态;则判断为不满足线程迁移条件;否则判断为满足线程迁移条件。In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when the moving-out processor and the moving-in processor meet one of the following conditions: the moving-in processor runs a thread for performing a predetermined task; the moving-out processing If there is only one optional thread to be migrated on the processor and it is a thread that executes a predetermined task, and the migrating processor is not in an idle state; then it is judged that the thread migration condition is not satisfied; otherwise, it is judged that the thread migration condition is satisfied.

在一个实施例中,计算机程序被处理器执行时还实现以下步骤:获取迁出处理器所在的处理器核群信息和迁入处理器所在的处理器核群信息;当迁出处理器与迁入处理器在同一处理器核群时,获取迁出处理器上优先级最高的线程队列内的线程个数;若线程个数为多个,则按照优先级从高至低的顺序查找线程队列;若线程个数为一个,则按照优先级从低至高的顺序查找线程队列。In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining information about the processor core group where the outgoing processor is located and information about the processor core group where the incoming processor is located; When the incoming processor is in the same processor core group, obtain the number of threads in the thread queue with the highest priority on the outgoing processor; if there are multiple threads, search the thread queue in order of priority from high to low ; If the number of threads is one, search the thread queue in order of priority from low to high.

在一个实施例中,计算机程序被处理器执行时还实现以下步骤:当迁出处理器所在的处理器核群为小核群,迁入处理器所在的处理器核群为大核群时,执行下列步骤:若迁入处理器上无执行预定任务的线程运行,则按照负载量从高至低的顺序查找执行预定任务线程的线程队列;若迁出处理器上无执行预定任务的线程运行且迁入处理器上运行有执行预定任务的线程,则结束查找。In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when the processor core group where the outgoing processor is located is a small core group, and the processor core group where the incoming processor is located is a large core group, Perform the following steps: If there is no thread executing the scheduled task running on the moving-in processor, search for the thread queue of the thread executing the scheduled task in the order of load from high to low; if there is no thread executing the scheduled task running on the moving-out processor And if there are threads executing scheduled tasks running on the incoming processor, the search ends.

在一个实施例中,计算机程序被处理器执行时还实现以下步骤:当迁出处理器所在的处理器核群为大核群,迁入处理器所在的处理器核群为小核群时,执行下列步骤:若迁出处理器上执行预定任务的线程的总负载量为大核群中最大的,则根据线程的负载量从小至大的顺序查找执行预定任务的线程队列;否则结束查找执行预定任务的线程队列。In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when the processor core group where the outgoing processor is located is a large core group, and the processor core group where the incoming processor is located is a small core group, Execute the following steps: if the total load of the threads executing the scheduled tasks on the outgoing processor is the largest in the large core group, then search for the thread queues that execute the scheduled tasks in order of the thread loads from small to large; otherwise, end the search execution Thread queue for scheduled tasks.

在一个实施例中,计算机程序被处理器执行时还实现以下步骤:获取正在运行的线程所对应的存储资源信息;利用存储资源信息统计正在运行的线程在预设时间内访问输入输出设备的次数;若访问输入输出设备的次数大于第一阈值,则将正在运行的线程记录为第一类型线程。In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining the storage resource information corresponding to the running thread; using the storage resource information to count the number of times the running thread accesses the input and output device within a preset time ; If the number of accesses to the input and output devices is greater than the first threshold, record the running thread as the first type thread.

在一个实施例中,计算机程序被处理器执行时还实现以下步骤:获取正在运行的线程所对应的存储资源信息;利用存储资源信息统计正在运行的线程在预设时间内访问内存的次数;若访问内存的次数大于第二阈值,则将正在运行的线程记录为第二类型线程。In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining the storage resource information corresponding to the running thread; using the storage resource information to count the number of times the running thread accesses the memory within a preset time; if If the number of memory access times is greater than the second threshold, the running thread is recorded as the second type thread.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented through computer programs to instruct related hardware, and the computer programs can be stored in a non-volatile computer-readable memory In the medium, when the computer program is executed, it may include the processes of the embodiments of the above-mentioned methods. Wherein, any references to memory, storage, database or other media used in the various embodiments provided in the present application may include non-volatile and/or volatile memory. Nonvolatile memory can include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Chain Synchlink DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined arbitrarily. To make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be It is considered to be within the range described in this specification.

以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only represent several implementation modes of the present application, and the description thereof is relatively specific and detailed, but it should not be construed as limiting the scope of the patent for the invention. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the scope of protection of the patent application should be based on the appended claims.

Claims (10)

1.一种线程调度管理方法,所述方法包括:1. A thread scheduling management method, said method comprising: 选择迁出处理器和迁入处理器,判断迁出处理器和迁入处理器是否满足线程迁移条件;其中,所述迁出处理器包括一个或多个线程队列;Selecting the outgoing processor and the incoming processor, and judging whether the outgoing processor and the incoming processor meet the thread migration condition; wherein, the outgoing processor includes one or more thread queues; 若是,查找运行于迁出处理器上的线程队列内的线程,计算查找到的线程对应的剩余待迁移负载量;If yes, find the threads running in the thread queue on the outgoing processor, and calculate the remaining load to be migrated corresponding to the found threads; 根据剩余待迁移负载量选择目标线程,将所述目标线程调度至迁入处理器。A target thread is selected according to the remaining load to be migrated, and the target thread is scheduled to the transfer-in processor. 2.根据权利要求1所述的线程调度管理方法,其特征在于,所述判断迁出处理器和迁入处理器是否满足线程迁移条件的步骤包括:2. The thread scheduling management method according to claim 1, wherein the step of judging whether the moving-out processor and the moving-in processor satisfy the thread migration condition comprises: 当迁出处理器和迁入处理器满足下列条件之一时:When the outgoing processor and incoming processor meet one of the following conditions: 迁入处理器上运行有执行预定任务的线程;There are threads executing scheduled tasks running on the incoming processor; 迁出处理器上可选的待迁移线程仅有一个且为执行预定任务的线程,迁入处理器不处于闲置状态;There is only one optional thread to be migrated on the outgoing processor and it is a thread that executes a scheduled task, and the incoming processor is not idle; 则判断为不满足线程迁移条件;否则判断为满足线程迁移条件。Then it is judged that the thread migration condition is not satisfied; otherwise, it is judged that the thread migration condition is satisfied. 3.根据权利要求1所述的线程调度管理方法,其特征在于,所述查找运行于迁出处理器上的线程队列内的步骤包括:3. The thread scheduling management method according to claim 1, wherein the step of searching and running in the thread queue on the outgoing processor comprises: 获取所述迁出处理器所在的处理器核群信息和迁入处理器所在的处理器核群信息;Acquiring the processor core group information where the outgoing processor is located and the processor core group information where the incoming processor is located; 当所述迁出处理器与所述迁入处理器在同一处理器核群时,获取迁出处理器上优先级最高的线程队列内的线程个数;When the moving-out processor and the moving-in processor are in the same processor core group, obtain the number of threads in the thread queue with the highest priority on the moving-out processor; 若所述线程个数为多个,则按照优先级从高至低的顺序查找线程队列;If the number of threads is multiple, search the thread queue in order of priority from high to low; 若所述线程个数为一个,则按照优先级从低至高的顺序查找线程队列。If the number of threads is one, the thread queue is searched in order of priority from low to high. 4.根据权利要求3所述的线程调度管理方法,其特征在于,所述方法还包括:4. The thread scheduling management method according to claim 3, wherein the method further comprises: 当所述迁出处理器所在的处理器核群为小核群,迁入处理器所在的处理器核群为大核群时,执行下列步骤:When the processor core group where the moving-out processor is located is a small core group, and the processor core group where the moving-in processor is located is a large core group, perform the following steps: 若迁入处理器上无执行预定任务的线程运行,则按照负载量从高至低的顺序查找执行预定任务线程的线程队列;If there is no thread executing the scheduled task running on the incoming processor, search for the thread queue of the thread executing the scheduled task in the order of load from high to low; 若迁出处理器上无执行预定任务的线程运行且迁入处理器上运行有执行预定任务的线程,则结束查找。If there is no thread executing the scheduled task running on the outgoing processor and there is a thread executing the scheduled task running on the incoming processor, the search ends. 5.根据权利要求3所述的线程调度管理方法,其特征在于,所述方法还包括:5. The thread scheduling management method according to claim 3, wherein the method further comprises: 当所述迁出处理器所在的处理器核群为大核群,迁入处理器所在的处理器核群为小核群时,执行下列步骤:When the processor core group where the moving-out processor is located is a large core group, and the processor core group where the moving-in processor is located is a small core group, perform the following steps: 若迁出处理器上执行预定任务的线程的总负载量为大核群中最大的,则根据线程的负载量从小至大的顺序查找执行预定任务的线程队列;否则结束查找执行预定任务的线程队列。If the total load of the threads executing scheduled tasks on the outgoing processor is the largest in the large core group, then search the thread queue for executing scheduled tasks according to the order of thread loads from small to large; otherwise, end the search for threads that execute scheduled tasks queue. 6.根据权利1所述的方法,其特征在于,所述方法还包括:6. The method according to claim 1, wherein the method further comprises: 获取正在运行的线程所对应的存储资源信息;Obtain the storage resource information corresponding to the running thread; 利用所述存储资源信息统计所述正在运行的线程在预设时间内访问输入输出设备的次数;Using the storage resource information to count the number of times the running thread accesses the input and output device within a preset time; 若所述访问输入输出设备的次数大于第一阈值,则将所述正在运行的线程记录为第一类型线程。If the number of accesses to the input and output device is greater than a first threshold, record the running thread as a first type thread. 7.根据权利1所述的方法,其特征在于,所述方法还包括:7. The method according to claim 1, wherein the method further comprises: 获取正在运行的线程所对应的存储资源信息;Obtain the storage resource information corresponding to the running thread; 利用所述存储资源信息统计所述正在运行的线程在预设时间内访问内存的次数;Using the storage resource information to count the number of times the running thread accesses the memory within a preset time; 若所述访问内存的次数大于第二阈值,则将所述正在运行的线程记录为第二类型线程。If the number of memory access times is greater than a second threshold, record the running thread as a second type thread. 8.一种线程调度管理装置,其特征在于,所述装置包括:8. A thread scheduling management device, characterized in that the device comprises: 选择模块,用于选择迁出处理器和迁入处理器,判断迁出处理器和迁入处理器是否满足线程迁移条件;其中,所述迁出处理器包括一个或多个线程队列;The selection module is used to select the outgoing processor and the incoming processor, and judge whether the outgoing processor and the incoming processor meet the thread migration condition; wherein, the outgoing processor includes one or more thread queues; 查找模块,用于若满足迁移条件,查找运行于迁出处理器上的线程队列内的线程,计算查找到的线程对应的剩余待迁移负载量;A search module, configured to search for threads running in the thread queue on the outgoing processor if the migration conditions are met, and calculate the remaining load to be migrated corresponding to the found threads; 调度模块,用于根据剩余待迁移负载量选择目标线程,将所述目标线程调度至迁入处理器。A scheduling module, configured to select a target thread according to the remaining load to be migrated, and schedule the target thread to the transfer-in processor. 9.一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1至7中任一项所述方法的步骤。9. A computer device, comprising a memory, a processor, and a computer program stored on the memory and operable on the processor, characterized in that, when the processor executes the computer program, any one of claims 1 to 7 is realized. A step of said method. 10.一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至7中任一项所述的方法的步骤。10. A computer-readable storage medium, on which a computer program is stored, characterized in that, when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are realized.
CN201810200639.2A 2018-03-12 2018-03-12 Thread scheduling management method, apparatus, computer equipment and storage medium Active CN108549574B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810200639.2A CN108549574B (en) 2018-03-12 2018-03-12 Thread scheduling management method, apparatus, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810200639.2A CN108549574B (en) 2018-03-12 2018-03-12 Thread scheduling management method, apparatus, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN108549574A true CN108549574A (en) 2018-09-18
CN108549574B CN108549574B (en) 2022-03-15

Family

ID=63516101

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810200639.2A Active CN108549574B (en) 2018-03-12 2018-03-12 Thread scheduling management method, apparatus, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN108549574B (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109783028A (en) * 2019-01-16 2019-05-21 Oppo广东移动通信有限公司 Optimization method, device, storage medium and the intelligent terminal of I/O scheduling
CN109947569A (en) * 2019-03-15 2019-06-28 Oppo广东移动通信有限公司 method, device, terminal and storage medium for binding core
CN110989933A (en) * 2019-12-05 2020-04-10 北京首汽智行科技有限公司 Message queue RockMq smooth migration method
CN111813521A (en) * 2020-07-01 2020-10-23 Oppo广东移动通信有限公司 Thread scheduling method, device, storage medium and electronic device
CN112052077A (en) * 2019-06-06 2020-12-08 北京字节跳动网络技术有限公司 Method, device, equipment and medium for software task management
CN112232770A (en) * 2020-10-17 2021-01-15 严怀华 Business information processing method based on smart community and cloud service center
CN113326140A (en) * 2021-06-30 2021-08-31 统信软件技术有限公司 Process migration method and device, computing equipment and storage medium
CN113495787A (en) * 2020-04-03 2021-10-12 Oppo广东移动通信有限公司 Resource allocation method, device, storage medium and electronic equipment
CN113553164A (en) * 2021-09-17 2021-10-26 统信软件技术有限公司 Process migration method, computing device and storage medium
CN113918527A (en) * 2021-12-15 2022-01-11 西安统信软件技术有限公司 Scheduling method and device based on file cache and computing equipment
CN114265677A (en) * 2021-12-15 2022-04-01 西安统信软件技术有限公司 Scheduling method and device for load balancing and computing equipment
CN115617518A (en) * 2022-10-13 2023-01-17 维沃移动通信有限公司 Thread management method, device, electronic device and storage medium
WO2024007922A1 (en) * 2022-07-06 2024-01-11 华为技术有限公司 Task migration method and apparatus, and device, storage medium and product

Citations (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5745778A (en) * 1994-01-26 1998-04-28 Data General Corporation Apparatus and method for improved CPU affinity in a multiprocessor system
US20080109814A1 (en) * 2006-11-06 2008-05-08 Samsung Electronics Co., Ltd. Apparatus and method for balancing load in multi-core processor system
CN101256515A (en) * 2008-03-11 2008-09-03 浙江大学 Implementation method of multi-core processor operating system load balancing
CN101345770A (en) * 2008-08-22 2009-01-14 杭州华三通信技术有限公司 Load equalization implementing method, storage control equipment and memory system
US20100293312A1 (en) * 2009-04-27 2010-11-18 Sonnier David P Network Communications Processor Architecture
CN102184125A (en) * 2011-06-02 2011-09-14 首都师范大学 Load balancing method based on program behaviour online analysis under heterogeneous multi-core environment
CN102834807A (en) * 2011-04-18 2012-12-19 华为技术有限公司 Method and device for multiprocessor system load balancing
US20140089936A1 (en) * 2012-09-21 2014-03-27 Htc Corporation Multi-core device and multi-thread scheduling method thereof
WO2015070789A1 (en) * 2013-11-14 2015-05-21 Mediatek Inc. Task scheduling method and related non-transitory computer readable medium for dispatching task in multi-core processor system based at least partly on distribution of tasks sharing same data and/or accessing same memory address (es)
CN104951357A (en) * 2014-03-28 2015-09-30 华为技术有限公司 Parallel user state protocol stack management method and protocol stack system
CN105528330A (en) * 2014-09-30 2016-04-27 杭州华为数字技术有限公司 Load balancing method and device, cluster and many-core processor
CN105955809A (en) * 2016-04-25 2016-09-21 深圳市万普拉斯科技有限公司 Thread scheduling method and system
CN106686039A (en) * 2015-11-10 2017-05-17 华为技术有限公司 Resource scheduling method and device in a cloud computing system
US20170206111A1 (en) * 2016-01-15 2017-07-20 Qualcomm Innovation Center, Inc. Managing processing capacity provided to threads based upon load prediction
CN106980533A (en) * 2016-01-18 2017-07-25 杭州海康威视数字技术股份有限公司 Method for scheduling task, device and electronic equipment based on heterogeneous processor
CN107015862A (en) * 2015-12-22 2017-08-04 英特尔公司 Thread and/or virtual machine scheduling for cores with different capabilities
US20170295191A1 (en) * 2016-04-08 2017-10-12 Samsung Electronics Co., Ltd. Load balancing method and apparatus in intrusion detection system
CN107315637A (en) * 2016-04-26 2017-11-03 中兴通讯股份有限公司 The load-balancing method and device of signal processing module

Patent Citations (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5745778A (en) * 1994-01-26 1998-04-28 Data General Corporation Apparatus and method for improved CPU affinity in a multiprocessor system
US20080109814A1 (en) * 2006-11-06 2008-05-08 Samsung Electronics Co., Ltd. Apparatus and method for balancing load in multi-core processor system
CN101256515A (en) * 2008-03-11 2008-09-03 浙江大学 Implementation method of multi-core processor operating system load balancing
CN101345770A (en) * 2008-08-22 2009-01-14 杭州华三通信技术有限公司 Load equalization implementing method, storage control equipment and memory system
US20100293312A1 (en) * 2009-04-27 2010-11-18 Sonnier David P Network Communications Processor Architecture
CN102834807A (en) * 2011-04-18 2012-12-19 华为技术有限公司 Method and device for multiprocessor system load balancing
CN102184125A (en) * 2011-06-02 2011-09-14 首都师范大学 Load balancing method based on program behaviour online analysis under heterogeneous multi-core environment
US20140089936A1 (en) * 2012-09-21 2014-03-27 Htc Corporation Multi-core device and multi-thread scheduling method thereof
WO2015070789A1 (en) * 2013-11-14 2015-05-21 Mediatek Inc. Task scheduling method and related non-transitory computer readable medium for dispatching task in multi-core processor system based at least partly on distribution of tasks sharing same data and/or accessing same memory address (es)
CN104951357A (en) * 2014-03-28 2015-09-30 华为技术有限公司 Parallel user state protocol stack management method and protocol stack system
CN105528330A (en) * 2014-09-30 2016-04-27 杭州华为数字技术有限公司 Load balancing method and device, cluster and many-core processor
CN106686039A (en) * 2015-11-10 2017-05-17 华为技术有限公司 Resource scheduling method and device in a cloud computing system
CN107015862A (en) * 2015-12-22 2017-08-04 英特尔公司 Thread and/or virtual machine scheduling for cores with different capabilities
US20170206111A1 (en) * 2016-01-15 2017-07-20 Qualcomm Innovation Center, Inc. Managing processing capacity provided to threads based upon load prediction
CN106980533A (en) * 2016-01-18 2017-07-25 杭州海康威视数字技术股份有限公司 Method for scheduling task, device and electronic equipment based on heterogeneous processor
US20170295191A1 (en) * 2016-04-08 2017-10-12 Samsung Electronics Co., Ltd. Load balancing method and apparatus in intrusion detection system
CN105955809A (en) * 2016-04-25 2016-09-21 深圳市万普拉斯科技有限公司 Thread scheduling method and system
CN107315637A (en) * 2016-04-26 2017-11-03 中兴通讯股份有限公司 The load-balancing method and device of signal processing module

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
KISHORE KUMAR PUSUKURI 等: "Tumbler: An Effective Load Balancing Technique for MultiCPU Multicore Systems", 《ACM TRANSACTIONS ON ARCHITECTURE AND CODE OPTIMIZATION》 *
姜波: "线程调度方法与测试工具的研究与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *
陈玮 等: "H.264 视频解码的OpenMP 并行优化", 《计算机系统应用》 *

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109783028A (en) * 2019-01-16 2019-05-21 Oppo广东移动通信有限公司 Optimization method, device, storage medium and the intelligent terminal of I/O scheduling
CN109947569B (en) * 2019-03-15 2021-04-06 Oppo广东移动通信有限公司 Method, device, terminal and storage medium for binding core
CN109947569A (en) * 2019-03-15 2019-06-28 Oppo广东移动通信有限公司 method, device, terminal and storage medium for binding core
CN112052077A (en) * 2019-06-06 2020-12-08 北京字节跳动网络技术有限公司 Method, device, equipment and medium for software task management
CN110989933A (en) * 2019-12-05 2020-04-10 北京首汽智行科技有限公司 Message queue RockMq smooth migration method
CN113495787A (en) * 2020-04-03 2021-10-12 Oppo广东移动通信有限公司 Resource allocation method, device, storage medium and electronic equipment
CN111813521A (en) * 2020-07-01 2020-10-23 Oppo广东移动通信有限公司 Thread scheduling method, device, storage medium and electronic device
CN112232770A (en) * 2020-10-17 2021-01-15 严怀华 Business information processing method based on smart community and cloud service center
CN112232770B (en) * 2020-10-17 2021-08-20 成都数字家园科技有限公司 Business information processing method and cloud service device based on smart community and cloud service
CN113326140A (en) * 2021-06-30 2021-08-31 统信软件技术有限公司 Process migration method and device, computing equipment and storage medium
CN113553164A (en) * 2021-09-17 2021-10-26 统信软件技术有限公司 Process migration method, computing device and storage medium
CN113918527A (en) * 2021-12-15 2022-01-11 西安统信软件技术有限公司 Scheduling method and device based on file cache and computing equipment
CN114265677A (en) * 2021-12-15 2022-04-01 西安统信软件技术有限公司 Scheduling method and device for load balancing and computing equipment
WO2024007922A1 (en) * 2022-07-06 2024-01-11 华为技术有限公司 Task migration method and apparatus, and device, storage medium and product
CN115617518A (en) * 2022-10-13 2023-01-17 维沃移动通信有限公司 Thread management method, device, electronic device and storage medium

Also Published As

Publication number Publication date
CN108549574B (en) 2022-03-15

Similar Documents

Publication Publication Date Title
CN108549574B (en) Thread scheduling management method, apparatus, computer equipment and storage medium
CN108509260B (en) Thread identification processing method, apparatus, computer equipment and storage medium
US10509677B2 (en) Granular quality of service for computing resources
WO2021254135A1 (en) Task execution method and storage device
US9858115B2 (en) Task scheduling method for dispatching tasks based on computing power of different processor cores in heterogeneous multi-core processor system and related non-transitory computer readable medium
US8413158B2 (en) Processor thread load balancing manager
KR20130116166A (en) Multithread application-aware memory scheduling scheme for multi-core processors
CN112925616A (en) Task allocation method and device, storage medium and electronic equipment
US10185384B2 (en) Reducing power by vacating subsets of CPUs and memory
CN111756802A (en) A scheduling method and system for data flow tasks on NUMA platform
WO2024119988A1 (en) Process scheduling method and apparatus in multi-cpu environment, electronic device, and medium
CN115421924A (en) Memory allocation method, device and equipment
CN118245218A (en) Cache management method, cache management device, processor and electronic device
CN117971437A (en) Task allocation method, circuit, device, medium, and program
CN118245186B (en) Cache management method, cache management device, processor and electronic device
WO2025200126A1 (en) Instruction processing method and apparatus, processor, and computer-readable storage medium
CN101847128A (en) TLB management method and device
WO2023237115A1 (en) Data processing method and apparatus, and device and system
WO2024164369A1 (en) Resource-aware task allocation method for mixed-criticality partitioned real-time operating system
JP2019071026A (en) Computing machine and cpu core allocation method
WO2022042519A1 (en) Resource allocation method and apparatus, and computer device and computer-readable storage medium
CN119248798B (en) Lightweight scanning method for storage engine of electronic equipment
CN116700790B (en) Data processing apparatus, register management method, and machine-readable storage medium
CN117632243A (en) A code processing method and computing device
CN113360192A (en) Thermal cache identification method and device, storage medium and electronic equipment

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
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20250220

Address after: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Patentee after: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

Country or region after: China

Address before: 518000 Room 201, building A, 1 front Bay Road, Shenzhen Qianhai cooperation zone, Shenzhen, Guangdong

Patentee before: ONEPLUS TECHNOLOGY (SHENZHEN) Co.,Ltd.

Country or region before: China

TR01 Transfer of patent right