WO2023132414A1 - 스레드 할당 방법, 스레드 할당 장치, 및 컴퓨터 판독 가능한 기록 매체 - Google Patents

스레드 할당 방법, 스레드 할당 장치, 및 컴퓨터 판독 가능한 기록 매체 Download PDF

Info

Publication number
WO2023132414A1
WO2023132414A1 PCT/KR2022/007074 KR2022007074W WO2023132414A1 WO 2023132414 A1 WO2023132414 A1 WO 2023132414A1 KR 2022007074 W KR2022007074 W KR 2022007074W WO 2023132414 A1 WO2023132414 A1 WO 2023132414A1
Authority
WO
WIPO (PCT)
Prior art keywords
thread
threads
groups
allocated
allocating
Prior art date
Application number
PCT/KR2022/007074
Other languages
English (en)
French (fr)
Inventor
백웅기
박진수
박성범
한명균
Original Assignee
울산과학기술원
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 울산과학기술원 filed Critical 울산과학기술원
Publication of WO2023132414A1 publication Critical patent/WO2023132414A1/ko

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline or look ahead
    • G06F9/3836Instruction issuing, e.g. dynamic instruction scheduling or out of order instruction execution
    • G06F9/3851Instruction issuing, e.g. dynamic instruction scheduling or out of order instruction execution from multiple instruction streams, e.g. multistreaming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/22Microcontrol or microprogram arrangements
    • G06F9/28Enhancement of operational speed, e.g. by using several microcontrol devices operating in parallel
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • G06F9/30076Arrangements for executing specific machine instructions to perform miscellaneous control operations, e.g. NOP
    • G06F9/3009Thread control instructions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline or look ahead
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/501Performance criteria
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5018Thread allocation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5021Priority

Definitions

  • the present invention relates to a method for allocating threads, and more particularly, to a method for allocating threads to a plurality of cores included in a computing device.
  • a technical problem to be solved by the present invention is to provide a thread assignment method for creating a thread group corresponding to an active core among a plurality of cores included in a computing device and allocating a thread to the active core through the created thread group. is to provide
  • One aspect of the present invention includes generating a plurality of thread groups based on the number of active cores among a plurality of cores included in a computing device; determining the number of threads to be allocated to each of the plurality of thread groups among the plurality of threads to be executed in a current period based on the amount of operations per thread of each of the plurality of thread groups; allocating at least one thread to each of the plurality of thread groups based on the priority of each of the plurality of threads and the determined number; and allocating each of the plurality of thread groups to each of the active cores.
  • the determining of the number of threads may include initializing the number of threads to be allocated to each of the plurality of thread groups; and increasing the number of threads to be allocated to each of the plurality of thread groups in an order of increasing computation per thread.
  • the step of increasing the number of threads may be repeated until all of the plurality of threads are allocated to each of the plurality of thread groups.
  • the assigning of the at least one thread may include calculating an amount of operation per thread based on the number of threads to be assigned to each of the plurality of thread groups; sorting the plurality of thread groups based on the amount of operations per thread; and allocating the at least one thread to each of the plurality of thread groups according to the sorted order.
  • the allocating of the at least one thread may include setting a priority for each of the plurality of threads based on at least one of a thread ID and a resource previously assigned to each of the plurality of threads.
  • the priority may be set higher as the number of pre-assigned resources decreases, and set higher as the value of the thread ID decreases.
  • the assigning of each of the plurality of thread groups may include selecting a thread group having the largest amount of computation per thread among at least one unallocated thread group; calculating a migration cost of the selected thread group for each unallocated active core based on a core allocation record of each of the at least one thread included in the selected thread group; and allocating the selected thread group to an active core having the smallest migration cost.
  • the calculating of the migration cost may include calculating the migration cost based on a first cost for migration between different processors and a second cost for migration between different cores, wherein the migration cost is lower than the second cost. 1 Costs can be given more weight.
  • the method may further include setting a scheduling period such that each of the plurality of thread groups is allocated to each of the plurality of active cores.
  • the setting of the scheduling period may include obtaining performance data for the plurality of threads; and adjusting the scheduling period based on the performance data.
  • Another aspect of the present invention includes a generation unit for generating a plurality of thread groups based on the number of active cores among a plurality of cores included in a computing device; a setting unit that determines the number of threads to be allocated to each of the plurality of thread groups among the plurality of threads to be executed in a current period based on the amount of operations per thread of each of the plurality of thread groups; a thread allocator allocating at least one thread to each of the plurality of thread groups based on the priority of each of the plurality of threads and the determined number; and a group allocator that allocates each of the plurality of thread groups to each of the active cores.
  • the setting unit may initialize the number of threads to be allocated to each of the plurality of thread groups, and increase the number of threads to be allocated to each of the plurality of thread groups in an order of increasing computation per thread.
  • the thread allocator may calculate the amount of computation per thread based on the number of threads to be allocated to each of the plurality of thread groups, sort the plurality of thread groups based on the amount of computation per thread, and arrange the plurality of thread groups in the sorted order. Accordingly, the at least one thread may be allocated to each of the plurality of thread groups.
  • the thread group allocator selects a thread group having the largest computation per thread from among at least one unallocated thread group, and based on a core allocation record of each of at least one thread included in the selected thread group, A migration cost of the selected thread group for each unassigned active core may be calculated, and the selected thread group may be allocated to an active core having the lowest calculated migration cost.
  • the method may further include a scheduling unit configured to set a scheduling period such that each of the plurality of thread groups is allocated to each of the plurality of active cores.
  • Another aspect of the present invention is a computer readable recording medium storing a computer program, which, when executed by a processor, is the number of active cores among a plurality of cores included in a computing device.
  • Another aspect of the present invention is a computer program stored on a computer-readable recording medium, wherein the computer program, when executed by a processor, increases the number of active cores among a plurality of cores included in a computing device.
  • a thread group is created to correspond to an active core among a plurality of cores included in a computing device, and a thread is assigned to the active core through the created thread group. can be assigned to
  • FIG. 1 is a block diagram of a thread allocation device according to an embodiment of the present invention.
  • FIG. 2 is a diagram illustrating an embodiment of a thread group created in the generator of FIG. 1 .
  • 3 to 6 are diagrams illustrating an embodiment of a process of determining the number of threads to be allocated in the setting unit of FIG. 1 .
  • FIG. 7 to 8 are diagrams illustrating an embodiment of a process of allocating threads to thread groups in the thread allocating unit of FIG. 1 .
  • FIG. 9 is a diagram illustrating an embodiment of a process of allocating thread groups to active cores in the group allocator of FIG. 1 .
  • FIG. 10 is a flowchart of a thread allocation method according to an embodiment of the present invention.
  • FIG. 1 is a block diagram of a thread allocation device according to an embodiment of the present invention.
  • the thread allocation device 100 may include a thread allocation module 110 and a scheduling unit 130 .
  • the thread allocation module 110 may include a creation unit 111 , a setting unit 113 , a thread allocation unit 115 and a group allocation unit 117 .
  • the generation unit 111 may generate a plurality of thread groups based on the number of active cores among a plurality of cores included in the computing device.
  • the computing device includes one or more processors such as a central processing unit (CPU), a graphic processing unit (GPU), and a network processing unit (NPU), and each processor may include a plurality of cores.
  • processors such as a central processing unit (CPU), a graphic processing unit (GPU), and a network processing unit (NPU)
  • each processor may include a plurality of cores.
  • the computing device may allocate threads for the application program to a plurality of active cores among the plurality of cores so as to perform operations on the application program.
  • At least one thread may be allocated to each active core to perform an operation for an application program.
  • the setting unit 113 may determine the number of threads to be allocated to each of the plurality of thread groups among the plurality of threads to be executed in the current period based on the amount of operations per thread of each of the plurality of thread groups.
  • the amount of computation per thread may be the amount of computation for each of at least one thread to be allocated to the thread group.
  • the amount of computation per thread may be calculated from the computational capacity of the thread group based on the number of threads to be allocated to the thread group.
  • the amount of computation per thread may be a value obtained by dividing the computational capacity of a thread group by the number of threads to be allocated to the thread group.
  • the computational capacity may be set to correspond to the computational capacity of the active core.
  • the computational capacity may be set based on the type of active core.
  • the setting unit 113 may initialize the number of threads to be allocated to each of the plurality of thread groups.
  • the setting unit 113 may increase the number of threads to be allocated to each of the plurality of thread groups in the order of increasing computation per thread.
  • the setting unit 113 may repeat a process of increasing the number of threads to be allocated to each of the plurality of thread groups until all of the plurality of threads are allocated to each of the plurality of thread groups.
  • the period is a scheduling period and may be a time interval in which a thread group assigned to an active core performs an operation for an application program. To this end, the period may be set by the scheduling unit 130 . A process of setting the scheduling period by the scheduling unit 130 will be described in detail below.
  • the thread allocator 115 may allocate at least one thread to each of the plurality of thread groups based on the priority of each of the plurality of threads and the number determined above.
  • the number determined above may be the number of threads to be allocated to each of the plurality of threads.
  • the priority may be set based on at least one of a thread ID and a resource previously assigned to each of a plurality of threads.
  • the resource may be an operation amount assigned to each thread, and the thread ID may be a unique number assigned to each thread. Accordingly, in one embodiment, the priority may be set higher as the number of pre-assigned resources is smaller, and set higher as the value of the thread ID is smaller.
  • the thread allocator 115 may calculate an operation amount per thread of each of the plurality of thread groups based on the number of threads to be allocated to each of the plurality of thread groups.
  • the amount of computation per thread may be the amount of computation for each of at least one thread scheduled to be allocated to the thread group.
  • the amount of computation per thread may be calculated from the computational capacity of the thread group based on the number of threads scheduled to be allocated to the thread group.
  • the amount of computation per thread may be a value obtained by dividing the computational capacity of a thread group by the number of threads scheduled to be allocated to the thread group.
  • the thread allocator 115 may sort the plurality of thread groups based on the amount of operations per thread, and allocate at least one thread to each of the plurality of thread groups according to the sorted order.
  • the thread allocator 115 may first sort a thread group having a small ID value assigned to the thread group among a plurality of thread groups having the same amount of computation per thread.
  • the thread allocator 115 may allocate at least one thread according to priority to a plurality of sorted thread groups. At this time, the thread allocator 115 may allocate as many threads as the number determined by the setting unit 113 to each thread group.
  • the group allocator 117 may allocate each of a plurality of thread groups to each active core.
  • the group allocator 117 may allocate a thread group to an active core based on an amount of computation per thread for each of a plurality of thread groups and a migration cost.
  • the migration cost may be calculated based on the core allocation record for each thread.
  • the core allocation record may be a record of cores to which threads are allocated in the previous scheduling period.
  • a migration cost may occur if the thread is assigned to a second core different from the first core assigned in the previous scheduling period.
  • a lower migration cost may occur than when the second core is included in a processor different from the first core.
  • the group allocator 117 may calculate a migration cost based on a first cost for migration between different processors and a second cost for migration between different cores. At this time, the group assigning unit 117 may calculate the migration cost by assigning a higher weight to the first cost than to the second cost.
  • a migration cost of any one thread group to any one active core is the sum of migration costs incurred when each of the at least one thread assigned to the thread group is assigned to the active core.
  • the group allocator 117 may allocate each of a plurality of thread groups to each of a plurality of active cores according to an embodiment as follows.
  • the group allocator 117 may select a thread group having the largest amount of computation per thread from among at least one thread group not allocated to an active core.
  • the group allocator 117 may calculate the migration cost of the selected thread group for each unallocated active core based on the core allocation record of each of the at least one thread included in the selected thread group. .
  • the group allocator 117 may allocate the thread group selected above to the active core with the smallest calculated migration cost.
  • the group allocator 117 may repeat the process of selecting a thread group, calculating a migration cost, and allocating the thread group to the active core until there is no unassigned thread group to the active core. .
  • the scheduling unit 130 may set a scheduling period such that each of a plurality of thread groups is allocated to each active core.
  • the scheduling unit 130 may set an initial scheduling period to a preset minimum period (eg, 0.125 ms) when an application program is executed.
  • the scheduling unit 130 may obtain performance data for a plurality of threads and adjust a scheduling period based on the obtained performance data.
  • the scheduling unit 130 may double the scheduling period when the new performance data is higher than the previous performance data. Also, when the new performance data is lower than the previous performance data, the scheduling unit 130 may fix the scheduling period to the previous scheduling period until the application program is terminated. In this case, the scheduling unit 130 may record a fixed scheduling period for the application program, and allocate threads according to the recorded scheduling period when the application program is re-executed.
  • the scheduling unit 130 may obtain performance data from a performance monitoring device.
  • the performance monitoring device may request a signal for an application program executed by the computing device at predetermined intervals.
  • the performance monitoring device may request signals according to a predetermined period and generate performance data based on intervals between signals received from the computing device.
  • the performance monitoring apparatus may generate performance data to indicate higher performance as the interval between received signals becomes shorter, and generate performance data to indicate lower performance as the interval becomes longer.
  • the performance monitoring device may receive a heartbeat signal from the computing device according to a predetermined period.
  • the heartbeat signal may be a signal transmitted by an arbitrary device to maintain a connection with a specific network.
  • a conventionally known technique may be used to generate the heartbeat signal.
  • the performance monitoring apparatus may generate performance data to represent high performance as the interval between heartbeat signals becomes shorter, and generate performance data to represent lower performance as the interval becomes longer.
  • FIG. 2 is a diagram illustrating an embodiment of a thread group created in the generator of FIG. 1 .
  • a plurality of cores 210 and 230 included in the processor and a plurality of thread groups 310 created by the generator 111 may be identified.
  • a plurality of thread groups 310 may be created to correspond to a plurality of active cores 210 .
  • the same number of thread groups 310 as the number of active cores 210 may be created.
  • the thread group 310 may be created with the same type as the active core 210 .
  • the generator 111 when three high-performance active cores 211 (H) and two low-performance active cores 213 (L) are set as active cores 210, the generator 111 generates high-performance thread groups 311 (TG1 to TG3). ) and two low-performance thread groups 313 (TG4 to TG5) can be created.
  • 3 to 6 are diagrams illustrating an embodiment of a process of determining the number of threads to be allocated in the setting unit of FIG. 1 .
  • the computation capacity of each of the plurality of thread groups 310 the number of threads predicted to be allocated to each of the plurality of thread groups 310 (Thread count), and the amount of computation per thread (Per- thread computation capacity).
  • the computational capacity of the high-performance thread group 311 (TG1 to TG3) may be set to C, and the computational capacity of the low-performance thread group 313 (TG4 to TG5) may be set to 0.8C, respectively.
  • the number of threads expected to be allocated to each of the plurality of thread groups 310 is initialized to 1 immediately after each of the plurality of thread groups 310 is created.
  • the setting unit 113 may increase the number of threads to be allocated to the first high-performance thread group 311 (TG1) according to the order of the largest computation amount per thread.
  • an operation amount per thread for the first high-performance thread group 311 (TG1) may be estimated to be 0.5C.
  • the setting unit 113 may increase the number of threads to be allocated to the second high-performance thread group 311 (TG2) according to the order of the largest computation amount per thread.
  • the amount of operations per thread for the second high-performance thread group 311 can be estimated to be 0.5C.
  • the setting unit 113 may increase the number of threads to be allocated to the third high-performance thread group 311 (TG3) according to the order of the largest amount of operations per thread.
  • an operation amount per thread for the third high-performance thread group 311 may be estimated to be 0.5C.
  • the setting unit 113 may end the process of increasing the number of threads to be allocated to each of the plurality of thread groups 310 in the current state. .
  • the setting unit 113 determines the number of threads to be allocated to each of the high-performance thread groups 311 (TG1 to TG3) as two, and sets the number of threads to be allocated to each of the low-performance thread groups 313 (TG4 to TG5).
  • the number of can be determined as one.
  • FIG. 7 to 8 are diagrams illustrating an embodiment of a process of allocating threads to thread groups in the thread allocating unit of FIG. 1 .
  • a plurality of threads arranged in the direction of an arrow may be identified. At this time, a plurality of threads were shaped as wave marks.
  • each of the low-performance thread groups 313 (TG4 to TG5) whose calculation amount per thread is greater than that of each of the high-performance thread groups 311 (TG1 to TG3) is sorted first. there is.
  • At least one thread is allocated according to priority to a plurality of sorted thread groups.
  • FIG. 9 is a diagram illustrating an embodiment of a process of allocating thread groups to active cores in the group allocator of FIG. 1 .
  • each of the plurality of thread groups 310 is assigned to each of the plurality of active cores 210 .
  • each of the plurality of thread groups 310 is allocated to each of the plurality of active cores 210 based on the amount of operations per thread for each of the plurality of thread groups and the migration cost.
  • FIG. 10 is a flowchart of a thread allocation method according to an embodiment of the present invention.
  • the generation unit 111 may generate a plurality of thread groups 310 based on the number of active cores 210 among a plurality of cores included in the computing device (S100).
  • the setting unit 113 may determine the number of threads to be allocated to each of the plurality of thread groups 310 among the plurality of threads to be executed in the current period based on the amount of operations per thread of each of the plurality of thread groups 310 .
  • the thread allocator 115 may allocate at least one thread to each of the plurality of thread groups 310 based on the priority of each of the plurality of threads and the number determined above (S300).
  • the group allocator 117 may allocate each of the plurality of thread groups 310 to each of the active cores 210 (S400).
  • a device is a device capable of calling a stored command from a storage medium and operating according to the called command, and may include an electronic device (eg, a device) according to the disclosed embodiments.
  • the command is executed by a processor (eg, a processor)
  • the processor may perform a function corresponding to the command directly or by using other components under the control of the processor.
  • An instruction may include code generated or executed by a compiler or interpreter.
  • the device-readable storage medium may be provided in the form of a non-transitory storage medium.
  • 'non-temporary' only means that the storage medium does not contain a signal and is tangible, but does not distinguish whether data is stored semi-permanently or temporarily in the storage medium.
  • the method according to various embodiments disclosed in this document may be provided by being included in a computer program product.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Multi Processors (AREA)

Abstract

본 발명은 액티브(Active) 코어의 개수에 기초하여 다수의 스레드 그룹을 생성하고, 스레드 당 연산량에 기초하여 다수의 스레드 그룹 각각에 할당할 스레드의 개수를 결정하며, 다수의 스레드 각각의 우선 순위와, 상기에서 결정된 개수에 기초하여 스레드 그룹 각각에 스레드를 할당하고, 액티브 코어 각각에 스레드 그룹을 할당하는, 스레드 할당 방법을 제공한다.

Description

스레드 할당 방법, 스레드 할당 장치, 및 컴퓨터 판독 가능한 기록 매체
본 발명은 스레드 할당 방법에 관한 것으로, 더욱 상세하게는, 컴퓨팅 장치에 포함된 다수의 코어들에 스레드를 할당하는 방법에 관한 것이다.
종래의 스레드 할당 기법은 코어들에 할당된 스레드들에 연산 자원이 불균형하게 할당되거나, 스레드 간의 하드웨어 자원이 충돌하기도 한다.
예를 들어, 종래에는 코어 개수가 스레드 개수의 약수가 아닌 경우에 일부 코어들에 다른 코어들보다 더 많은 수의 스레드들이 할당되어 코어의 성능이 심각하게 저하되기도 한다. 또한, 코어 개수가 많아질수록 스레드 간의 자원 불균형이 커지므로 더 큰 성능 저하가 발생하기도 한다.
더욱이, 이종 코어들의 경우에는 이종 코어들 간의 성능 차이가 고려되지 못한 채 스레드 할당이 수행되기도 하는 문제점이 존재한다.
본 발명이 해결하고자 하는 기술적 과제는 컴퓨팅 장치에 포함된 다수의 코어들 중 액티브(Active) 코어에 대응되도록 스레드 그룹을 생성하고, 생성된 스레드 그룹을 통해 스레드를 액티브 코어에 할당하는 스레드 할당 방법을 제공하는 것이다.
본 발명의 일측면은, 컴퓨팅 장치에 포함된 다수의 코어들 중 액티브(Active) 코어의 개수에 기초하여 다수의 스레드 그룹을 생성하는 단계; 상기 다수의 스레드 그룹 각각의 스레드 당 연산량에 기초하여 현재 주기 내 실행할 다수의 스레드 중 상기 다수의 스레드 그룹 각각에 할당할 스레드의 개수를 결정하는 단계; 상기 다수의 스레드 각각의 우선 순위와, 상기 결정된 개수에 기초하여 상기 다수의 스레드 그룹 각각에 적어도 하나의 스레드를 할당하는 단계; 및 상기 액티브 코어 각각에 상기 다수의 스레드 그룹 각각을 할당하는 단계;를 포함할 수 있다.
또한, 상기 스레드의 개수를 결정하는 단계는, 상기 다수의 스레드 그룹 각각에 할당할 스레드의 개수를 초기화하는 단계; 및 상기 스레드 당 연산량이 큰 순서대로 상기 다수의 스레드 그룹 각각에 할당할 스레드의 개수를 증가시키는 단계;를 포함할 수 있다.
또한, 상기 스레드의 개수를 증가시키는 단계는, 상기 다수의 스레드 그룹 각각에 상기 다수의 스레드가 모두 할당될 때까지 반복될 수 있다.
또한, 상기 적어도 하나의 스레드를 할당하는 단계는, 상기 다수의 스레드 그룹 각각에 할당할 스레드의 개수에 기초하여 상기 스레드 당 연산량을 산출하는 단계; 상기 스레드 당 연산량에 기초하여 상기 다수의 스레드 그룹을 정렬하는 단계; 및 상기 정렬된 순서에 따라 상기 다수의 스레드 그룹 각각에 상기 적어도 하나의 스레드를 할당하는 단계;를 포함할 수 있다.
또한, 상기 적어도 하나의 스레드를 할당하는 단계는, 상기 다수의 스레드 각각에 대해 미리 부여된 자원과 스레드 ID 중 적어도 하나에 기초하여 상기 다수의 스레드 각각에 대한 우선 순위를 설정하는 단계;를 포함할 수 있다.
또한, 상기 우선 순위는, 상기 미리 부여된 자원이 적을수록 높게 설정되고, 상기 스레드 ID의 값이 작을수록 높게 설정될 수 있다.
또한, 상기 다수의 스레드 그룹 각각을 할당하는 단계는, 미 할당된 적어도 하나의 스레드 그룹 중 상기 스레드 당 연산량이 가장 큰 스레드 그룹을 선택하는 단계; 상기 선택된 스레드 그룹에 포함된 적어도 하나의 스레드 각각의 코어 할당 기록에 기초하여, 미 할당된 액티브 코어 각각에 대한 상기 선택된 스레드 그룹의 이주 비용을 산출하는 단계; 및 상기 산출된 이주 비용이 가장 작은 액티브 코어에 상기 선택된 스레드 그룹을 할당하는 단계;를 포함할 수 있다.
또한, 상기 이주 비용을 산출하는 단계는, 서로 다른 프로세서 간의 이주에 대한 제 1 비용과, 서로 다른 코어 간의 이주에 대한 제 2 비용에 기초하여 상기 이주 비용을 산출하되, 상기 제 2 비용보다 상기 제 1 비용에 더 큰 가중치를 부여할 수 있다.
또한, 상기 다수의 액티브 코어 각각에 상기 다수의 스레드 그룹 각각이 할당되도록 스케줄링 주기를 설정하는 단계;를 더 포함할 수 있다.
또한, 상기 스케줄링 주기를 설정하는 단계는, 상기 다수의 스레드에 대한 성능 데이터를 획득하는 단계; 및 상기 성능 데이터에 기초하여 상기 스케줄링 주기를 조절하는 단계;를 포함할 수 있다.
본 발명의 다른 일측면은, 컴퓨팅 장치에 포함된 다수의 코어들 중 액티브(Active) 코어의 개수에 기초하여 다수의 스레드 그룹을 생성하는 생성부; 상기 다수의 스레드 그룹 각각의 스레드 당 연산량에 기초하여 현재 주기 내 실행할 다수의 스레드 중 상기 다수의 스레드 그룹 각각에 할당할 스레드의 개수를 결정하는 설정부; 상기 다수의 스레드 각각의 우선 순위와, 상기 결정된 개수에 기초하여 상기 다수의 스레드 그룹 각각에 적어도 하나의 스레드를 할당하는 스레드 할당부; 및 상기 액티브 코어 각각에 상기 다수의 스레드 그룹 각각을 할당하는 그룹 할당부;를 포함할 수 있다.
또한, 상기 설정부는, 상기 다수의 스레드 그룹 각각에 할당할 스레드의 개수를 초기화하고, 상기 스레드 당 연산량이 큰 순서대로 상기 다수의 스레드 그룹 각각에 할당할 스레드의 개수를 증가시킬 수 있다.
또한, 상기 스레드 할당부는, 상기 다수의 스레드 그룹 각각에 할당할 스레드의 개수에 기초하여 상기 스레드 당 연산량을 산출하고, 상기 스레드 당 연산량에 기초하여 상기 다수의 스레드 그룹을 정렬하며, 상기 정렬된 순서에 따라 상기 다수의 스레드 그룹 각각에 상기 적어도 하나의 스레드를 할당할 수 있다.
또한, 상기 스레드 그룹 할당부는, 미 할당된 적어도 하나의 스레드 그룹 중 상기 스레드 당 연산량이 가장 큰 스레드 그룹을 선택하고, 상기 선택된 스레드 그룹에 포함된 적어도 하나의 스레드 각각의 코어 할당 기록에 기초하여, 미 할당된 액티브 코어 각각에 대한 상기 선택된 스레드 그룹의 이주 비용을 산출하며, 상기 산출된 이주 비용이 가장 작은 액티브 코어에 상기 선택된 스레드 그룹을 할당할 수 있다.
또한, 상기 다수의 액티브 코어 각각에 상기 다수의 스레드 그룹 각각이 할당되도록 스케줄링 주기를 설정하는 스케줄링부;를 더 포함할 수 있다.
본 발명의 또 다른 일측면은, 컴퓨터 프로그램을 저장하고 있는 컴퓨터 판독 가능 기록매체로서, 상기 컴퓨터 프로그램은, 프로세서에 의해 실행되면, 컴퓨팅 장치에 포함된 다수의 코어들 중 액티브(Active) 코어의 개수에 기초하여 다수의 스레드 그룹을 생성하는 단계; 상기 다수의 스레드 그룹 각각의 스레드 당 연산량에 기초하여 현재 주기 내 실행할 다수의 스레드 중 상기 다수의 스레드 그룹 각각에 할당할 스레드의 개수를 결정하는 단계; 상기 다수의 스레드 각각의 우선 순위와, 상기 결정된 개수에 기초하여 상기 다수의 스레드 그룹 각각에 적어도 하나의 스레드를 할당하는 단계; 및 상기 액티브 코어 각각에 상기 다수의 스레드 그룹 각각을 할당하는 단계;를 포함하는 방법을 상기 프로세서가 수행하도록 하기 위한 명령어를 포함할 수 있다.
본 발명의 다른 일측면은, 컴퓨터 판독 가능한 기록매체에 저장되어 있는 컴퓨터 프로그램으로서, 상기 컴퓨터 프로그램은, 프로세서에 의해 실행되면, 컴퓨팅 장치에 포함된 다수의 코어들 중 액티브(Active) 코어의 개수에 기초하여 다수의 스레드 그룹을 생성하는 단계; 상기 다수의 스레드 그룹 각각의 스레드 당 연산량에 기초하여 현재 주기 내 실행할 다수의 스레드 중 상기 다수의 스레드 그룹 각각에 할당할 스레드의 개수를 결정하는 단계; 상기 다수의 스레드 각각의 우선 순위와, 상기 결정된 개수에 기초하여 상기 다수의 스레드 그룹 각각에 적어도 하나의 스레드를 할당하는 단계; 및 상기 액티브 코어 각각에 상기 다수의 스레드 그룹 각각을 할당하는 단계;를 포함하는 방법을 상기 프로세서가 수행하도록 하기 위한 명령어를 포함할 수 있다.
상술한 본 발명의 일측면에 따르면, 스레드 할당 방법을 제공함으로써 컴퓨팅 장치에 포함된 다수의 코어들 중 액티브(Active) 코어에 대응되도록 스레드 그룹을 생성하고, 생성된 스레드 그룹을 통해 스레드를 액티브 코어에 할당할 수 있다.
도 1은 본 발명의 일 실시예에 따른 스레드 할당 장치의 블록도이다.
도 2는 도 1의 생성부에서 생성되는 스레드 그룹의 일 실시예를 나타낸 도면이다.
도 3 내지 도 6은 도 1의 설정부에서, 할당할 스레드의 개수를 결정하는 과정의 일 실시예를 나타낸 도면이다.
도 7 내지 도 8은 도 1의 스레드 할당부에서 스레드 그룹에 스레드를 할당하는 과정의 일 실시예를 나타낸 도면이다.
도 9는 도 1의 그룹 할당부에서 액티브 코어에 스레드 그룹을 할당하는 과정의 일 실시예를 나타낸 도면이다.
도 10은 본 발명의 일 실시예에 따른 스레드 할당 방법의 순서도이다.
본 발명의 이점 및 특징, 그리고 그것들을 달성하는 방법은 첨부되는 도면과 함께 상세하게 후술되어 있는 실시예들을 참조하면 명확해질 것이다. 그러나 본 발명은 이하에서 개시되는 실시예들에 한정되는 것이 아니라 서로 다른 다양한 형태로 구현될 수 있으며, 단지 본 실시예들은 본 발명의 개시가 완전하도록 하고, 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자에게 발명의 범주를 완전하게 알려주기 위해 제공되는 것이며, 본 발명은 청구항의 범주에 의해 정의될 뿐이다.
본 발명의 실시예들을 설명함에 있어서 공지 기능 또는 구성에 대한 구체적인 설명이 본 발명의 요지를 불필요하게 흐릴 수 있다고 판단되는 경우에는 그 상세한 설명을 생략할 것이다. 그리고 후술되는 용어들은 본 발명의 실시예에서의 기능을 고려하여 정의된 용어들로서 이는 사용자, 운용자의 의도 또는 관례 등에 따라 달라질 수 있다. 그러므로 그 정의는 본 명세서 전반에 걸친 내용을 토대로 내려져야 할 것이다.
이하, 첨부된 도면을 참조하여 본 발명의 바람직한 실시 예에 대하여 상세하게 설명한다.
도 1은 본 발명의 일 실시예에 따른 스레드 할당 장치의 블록도이다.
도 1을 참조하면, 스레드 할당 장치(100)는 스레드 할당 모듈(110) 및 스케줄링부(130)를 포함할 수 있다.
이때, 스레드 할당 모듈(110)은 생성부(111), 설정부(113), 스레드 할당부(115) 및 그룹 할당부(117)를 포함할 수 있다.
생성부(111)는 컴퓨팅 장치에 포함된 다수의 코어들 중 액티브(Active) 코어의 개수에 기초하여 다수의 스레드 그룹을 생성할 수 있다.
여기에서, 컴퓨팅 장치는 CPU(Central Processing Unit), GPU(Graphic Processing Unit) 및 NPU(Network Processing Unit) 등의 프로세서를 하나 이상 포함하고, 각 프로세서는 다수의 코어를 포함할 수 있다.
이에 따라, 컴퓨팅 장치는 메모리에 저장된 응용 프로그램이 실행되면, 응용 프로그램에 대한 연산을 수행할 수 있도록 다수의 코어들 중에서, 다수의 액티브 코어에 상기의 응용 프로그램에 대한 스레드를 할당할 수 있다.
이러한 경우에, 액티브 코어 각각에는 적어도 하나의 스레드가 할당되어 응용 프로그램에 대한 연산을 수행할 수 있다.
설정부(113)는 다수의 스레드 그룹 각각의 스레드 당 연산량에 기초하여 현재 주기 내 실행할 다수의 스레드 중 다수의 스레드 그룹 각각에 할당할 스레드의 개수를 결정할 수 있다.
여기에서, 스레드 당 연산량은 스레드 그룹에 할당할 적어도 하나의 스레드 각각에 대한 연산량일 수 있다. 이를 위해, 스레드 당 연산량은 스레드 그룹에 할당할 스레드의 개수에 기초하여 스레드 그룹의 연산용량으로부터 산출될 수 있다. 예를 들어, 스레드 당 연산량은 스레드 그룹의 연산용량을 스레드 그룹에 할당할 스레드의 개수로 나눈 값일 수 있다.
이때, 연산용량은 액티브 코어의 연산용량에 대응되도록 설정될 수 있다. 일 실시예에서, 연산용량은 액티브 코어의 타입에 기초하여 설정될 수 있다.
이에 따라, 설정부(113)는 다수의 스레드 그룹 각각에 할당할 스레드의 개수를 초기화할 수 있다.
이에 따라, 설정부(113)는 스레드 당 연산량이 큰 순서대로 다수의 스레드 그룹 각각에 할당할 스레드의 개수를 증가시킬 수 있다.
이와 관련하여, 설정부(113)는 다수의 스레드 그룹 각각에 다수의 스레드가 모두 할당될 때까지, 다수의 스레드 그룹 각각에 할당할 스레드의 개수를 증가시키는 과정을 반복할 수 있다.
한편, 주기는 스케줄링 주기로서, 액티브 코어에 할당된 스레드 그룹이 응용 프로그램에 대한 연산을 수행하는 시간 간격일 수 있다. 이를 위해, 주기는 스케줄링부(130)에 의해 설정될 수 있다. 스케줄링부(130)가 스케줄링 주기를 설정하는 과정은 아래에서 상세히 설명하도록 한다.
스레드 할당부(115)는 다수의 스레드 각각의 우선 순위와, 상기에서 결정된 개수에 기초하여 다수의 스레드 그룹 각각에 적어도 하나의 스레드를 할당할 수 있다.
이때, 상기에서 결정된 개수는 다수의 스레드 각각에 할당할 스레드의 개수일 수 있다. 또한, 우선 순위는 다수의 스레드 각각에 대해 미리 부여된 자원과 스레드 ID 중 적어도 하나에 기초하여 설정될 수 있다.
여기에서, 자원은 각 스레드에 부여되어 있는 연산량이고, 스레드 ID는 각 스레드마다 부여된 고유 번호일 수 있다. 이에 따라, 일 실시예에서, 우선 순위는 미리 부여된 자원이 적을수록 높게 설정되고, 스레드 ID의 값이 작을수록 높게 설정될 수 있다.
한편, 스레드 할당부(115)는 다수의 스레드 그룹 각각에 할당할 스레드의 개수에 기초하여 다수의 스레드 그룹 각각의 스레드 당 연산량을 산출할 수 있다.
여기에서, 스레드 당 연산량은 스레드 그룹에 할당할 것으로 예정된 적어도 하나의 스레드 각각에 대한 연산량일 수 있다. 이를 위해, 스레드 당 연산량은 스레드 그룹에 할당할 것으로 예정된 스레드의 개수에 기초하여 스레드 그룹의 연산용량으로부터 산출될 수 있다.
예를 들어, 스레드 당 연산량은 스레드 그룹의 연산용량을 스레드 그룹에 할당할 것으로 예정된 스레드의 개수로 나눈 값일 수 있다.
이에 따라, 스레드 할당부(115)는 스레드 당 연산량에 기초하여 다수의 스레드 그룹을 정렬하고, 정렬된 순서에 따라 다수의 스레드 그룹 각각에 적어도 하나의 스레드를 할당할 수 있다.
이때, 스레드 할당부(115)는 스레드 당 연산량이 동일한 다수의 스레드 그룹에 대해, 스레드 그룹에 부여된 ID의 값이 작은 스레드 그룹을 먼저 정렬할 수 있다.
이에 따라, 스레드 할당부(115)는 정렬된 다수의 스레드 그룹에, 우선 순위에 따른 적어도 하나의 스레드를 할당할 수 있다. 이때, 스레드 할당부(115)는 설정부(113)에 의해 각 스레드 그룹에 결정된 개수만큼 스레드를 할당할 수 있다.
그룹 할당부(117)는 액티브 코어 각각에 다수의 스레드 그룹 각각을 할당할 수 있다.
이를 위해, 그룹 할당부(117)는 다수의 스레드 그룹 각각에 대한 스레드 당 연산량과, 이주 비용에 기초하여 액티브 코어에 스레드 그룹을 할당할 수 있다.
이때, 이주 비용은 각각의 스레드에 대한 코어 할당 기록에 기초하여 산출될 수 있다. 여기에서, 코어 할당 기록은 이전 스케줄링 주기에서 스레드가 할당된 코어를 기록한 것일 수 있다.
따라서, 이주 비용은 스레드가 이전 스케줄링 주기에서 할당된 제 1 코어와는 다른 제 2 코어에 할당되는 경우에 발생할 수 있다. 이때, 제 2 코어가 제 1 코어와 동일한 프로세서에 포함된 경우에는, 제 2 코어가 제 1 코어와는 다른 프로세서에 포함된 경우보다 작은 값의 이주 비용이 발생할 수 있다.
다시 말해서, 그룹 할당부(117)는 서로 다른 프로세서 간의 이주에 대한 제 1 비용과, 서로 다른 코어 간의 이주에 대한 제 2 비용에 기초하여 이주 비용을 산출할 수 있다. 이때, 그룹 할당부(117)는 제 2 비용보다 상기 제 1 비용에 더 큰 가중치를 부여하여 이주 비용을 산출할 수 있다.
일 실시예에서, 어느 하나의 액티브 코어에 대한 어느 하나의 스레드 그룹의 이주 비용은 상기의 스레드 그룹에 할당된 적어도 하나의 스레드 각각이 상기의 액티브 코어에 할당되는 경우에 발생하는 이주 비용의 총합일 수 있다.
이에 기초하여, 그룹 할당부(117)는 아래와 같은 일 실시예에 따라 다수의 액티브 코어 각각에 다수의 스레드 그룹 각각을 할당할 수 있다.
일 실시예에서, 그룹 할당부(117)는 액티브 코어에 미 할당된 적어도 하나의 스레드 그룹 중 스레드 당 연산량이 가장 큰 스레드 그룹을 선택할 수 있다.
이에 따라, 그룹 할당부(117)는 선택된 스레드 그룹에 포함된 적어도 하나의 스레드 각각의 코어 할당 기록에 기초하여, 미 할당된 액티브 코어 각각에 대한 상기에서 선택된 스레드 그룹의 이주 비용을 산출할 수 있다.
이때, 그룹 할당부(117)는 산출된 이주 비용이 가장 작은 액티브 코어에 상기에서 선택된 스레드 그룹을 할당할 수 있다.
이와 관련하여, 그룹 할당부(117)는 액티브 코어에 미 할당된 스레드 그룹이 존재하지 않을 때까지 스레드 그룹을 선택하고, 이주 비용을 산출하여 액티브 코어에 스레드 그룹을 할당하는 과정을 반복할 수 있다.
한편, 스케줄링부(130)는 액티브 코어 각각에 다수의 스레드 그룹 각각이 할당되도록 스케줄링 주기를 설정할 수 있다. 일 실시예에서, 스케줄링부(130)는 응용 프로그램이 실행되면 초기의 스케줄링 주기를 미리 설정된 최소 주기(예를 들어, 0.125 ms)로 설정할 수 있다.
이에 따라, 스케줄링부(130)는 다수의 스레드에 대한 성능 데이터를 획득하고, 획득된 성능 데이터에 기초하여 스케줄링 주기를 조절할 수 있다.
일 실시예에서, 스케줄링부(130)는 새로운 성능 데이터가 이전의 성능 데이터보다 높게 나타나는 경우에 스케줄링 주기를 2 배 늘릴 수 있다. 또한, 스케줄링부(130)는 새로운 성능 데이터가 이전의 성능 데이터보다 낮게 나타나는 경우에는 응용 프로그램이 종료될 때까지 스케줄링 주기를 이전 스케줄링 주기로 고정할 수 있다. 이러한 경우에, 스케줄링부(130)는 응용 프로그램에 대해 고정된 스케줄링 주기를 기록하고, 상기의 응용 프로그램이 재 실행되는 경우에 기록된 스케줄링 주기에 따라 스레드를 할당할 수 있다.
한편, 일 실시예에서, 스케줄링부(130)는 성능 모니터링 장치로부터 성능 데이터를 획득할 수 있다. 이를 위해, 성능 모니터링 장치는 컴퓨팅 장치에 의해 실행된 응용 프로그램에 대해 미리 설정된 주기마다 신호를 요청할 수 있다.
이에 따라, 성능 모니터링 장치는 일정한 주기에 따라 신호를 요청하여 컴퓨팅 장치로부터 수신된 신호 간의 간격에 기초하여 성능 데이터를 생성할 수 있다.
예를 들어, 성능 모니터링 장치는 수신된 신호 간의 간격이 짧아질수록 성능 데이터가 높은 성능을 나타내도록 생성하고, 간격이 길어질수록 성능 데이터가 낮은 성능을 나타내도록 생성할 수 있다.
일 실시예에서, 성능 모니터링 장치는 일정한 주기에 따라 컴퓨팅 장치로부터 하트비트(Heartbeats) 신호를 수신할 수 있다.
여기에서, 하트비트 신호는 임의의 장치가 특정 네트워크와의 연결이 유지되도록 송신하는 신호일 수 있다. 이때, 하트비트 신호를 생성하는 것은 종래에 공지된 기술이 이용될 수 있다.
이에 따라, 성능 모니터링 장치는 하트비트 신호 간의 간격이 짧아질수록 성능 데이터가 높은 성능을 나타내도록 생성하고, 간격이 길어질수록 성능 데이터가 낮은 성능을 나타내도록 생성할 수 있다.
도 2는 도 1의 생성부에서 생성되는 스레드 그룹의 일 실시예를 나타낸 도면이다.
도 2를 참조하면, 프로세서에 포함된 다수의 코어들(210, 230)과, 생성부(111)에 의해 생성된 다수의 스레드 그룹(310)을 확인할 수 있다.
이와 같이, 스레드 그룹(310)은 다수의 액티브 코어(210)에 대응되도록 다수개가 생성될 수 있다. 이때, 스레드 그룹(310)은 액티브 코어(210)의 개수와 동일한 개수로 생성될 수 있다. 또한, 스레드 그룹(310)은 액티브 코어(210)의 타입과 동일한 타입으로 생성될 수 있다.
일 실시예에서, 생성부(111)는 고성능 액티브 코어(211, H) 3개와 저성능 액티브 코어(213, L) 2개가 액티브 코어(210)로서 설정되면, 고성능 스레드 그룹(311, TG1 내지 TG3) 3개와 저성능 스레드 그룹(313, TG4 내지 TG5) 2개를 생성할 수 있다.
도 3 내지 도 6은 도 1의 설정부에서, 할당할 스레드의 개수를 결정하는 과정의 일 실시예를 나타낸 도면이다.
도 3을 참조하면, 다수의 스레드 그룹(310) 각각의 연산용량(Computation capacity), 다수의 스레드 그룹(310) 각각에 대해 할당할 것으로 예측된 스레드 개수(Thread count) 및 스레드 당 연산량(Per-thread computation capacity)을 확인할 수 있다.
이때, 고성능 스레드 그룹(311, TG1 내지 TG3)은 연산용량이 각각 C로 설정되고, 저성능 스레드 그룹(313, TG4 내지 TG5)은 연산용량이 각각 0.8C로 설정될 수 있다.
이와 관련하여, 다수의 스레드 그룹(310) 각각이 생성된 직후에, 다수의 스레드 그룹(310) 각각에 할당할 것으로 예상되는 스레드의 개수가 1로 초기화된 것을 확인할 수 있다.
이에 따라, 설정부(113)는 스레드 당 연산량이 큰 순서에 따라, 제 1 고성능 스레드 그룹(311, TG1)에 할당할 스레드의 개수를 증가시킬 수 있다.
도 4를 참조하면, 제 1 고성능 스레드 그룹(311, TG1)에 할당할 스레드의 개수가 증가된 것을 확인할 수 있다.
이에 따라, 제 1 고성능 스레드 그룹(311, TG1)에 대한 스레드 당 연산량은 0.5C로 예측될 수 있다.
다음으로, 설정부(113)는 스레드 당 연산량이 큰 순서에 따라, 제 2 고성능 스레드 그룹(311, TG2)에 할당할 스레드의 개수를 증가시킬 수 있다.
도 5를 참조하면, 제 2 고성능 스레드 그룹(311, TG2)에 할당할 스레드의 개수가 증가된 것을 확인할 수 있다.
이에 따라, 제 2 고성능 스레드 그룹(311, TG2)에 대한 스레드 당 연산량은 0.5C로 예측될 수 있다.
다음으로, 설정부(113)는 스레드 당 연산량이 큰 순서에 따라, 제 3 고성능 스레드 그룹(311, TG3)에 할당할 스레드의 개수를 증가시킬 수 있다.
도 6을 참조하면, 제 3 고성능 스레드 그룹(311, TG3)에 할당할 스레드의 개수가 증가된 것을 확인할 수 있다.
이에 따라, 제 3 고성능 스레드 그룹(311, TG3)에 대한 스레드 당 연산량은 0.5C로 예측될 수 있다.
이때, 설정부(113)는 현재 주기 내 실행할 다수의 스레드의 개수가 8개인 경우에, 현재 상태에서, 다수의 스레드 그룹(310) 각각에 할당할 스레드의 개수를 증가시키는 과정을 종료할 수 있다.
다시 말해서, 설정부(113)는 고성능 스레드 그룹(311, TG1 내지 TG3) 각각에 대해 할당할 스레드의 개수를 2개로 결정하고, 저성능 스레드 그룹(313, TG4 내지 TG5) 각각에 대해 할당할 스레드의 개수를 1개로 결정할 수 있다.
도 7 내지 도 8은 도 1의 스레드 할당부에서 스레드 그룹에 스레드를 할당하는 과정의 일 실시예를 나타낸 도면이다.
도 7을 참조하면, 정렬된 스레드 그룹(310)과 우선 순위에 기초하여 화살표 방향으로 나열된 다수의 스레드를 확인할 수 있다. 이때, 다수의 스레드는 물결 표시로 형상화되었다.
도 6을 더 참조하면, 고성능 스레드 그룹(311, TG1 내지 TG3) 각각에 대한 스레드 당 연산량 보다 큰 스레드 당 연산량이 산출된 저성능 스레드 그룹(313, TG4 내지 TG5) 각각이 먼저 정렬된 것을 확인할 수 있다.
또한, 스레드 당 연산량이 동일한 경우에는, 스레드 그룹의 ID의 값이 작은 스레드 그룹이 먼저 정렬된 것을 확인할 수 있다.
도 8을 참조하면, 정렬된 다수의 스레드 그룹에, 우선 순위에 따른 적어도 하나의 스레드가 할당된 것을 확인할 수 있다.
도 9는 도 1의 그룹 할당부에서 액티브 코어에 스레드 그룹을 할당하는 과정의 일 실시예를 나타낸 도면이다.
도 9를 참조하면, 다수의 액티브 코어(210) 각각에 다수의 스레드 그룹(310) 각각이 할당된 것을 확인할 수 있다.
이때, 다수의 스레드 그룹 각각에 대한 스레드 당 연산량과, 이주 비용에 기초하여 다수의 액티브 코어(210) 각각에 다수의 스레드 그룹(310) 각각이 할당된 것으로 이해할 수 있다.
도 10은 본 발명의 일 실시예에 따른 스레드 할당 방법의 순서도이다.
도 10을 참조하면, 생성부(111)는 컴퓨팅 장치에 포함된 다수의 코어들 중 액티브 코어(210)의 개수에 기초하여 다수의 스레드 그룹(310)을 생성할 수 있다(S100).
이때, 설정부(113)는 다수의 스레드 그룹(310) 각각의 스레드 당 연산량에 기초하여 현재 주기 내 실행할 다수의 스레드 중 다수의 스레드 그룹(310) 각각에 할당할 스레드의 개수를 결정할 수 있다.
이에 따라, 스레드 할당부(115)는 다수의 스레드 각각의 우선 순위와, 상기에서 결정된 개수에 기초하여 다수의 스레드 그룹(310) 각각에 적어도 하나의 스레드를 할당할 수 있다(S300).
이를 통해, 그룹 할당부(117)는 액티브 코어(210) 각각에 다수의 스레드 그룹(310) 각각을 할당할 수 있다(S400).
본 문서의 다양한 실시예들은 기기(machine)(예: 컴퓨터)로 읽을 수 있는 저장 매체(machine-readable storage media)(예: 메모리(내장 메모리 또는 외장 메모리))에 저장된 명령어를 포함하는 소프트웨어(예: 프로그램)로 구현될 수 있다. 기기는, 저장 매체로부터 저장된 명령어를 호출하고, 호출된 명령어에 따라 동작이 가능한 장치로서, 개시된 실시예들에 따른 전자 장치(예: 장치)를 포함할 수 있다. 상기 명령이 프로세서(예: 프로세서)에 의해 실행될 경우, 프로세서가 직접, 또는 상기 프로세서의 제어 하에 다른 구성요소들을 이용하여 상기 명령에 해당하는 기능을 수행할 수 있다. 명령은 컴파일러 또는 인터프리터에 의해 생성 또는 실행되는 코드를 포함할 수 있다. 기기로 읽을 수 있는 저장매체는, 비일시적(non-transitory) 저장매체의 형태로 제공될 수 있다. 여기서, '비일시적'은 저장매체가 신호(signal)를 포함하지 않으며 실재(tangible)한다는 것을 의미할 뿐 데이터가 저장매체에 반영구적 또는 임시적으로 저장됨을 구분하지 않는다.
일 실시예에 따르면, 본 문서에 개시된 다양한 실시예들에 따른 방법은 컴퓨터 프로그램 제품(computer program product)에 포함되어 제공될 수 있다.
이상의 설명은 본 발명의 기술 사상을 예시적으로 설명한 것에 불과한 것으로서, 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자라면 본 발명의 본질적인 품질에서 벗어나지 않는 범위에서 다양한 수정 및 변형이 가능할 것이다. 따라서, 본 발명에 개시된 실시예들은 본 발명의 기술 사상을 한정하기 위한 것이 아니라 설명하기 위한 것이고, 이러한 실시예에 의하여 본 발명의 기술 사상의 범위가 한정되는 것은 아니다. 본 발명의 보호 범위는 아래의 청구범위에 의하여 해석되어야 하며, 그와 균등한 범위 내에 있는 모든 기술사상은 본 발명의 권리범위에 포함되는 것으로 해석되어야 할 것이다.

Claims (16)

  1. 컴퓨팅 장치에 포함된 다수의 코어들 중 액티브(Active) 코어의 개수에 기초하여 다수의 스레드 그룹을 생성하는 단계;
    상기 다수의 스레드 그룹 각각의 스레드 당 연산량에 기초하여 현재 주기 내 실행할 다수의 스레드 중 상기 다수의 스레드 그룹 각각에 할당할 스레드의 개수를 결정하는 단계;
    상기 다수의 스레드 각각의 우선 순위와, 상기 결정된 개수에 기초하여 상기 다수의 스레드 그룹 각각에 적어도 하나의 스레드를 할당하는 단계; 및
    상기 액티브 코어 각각에 상기 다수의 스레드 그룹 각각을 할당하는 단계;를 포함하는, 스레드 할당 방법.
  2. 제 1 항에 있어서, 상기 스레드의 개수를 결정하는 단계는,
    상기 다수의 스레드 그룹 각각에 할당할 스레드의 개수를 초기화하는 단계; 및
    상기 스레드 당 연산량이 큰 순서대로 상기 다수의 스레드 그룹 각각에 할당할 스레드의 개수를 증가시키는 단계;를 포함하는, 스레드 할당 방법.
  3. 제 2 항에 있어서, 상기 상기 스레드의 개수를 증가시키는 단계는,
    상기 다수의 스레드 그룹 각각에 상기 다수의 스레드가 모두 할당될 때까지 반복되는, 스레드 할당 방법.
  4. 제 1 항에 있어서, 상기 적어도 하나의 스레드를 할당하는 단계는,
    상기 다수의 스레드 그룹 각각에 할당할 스레드의 개수에 기초하여 상기 스레드 당 연산량을 산출하는 단계;
    상기 스레드 당 연산량에 기초하여 상기 다수의 스레드 그룹을 정렬하는 단계; 및
    상기 정렬된 순서에 따라 상기 다수의 스레드 그룹 각각에 상기 적어도 하나의 스레드를 할당하는 단계;를 포함하는, 스레드 할당 방법.
  5. 제 4 항에 있어서, 상기 적어도 하나의 스레드를 할당하는 단계는,
    상기 다수의 스레드 각각에 대해 미리 부여된 자원과 스레드 ID 중 적어도 하나에 기초하여 상기 다수의 스레드 각각에 대한 우선 순위를 설정하는 단계;를 포함하는, 스레드 할당 방법.
  6. 제 5 항에 있어서, 상기 우선 순위는,
    상기 미리 부여된 자원이 적을수록 높게 설정되고, 상기 스레드 ID의 값이 작을수록 높게 설정되는, 스레드 할당 방법.
  7. 제 1 항에 있어서, 상기 다수의 스레드 그룹 각각을 할당하는 단계는,
    미 할당된 적어도 하나의 스레드 그룹 중 상기 스레드 당 연산량이 가장 큰 스레드 그룹을 선택하는 단계;
    상기 선택된 스레드 그룹에 포함된 적어도 하나의 스레드 각각의 코어 할당 기록에 기초하여, 미 할당된 액티브 코어 각각에 대한 상기 선택된 스레드 그룹의 이주 비용을 산출하는 단계; 및
    상기 산출된 이주 비용이 가장 작은 액티브 코어에 상기 선택된 스레드 그룹을 할당하는 단계;를 포함하는, 스레드 할당 방법.
  8. 제 7 항에 있어서, 상기 이주 비용을 산출하는 단계는,
    서로 다른 프로세서 간의 이주에 대한 제 1 비용과, 서로 다른 코어 간의 이주에 대한 제 2 비용에 기초하여 상기 이주 비용을 산출하되, 상기 제 2 비용보다 상기 제 1 비용에 더 큰 가중치를 부여하는, 스레드 할당 방법.
  9. 제 1 항에 있어서,
    상기 다수의 액티브 코어 각각에 상기 다수의 스레드 그룹 각각이 할당되도록 스케줄링 주기를 설정하는 단계;를 더 포함하는, 스레드 할당 방법.
  10. 제 9 항에 있어서, 상기 스케줄링 주기를 설정하는 단계는,
    상기 다수의 스레드에 대한 성능 데이터를 획득하는 단계; 및
    상기 성능 데이터에 기초하여 상기 스케줄링 주기를 조절하는 단계;를 포함하는, 스레드 할당 방법.
  11. 컴퓨팅 장치에 포함된 다수의 코어들 중 액티브(Active) 코어의 개수에 기초하여 다수의 스레드 그룹을 생성하는 생성부;
    상기 다수의 스레드 그룹 각각의 스레드 당 연산량에 기초하여 현재 주기 내 실행할 다수의 스레드 중 상기 다수의 스레드 그룹 각각에 할당할 스레드의 개수를 결정하는 설정부;
    상기 다수의 스레드 각각의 우선 순위와, 상기 결정된 개수에 기초하여 상기 다수의 스레드 그룹 각각에 적어도 하나의 스레드를 할당하는 스레드 할당부; 및
    상기 액티브 코어 각각에 상기 다수의 스레드 그룹 각각을 할당하는 그룹 할당부;를 포함하는, 스레드 할당 장치.
  12. 제 11 항에 있어서, 상기 설정부는,
    상기 다수의 스레드 그룹 각각에 할당할 스레드의 개수를 초기화하고, 상기 스레드 당 연산량이 큰 순서대로 상기 다수의 스레드 그룹 각각에 할당할 스레드의 개수를 증가시키는, 스레드 할당 장치.
  13. 제 11 항에 있어서, 상기 스레드 할당부는,
    상기 다수의 스레드 그룹 각각에 할당할 스레드의 개수에 기초하여 상기 스레드 당 연산량을 산출하고, 상기 스레드 당 연산량에 기초하여 상기 다수의 스레드 그룹을 정렬하며, 상기 정렬된 순서에 따라 상기 다수의 스레드 그룹 각각에 상기 적어도 하나의 스레드를 할당하는, 스레드 할당 장치.
  14. 제 11 항에 있어서, 상기 스레드 그룹 할당부는,
    미 할당된 적어도 하나의 스레드 그룹 중 상기 스레드 당 연산량이 가장 큰 스레드 그룹을 선택하고, 상기 선택된 스레드 그룹에 포함된 적어도 하나의 스레드 각각의 코어 할당 기록에 기초하여, 미 할당된 액티브 코어 각각에 대한 상기 선택된 스레드 그룹의 이주 비용을 산출하며, 상기 산출된 이주 비용이 가장 작은 액티브 코어에 상기 선택된 스레드 그룹을 할당하는, 스레드 할당 장치.
  15. 제 11 항에 있어서,
    상기 다수의 액티브 코어 각각에 상기 다수의 스레드 그룹 각각이 할당되도록 스케줄링 주기를 설정하는 스케줄링부;를 더 포함하는, 스레드 할당 장치.
  16. 컴퓨터 프로그램을 저장하고 있는 컴퓨터 판독 가능 비 일시적 기록매체로서,
    상기 컴퓨터 프로그램은, 프로세서에 의해 실행되면,
    컴퓨팅 장치에 포함된 다수의 코어들 중 액티브(Active) 코어의 개수에 기초하여 다수의 스레드 그룹을 생성하는 단계;
    상기 다수의 스레드 그룹 각각의 스레드 당 연산량에 기초하여 현재 주기 내 실행할 다수의 스레드 중 상기 다수의 스레드 그룹 각각에 할당할 스레드의 개수를 결정하는 단계;
    상기 다수의 스레드 각각의 우선 순위와, 상기 결정된 개수에 기초하여 상기 다수의 스레드 그룹 각각에 적어도 하나의 스레드를 할당하는 단계; 및
    상기 액티브 코어 각각에 상기 다수의 스레드 그룹 각각을 할당하는 단계;를 포함하는 방법을 상기 프로세서가 수행하도록 하기 위한 명령어를 포함하는, 컴퓨터 판독 가능한 기록매체.
PCT/KR2022/007074 2022-01-07 2022-05-17 스레드 할당 방법, 스레드 할당 장치, 및 컴퓨터 판독 가능한 기록 매체 WO2023132414A1 (ko)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
KR1020220002525A KR20230106865A (ko) 2022-01-07 2022-01-07 스레드 할당 방법, 컴퓨터 판독 가능한 기록 매체, 컴퓨터 프로그램 및 장치
KR10-2022-0002525 2022-01-07

Publications (1)

Publication Number Publication Date
WO2023132414A1 true WO2023132414A1 (ko) 2023-07-13

Family

ID=87073836

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/KR2022/007074 WO2023132414A1 (ko) 2022-01-07 2022-05-17 스레드 할당 방법, 스레드 할당 장치, 및 컴퓨터 판독 가능한 기록 매체

Country Status (2)

Country Link
KR (1) KR20230106865A (ko)
WO (1) WO2023132414A1 (ko)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9280388B2 (en) * 2013-01-22 2016-03-08 Oracle International Corporation Method and apparatus for efficient scheduling of multithreaded programs
US20180349186A1 (en) * 2017-06-04 2018-12-06 Apple Inc. Scheduler for AMP Architecture with Closed Loop Performance Controller Using Static and Dynamic Thread Grouping
KR101975288B1 (ko) * 2012-06-15 2019-05-07 삼성전자 주식회사 멀티 클러스터 프로세싱 시스템 및 그 구동 방법
KR102022972B1 (ko) * 2018-03-09 2019-09-19 울산과학기술원 이종 멀티 프로세싱 시스템 환경 기반 런타임 관리장치 및 방법
US20210055958A1 (en) * 2019-08-22 2021-02-25 Intel Corporation Technology For Dynamically Grouping Threads For Energy Efficiency

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8724486B2 (en) 2008-05-02 2014-05-13 Pine Valley Investments, Inc. System and method for heartbeat signal generation
US11436118B2 (en) 2019-12-27 2022-09-06 Intel Corporation Apparatus and method for adaptively scheduling work on heterogeneous processing resources

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101975288B1 (ko) * 2012-06-15 2019-05-07 삼성전자 주식회사 멀티 클러스터 프로세싱 시스템 및 그 구동 방법
US9280388B2 (en) * 2013-01-22 2016-03-08 Oracle International Corporation Method and apparatus for efficient scheduling of multithreaded programs
US20180349186A1 (en) * 2017-06-04 2018-12-06 Apple Inc. Scheduler for AMP Architecture with Closed Loop Performance Controller Using Static and Dynamic Thread Grouping
KR102022972B1 (ko) * 2018-03-09 2019-09-19 울산과학기술원 이종 멀티 프로세싱 시스템 환경 기반 런타임 관리장치 및 방법
US20210055958A1 (en) * 2019-08-22 2021-02-25 Intel Corporation Technology For Dynamically Grouping Threads For Energy Efficiency

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
PARK JINSU; PARK SEONGBEOM; HAN MYEONGGYUN; BAEK WOONGKI: "PALM: Progress- and Locality-Aware Adaptive Task Migration for Efficient Thread Packing", 2021 IEEE INTERNATIONAL PARALLEL AND DISTRIBUTED PROCESSING SYMPOSIUM (IPDPS), IEEE, 17 May 2021 (2021-05-17), pages 330 - 339, XP033933806, DOI: 10.1109/IPDPS49936.2021.00041 *

Also Published As

Publication number Publication date
KR20230106865A (ko) 2023-07-14

Similar Documents

Publication Publication Date Title
WO2014104634A1 (en) System and method for dynamically expanding virtual cluster and recording medium on which program for executing the method is recorded
WO2014025145A1 (en) Method and apparatus for processing message between processors
WO2019031858A1 (en) METHOD AND APPARATUS FOR DETERMINING MEMORY NEEDS IN A NETWORK
WO2012044015A2 (en) Method and apparatus for dynamic resource allocation of processing units
WO2014094495A1 (zh) 云调度方法及其系统
WO2020235880A1 (en) Apparatus and method for adjusting resources in cloud system
WO2021034024A1 (en) Electronic apparatus and method for controlling thereof
WO2016064158A1 (ko) 재구성 가능 프로세서 및 그 동작 방법
WO2022124720A1 (ko) 운영체제 커널 메모리의 실시간 오류 검출 방법
WO2014204167A1 (ko) 영상 저장 방법 및 장치
WO2013066124A1 (ko) 인터럽트 할당 방법 및 장치
WO2021210880A1 (ko) 가상 머신에 자원을 할당하는 방법 및 장치
WO2023132414A1 (ko) 스레드 할당 방법, 스레드 할당 장치, 및 컴퓨터 판독 가능한 기록 매체
WO2014112831A1 (en) Method and system for dynamically changing page allocator
WO2013165188A1 (ko) 컴퓨팅 장치에서 수행되는 자원 모니터링 방법 및 컴퓨팅 장치
JPH0628323A (ja) プロセス実行制御方法
WO2013027951A1 (ko) 멀티 코어 시스템의 인터럽트 할당 방법 및 장치
WO2022145613A1 (ko) 다중 코어 할당 장치 및 방법
WO2021020746A1 (ko) 가상 머신 관리 장치 및 방법
WO2013085089A1 (ko) M2m 클라우드 환경에서 통신망 자원 활용 방법 및 그 시스템
JPH1165862A (ja) マルチプロセッサ資源分割管理方式
WO2012118268A2 (ko) 멀티 버추얼 머신을 이용한 멀티 쓰레드 처리시스템 및 그 방법
WO2021157837A1 (en) Electronic device for scheduling based on heterogeneous multi-processor and operating method
JPH02210542A (ja) 仮想計算機システムにおける実行制御方式
WO2017007044A1 (ko) 신호 처리 장치 및 방법

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22918951

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2022918951

Country of ref document: EP

ENP Entry into the national phase

Ref document number: 2022918951

Country of ref document: EP

Effective date: 20240610