TW202119207A - Scheduling method and apparatus, electronic device and storage medium - Google Patents

Scheduling method and apparatus, electronic device and storage medium Download PDF

Info

Publication number
TW202119207A
TW202119207A TW109115358A TW109115358A TW202119207A TW 202119207 A TW202119207 A TW 202119207A TW 109115358 A TW109115358 A TW 109115358A TW 109115358 A TW109115358 A TW 109115358A TW 202119207 A TW202119207 A TW 202119207A
Authority
TW
Taiwan
Prior art keywords
task
scheduling period
time
length
current scheduling
Prior art date
Application number
TW109115358A
Other languages
Chinese (zh)
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 TW202119207A publication Critical patent/TW202119207A/en

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/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4812Task transfer initiation or dispatching by interrupt, e.g. masked
    • G06F9/4831Task transfer initiation or dispatching by interrupt, e.g. masked with variable priority
    • G06F9/4837Task transfer initiation or dispatching by interrupt, e.g. masked with variable priority time dependent
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution
    • 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
    • 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/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
    • 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/5061Partitioning or combining of resources
    • G06F9/5077Logical partitioning of resources; Management or configuration of virtualized resources

Landscapes

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

Abstract

The present disclosure relates to a scheduling method and apparatus, an electronic device, and a storage medium. The method includes: obtaining task processing time of a first task within a current scheduling period; base on the task processing time and a length of a first time slice allocated for the first task within the current scheduling period, determining whether the first task times out; and based on the determined result, adjusting a time slice allocated for at least one second task within a target scheduling period, where the target scheduling period includes the current scheduling period or a scheduling period next to the current scheduling period.

Description

調度方法及裝置、電子設備和記錄媒體Scheduling method and device, electronic equipment and recording medium

本公開涉及電腦技術領域,尤其涉及一種調度方法及裝置、電子設備和記錄媒體。The present disclosure relates to the field of computer technology, in particular to a scheduling method and device, electronic equipment and recording media.

隨著人工智慧技術的快速發展,建立了一大批人工智慧企業,而人工智慧中應用的神經網路依賴於圖像處理器(Graphics Processing Unit,GPU)的計算能力,GPU的計算任務由小規模逐漸向大規模、高速網路互連發展。為了滿足不同任務對GPU的不同要求,學術界和工業界開始探索GPU虛擬化技術。With the rapid development of artificial intelligence technology, a large number of artificial intelligence enterprises have been established. The neural network used in artificial intelligence relies on the computing power of the graphics processing unit (GPU). Gradually develop towards large-scale, high-speed internet interconnection. In order to meet the different requirements of different tasks on the GPU, academia and industry have begun to explore GPU virtualization technology.

本公開提出了一種調度方案。The present disclosure proposes a scheduling scheme.

根據本公開的一方面,提供了一種調度方法,包括:獲取當前調度週期內第一任務的任務處理時間;基於所述任務處理時間以及所述當前調度週期內為所述第一任務分配的第一時間片,確定所述第一任務是否超時;根據確定的結果,調整目標調度週期內為至少一個第二任務分配的時間片,其中,所述目標調度週期包括所述當前調度週期或所述當前調度週期的下一調度週期。According to an aspect of the present disclosure, there is provided a scheduling method, including: obtaining task processing time of a first task in a current scheduling period; based on the task processing time and the first task allocated to the first task in the current scheduling period A time slice to determine whether the first task has timed out; according to the determined result, the time slice allocated to at least one second task in the target scheduling period is adjusted, wherein the target scheduling period includes the current scheduling period or the State the next scheduling period of the current scheduling period.

在一個或多個可選實施例中,所述基於所述任務處理時間以及所述當前調度週期內為所述第一任務分配的第一時間片,確定所述第一任務是否超時,包括:確定所述任務處理時間的截止時刻與所述第一時間片的截止時刻之間的第一時間差值;在所述第一時間差值大於第一時間閾值的情況下,確定所述第一任務超時。In one or more optional embodiments, the determining whether the first task times out based on the task processing time and the first time slice allocated for the first task in the current scheduling period includes : Determine the first time difference between the deadline of the task processing time and the deadline of the first time slice; if the first time difference is greater than the first time threshold, determine the first time difference A task timed out.

在一個或多個可選實施例中,所述第一時間閾值是基於所述第一時間片的長度得到的。In one or more optional embodiments, the first time threshold is obtained based on the length of the first time slice.

在一個或多個可選實施例中,所述根據確定的結果,調整目標調度週期內為至少一個第二任務分配的時間片,包括:在確定所述第一任務超時的情況下,調整所述當前調度週期的長度;基於所述當前調度週期的調整後的長度,調整所述當前調度週期內為至少一個第二任務分配的時間片。In one or more optional embodiments, the adjusting the time slice allocated to the at least one second task in the target scheduling period according to the result of the determination includes: adjusting when the first task is determined to time out The length of the current scheduling period; based on the adjusted length of the current scheduling period, adjusting the time slice allocated for at least one second task in the current scheduling period.

在一個或多個可選實施例中,所述基於所述當前調度週期的調整後的長度,調整所述當前調度週期內為至少一個第二任務分配的時間片,包括:基於所述當前調度週期的調整後的長度以及每個所述第二任務對應的服務品質參數,調整所述當前調度週期內為每個所述第二任務分配的時間片的長度,以使每個所述第二任務的服務品質參數保持為對應的預設數值和/或每個所述第二任務的時間片在所述當前調度週期中所占的比例保持為對應的預設數值。In one or more optional embodiments, the adjusting the time slice allocated for at least one second task in the current scheduling period based on the adjusted length of the current scheduling period includes: based on the current scheduling period The adjusted length of the period and the service quality parameter corresponding to each second task, adjust the length of the time slice allocated for each second task in the current scheduling period, so that each second task The service quality parameter of the task is maintained at the corresponding preset value and/or the proportion of the time slice of each second task in the current scheduling period is maintained at the corresponding preset value.

在一個或多個可選實施例中,所述在確定所述第一任務超時的情況下,調整所述當前調度週期的長度,包括:獲取所述當前調度週期內第三任務的超時次數,其中,所述第三任務為當前調度週期內已執行完畢的任務;根據所述超時次數,確定對所述當前調度週期的長度進行延長的延長係數,其中,所述延長係數與所述超時次數正相關;基於所述延長係數,對所述當前調度週期的長度進行延長,得到所述當前調度週期調整後的長度。In one or more optional embodiments, in the case where it is determined that the first task is timed out, adjusting the length of the current scheduling period includes: obtaining the timeout of the third task in the current scheduling period The third task is a task that has been executed in the current scheduling period; according to the number of timeouts, an extension coefficient for extending the length of the current scheduling period is determined, wherein the extension coefficient is The number of timeouts is positively correlated; based on the extension coefficient, the length of the current scheduling period is extended to obtain the adjusted length of the current scheduling period.

在一個或多個可選實施例中,所述延長係數是基於以所述超時次數為變量的指數函數得到的。In one or more optional embodiments, the extension coefficient is obtained based on an exponential function with the number of timeouts as a variable.

在一個或多個可選實施例中,所述方法還包括:獲取所述當前調度週期內第三任務的任務處理時間,其中,所述至少一個第二任務包括所述第三任務;響應於所述第三任務的任務處理時間小於所述第三任務的調整後的時間片長度,在所述當前調度週期內對所述第三任務進行時間補償。In one or more optional embodiments, the method further includes: acquiring the task processing time of a third task in the current scheduling period, wherein the at least one second task includes the third task; in response to The task processing time of the third task is less than the adjusted time slice length of the third task, and time compensation is performed on the third task in the current scheduling period.

在一個或多個可選實施例中,所述響應於所述第三任務的任務處理時間小於所述第三任務的調整後的時間片長度,在所述當前調度週期內對所述第三任務進行時間補償,包括:基於所述第三任務的任務處理時間和所述第三任務的調整後的時間片長度,確定所述第三任務的補償時間;基於所述補償時間,將所述第三任務的補償任務添加到所述當前調度週期的調度隊列中。In one or more optional embodiments, the task processing time in response to the third task is less than the adjusted time slice length of the third task, and the third task is processed in the current scheduling period. The time compensation of the task includes: determining the compensation time of the third task based on the task processing time of the third task and the adjusted time slice length of the third task; and calculating the compensation time of the third task based on the compensation time The compensation task of the third task is added to the scheduling queue of the current scheduling period.

在一個或多個可選實施例中,基於所述補償時間,將所述第三任務的所述補償任務添加到所述當前調度週期的調度隊列中,包括:基於所述補償時間,將所述第三任務的所述補償任務添加到所述當前調度週期的調度隊列的隊尾。In one or more optional embodiments, adding the compensation task of the third task to the scheduling queue of the current scheduling period based on the compensation time includes: adding the compensation task of the third task to the scheduling queue of the current scheduling period based on the compensation time. The compensation task of the third task is added to the end of the scheduling queue of the current scheduling period.

在一個或多個可選實施例中,所述根據確定的結果,調整目標調度週期內為至少一個第二任務分配的時間片,包括:在確定所述當前調度週期內每個任務均未超時的情況下,調整所述當前調度週期的下一調度週期的長度;基於所述下一調度週期的調整後的長度,確定所述下一調度週期內為至少一個第二任務分配的時間片。In one or more optional embodiments, the adjusting the time slice allocated for the at least one second task in the target scheduling period according to the result of the determination includes: determining that each task does not exceed the time in the current scheduling period. In the case of time, the length of the next scheduling period of the current scheduling period is adjusted; based on the adjusted length of the next scheduling period, the time slice allocated for at least one second task in the next scheduling period is determined .

在一個或多個可選實施例中,所述調整所述當前調度週期的下一調度週期的長度,包括:利用預設的縮減係數對所述下一調度週期的長度進行縮減。In one or more optional embodiments, the adjusting the length of the next scheduling period of the current scheduling period includes: reducing the length of the next scheduling period by using a preset reduction factor.

在一個或多個可選實施例中,所述基於所述下一調度週期的調整後的長度,確定所述下一調度週期內為至少一個第二任務分配的時間片,包括:基於所述下一調度週期的調整後的長度以及每個所述第二任務對應的服務品質參數,確定所述下一調度週期內每個所述第二任務分配的時間片的長度,以使每個所述第二任務的服務品質參數保持為對應的預設數值和/或每個所述第二任務的時間片在所述下一調度週期中所占的比例保持為對應的預設數值。In one or more optional embodiments, the determining a time slice allocated for at least one second task in the next scheduling period based on the adjusted length of the next scheduling period includes: based on the The adjusted length of the next scheduling period and the service quality parameter corresponding to each of the second tasks determine the length of the time slice allocated by each of the second tasks in the next scheduling period, so that each The service quality parameter of the second task is maintained at the corresponding preset value and/or the proportion of the time slice of each second task in the next scheduling period is maintained at the corresponding preset value.

在一個或多個可選實施例中,所述方法還包括:獲取預設時間段內多個任務執行歷史任務的歷史任務處理時間;根據所述歷史任務處理時間的統計資訊,確定所述當前調度週期的初始長度。In one or more optional embodiments, the method further includes: acquiring the historical task processing time of multiple tasks executing historical tasks within a preset time period; and determining the current task processing time according to the statistical information of the historical task processing time The initial length of the scheduling period.

根據本公開的一方面,提供了一種調度裝置,包括:獲取模組,用於獲取當前調度週期內第一任務的任務處理時間;確定模組,用於基於所述任務處理時間以及所述當前調度週期內為所述第一任務分配的第一時間片,確定所述第一任務是否超時;調整模組,用於根據確定的結果,調整目標調度週期內為至少一個第二任務分配的時間片,其中,所述目標調度週期包括所述當前調度週期或所述當前調度週期的下一調度週期。According to an aspect of the present disclosure, there is provided a scheduling device, including: an acquisition module for acquiring the task processing time of a first task in a current scheduling period; a determination module for acquiring task processing time based on the task processing time and the current The first time slice allocated for the first task in the scheduling period determines whether the first task has timed out; the adjustment module is used to adjust the allocation of at least one second task in the target scheduling period according to the determined result Time slice, wherein the target scheduling period includes the current scheduling period or the next scheduling period of the current scheduling period.

根據本公開的另一方面,提供了一種電子設備,包括:處理器;用於儲存電腦可讀指令的記憶體;其中,所述處理器用於調度所述記憶體儲存的所述電腦可讀指令,以執行上述調度方法。According to another aspect of the present disclosure, there is provided an electronic device including: a processor; a memory for storing computer-readable instructions; wherein the processor is used for scheduling the computer-readable instructions stored in the memory , To perform the above scheduling method.

根據本公開的另一方面,提供了一種電腦可讀記錄媒體,其上儲存有電腦程式指令,所述電腦程式指令被電腦執行時實現上述調度方法。According to another aspect of the present disclosure, there is provided a computer-readable recording medium on which computer program instructions are stored, and the computer program instructions implement the above scheduling method when executed by a computer.

在本公開的另一方面,提供了一種電腦程式,包括電腦可讀指令,其中,所述電腦可讀指令被電腦執行時實現上述調度方法。In another aspect of the present disclosure, there is provided a computer program including computer-readable instructions, wherein the computer-readable instructions implement the above scheduling method when executed by a computer.

在本公開實施例中,可以獲取當前調度週期內第一任務的任務處理時間,然後基於任務處理時間以及當前調度週期內為第一任務分配的第一時間片,確定第一任務是否超時,再根據確定的結果,調整目標調度週期內為至少一個第二任務分配的時間片,其中,目標調度週期包括當前調度週期或當前調度週期的下一調度週期。這樣,可以自動對為目標調度週期內的第二任務分配的時間片進行調整,使目標調度週期內為每個第二任務被分配的時間片滿足服務品質的要求,從而提高用戶體驗。In the embodiment of the present disclosure, the task processing time of the first task in the current scheduling period can be obtained, and then based on the task processing time and the first time slice allocated for the first task in the current scheduling period, it is determined whether the first task has timed out, According to the determined result, the time slice allocated to the at least one second task in the target scheduling period is adjusted, where the target scheduling period includes the current scheduling period or the next scheduling period of the current scheduling period. In this way, the time slice allocated for the second task in the target scheduling period can be automatically adjusted, so that the time slice allocated for each second task in the target scheduling period meets the service quality requirements, thereby improving user experience.

應當理解的是,以上的一般描述和後文的細節描述僅是示例性和解釋性的,而非限制本公開。It should be understood that the above general description and the following detailed description are only exemplary and explanatory, rather than limiting the present disclosure.

根據下面參考附圖對示例性實施例的詳細說明,本公開的其它特徵及方面將變得清楚。According to the following detailed description of exemplary embodiments with reference to the accompanying drawings, other features and aspects of the present disclosure will become clear.

以下將參考附圖詳細說明本公開的各種示例性實施例、特徵和方面。附圖中相同的附圖標記表示功能相同或相似的元件。儘管在附圖中繪示了實施例的各種方面,但是除非特別指出,不必按比例繪製附圖。Various exemplary embodiments, features, and aspects of the present disclosure will be described in detail below with reference to the drawings. The same reference numerals in the drawings indicate elements with the same or similar functions. Although various aspects of the embodiments are illustrated in the drawings, unless otherwise noted, the drawings are not necessarily drawn to scale.

在這裡專用的詞「示例性」意為「用作例子、實施例或說明性」。這裡作為「示例性」所說明的任何實施例不必解釋為優於或好於其它實施例。The dedicated word "exemplary" here means "serving as an example, embodiment, or illustration." Any embodiment described here as "exemplary" need not be construed as being superior or better than other embodiments.

本文中術語「和/或」,僅僅是一種描述關聯對象的關聯關係,表示可以存在三種關係,例如,A和/或B,可以表示:單獨存在A,同時存在A和B,單獨存在B這三種情況。另外,本文中術語「至少一種」表示多種中的任意一種或多種中的至少兩種的任意組合,例如,包括A、B、C中的至少一種,可以表示包括從A、B和C構成的集合中選擇的任意一個或多個元素。The term "and/or" in this article is only an association relationship that describes associated objects. It means that there can be three relationships. For example, A and/or B can mean: A alone exists, A and B exist at the same time, and B exists alone. three situations. In addition, the term "at least one" in this document means any one or any combination of at least two of the multiple, for example, including at least one of A, B, and C, and may mean including those formed from A, B, and C. Any one or more elements selected in the set.

另外,為了更好地說明本公開,在下文的具體實施方式中給出了眾多的具體細節。本領域技術人員應當理解,沒有某些具體細節,本公開同樣可以實施。在一些實例中,對於本領域技術人員熟知的方法、手段、元件和電路未作詳細描述,以便於凸顯本公開的主旨。In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. Those skilled in the art should understand that the present disclosure can also be implemented without certain specific details. In some instances, the methods, means, elements, and circuits well known to those skilled in the art have not been described in detail, so as to highlight the gist of the present disclosure.

本公開實施例提供的調度方案,可以獲取當前調度週期內虛擬圖像處理單元(virtual Graphics Processing Unit,vGPU)的各個任務的任務處理時間,然後基於第一任務的任務處理時間以及當前調度週期內為第一任務分配的第一時間片,確定第一任務是否超時,從而可以根據確定的結果,調整目標調度週期內為至少一個第二任務分配的時間片。這樣可以在為第一任務分配的第一時間片過長或過短的情況下,自動對第二任務分配的時間片進行調整,從而合理配置目標調度週期內的第二任務的時間片,使GPU在具有較高的性能的同時,可以對分配的時間片進行靈活設置,使GPU的資源得到有效的利用,提高用戶體驗。The scheduling scheme provided by the embodiments of the present disclosure can obtain the task processing time of each task of the virtual graphics processing unit (vGPU) in the current scheduling period, and then based on the task processing time of the first task and the current scheduling period The first time slice allocated for the first task determines whether the first task times out, so that the time slice allocated for at least one second task in the target scheduling period can be adjusted according to the determined result. In this way, when the first time slice assigned to the first task is too long or too short, the time slice assigned to the second task can be automatically adjusted, so as to reasonably configure the time slice of the second task in the target scheduling period, so that While the GPU has high performance, it can flexibly set the allocated time slices, so that the resources of the GPU can be effectively used and the user experience can be improved.

這裡,可以將GPU,也就是物理GPU,劃分為更小粒度單元,每個單元可以稱為虛擬圖像處理單元。虛擬圖像處理單元可以分時多工GPU的方式對任務進行處理,每個任務可以包括多個任務單元。虛擬圖像處理單元在執行任務時,無法暫停正在執行的任務單元,因此,當虛擬圖像處理單元執行某個任務單元的處理時間較長時,該任務的任務處理時間會超過為該任務分配的時間片,從而降低其他任務的服務品質(QoS)。該服務品質可以是評價提供服務能力的一個指標,本公開實施例提供的調度方案,可以使任務的任務處理時間匹配該任務被分配的時間片,使得調度系統提供的服務品質得到保證。這裡的任務單元可以理解為任務處理的基礎單元,通常不可劃分成更小的單元,以及正在執行過程中不可暫停。多個任務單元可以分時多工虛擬圖像處理單元。例如,一個任務單元可以對應一個核(kernel)函數。核函數可以包括一組指令,每個核函數的長度可以相同也可以不同,在執行核函數時,必須等該核函數的所有指令全部執行完畢之後才可以停止。Here, the GPU, that is, the physical GPU, can be divided into smaller granular units, and each unit can be called a virtual image processing unit. The virtual image processing unit can process tasks in a time-sharing multiplexing GPU manner, and each task can include multiple task units. When the virtual image processing unit is performing a task, it cannot pause the task unit being executed. Therefore, when the processing time of the virtual image processing unit to execute a task unit is long, the task processing time of the task will exceed the task assigned to the task. Time slice, thereby reducing the quality of service (QoS) of other tasks. The service quality may be an index for evaluating the service capability. The scheduling scheme provided by the embodiment of the present disclosure can match the task processing time of the task to the time slice assigned to the task, so that the service quality provided by the scheduling system is guaranteed. The task unit here can be understood as the basic unit of task processing, usually cannot be divided into smaller units, and cannot be suspended during execution. Multiple task units can be time-sharing multiplexed virtual image processing unit. For example, a task unit can correspond to a kernel function. A kernel function can include a set of instructions, and the length of each kernel function can be the same or different. When executing a kernel function, you must wait for all the instructions of the kernel function to be executed before stopping.

一台設備可能包括一個或多個GPU,一個GPU也可能包括一個或多個虛擬圖像處理單元。本公開提供的調度方法可以應用在單個虛擬圖像處理單元上,也可以應用在多個虛擬圖像處理單元上。其中,多個虛擬圖像處理單元中的每個虛擬圖像處理單元的調度方法同單個虛擬圖像處理單元的調度方法類似。為了簡單起見,後續以單個虛擬圖像處理單元為例進行說明。本領域技術人員應該可以理解,本公開不限制虛擬圖像處理單元的數量。類似的,本領域技術人員應該可以理解,本公開也不限制GPU的數量。A device may include one or more GPUs, and a GPU may also include one or more virtual image processing units. The scheduling method provided by the present disclosure can be applied to a single virtual image processing unit, and can also be applied to multiple virtual image processing units. Wherein, the scheduling method of each of the multiple virtual image processing units is similar to the scheduling method of a single virtual image processing unit. For the sake of simplicity, a single virtual image processing unit is used as an example for description in the following. Those skilled in the art should understand that the present disclosure does not limit the number of virtual image processing units. Similarly, those skilled in the art should understand that the present disclosure does not limit the number of GPUs.

本公開實施例提供的技術方案可以應用於GPU的任務處理、虛擬圖像處理單元的調度、時間片自適應的擴展等等,本公開實施例對此不做限定。The technical solutions provided by the embodiments of the present disclosure can be applied to task processing of GPUs, scheduling of virtual image processing units, time slice adaptive expansion, etc., which are not limited in the embodiments of the present disclosure.

圖1繪示根據本公開實施例的調度方法的流程圖。該調度方法可以由終端設備、伺服器或其它類型的電子設備執行,其中,終端設備可以為用戶設備(User Equipment,UE)、移動設備、用戶終端、終端、蜂巢式行動電話、無線電話、個人數位助理(Personal Digital Assistant,PDA)、手持設備、計算設備、車載設備、可穿戴設備等。在一些可能的實現方式中,該調度方法可以通過處理器調用記憶體中儲存的電腦可讀指令的方式來實現。該調度方法可以應用於在同一虛擬圖像處理單元上調度多個任務,其中,針對每個任務,可以分配一個或多個時間片,並通過在時間片上執行該任務的至少一個任務單元來實現對任務的執行。下面以電子設備作為執行主體為例對本公開實施例的調度方法進行說明。Fig. 1 shows a flowchart of a scheduling method according to an embodiment of the present disclosure. The scheduling method can be executed by terminal equipment, servers or other types of electronic equipment, where the terminal equipment can be User Equipment (UE), mobile equipment, user terminal, terminal, cellular mobile phone, wireless phone, personal Digital assistants (Personal Digital Assistant, PDA), handheld devices, computing devices, in-vehicle devices, wearable devices, etc. In some possible implementations, the scheduling method can be implemented by the processor invoking computer-readable instructions stored in the memory. The scheduling method can be applied to schedule multiple tasks on the same virtual image processing unit. For each task, one or more time slices can be allocated, and this can be achieved by executing at least one task unit of the task on the time slice The execution of the task. The scheduling method of the embodiment of the present disclosure will be described below by taking the electronic device as the execution subject as an example.

步驟S11,獲取當前調度週期內第一任務的任務處理時間。Step S11: Obtain the task processing time of the first task in the current scheduling period.

在本公開實施例中,電子設備可以檢測當前調度週期內多個任務中的每個任務的任務處理時間,第一任務可以是當前正在處理的任務。當前調度週期可以是當前正在處理的任務所在的調度週期。在虛擬圖像處理單元中,任務隊列包括多個調度週期。In the embodiment of the present disclosure, the electronic device may detect the task processing time of each of the multiple tasks in the current scheduling period, and the first task may be the task currently being processed. The current scheduling period may be the scheduling period of the task currently being processed. In the virtual image processing unit, the task queue includes multiple scheduling periods.

在一些例子中,在虛擬圖像處理單元中,一個調度週期較短,例如可以是幾秒,也可以是幾百毫秒。而一個任務隊列的週期相對較長,例如可以是幾小時,甚至是幾天。由於任務隊列中的一個任務可能需要被多個調度週期執行才能完成,相應地,本公開所述的調度週期內的某一任務,指的是該任務分配在該調度週期內執行的部分,可以是該任務的所有任務單元,也可以是該任務的部分任務單元。兩個任務調度週期時分處理的多個任務可能相同,也可能不同。In some examples, in the virtual image processing unit, a scheduling period is relatively short, for example, it can be several seconds or several hundreds of milliseconds. The cycle of a task queue is relatively long, for example, it can be several hours or even several days. Since a task in the task queue may need to be executed in multiple scheduling periods to complete, correspondingly, a certain task in the scheduling period described in the present disclosure refers to the part of the task allocated to be executed in the scheduling period. It is all task units of the task, or part of the task units of the task. Multiple tasks processed by time division in two task scheduling periods may be the same or different.

每個任務可以分時多工虛擬圖像處理單元。相應地,多個任務可以形成調度隊列。任務可以是圖像處理任務,也可以是訓練神經網路任務。本公開不限制任務具體處理的任務。任務的任務處理時間可以是在一個調度週期內執行該任務所花費的總時間,其中,執行該任務可以包括執行該任務的一個或多個任務單元。Each task can be time-sharing multiplexed virtual image processing unit. Correspondingly, multiple tasks can form a scheduling queue. The task can be an image processing task or a neural network training task. The present disclosure does not limit the tasks specifically handled by the tasks. The task processing time of a task may be the total time spent to execute the task in a scheduling period, where executing the task may include executing one or more task units of the task.

步驟S12,基於所述任務處理時間以及所述當前調度週期內為所述第一任務分配的第一時間片,確定所述第一任務是否超時。Step S12: Determine whether the first task times out based on the task processing time and the first time slice allocated for the first task in the current scheduling period.

在本公開實施例中,可以將第一任務的任務處理時間與為第一任務分配的第一時間片進行比對,得到比對結果,並根據該比對結果確定第一任務是否超時。這裡,第一時間片可以是為第一任務分配的、佔用虛擬圖像處理單元的時間。為每個任務分配的時間片的長度可以相同,也可以不同。In the embodiment of the present disclosure, the task processing time of the first task may be compared with the first time slice allocated for the first task to obtain a comparison result, and according to the comparison result, it is determined whether the first task has timed out. Here, the first time slice may be the time allocated for the first task and occupying the virtual image processing unit. The length of the time slice allocated to each task can be the same or different.

例如,第一任務包括多個任務單元,在當前調度週期內為該第一任務分配了第一時間片,用於執行第一任務的至少兩個任務單元。在利用當前調度週期的第一時間片執行所述第一任務的至少兩個任務單元的過程中,假設從第n個任務單元開始執行,而在執行第m個任務單元時,第一時間片已經到時,但是由於任務單元不能暫停,必須等第m個任務單元執行完畢才可以切換到下一個任務,這種情況下,第一任務的任務處理時間也就是從開始執行第n個任務單元到第m個任務執行完畢所花費的時間,超過了為其分配的第一時間片的長度,即第一任務超時。其中,m、n都是正整數,m≥n。For example, the first task includes multiple task units, and the first time slice is allocated to the first task in the current scheduling period, and at least two task units are used to execute the first task. In the process of using the first time slice of the current scheduling period to execute at least two task units of the first task, it is assumed that the execution starts from the nth task unit, and when the mth task unit is executed, the first time slice The time has expired, but because the task unit cannot be suspended, you must wait for the mth task unit to complete before switching to the next task. In this case, the task processing time of the first task is from the beginning of the nth task unit. The time taken to complete the execution of the mth task exceeds the length of the first time slice allocated for it, that is, the first task times out. Among them, m and n are both positive integers, and m≥n.

例如,可以將第一任務的任務處理時間的長度與第一時間片的長度進行比對,判斷第一任務的任務處理時間的長度是否大於第一時間片的長度,如果第一任務的任務處理時間的長度大於第一時間片的長度,可以確定第一任務超時。如果第一任務的任務處理時間的長度小於或等於第一時間片的長度,可以確定第一任務未超時。For example, the length of the task processing time of the first task can be compared with the length of the first time slice to determine whether the length of the task processing time of the first task is greater than the length of the first time slice. If the task processing time of the first task is If the length of the time is greater than the length of the first time slice, it can be determined that the first task has timed out. If the length of the task processing time of the first task is less than or equal to the length of the first time slice, it may be determined that the first task has not timed out.

再例如,可以將第一任務的任務處理時間的截止時刻與第一時間片的截止時刻進行比對,如果第一任務的任務處理時間的截止時刻大於第一時間片的截止時刻,可以確定第一任務超時。如果第一任務的任務處理時間的截止時刻小於或等於第一時間片的截止時刻,可以確定第一任務未超時。For another example, the deadline of the task processing time of the first task can be compared with the deadline of the first time slice. If the deadline of the task processing time of the first task is greater than the deadline of the first time slice, the first task can be determined. A task timed out. If the deadline of the task processing time of the first task is less than or equal to the deadline of the first time slice, it can be determined that the first task has not timed out.

在一個可能的實現方式中,可以確定第一任務的任務處理時間的截止時刻與第一時間片的截止時刻之間的第一時間差值,然後在第一時間差值大於第一時間閾值的情況下,確定第一任務超時。In a possible implementation, the first time difference between the deadline of the task processing time of the first task and the deadline of the first time slice can be determined, and then the first time difference is greater than the first time threshold. In this case, it is determined that the first task has timed out.

在該實現方式中,可以先計算第一任務的任務處理時間的截止時刻與第一時間片的截止時刻之間的第一時間差值,再將計算的第一時間差值與預設的第一時間閾值進行比較,如果第一時間差值大於第一時間閾值,則可以確定第一任務超時。如果第一時間差值小於或等於第一時間閾值,則可以確定第一任務未超時。In this implementation manner, the first time difference between the deadline of the task processing time of the first task and the deadline of the first time slice may be calculated first, and then the calculated first time difference may be compared with the preset first time difference. A time threshold is compared, and if the first time difference is greater than the first time threshold, it can be determined that the first task has timed out. If the first time difference is less than or equal to the first time threshold, it can be determined that the first task has not timed out.

仍以上述例子進行說明,在執行第m個任務單元時,該時間片已經到時,但是由於任務單元不能暫停,必須等第m個任務單元執行完畢才可以切換到下一個任務,這種情況下,不直接判斷第一任務超時,而是判斷第一任務的任務處理時間的截止時刻,也就是第m個任務單元的截止時刻,與第一時間片的截止時刻之間的第一時間差值。如果第一時間差值大於第一時間閾值,再確定第一任務超時。Still taking the above example to illustrate, when the m-th task unit is executed, the time slice has expired, but because the task unit cannot be suspended, it must wait for the m-th task unit to complete before switching to the next task. In this case Next, do not directly determine the first task timeout, but determine the deadline of the task processing time of the first task, that is, the deadline of the m-th task unit, and the first time between the deadline of the first time slice Difference. If the first time difference is greater than the first time threshold, it is determined that the first task has timed out.

在一些例子中,第一時間閾值可以是預先設置的固定值,例如,可以將第一時間閾值設置為0.2s、0.5s等。In some examples, the first time threshold may be a preset fixed value, for example, the first time threshold may be set to 0.2s, 0.5s, etc.

在一些例子中,第一時間閾值可以是預先設置的比例值。例如,上述第一時間閾值可以基於第一時間片的長度得到,如,可以將第一時間閾值設置為第一時間片長度的1%,這樣可以通過第一時間片的長度設置第一時間閾值,使第一時間閾值更靈活。當第一時間片較短時,第一時間閾值較小,也就是超時判定的條件相對苛刻;而當第一時間片較長時,第一時間閾值較大,也就是超時判定的條件相對寬鬆。再例如,還可以基於當前調度週期的長度得到第一時間閾值,如,將第一時間閾值設置為當前調度週期的長度的1%。In some examples, the first time threshold may be a preset ratio value. For example, the above-mentioned first time threshold can be obtained based on the length of the first time slice. For example, the first time threshold can be set to 1% of the length of the first time slice, so that the first time threshold can be set by the length of the first time slice. , Make the first time threshold more flexible. When the first time slice is short, the first time threshold is smaller, that is, the condition for timeout judgment is relatively harsh; when the first time slice is longer, the first time threshold is larger, which is the condition for timeout judgment Relatively loose. For another example, the first time threshold may also be obtained based on the length of the current scheduling period, for example, the first time threshold is set to 1% of the length of the current scheduling period.

通過第一時間閾值,可以允許第一任務的任務處理時間與第一時間片的第一時間差值在合理的範圍內,使得為第二任務分配的時間片進行調整的過程可以收斂,而不是過於頻繁地調整第二任務分配的時間片。例如,當按比例調整第一時間閾值時,如,當第一時間片越長時,第一時間閾值越大,這樣可以減少第一任務超時的可能性。從而使得對第二任務進行調整的過程可以收斂。Through the first time threshold, the difference between the task processing time of the first task and the first time slice of the first time slice can be allowed to be within a reasonable range, so that the process of adjusting the time slice allocated to the second task can converge instead of Adjust the time slice assigned to the second task too frequently. For example, when the first time threshold is adjusted proportionally, for example, when the first time slice is longer, the first time threshold is larger, which can reduce the possibility of the first task overtime. Thus, the process of adjusting the second task can be converged.

步驟S13,根據確定的結果,調整目標調度週期內為至少一個第二任務分配的時間片,其中,所述目標調度週期包括所述當前調度週期或所述當前調度週期的下一調度週期。Step S13: Adjust the time slice allocated to at least one second task in the target scheduling period according to the determined result, where the target scheduling period includes the current scheduling period or the next scheduling period of the current scheduling period.

在本公開實施例中,可以根據確定第一任務是否超時的結果,對至少一個第二任務分配的時間片進行調整。第二任務可以是當前調度週期內的任務,或者,可以是當前調度週期的下一調度週期內的任務。In the embodiment of the present disclosure, the time slice allocated to at least one second task can be adjusted according to the result of determining whether the first task has timed out. The second task may be a task in the current scheduling period, or may be a task in a scheduling period next to the current scheduling period.

當第二任務是當前調度週期內的任務時,第二任務可以包括當前調度週期內已執行完畢的任務、當前調度週期內未執行的任務、以及第一任務。當第二任務是是當前調度週期的下一調度週期內的任務時,第二任務可以包括下一調度週期內所有的任務。When the second task is a task in the current scheduling period, the second task may include tasks that have been executed in the current scheduling period, tasks that have not been executed in the current scheduling period, and the first task. When the second task is a task in a scheduling period next to the current scheduling period, the second task may include all tasks in the next scheduling period.

舉例來說,如果當前調度週期內的第一任務超時,則可以將分配給第二任務的時間片的長度進行延長,得到延長後的第二任務的時間片。如果在當前調度週期內所有的任務均未超時,則可以將下一調度週期內分配給第二任務的時間片進行縮短,得到縮短後的第二任務的時間片。若當前調度週期內有任務超時,在調整本調度週期長度的基礎上,下一調度週期繼承本調度週期調整後的長度。本公開提供的調度方法,通過不斷地對調度週期進行調整,如超時情況下延長本調度週期(下一調度週期的長度等於本調度週期延長之後的長度)以及未超時情況下縮減下一調度週期,可以達到調度週期相對的「穩態」,同時,可以將為任務分配的時間片調整到合理的範圍。For example, if the first task in the current scheduling period times out, the length of the time slice allocated to the second task can be extended to obtain the extended time slice of the second task. If all tasks have not timed out in the current scheduling period, the time slice allocated to the second task in the next scheduling period can be shortened to obtain the shortened time slice of the second task. If there is a task timeout in the current scheduling period, on the basis of adjusting the length of the scheduling period, the next scheduling period will inherit the adjusted length of the scheduling period. The scheduling method provided by the present disclosure continuously adjusts the scheduling period, such as extending the scheduling period in the case of a timeout (the length of the next scheduling period is equal to the length after the extension of the scheduling period) and reducing the next scheduling period without timeout. The scheduling cycle can achieve the relative "steady state" of the scheduling cycle, and at the same time, the time slice allocated for the task can be adjusted to a reasonable range.

通過上述調度方案,可以自動對分配給第二任務的時間片進行調整,使得目標調度週期內的第二任務被分配的時間片滿足服務品質的要求。Through the above scheduling scheme, the time slice allocated to the second task can be automatically adjusted, so that the time slice allocated to the second task in the target scheduling period meets the quality of service requirements.

在一個可能的實現方式中,可以在確定第一任務超時的情況下,調整當前調度週期的長度,然後基於當前調度週期的調整後的長度,對在當前調度週期內為至少一個第二任務分配的時間片進行調整。In a possible implementation manner, when it is determined that the first task is overtime, the length of the current scheduling period can be adjusted, and then based on the adjusted length of the current scheduling period, there is at least one second task in the current scheduling period. The allocated time slice is adjusted.

在該實現方式中,如果確定第一任務超時,可以先對當前調度週期的長度進行調整,例如,將當前調度週期的長度延長一個固定的時長,或者,將當前調度週期的長度擴大為原來的若干倍。然後可以根據當前調度週期調整後的長度,調整當前調度週期內為至少一個第二任務分配的時間片長度。例如,將為每個第二任務分配的時間片均延長一個固定的時間長度,或者,可以按照一定的比例延長為每個第二任務分配的時間片。通過這種方式,可以在確定第一任務超時的情況下,對當前調度週期的長度進行調整,通過當前調度週期調整後的長度,可以實現對第二任務的時間片的調整。In this implementation, if it is determined that the first task has timed out, the length of the current scheduling period can be adjusted first. For example, the length of the current scheduling period can be extended by a fixed period of time, or the length of the current scheduling period can be expanded to Several times the original. Then, according to the adjusted length of the current scheduling period, the length of the time slice allocated to the at least one second task in the current scheduling period can be adjusted. For example, the time slice allocated to each second task is extended by a fixed time length, or the time slice allocated to each second task can be extended according to a certain ratio. In this way, when it is determined that the first task has timed out, the length of the current scheduling period can be adjusted, and the time slice of the second task can be adjusted through the adjusted length of the current scheduling period.

在一個示例中,可以基於當前調度週期的調整後的長度以及每個所述第二任務的服務品質參數,調整當前調度週期內為每個所述第二任務分配的時間片的長度,以使每個第二任務的服務品質參數保持為對應的預設數值和/或每個第二任務的時間片在當前調度週期中所占的比例保持為對應的預設數值。In an example, the length of the time slice allocated for each second task in the current scheduling period may be adjusted based on the adjusted length of the current scheduling period and the service quality parameters of each second task, so that The service quality parameter of each second task is maintained at the corresponding preset value and/or the proportion of the time slice of each second task in the current scheduling period is maintained at the corresponding preset value.

例如,當前調度週期有三個第二任務A、B和C,假設在調整前,第二任務A、B和C在當前調度週期中所占的比例為3:3:4,也就是預設數值為3:3:4。經過調整,第二任務A、B和C在當前調度週期中所占的比例仍為3:3:4。For example, there are three second tasks A, B, and C in the current scheduling period. Assuming that before the adjustment, the ratio of the second tasks A, B, and C in the current scheduling period is 3:3:4, which is the preset value It is 3:3:4. After adjustment, the proportion of the second tasks A, B, and C in the current scheduling period is still 3:3:4.

在該示例中,服務品質參數可以是表徵服務品質的一個參數,服務品質參數可以是一個調度週期中任意一個任務對應的時間片占該調度週期的時間片份額。一個任務的服務品質越高,其在調度週期內佔用的時間片份額越多。例如,一個任務的服務品質可以對應一個權重,服務品質越高,權重越高。在計算時間片份額時,可以先計算該調度週期內各任務的權重的和,然後用一個任務的權重除以各任務的權重的和,所得到的數值,可以是該任務對應的時間片占該調度週期的時間片份額。通過對不同的任務分配不同的服務品質,可以確保服務品質高的任務能夠得到優先處理。一個調度週期中可以包括多個任務,每個任務可以對應一個服務品質參數。在調整當期調度週期的長度之後,可以根據當前調度週期內每個第二任務的服務品質參數以及當前調度週期調整後的長度,調整為每個第二任務分配的時間片的長度。通過這種方式,使每個第二任務的服務品質參數保持不變,和/或,每個第二任務的時間片在當前調度週期中所占的比例保持不變。因此,可以根據服務品質來調整第二任務的時間片長度,從而滿足各任務的服務品質的要求。In this example, the quality of service parameter may be a parameter that characterizes the quality of service, and the quality of service parameter may be the share of the time slice corresponding to any task in a scheduling period in the scheduling period. The higher the service quality of a task, the more time slices it occupies in the scheduling period. For example, the service quality of a task can correspond to a weight. The higher the service quality, the higher the weight. When calculating the time slice share, you can first calculate the sum of the weights of each task in the scheduling period, and then divide the weight of a task by the sum of the weights of each task. The value obtained can be the time slice corresponding to the task. The time slice share of this scheduling period. By assigning different service qualities to different tasks, it can be ensured that tasks with high service quality can be given priority. A scheduling period can include multiple tasks, and each task can correspond to a quality of service parameter. After adjusting the length of the current scheduling period, the length of the time slice allocated to each second task can be adjusted according to the service quality parameter of each second task in the current scheduling period and the adjusted length of the current scheduling period. In this way, the service quality parameter of each second task remains unchanged, and/or the proportion of the time slice of each second task in the current scheduling period remains unchanged. Therefore, the time slice length of the second task can be adjusted according to the service quality, so as to meet the service quality requirements of each task.

在一個示例中,為了保證調度週期內每個任務的服務品質參數在調整之後不變,需要對第一任務的時長也進行處理。可以使用與其他第二任務相同的方式對第一任務的時長進行處理,例如,將第一任務已分配的時間片均延長一個固定的時間長度,或者,可以按照一定的比例將第一任務分配的時間片進行延長。In an example, in order to ensure that the service quality parameter of each task in the scheduling period remains unchanged after adjustment, the duration of the first task needs to be processed as well. The duration of the first task can be processed in the same way as other second tasks. For example, the allocated time slices of the first task are extended by a fixed length of time, or the first task can be increased in a certain proportion. The allocated time slice is extended.

在一個示例中,可以獲取當前調度週期內已執行完畢的任務的超時次數,該已執行完畢的任務可以被稱為第三任務。然後根據超時次數,確定對當前調度週期的長度進行延長的延長係數,再基於延長係數,對當前調度週期的長度進行延長,得到當前調度週期調整後的長度。這裡,延長係數與超時次數正相關。In an example, the number of timeouts of tasks that have been executed in the current scheduling period may be obtained, and the executed tasks may be referred to as the third task. Then, according to the number of timeouts, an extension coefficient for extending the length of the current scheduling period is determined, and then based on the extension coefficient, the length of the current scheduling period is extended to obtain the adjusted length of the current scheduling period. Here, the extension coefficient is positively correlated with the number of timeouts.

在該示例中,可以統計當前調度週期內第三任務的超時次數。每執行完畢一個第三任務,如果該第三任務超時,則可以將超時次數增加1。可以根據該超時次數確定對當前調度週期的長度進行延長的延長係數,該延長係數與超時次數正相關,例如,超時次數越大,延長係數越大。然後利用確定的延長係數可以對當前調度週期的長度進行延長,例如,將延長係數與當前調度週期的長度相乘,可以得到當前調度週期延長後的長度。其中,延長係數大於1。這樣,可以通過超時次數,對當前調度週期的長度進行合理的延長,使得到當前調度週期具有合理的時間長度。In this example, the number of timeouts of the third task in the current scheduling period can be counted. Every time a third task is executed, if the third task times out, the number of times out can be increased by one. The extension coefficient for extending the length of the current scheduling period may be determined according to the number of timeouts, and the extension coefficient is positively correlated with the number of timeouts. For example, the greater the number of timeouts, the greater the extension coefficient. Then, the length of the current scheduling period can be extended by using the determined extension coefficient. For example, the length of the current scheduling period can be obtained by multiplying the extension coefficient by the length of the current scheduling period. Among them, the extension factor is greater than 1. In this way, the length of the current scheduling period can be reasonably extended by the number of timeouts, so that the current scheduling period has a reasonable length of time.

在一個示例中,上述延長係數是基於以超時次數為變量的指數函數得到的。In an example, the aforementioned extension coefficient is obtained based on an exponential function with the number of timeouts as a variable.

在該示例中,該延長係數可以基於以超時次數為變量的指數函數得到,從而可以通過延長係數對當前調度週期的長度成倍數的延長,得到當前調度週期延長後的長度。這裡,當前調度週期延長後的長度可以根據下述公式(1)進行計算:In this example, the extension coefficient can be obtained based on an exponential function with the number of timeouts as a variable, so that the length of the current scheduling period can be extended by multiples of the extension coefficient to obtain the extended length of the current scheduling period. Here, the extended length of the current scheduling period can be calculated according to the following formula (1):

Figure 02_image001
公式(1),
Figure 02_image001
Formula 1),

其中,Tnewtimeslice 可以是當前調度週期延長後的長度,Toldtimeslice 可以是當前調度週期的長度,count可以是統計的超時次數,2count 可以是延長係數。 Wherein, T newtimeslice may extend the length of the current scheduling period, T oldtimeslice may be the length of the current scheduling period, count the number of timeouts can be statistical, 2 count coefficient may be extended.

這裡,延長係數採用2進制指數函數可以避免前期調度週期延長後的長度增長過快,還可以避免當前調度週期延長後的長度由於後期增長過慢而不收斂。Here, the use of a binary exponential function for the extension coefficient can prevent the length of the extended scheduling period from increasing too fast, and it can also prevent the length of the current scheduling period from being extended and not converging due to the slow increase in the later period.

舉例來講,假設當前調度週期包括10個任務,其中,第2個、第3個和第5個任務超時。在第2個任務超時時,由於第1個任務未超時,count為1,根據公式(1),Tnewtimeslice 是Toldtimeslice 的2倍,也就是說,相比於當前調度週期未開始執行時的長度,本次調整是長度延長2倍。在第3個任務超時時,count為2,根據公式(1),Tnewtimeslice 是Toldtimeslice 的4倍,需要注意的是,此時Toldtimeslice 是已經延長過一次的長度,也就是說,相比於當前調度週期未開始執行時的長度,本次調整是在已經延長2倍的情況下,長度再延長4倍。類似的,當第5個任務超時時,相比於當前調度週期未開始執行時的長度,本次調整是在已經延長2*4倍的情況下,長度再延長8倍。For example, suppose that the current scheduling cycle includes 10 tasks, among which the second, third, and fifth tasks have timed out. When the second time-out task, since the first task does not expire, count to 1, according to the formula (1), T newtimeslice T oldtimeslice is twice, that is, compared to the current scheduling period is not started The length of the time, this adjustment is to extend the length by 2 times. When the third task timeout, count of 2, according to equation (1), T newtimeslice T oldtimeslice of four times, to be noted that, at this time T oldtimeslice already once extended length, i.e., phase Compared with the length of the current scheduling period when the execution is not started, this adjustment is to extend the length by 4 times when the length has been extended by 2 times. Similarly, when the fifth task times out, compared to the length of the current scheduling period when the execution is not started, this adjustment is to extend the length by 8 times after it has been extended by 2*4 times.

在一種可能的實現方式中,可以獲取當前調度週期內已執行完畢的第三任務的任務處理時間,然後響應於第三任務的任務處理時間小於第三任務的調整後的時間片長度,在當前調度週期內對所述第三任務進行時間補償。其中,第二任務包括所述第三任務。In a possible implementation, the task processing time of the third task that has been executed in the current scheduling period can be obtained, and then in response to the task processing time of the third task being less than the adjusted time slice length of the third task, the current Time compensation is performed on the third task in the scheduling period. Wherein, the second task includes the third task.

在該實現方式中,在對當前調度週期內的至少一個第二任務的時間片進行調整之後,如果至少一個第二任務包括的任意一個第三任務的任務處理時間小於該第三任務的調整後的時間片長度,則可以在當前調度週期內對該第三任務進行補償。In this implementation manner, after adjusting the time slice of at least one second task in the current scheduling period, if the task processing time of any third task included in the at least one second task is less than the adjusted third task The length of the time slice can be compensated for the third task in the current scheduling period.

這裡,由於已執行完畢的第三任務的時間片無法直接進行延長,從而可以通過對第三任務進行時間補償的方式,使當前調度週期內每個第二任務的服務品質參數保持不變。其中,對第三任務進行時間補償可以理解為對第三任務分配相應的時間片。Here, since the time slice of the executed third task cannot be directly extended, the service quality parameter of each second task in the current scheduling period can be kept unchanged by time compensation for the third task. Among them, time compensation for the third task can be understood as assigning a corresponding time slice to the third task.

在該實現方式的一個示例中,可以基於第三任務的任務處理時間和第三任務的調整後的時間片長度,確定所述第三任務的補償時間,然後基於補償時間,把第三任務的補償任務添加到當前調度週期的調度隊列中。In an example of this implementation, the compensation time of the third task may be determined based on the task processing time of the third task and the adjusted time slice length of the third task, and then based on the compensation time, the compensation time of the third task The compensation task is added to the scheduling queue of the current scheduling period.

該示例提供了一種對第三任務進行時間補償的方式。在該示例中,可以根據第三任務的任務處理時間和第三任務的調整後的時間片長度,確定該第三任務的補償時間,例如,可以計算第三任務的調整後的時間片長度與該第三任務的任務處理時間之間的第二時間差值,將該第二時間差值作為第三任務的補償時間。然後可以將補償該第三任務的任務添加到當前調度週期的調度隊列中,並在執行該補償任務時為該第三任務分配計算的補償時間。這樣可以實現對已執行完畢的第三任務的時間補償,使已執行完畢的第三任務的服務品質參數保持不變。This example provides a way of time compensation for the third task. In this example, the compensation time of the third task can be determined according to the task processing time of the third task and the adjusted time slice length of the third task. For example, the adjusted time slice length of the third task and the adjusted time slice length of the third task can be calculated. The second time difference between the task processing times of the third task is used as the compensation time of the third task. Then, the task that compensates for the third task can be added to the scheduling queue of the current scheduling period, and the calculated compensation time can be allocated to the third task when the compensation task is executed. In this way, time compensation for the executed third task can be realized, and the service quality parameters of the executed third task remain unchanged.

在一個示例中,可以基於補償時間,將第三任務的補償任務添加到當前調度週期的調度隊列的隊尾。In one example, based on the compensation time, the compensation task of the third task may be added to the end of the scheduling queue of the current scheduling period.

在該示例中,可以根據第三任務的補償時間,將第三任務的補償任務添加到當前調度週期的調度隊列的隊尾,為該補償任務分配確定的補償時間,實現對該第三任務的時間補償。將該補償任務添加到當前調度週期的調度隊列的隊尾,可以不打亂當前調度週期的調度隊列中任務的順序,使調度隊列中任務按照原有的順序進行調度。In this example, according to the compensation time of the third task, the compensation task of the third task can be added to the end of the scheduling queue of the current scheduling period, and a determined compensation time can be allocated to the compensation task, so as to realize the compensation of the third task. Time compensation. Adding the compensation task to the end of the scheduling queue of the current scheduling period can not disrupt the order of the tasks in the scheduling queue of the current scheduling period, so that the tasks in the scheduling queue are scheduled in the original order.

在一個示例中,可以根據已執行完畢的第三任務的服務品質參數以及當前調度週期的調整前後的長度,確定第三任務的補償時間。In an example, the compensation time of the third task may be determined according to the service quality parameters of the executed third task and the length before and after the adjustment of the current scheduling period.

在該示例中,可以確定當前調度週期調整後的長度與調整前的長度之間的第三時間差值。然後可以根據第三時間差值和該第三任務的服務品質參數,確定該第三任務的補償時間。例如,將第三時間差值乘以該第三任務的服務品質參數,可以得到該第三任務的補償時間,進而實現對該第三任務的時間補償。這裡,補償時間可以根據下述公式(2)進行計算:In this example, the third time difference between the adjusted length of the current scheduling period and the length before the adjustment can be determined. Then, the compensation time of the third task can be determined according to the third time difference and the service quality parameter of the third task. For example, by multiplying the third time difference by the service quality parameter of the third task, the compensation time of the third task can be obtained, and then the time compensation of the third task can be realized. Here, the compensation time can be calculated according to the following formula (2):

Figure 02_image003
公式(2),
Figure 02_image003
Formula (2),

其中,tcompensation 可以表示補償時間,Tnewtimeslice 可以是當前調度週期調整後的長度,Toldtimeslice 可以是當前調度週期調整前的長度,SharevGPU 可以是第三任務的服務品質參數。通過公式(2)可以得到每個第三任務的補償時間。Wherein, t compensation may represent compensation time, T newtimeslice length may be adjusted after the current scheduling period, T oldtimeslice length may be adjusted before the current scheduling period, Share vGPU may be a quality of service parameter of the third task. The compensation time of each third task can be obtained by formula (2).

圖2繪示根據本公開實施例的分配給任務的時間片進行延長的示例流程圖,可以包括以下步驟。Fig. 2 shows an exemplary flow chart of extending the time slice allocated to a task according to an embodiment of the present disclosure, which may include the following steps.

步驟S201,判斷當前執行的任務是否超時。In step S201, it is judged whether the currently executed task has timed out.

其中,在當前任務超時的情況下,可以執行步驟S202以及後續步驟。在當前任務未超時的情況下,可以執行步驟S205以及後續步驟。Wherein, in the case that the current task times out, step S202 and subsequent steps can be executed. In the case that the current task has not timed out, step S205 and subsequent steps can be performed.

步驟S202,根據當前調度週期內已執行完畢的任務的超時次數,對當前調度週期的長度進行延長。In step S202, the length of the current scheduling period is extended according to the number of timeouts of tasks that have been executed in the current scheduling period.

其中,可選地,可以根據當前調度週期的當前累計的超時次數,即當前調度週期內已執行完畢的任務累計的超時次數,調整當前調度週期的長度。Optionally, the length of the current scheduling period can be adjusted according to the current cumulative number of timeouts in the current scheduling period, that is, the cumulative number of timeouts of tasks that have been executed in the current scheduling period.

步驟S203,根據當前調度週期的延長後的長度,調整為當前調度週期內每個任務分配的時間片。Step S203: Adjust the time slice allocated to each task in the current scheduling period according to the extended length of the current scheduling period.

步驟S204,將已執行完畢任務的補償任務插入到調度隊列的隊尾,並分配給補償任務相應的補償時間。Step S204, insert the compensation task of the completed task into the end of the scheduling queue, and allocate the compensation time corresponding to the compensation task.

通過對任務的時間片進行延長,可以在當前執行的任務超時的情況下,延長當前調度週期內為每個任務分配的時間片,使延長後的時間片與相應的服務品質相適應。By extending the time slice of the task, the time slice allocated for each task in the current scheduling period can be extended when the currently executing task is overtime, so that the extended time slice can be adapted to the corresponding service quality.

步驟S205,判斷當前調度週期是否結束。Step S205: It is judged whether the current scheduling period is over.

在當前調度週期還未結束的情況下,執行步驟S207。在當前調度週期結束的情況下,執行步驟S206。If the current scheduling period has not ended, step S207 is executed. When the current scheduling period ends, step S206 is executed.

步驟S206,終止當前流程。將當前調度週期的長度繼承給下一調度週期。Step S206, the current process is terminated. Inherit the length of the current scheduling period to the next scheduling period.

步驟S207,調度下一個任務執行任務,並將下一個任務更新為當前執行的任務,返回步驟S201。In step S207, the next task is scheduled to execute the task, the next task is updated to the currently executed task, and step S201 is returned.

在一個可能的實現方式中,可以在確定當前調度週期內每個任務均未超時的情況下,對當前調度週期的下一調度週期的長度進行調整,然後基於下一調度週期的調整後的長度,確定下一調度週期內為第二任務分配的時間片。In a possible implementation, it is possible to adjust the length of the next scheduling period of the current scheduling period under the condition that each task in the current scheduling period has not timed out, and then adjust the length of the next scheduling period based on the adjustment of the next scheduling period. Length determines the time slice allocated for the second task in the next scheduling period.

在該示例中,在當前調度週期內每個任務均未超時的情況下,可以對當前調度週期的下一調度週期的長度進行縮減,得到下一調度週期的縮短後的長度。例如,可以在下一調度週期的長度的基礎上縮減一定的時長,或者,可以將下一調度週期的長度乘以一定的係數,得到下一調度週期的縮短後的長度。然後可以根據下一調度週期的調整後的長度,確定下一調度週期內為每個第二任務分配的時間片的長度,例如,可以將下一調度週期內為每個第二任務分配的時間片的長度進行縮減,使縮減後的時間片的長度之和等於下一調度週期調整後的長度。根據每個第二任務縮減後的時間片的長度,可以進一步確定為每個第二任務分配的時間片,從而可以在為當前調度週期內的任務分配的時間片過長時,自動縮減下一調度週期內的第二任務的時間片,從而可以有效利用虛擬圖像處理單元資源。In this example, if each task does not time out in the current scheduling period, the length of the next scheduling period of the current scheduling period can be reduced to obtain the shortened length of the next scheduling period. For example, a certain duration can be reduced on the basis of the length of the next scheduling period, or the length of the next scheduling period can be multiplied by a certain coefficient to obtain the shortened length of the next scheduling period. Then, the length of the time slice allocated for each second task in the next scheduling period can be determined according to the adjusted length of the next scheduling period. For example, the time allocated for each second task in the next scheduling period can be set The length of the slices is reduced, so that the sum of the lengths of the reduced time slices is equal to the adjusted length of the next scheduling period. According to the length of the reduced time slice of each second task, the time slice allocated for each second task can be further determined, so that when the time slice allocated to the task in the current scheduling period is too long, the next time slice can be automatically reduced The time slice of the second task in the scheduling period, so that the resources of the virtual image processing unit can be effectively used.

在一個示例中,可以利用預設的縮減係數對下一調度週期的長度進行縮減。In an example, a preset reduction factor may be used to reduce the length of the next scheduling period.

在該示例中,縮減係數可以根據實際應用場景進行設置,可以設置為小於1的實數,例如,將縮減係數設置為1/2。在利用縮減係數對下一調度週期的長度進行縮減時,可以將下一調度週期的長度乘以縮減係數,得到下一調度週期縮減後的長度。通過利用合適的縮減係數對下一調度週期的長度進行縮減,可以避免對下一調度週期的長度過於激進的縮減導致下一調度週期縮減後的長度過小。In this example, the reduction factor can be set according to actual application scenarios, and can be set to a real number less than 1, for example, the reduction factor is set to 1/2. When using the reduction factor to reduce the length of the next scheduling period, the length of the next scheduling period can be multiplied by the reduction factor to obtain the reduced length of the next scheduling period. By using an appropriate reduction factor to reduce the length of the next scheduling period, it is possible to avoid an excessively aggressive reduction of the length of the next scheduling period, resulting in the reduced length of the next scheduling period being too small.

在一個示例中,可以基於下一調度週期的調整後的長度以及每個第二任務對應的服務品質參數,確定下一調度週期內每個第二任務分配的時間片的長度,以使每個第二任務的服務品質參數保持為對應的預設數值和/或每個所述第二任務的時間片在下一調度週期中所占的比例保持為對應的預設數值。In an example, the length of the time slice allocated for each second task in the next scheduling period can be determined based on the adjusted length of the next scheduling period and the service quality parameter corresponding to each second task, so that each The service quality parameter of the second task is maintained at the corresponding preset value and/or the proportion of the time slice of each second task in the next scheduling period is maintained at the corresponding preset value.

在該示例中,在調整下一調度週期的長度之後,可以根據下一調度週期內每個第二任務對應的服務品質參數以及下一調度週期調整後的長度,確定為每個第二任務分配的時間片的長度,例如,將每個第二任務對應的服務品質參數與下一調度週期調後的長度相乘,得到該第二任務分配的時間片的長度,進而確定為每個第二任務分配的時間片,這樣,可以使每個第二任務的服務品質參數保持不變,和/或,每個第二任務的時間片在當前調度週期中所占的比例保持不變,從而滿足服務品質的要求。In this example, after adjusting the length of the next scheduling period, it can be determined to assign each second task according to the service quality parameter corresponding to each second task in the next scheduling period and the adjusted length of the next scheduling period For example, the service quality parameter corresponding to each second task is multiplied by the adjusted length of the next scheduling period to obtain the length of the time slice allocated by the second task, which is then determined as each second task The time slice of the task allocation, in this way, the service quality parameter of each second task can be kept unchanged, and/or the proportion of the time slice of each second task in the current scheduling period remains unchanged, thereby satisfying Service quality requirements.

圖3繪示根據本公開實施例的對分配給任務的時間片進行縮減的示例流程圖,可以包括以下步驟。Fig. 3 shows an exemplary flow chart of reducing the time slice allocated to a task according to an embodiment of the present disclosure, which may include the following steps.

步驟S301,判斷當前調度週期內每個任務是否超時。In step S301, it is judged whether each task in the current scheduling period has timed out.

步驟S302,在當前調度週期內每個任務均未超時的情況下,利用縮減係數對下一調度週期的長度進行縮減,得到下一調度週期縮減後的長度。In step S302, when each task does not time out in the current scheduling period, the length of the next scheduling period is reduced by the reduction coefficient to obtain the reduced length of the next scheduling period.

步驟S303,根據下一調度週期縮減後的長度,對為下一調度週期的每個任務分配的時間片進行縮減。Step S303: According to the reduced length of the next scheduling period, the time slice allocated for each task in the next scheduling period is reduced.

步驟S304,執行下一個調度週期的任務的調度。Step S304: Perform task scheduling in the next scheduling period.

通過對任務的時間片進行縮減,可以在當前調度週期內的任務均未超時的情況下,自動對為下一調度週期內每個任務分配的時間片進行縮減,使縮減後的時間片與相應的服務品質相適應。By reducing the time slice of the task, the time slice allocated for each task in the next scheduling period can be automatically reduced when the tasks in the current scheduling period have not timed out, so that the reduced time slice is the same as the one assigned to each task in the next scheduling period. Corresponding service quality is compatible.

在一個可能的實現方式中,可以獲取預設時間段內多個任務單元執行歷史任務的歷史任務處理時間,然後根據歷史任務處理時間的統計資訊,確定當前調度週期的初始長度。In a possible implementation manner, the historical task processing time of multiple task units executing historical tasks within a preset time period can be obtained, and then the initial length of the current scheduling period can be determined according to the statistical information of the historical task processing time.

在該實現方式中,可以通過預設時間段內的歷史任務處理時間,確定當前調度週期的初始長度。預設時間段可以根據實際應用場景進行設置,例如,可以獲取最近24小時內多個任務執行歷史任務的歷史任務處理時間。歷史任務處理時間的統計資訊可以包括歷史任務的資訊、歷史任務的累積頻率等,然後根據歷史任務處理時間的統計資訊,可以確定當前調度週期的初始長度。例如,可以根據多個任務執行歷史任務時間,確定一個歷史任務處理時間與歷史任務的累積頻率之間的曲線,然後根據該曲線可以選擇一個合適的歷史任務處理時間作為當前調度週期的初始長度。In this implementation manner, the initial length of the current scheduling period can be determined based on the historical task processing time within a preset time period. The preset time period can be set according to actual application scenarios. For example, the historical task processing time of multiple tasks executing historical tasks in the last 24 hours can be obtained. The statistical information of the historical task processing time may include the information of the historical task, the cumulative frequency of the historical task, etc., and then the initial length of the current scheduling period can be determined based on the statistical information of the historical task processing time. For example, a curve between the processing time of a historical task and the cumulative frequency of the historical task can be determined according to the historical task execution time of multiple tasks, and then an appropriate historical task processing time can be selected according to the curve as the initial length of the current scheduling period.

圖4繪示根據本公開實施例的歷史任務處理時間與累積頻率的曲線,圖中橫坐標對應歷史任務處理時間,橫坐標的單位是ms,縱坐標對應累積頻率。如圖4所示,累積頻率為70%對應約100 ms,可以理解為在預設時間段內,有70%的任務單元的任務處理時間都在100 ms以內。例如,可以將累積頻率為70%對應的歷史任務處理時間確定當前調度週期的初始長度。或者,可以將累積頻率為70%對應的歷史任務處理時間乘以一個倍數,例如,將累積頻率為70%對應的歷史任務處理時間乘以10,得到當前調度週期的初始長度。4 shows a curve of historical task processing time and cumulative frequency according to an embodiment of the present disclosure. In the figure, the abscissa corresponds to the historical task processing time, the unit of the abscissa is ms, and the ordinate corresponds to the cumulative frequency. As shown in Figure 4, the cumulative frequency of 70% corresponds to about 100 ms, which can be understood as the task processing time of 70% of the task units within 100 ms within the preset time period. For example, the historical task processing time corresponding to a cumulative frequency of 70% can be used to determine the initial length of the current scheduling period. Alternatively, the historical task processing time corresponding to a cumulative frequency of 70% can be multiplied by a multiple, for example, the historical task processing time corresponding to a cumulative frequency of 70% can be multiplied by 10 to obtain the initial length of the current scheduling period.

在該實現方式的一個示例中,可以根據當前調度週期的初始長度以及當前調度週期內每個任務對應的服務品質參數,確定為每個任務分配的初始時間片的時長。In an example of this implementation manner, the length of the initial time slice allocated for each task can be determined according to the initial length of the current scheduling period and the service quality parameter corresponding to each task in the current scheduling period.

在該示例中,可以根據當前調度週期內每個任務對應的服務品質參數以及當前調度週期的初始長度,計算為每個任務分配的初始時長,例如,當前調度週期包括3個任務,任務A、任務B和任務C,其中,任務A對應的時間片份額是3,任務B對應的時間片份額是3,任務C對應的時間片份額是4,則任務A的初始時間片可以是0.3個初始時長,任務B的初始時間片可以是0.3個初始時長,任務C的初始時間片可以是0.4個初始時長。這樣,一個調度週期內每個任務的初始時間片可以按照相應的服務品質參數進行分配,滿足服務品質要求。In this example, the initial duration allocated to each task can be calculated according to the service quality parameters corresponding to each task in the current scheduling period and the initial length of the current scheduling period. For example, the current scheduling period includes 3 tasks, task A , Task B and Task C, where the time slice share corresponding to task A is 3, the time slice share corresponding to task B is 3, and the time slice share corresponding to task C is 4, then the initial time slice of task A can be 0.3 The initial duration, the initial time slice of task B can be 0.3 initial duration, and the initial time slice of task C can be 0.4 initial duration. In this way, the initial time slice of each task in a scheduling period can be allocated according to the corresponding service quality parameters to meet the service quality requirements.

在一個可能的實現方式中,當前調度週期的初始長度也可以根據實際應用場景進行設置,例如,將初始長度設置為100 ms。然後當前調度週期的初始長度以及當前調度週期內每個任務對應的服務品質參數,可以確定當前調度週期內每個任務分配的初始時間片。In a possible implementation manner, the initial length of the current scheduling period can also be set according to actual application scenarios, for example, the initial length is set to 100 ms. Then the initial length of the current scheduling period and the service quality parameter corresponding to each task in the current scheduling period can determine the initial time slice allocated for each task in the current scheduling period.

本公開實施例提供的調度方案,可以在為任務分配的時間片的長度過長或過短的情況下,自動對為任務分配的時間片進行調整,實現對任務的時間片進行合理配置的效果。The scheduling scheme provided by the embodiments of the present disclosure can automatically adjust the time slice allocated to the task when the length of the time slice allocated to the task is too long or too short, so as to achieve the effect of rationally configuring the time slice of the task .

可以理解,本公開提及的上述各個方法實施例,在不違背原理邏輯的情況下,均可以彼此相互結合形成結合後的實施例,限於篇幅,本公開不再贅述。It can be understood that the various method embodiments mentioned in the present disclosure can be combined with each other to form a combined embodiment without violating the principle and logic. The length is limited, and the details of this disclosure will not be repeated.

此外,本公開還提供了裝置、電子設備、電腦可讀記錄媒體、程式,上述均可用來實現本公開提供的任一種調度方法,相應技術方案和描述和參見方法部分的相應記載,不再贅述。In addition, the present disclosure also provides devices, electronic equipment, computer-readable recording media, and programs, all of which can be used to implement any of the scheduling methods provided in the present disclosure. The corresponding technical solutions and descriptions and the corresponding records in the method section will not be repeated. .

本領域技術人員可以理解,在具體實施方式的上述方法中,各步驟的撰寫順序並不意味著嚴格的執行順序而對實施過程構成任何限定,各步驟的具體執行順序應當以其功能和可能的內在邏輯確定。Those skilled in the art can understand that in the above-mentioned methods of the specific implementation, the writing order of the steps does not mean a strict execution order but constitutes any limitation on the implementation process. The specific execution order of each step should be based on its function and possibility. The inner logic is determined.

圖5繪示根據本公開實施例的調度裝置的方塊圖,如圖5所示,所述裝置包括獲取模組51、確定模組52和調整模組53。FIG. 5 shows a block diagram of a scheduling device according to an embodiment of the present disclosure. As shown in FIG. 5, the device includes an acquisition module 51, a determination module 52 and an adjustment module 53.

獲取模組51,用於獲取當前調度週期內第一任務的任務處理時間。The obtaining module 51 is used to obtain the task processing time of the first task in the current scheduling period.

確定模組52,用於基於所述任務處理時間以及所述當前調度週期內為所述第一任務分配的第一時間片,確定所述第一任務是否超時。The determining module 52 is configured to determine whether the first task has timed out based on the task processing time and the first time slice allocated for the first task in the current scheduling period.

調整模組53,用於根據確定的結果,調整目標調度週期內為至少一個第二任務分配的時間片,其中,所述目標調度週期包括所述當前調度週期或所述當前調度週期的下一調度週期。The adjustment module 53 is configured to adjust the time slice allocated to at least one second task in the target scheduling period according to the determined result, wherein the target scheduling period includes the current scheduling period or the next one of the current scheduling period The scheduling period.

在一個或多個可選實施例中,所述確定模組52,具體用於確定所述任務處理時間的截止時刻與所述第一時間片的截止時刻之間的第一時間差值;在所述第一時間差值大於第一時間閾值的情況下,確定所述第一任務超時。In one or more optional embodiments, the determining module 52 is specifically configured to determine the first time difference between the deadline of the task processing time and the deadline of the first time slice; In a case where the first time difference is greater than a first time threshold, it is determined that the first task has timed out.

在一個或多個可選實施例中,所述第一時間閾值是基於所述第一時間片的長度得到的。In one or more optional embodiments, the first time threshold is obtained based on the length of the first time slice.

在一個或多個可選實施例中,所述調整模組53,具體用於在確定所述第一任務超時的情況下,調整所述當前調度週期的長度;基於所述當前調度週期的調整後的長度,調整所述當前調度週期內為所述至少一個第二任務分配的時間片。In one or more optional embodiments, the adjustment module 53 is specifically configured to adjust the length of the current scheduling period when it is determined that the first task has timed out; based on the current scheduling period Adjust the adjusted length to adjust the time slice allocated to the at least one second task in the current scheduling period.

在一個或多個可選實施例中,所述調整模組53,具體用於基於所述當前調度週期的調整後的長度以及每個所述第二任務的服務品質參數,調整所述當前調度週期內每個所述第二任務分配的時間片的長度,以使每個所述第二任務的服務品質參數保持為對應的預設數值和/或每個所述第二任務的時間片在所述當前調度週期中所占的比例保持為對應的預設數值。In one or more optional embodiments, the adjustment module 53 is specifically configured to adjust the current scheduling based on the adjusted length of the current scheduling period and the service quality parameters of each second task The length of the time slice allocated for each second task in the cycle, so that the service quality parameter of each second task is maintained at the corresponding preset value and/or the time slice of each second task is within The proportion in the current scheduling period remains at the corresponding preset value.

在一個或多個可選實施例中,所述調整模組53,具體用於獲取所述當前調度週期內第三任務的超時次數,其中,所述第三任務為當前調度週期內已執行完畢的任務;根據所述超時次數,確定對所述當前調度週期的長度進行延長的延長係數,其中,所述延長係數與所述超時次數正相關;基於所述延長係數,對所述當前調度週期的長度進行延長,得到所述當前調度週期調整後的長度。In one or more optional embodiments, the adjustment module 53 is specifically configured to obtain the number of timeouts of the third task in the current scheduling period, where the third task is executed in the current scheduling period Completed tasks; determine an extension coefficient for extending the length of the current scheduling period according to the number of timeouts, wherein the extension coefficient is positively correlated with the number of timeouts; based on the extension coefficient, the The length of the current scheduling period is extended to obtain the adjusted length of the current scheduling period.

在一個或多個可選實施例中,所述延長係數是基於以所述超時次數為變量的指數函數得到的。In one or more optional embodiments, the extension coefficient is obtained based on an exponential function with the number of timeouts as a variable.

在一個或多個可選實施例中,所述調整模組53,還用於獲取所述當前調度週期內第三任務的任務處理時間,其中,所述至少一個第二任務包括所述第三任務;響應於所述第三任務的任務處理時間小於所述第三任務的調整後的時間片長度,在所述當前調度週期內對所述第三任務進行時間補償。In one or more optional embodiments, the adjustment module 53 is further configured to obtain the task processing time of the third task in the current scheduling period, wherein the at least one second task includes the third Task; in response to the task processing time of the third task being less than the adjusted time slice length of the third task, time compensation is performed on the third task within the current scheduling period.

在一個或多個可選實施例中,所述調整模組53,具體用於基於所述第三任務的任務處理時間和所述第三任務的調整後的時間片長度,確定所述第三任務的補償時間;基於所述補償時間,將所述第三任務的補償任務添加到所述當前調度週期的調度隊列中。In one or more optional embodiments, the adjustment module 53 is specifically configured to determine the third task based on the task processing time of the third task and the adjusted time slice length of the third task. The compensation time of the task; based on the compensation time, the compensation task of the third task is added to the scheduling queue of the current scheduling period.

在一個或多個可選實施例中,所述調整模組53,具體用於基於所述補償時間,將所述第三任務的所述補償任務添加到所述當前調度週期的調度隊列的隊尾。In one or more optional embodiments, the adjustment module 53 is specifically configured to add the compensation task of the third task to the queue of the scheduling queue of the current scheduling period based on the compensation time. tail.

在一個或多個可選實施例中,所述調整模組53,具體用於在確定所述當前調度週期內每個任務均未超時的情況下,調整所述當前調度週期的下一調度週期的長度;基於所述下一調度週期的調整後的長度,確定所述下一調度週期內為至少一個第二任務分配的時間片。In one or more optional embodiments, the adjustment module 53 is specifically configured to adjust the next scheduling of the current scheduling period when it is determined that each task has not timed out in the current scheduling period. The length of the period; based on the adjusted length of the next scheduling period, determine the time slice allocated for at least one second task in the next scheduling period.

在一個或多個可選實施例中,所述調整模組53,具體用於利用預設的縮減係數對所述下一調度週期的長度進行縮減。In one or more optional embodiments, the adjustment module 53 is specifically configured to use a preset reduction coefficient to reduce the length of the next scheduling period.

在一個或多個可選實施例中,所述調整模組53,具體用於基於所述下一調度週期的調整後的長度以及每個所述第二任務的服務品質參數,確定所述下一調度週期內每個所述第二任務分配的時間片的長度,以使每個所述第二任務的服務品質參數保持為對應的預設數值和/或每個所述第二任務的時間片在所述下一調度週期中所占的比例保持為對應的預設數值。In one or more optional embodiments, the adjustment module 53 is specifically configured to determine the next task based on the adjusted length of the next scheduling period and the service quality parameter of each second task. The length of the time slice allocated for each second task in a scheduling period, so that the service quality parameter of each second task is maintained at the corresponding preset value and/or the time of each second task The proportion of slices in the next scheduling period remains at the corresponding preset value.

在一個或多個可選實施例中,所述裝置還包括:初始週期確定模組,用於獲取預設時間段內多個虛擬圖像處理單元執行歷史任務的歷史任務處理時間;以及根據所述歷史任務處理時間的統計資訊,確定所述當前調度週期的初始長度。In one or more optional embodiments, the device further includes: an initial period determining module, configured to obtain historical task processing time of multiple virtual image processing units executing historical tasks within a preset time period; and The statistical information of the historical task processing time determines the initial length of the current scheduling period.

在一些實施例中,本公開實施例提供的裝置具有的功能或包含的模組可以用於執行上文方法實施例描述的方法,其具體實現可以參照上文方法實施例的描述,為了簡潔,這裡不再贅述。In some embodiments, the functions or modules contained in the device provided in the embodiments of the present disclosure can be used to execute the methods described in the above method embodiments. For specific implementation, refer to the description of the above method embodiments. For brevity, I won't repeat it here.

本公開實施例還提出一種電子設備,包括:處理器;用於儲存處理器可執行指令的記憶體;其中,所述處理器用於調用所述記憶體儲存的指令,以執行上述調度方法。An embodiment of the present disclosure also provides an electronic device, including: a processor; a memory used to store executable instructions of the processor; wherein the processor is used to call the instructions stored in the memory to execute the aforementioned scheduling method.

電子設備可以被提供為終端、伺服器或其它形態的設備。Electronic devices can be provided as terminals, servers, or other types of devices.

圖6是根據一示例性實施例繪示的一種電子設備600的方塊圖。例如,電子設備600可以被提供為一伺服器。參照圖6,電子設備600包括處理器622,其進一步包括一個或多個處理器,以及由記憶體632所代表的記憶體資源,用於儲存可由處理器622的執行的指令,例如應用程式。記憶體632中儲存的應用程式可以包括一個或一個以上的每一個對應於一組指令的模組。此外,處理器622被配置為執行指令,以執行上述調度方法。Fig. 6 is a block diagram of an electronic device 600 according to an exemplary embodiment. For example, the electronic device 600 may be provided as a server. 6, the electronic device 600 includes a processor 622, which further includes one or more processors, and a memory resource represented by a memory 632 for storing instructions executable by the processor 622, such as application programs. The application program stored in the memory 632 may include one or more modules each corresponding to a set of commands. In addition, the processor 622 is configured to execute instructions to execute the aforementioned scheduling method.

電子設備600還可以包括一個電源組件626被配置為執行電子設備600的電源管理,一個有線或無線網路介面650被配置為將電子設備600連接到網路,和一個輸入輸出(I/O)介面658。電子設備600可以操作基於儲存在記憶體632的操作系統,例如Windows ServerTM,Mac OS XTM,UnixTM, LinuxTM,FreeBSDTM或類似。The electronic device 600 may also include a power component 626 configured to perform power management of the electronic device 600, a wired or wireless network interface 650 configured to connect the electronic device 600 to a network, and an input and output (I/O) Interface 658. The electronic device 600 can operate based on an operating system stored in the memory 632, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM or the like.

在示例性實施例中,還提供了一種非易失性電腦可讀記錄媒體,例如包括電腦程式指令的記憶體632,上述電腦程式指令可由電子設備600的處理器622執行以完成上述調度方法。In an exemplary embodiment, a non-volatile computer-readable recording medium is also provided, such as the memory 632 including computer program instructions, which can be executed by the processor 622 of the electronic device 600 to complete the scheduling method.

本公開可以是系統、方法和/或電腦程式產品。電腦程式產品可以包括電腦可讀記錄媒體,其上載有用於使處理器實現本公開的各個方面的電腦可讀程式指令。The present disclosure may be a system, method, and/or computer program product. The computer program product may include a computer-readable recording medium loaded with computer-readable program instructions for enabling the processor to implement various aspects of the present disclosure.

電腦可讀記錄媒體可以是可以保持和儲存由指令執行設備使用的指令的有形設備。電腦可讀記錄媒體例如可以是――但不限於――電儲存設備、磁儲存設備、光儲存設備、電磁儲存設備、半導體儲存設備或者上述的任意合適的組合。電腦可讀記錄媒體的更具體的例子(非窮舉的列表)包括:可攜式電腦碟、硬碟、隨機存取記憶體(RAM)、唯讀記憶體(ROM)、可抹除可程式唯讀記憶體(EPROM或快閃記憶體)、靜態隨機存取記憶體(SRAM)、光碟唯讀記憶體(CD-ROM)、數位多功能影音光碟(DVD)、記憶卡、軟碟、機械編碼設備、例如其上儲存有指令的打孔卡或凹槽內凸起結構、以及上述的任意合適的組合。這裡所使用的電腦可讀記錄媒體不被解釋為瞬時信號本身,諸如無線電波或者其他自由傳播的電磁波、通過波導或其他傳輸媒介傳播的電磁波(例如,通過光纖電纜的光脈衝)、或者通過電線傳輸的電信號。The computer-readable recording medium may be a tangible device that can hold and store instructions used by the instruction execution device. The computer-readable recording medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable recording media (non-exhaustive list) include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable and programmable Read-only memory (EPROM or flash memory), static random access memory (SRAM), CD-ROM, digital multi-function audio-visual disc (DVD), memory card, floppy disk, machinery An encoding device, such as a punch card on which instructions are stored, or a convex structure in a groove, and any suitable combination of the above. The computer-readable recording medium used here is not interpreted as a transient signal itself, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (for example, light pulses through fiber optic cables), or through wires Transmission of electrical signals.

這裡所描述的電腦可讀程式指令可以從電腦可讀記錄媒體下載到各個計算/處理設備,或者通過網路、例如網際網路、區域網路、廣域網路和/或無線網路下載到外部電腦或外部儲存設備。網路可以包括銅傳輸電纜、光纖傳輸、無線傳輸、路由器、防火牆、交換機、網關電腦和/或邊緣運算伺服器。每個計算/處理設備中的網路適配卡或者網路介面從網路接收電腦可讀程式指令,並轉發該電腦可讀程式指令,以供儲存在各個計算/處理設備中的電腦可讀記錄媒體中。The computer-readable program instructions described here can be downloaded from a computer-readable recording medium to each computing/processing device, or downloaded to an external computer via a network, such as the Internet, a local area network, a wide area network, and/or a wireless network Or external storage device. The network may include copper transmission cables, optical fiber transmission, wireless transmission, routers, firewalls, switches, gateway computers, and/or edge computing servers. The network adapter card or network interface in each computing/processing device receives computer-readable program instructions from the network, and forwards the computer-readable program instructions to be readable by the computers stored in each computing/processing device In the recording medium.

用於執行本公開操作的電腦程式指令可以是彙編指令、指令集架構(ISA)指令、機器指令、機器相關指令、微代碼、韌體指令、狀態設置資料、或者以一種或多種程式語言的任意組合編寫的原始碼或目的碼,所述程式語言包括面向對象的程式語言—諸如Smalltalk、C++等,以及常規的過程式程式語言—諸如「C」語言或類似的程式語言。電腦可讀程式指令可以完全地在用戶電腦上執行、部分地在用戶電腦上執行、作為一個獨立的軟體包執行、部分在用戶電腦上部分在遠端電腦上執行、或者完全在遠端電腦或伺服器上執行。在涉及遠端電腦的情形中,遠端電腦可以通過任意種類的網路—包括區域網路(LAN)或廣域網路(WAN)—連接到用戶電腦,或者,可以連接到外部電腦(例如利用網際網路服務提供商來通過網際網路連接)。在一些實施例中,通過利用電腦可讀程式指令的狀態資訊來個性化定制電子電路,例如可程式邏輯電路、現場可程式閘陣列(FPGA)或可程式邏輯陣列(PLA),該電子電路可以執行電腦可讀程式指令,從而實現本公開的各個方面。The computer program instructions used to perform the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, status setting data, or any of one or more programming languages. The source code or the object code written in combination, the programming language includes object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as "C" language or similar programming languages. Computer-readable program instructions can be executed entirely on the user's computer, partly on the user's computer, executed as an independent software package, partly on the user's computer and partly executed on the remote computer, or entirely on the remote computer or Execute on the server. In the case of a remote computer, the remote computer can be connected to the user’s computer through any kind of network-including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (for example, using the Internet). Internet service provider to connect via the Internet). In some embodiments, the electronic circuit is personalized by using the status information of the computer-readable program instructions, such as programmable logic circuit, field programmable gate array (FPGA) or programmable logic array (PLA), the electronic circuit can be The computer-readable program instructions are executed to realize various aspects of the present disclosure.

這裡參照根據本公開實施例的方法、裝置(系統)和電腦程式產品的流程圖和/或方塊圖描述了本公開的各個方面。應當理解,流程圖和/或方塊圖的每個方框以及流程圖和/或方塊圖中各方框的組合,都可以由電腦可讀程式指令實現。Here, various aspects of the present disclosure are described with reference to flowcharts and/or block diagrams of methods, devices (systems) and computer program products according to embodiments of the present disclosure. It should be understood that each block of the flowchart and/or block diagram and the combination of each block in the flowchart and/or block diagram can be implemented by computer-readable program instructions.

這些電腦可讀程式指令可以提供給通用電腦、專用電腦或其它可程式資料處理裝置的處理器,從而生產出一種機器,使得這些指令在通過電腦或其它可程式資料處理裝置的處理器執行時,產生了實現流程圖和/或方塊圖中的一個或多個方框中規定的功能/動作的裝置。也可以把這些電腦可讀程式指令儲存在電腦可讀記錄媒體中,這些指令使得電腦、可程式資料處理裝置和/或其他設備以特定方式工作,從而,儲存有指令的電腦可讀記錄媒體則包括一個製造品,其包括實現流程圖和/或方塊圖中的一個或多個方框中規定的功能/動作的各個方面的指令。These computer-readable program instructions can be provided to the processors of general-purpose computers, dedicated computers, or other programmable data processing devices, thereby producing a machine that, when executed by the processors of the computer or other programmable data processing devices, A device that implements the functions/actions specified in one or more blocks in the flowcharts and/or block diagrams is produced. It is also possible to store these computer-readable program instructions in a computer-readable recording medium. These instructions make the computer, the programmable data processing device, and/or other equipment work in a specific manner, so that the computer-readable recording medium storing the instructions is It includes an article of manufacture, which includes instructions for implementing various aspects of the functions/actions specified in one or more blocks in the flowchart and/or block diagram.

也可以把電腦可讀程式指令加載到電腦、其它可程式資料處理裝置、或其它設備上,使得在電腦、其它可程式資料處理裝置或其它設備上執行一系列操作步驟,以產生電腦實現的過程,從而使得在電腦、其它可程式資料處理裝置、或其它設備上執行的指令實現流程圖和/或方塊圖中的一個或多個方框中規定的功能/動作。It is also possible to load computer-readable program instructions onto a computer, other programmable data processing device, or other equipment, so that a series of operation steps are executed on the computer, other programmable data processing device, or other equipment to produce a computer-implemented process , So that the instructions executed on the computer, other programmable data processing device, or other equipment realize the functions/actions specified in one or more blocks in the flowcharts and/or block diagrams.

附圖中的流程圖和方塊圖顯示了根據本公開的多個實施例的系統、方法和電腦程式產品的可能實現的體系架構、功能和操作。在這點上,流程圖或方塊圖中的每個方框可以代表一個模組、程式段或指令的一部分,所述模組、程式段或指令的一部分包含一個或多個用於實現規定的邏輯功能的可執行指令。在有些作為替換的實現中,方框中所標注的功能也可以以不同於附圖中所標注的順序發生。例如,兩個連續的方框實際上可以基本並行地執行,它們有時也可以按相反的順序執行,這依所涉及的功能而定。也要注意的是,方塊圖和/或流程圖中的每個方框、以及方塊圖和/或流程圖中的方框的組合,可以用執行規定的功能或動作的專用的基於硬體的系統來實現,或者可以用專用硬體與電腦指令的組合來實現。The flowcharts and block diagrams in the accompanying drawings show the possible implementation architecture, functions, and operations of the system, method, and computer program product according to multiple embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, program segment, or part of an instruction, and the module, program segment, or part of an instruction includes one or more Executable instructions for logic functions. In some alternative implementations, the functions marked in the block may also occur in a different order from the order marked in the drawings. For example, two consecutive blocks can actually be executed substantially in parallel, or they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and/or flowchart, as well as the combination of the blocks in the block diagram and/or flowchart, can use a dedicated hardware-based The system can be implemented, or it can be implemented by a combination of dedicated hardware and computer instructions.

以上已經描述了本公開的各實施例,上述說明是示例性的,並非窮盡性的,並且也不限於所揭露的各實施例。在不偏離所說明的各實施例的範圍和精神的情況下,對於本技術領域的普通技術人員來說許多修改和變更都是顯而易見的。本文中所用術語的選擇,旨在最好地解釋各實施例的原理、實際應用或對市場中技術的技術改進,或者使本技術領域的其它普通技術人員能理解本文揭露的各實施例。The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Without departing from the scope and spirit of the illustrated embodiments, many modifications and changes are obvious to those of ordinary skill in the art. The choice of terms used herein is intended to best explain the principles, practical applications, or technical improvements of the technologies in the market, or to enable those of ordinary skill in the art to understand the embodiments disclosed herein.

S11~S13, S201~S207, S301~S304:步驟 51:獲取模組 52:確定模組 53:調整模組 600:電子設備 622:處理器 626:電源組件 632:記憶體 650:網路介面 658:輸入輸出介面S11~S13, S201~S207, S301~S304: steps 51: Obtain modules 52: Determine the module 53: adjustment module 600: electronic equipment 622: processor 626: Power Components 632: memory 650: network interface 658: input and output interface

圖1繪示根據本公開實施例的調度方法的流程圖。 圖2繪示根據本公開實施例的對分配給任務的時間片進行延長的示例流程圖。 圖3繪示根據本公開實施例的對分配給任務的時間片進行縮減的示例流程圖。 圖4繪示根據本公開實施例的歷史任務處理時間與累積頻率的曲線。 圖5繪示根據本公開實施例的調度裝置的方塊圖。 圖6繪示根據本公開實施例的電子設備的示例方塊圖。Fig. 1 shows a flowchart of a scheduling method according to an embodiment of the present disclosure. Fig. 2 shows an exemplary flow chart of extending the time slice allocated to a task according to an embodiment of the present disclosure. FIG. 3 shows an exemplary flow chart of reducing the time slice allocated to a task according to an embodiment of the present disclosure. FIG. 4 illustrates a curve of historical task processing time and cumulative frequency according to an embodiment of the present disclosure. Fig. 5 shows a block diagram of a scheduling device according to an embodiment of the present disclosure. Fig. 6 shows an exemplary block diagram of an electronic device according to an embodiment of the present disclosure.

S11~S13:步驟S11~S13: steps

Claims (15)

一種調度方法,包括: 獲取當前調度週期內第一任務的任務處理時間; 基於所述任務處理時間以及所述當前調度週期內為所述第一任務分配的第一時間片,確定所述第一任務是否超時; 根據確定的結果,調整目標調度週期內為至少一個第二任務分配的時間片,其中,所述目標調度週期包括所述當前調度週期或所述當前調度週期的下一調度週期。A scheduling method, including: Obtain the task processing time of the first task in the current scheduling period; Determine whether the first task times out based on the task processing time and the first time slice allocated for the first task in the current scheduling period; According to the result of the determination, the time slice allocated to the at least one second task in the target scheduling period is adjusted, where the target scheduling period includes the current scheduling period or the next scheduling period of the current scheduling period. 如請求項1所述的方法,其中基於所述任務處理時間以及所述當前調度週期內為所述第一任務分配的所述第一時間片,確定所述第一任務是否超時的步驟包括: 確定所述任務處理時間的截止時刻與所述第一時間片的截止時刻之間的第一時間差值; 在所述第一時間差值大於第一時間閾值的情況下,確定所述第一任務超時。The method according to claim 1, wherein the step of determining whether the first task has timed out based on the task processing time and the first time slice allocated for the first task in the current scheduling period includes : Determining the first time difference between the deadline of the task processing time and the deadline of the first time slice; In a case where the first time difference is greater than a first time threshold, it is determined that the first task has timed out. 如請求項2所述的方法,其中所述第一時間閾值是基於所述第一時間片的長度得到的。The method according to claim 2, wherein the first time threshold is obtained based on the length of the first time slice. 如請求項1至3任意一項所述的方法,其中根據確定的結果,調整所述目標調度週期內為所述至少一個第二任務分配的時間片的步驟包括: 在確定所述第一任務超時的情況下,調整所述當前調度週期的長度; 基於所述當前調度週期的調整後的長度,調整所述當前調度週期內為所述至少一個第二任務分配的時間片。The method according to any one of claim items 1 to 3, wherein according to the determined result, the step of adjusting the time slice allocated for the at least one second task in the target scheduling period includes: In a case where it is determined that the first task has timed out, adjusting the length of the current scheduling period; Based on the adjusted length of the current scheduling period, adjust the time slice allocated for the at least one second task in the current scheduling period. 如請求項4所述的方法,其中基於所述當前調度週期的調整後的長度,調整所述當前調度週期內為所述至少一個第二任務分配的時間片的步驟包括: 基於所述當前調度週期的調整後的長度以及每個所述第二任務的服務品質參數,調整所述當前調度週期內為每個所述第二任務分配的時間片的長度,以使每個所述第二任務的服務品質參數保持為對應的預設數值和/或每個所述第二任務的時間片在所述當前調度週期中所占的比例保持為對應的預設數值。The method according to claim 4, wherein the step of adjusting the time slice allocated for the at least one second task in the current scheduling period based on the adjusted length of the current scheduling period includes: Based on the adjusted length of the current scheduling period and the service quality parameter of each second task, the length of the time slice allocated for each second task in the current scheduling period is adjusted so that each The service quality parameter of the second task is maintained at a corresponding preset value and/or the proportion of the time slice of each second task in the current scheduling period is maintained at the corresponding preset value. 如請求項4或5所述的方法,其中在確定所述第一任務超時的情況下,調整所述當前調度週期的長度的步驟包括: 獲取所述當前調度週期內第三任務的超時次數,其中,所述第三任務為當前調度週期內已執行完畢的任務; 根據所述超時次數,確定對所述當前調度週期的長度進行延長的延長係數,其中,所述延長係數與所述超時次數正相關; 基於所述延長係數,對所述當前調度週期的長度進行延長,得到所述當前調度週期調整後的長度。The method according to claim 4 or 5, wherein in a case where it is determined that the first task has timed out, the step of adjusting the length of the current scheduling period includes: Acquiring the number of timeouts of the third task in the current scheduling period, where the third task is a task that has been executed in the current scheduling period; Determining an extension coefficient for extending the length of the current scheduling period according to the number of timeouts, wherein the extension coefficient is positively correlated with the number of timeouts; Based on the extension coefficient, the length of the current scheduling period is extended to obtain the adjusted length of the current scheduling period. 如請求項4至6任意一項所述的方法,其中所述方法還包括: 獲取所述當前調度週期內第三任務的任務處理時間,其中,所述至少一個第二任務包括所述第三任務; 響應於所述第三任務的任務處理時間小於所述第三任務的調整後的時間片長度,在所述當前調度週期內對所述第三任務進行時間補償。The method according to any one of claims 4 to 6, wherein the method further includes: Acquiring the task processing time of the third task in the current scheduling period, where the at least one second task includes the third task; In response to the task processing time of the third task being less than the adjusted time slice length of the third task, time compensation is performed on the third task in the current scheduling period. 如請求項7所述的方法,其中響應於所述第三任務的任務處理時間小於所述第三任務的調整後的時間片長度,在所述當前調度週期內對所述第三任務進行時間補償的步驟包括: 基於所述第三任務的任務處理時間和所述第三任務的調整後的時間片長度,確定所述第三任務的補償時間; 基於所述補償時間,將所述第三任務的補償任務添加到所述當前調度週期的調度隊列的隊尾。The method according to claim 7, wherein in response to the task processing time of the third task being less than the adjusted time slice length of the third task, time the third task is performed within the current scheduling period The compensation steps include: Determining the compensation time of the third task based on the task processing time of the third task and the adjusted time slice length of the third task; Based on the compensation time, the compensation task of the third task is added to the end of the scheduling queue of the current scheduling period. 如請求項1至3中任一項所述的方法,其中根據確定的結果,調整所述目標調度週期內為所述至少一個第二任務分配的時間片的步驟包括: 在確定所述當前調度週期內每個任務均未超時的情況下,調整所述當前調度週期的所述下一調度週期的長度; 基於所述下一調度週期的調整後的長度,確定所述下一調度週期內為所述至少一個第二任務分配的時間片。The method according to any one of claim items 1 to 3, wherein according to the determined result, the step of adjusting the time slice allocated for the at least one second task in the target scheduling period includes: Adjusting the length of the next scheduling period of the current scheduling period when it is determined that each task in the current scheduling period has not timed out; Based on the adjusted length of the next scheduling period, determine the time slice allocated for the at least one second task in the next scheduling period. 如請求項9所述的方法,其中調整所述當前調度週期的所述下一調度週期的長度的步驟包括: 利用預設的縮減係數對所述下一調度週期的長度進行縮減。The method according to claim 9, wherein the step of adjusting the length of the next scheduling period of the current scheduling period includes: The length of the next scheduling period is reduced by using a preset reduction coefficient. 如請求項9或10所述的方法,其中基於所述下一調度週期的調整後的長度,確定所述下一調度週期內為所述至少一個第二任務分配的時間片的步驟包括: 基於所述下一調度週期的調整後的長度以及每個所述第二任務的服務品質參數,確定所述下一調度週期內每個所述第二任務分配的時間片的長度,以使每個所述第二任務的服務品質參數保持為對應的預設數值和/或每個所述第二任務的時間片在所述下一調度週期中所占的比例保持為對應的預設數值。The method according to claim 9 or 10, wherein the step of determining the time slice allocated for the at least one second task in the next scheduling period based on the adjusted length of the next scheduling period includes: Based on the adjusted length of the next scheduling period and the service quality parameter of each second task, the length of the time slice allocated for each second task in the next scheduling period is determined so that each The service quality parameter of each of the second tasks is maintained at the corresponding preset value and/or the proportion of the time slice of each second task in the next scheduling period is maintained at the corresponding preset value. 如請求項1至11中任意一項所述的方法,其中所述方法還包括: 獲取預設時間段內多個任務執行歷史任務的歷史任務處理時間; 根據所述歷史任務處理時間的統計資訊,確定所述當前調度週期的初始長度。The method according to any one of claims 1 to 11, wherein the method further includes: Obtain the historical task processing time of multiple tasks executing historical tasks within a preset time period; Determine the initial length of the current scheduling period according to the statistical information of the historical task processing time. 一種調度裝置,包括: 獲取模組,用於獲取當前調度週期內第一任務的任務處理時間; 確定模組,用於基於所述任務處理時間以及所述當前調度週期內為所述第一任務分配的第一時間片,確定所述第一任務是否超時; 調整模組,用於根據確定的結果,調整目標調度週期內為至少一個第二任務分配的時間片,其中,所述目標調度週期包括所述當前調度週期或所述當前調度週期的下一調度週期。A scheduling device includes: The obtaining module is used to obtain the task processing time of the first task in the current scheduling period; A determining module, configured to determine whether the first task has timed out based on the task processing time and the first time slice allocated for the first task in the current scheduling period; The adjustment module is configured to adjust the time slice allocated to at least one second task in a target scheduling period according to the determined result, wherein the target scheduling period includes the current scheduling period or the next scheduling of the current scheduling period cycle. 一種電子設備,包括: 處理器; 用於儲存處理器可執行指令的記憶體; 其中,所述處理器用於調用所述記憶體儲存的指令,以執行請求項1至12中任意一項所述的方法。An electronic device including: processor; Memory used to store executable instructions of the processor; Wherein, the processor is configured to call instructions stored in the memory to execute the method described in any one of request items 1-12. 一種電腦可讀記錄媒體,其上儲存有電腦程式指令,其中所述電腦程式指令被電腦執行時實現請求項1至12中任意一項所述的方法。A computer-readable recording medium has computer program instructions stored thereon, wherein the computer program instructions are executed by a computer to implement the method described in any one of request items 1 to 12.
TW109115358A 2019-11-13 2020-05-08 Scheduling method and apparatus, electronic device and storage medium TW202119207A (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911108865.9 2019-11-13
CN201911108865.9A CN112799793B (en) 2019-11-13 2019-11-13 Scheduling method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
TW202119207A true TW202119207A (en) 2021-05-16

Family

ID=75803534

Family Applications (1)

Application Number Title Priority Date Filing Date
TW109115358A TW202119207A (en) 2019-11-13 2020-05-08 Scheduling method and apparatus, electronic device and storage medium

Country Status (6)

Country Link
JP (1) JP2022515255A (en)
KR (1) KR20210095687A (en)
CN (1) CN112799793B (en)
SG (1) SG11202107163PA (en)
TW (1) TW202119207A (en)
WO (1) WO2021093248A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116700135B (en) * 2023-08-09 2023-10-20 长江三峡集团实业发展(北京)有限公司 Method and device for testing task scheduling mode of programmable logic controller
CN117290113B (en) * 2023-11-22 2024-02-13 太平金融科技服务(上海)有限公司 Task processing method, device, system and storage medium
CN117421106B (en) * 2023-12-11 2024-03-08 湖南行必达网联科技有限公司 Task scheduling method, system and equipment for embedded software

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4025260B2 (en) * 2003-08-14 2007-12-19 株式会社東芝 Scheduling method and information processing system
WO2012093496A1 (en) * 2011-01-07 2012-07-12 富士通株式会社 Multitasking scheduling method, and multi-core processor system
US9378139B2 (en) * 2013-05-08 2016-06-28 Nvidia Corporation System, method, and computer program product for low latency scheduling and launch of memory defined tasks
US9632844B2 (en) * 2013-12-12 2017-04-25 International Business Machines Corporation Non-preemption of a group of interchangeable tasks in a computing device
CN103885825B (en) * 2014-03-05 2018-01-05 南京邮电大学 Rate monotonic real-time scheduling method based on dynamic time piece
CN103841208B (en) * 2014-03-18 2017-09-01 北京工业大学 The cloud computing method for scheduling task optimized based on the response time
CN108984264B (en) * 2017-06-02 2022-11-15 阿里巴巴集团控股有限公司 Virtual GPU (graphics processing Unit) implementation method, device and system
CN110109745B (en) * 2019-05-15 2023-06-20 华南理工大学 Task collaborative online scheduling method for edge computing environment

Also Published As

Publication number Publication date
CN112799793A (en) 2021-05-14
WO2021093248A1 (en) 2021-05-20
KR20210095687A (en) 2021-08-02
CN112799793B (en) 2022-03-15
SG11202107163PA (en) 2021-07-29
JP2022515255A (en) 2022-02-17

Similar Documents

Publication Publication Date Title
TW202119207A (en) Scheduling method and apparatus, electronic device and storage medium
US10223165B2 (en) Scheduling homogeneous and heterogeneous workloads with runtime elasticity in a parallel processing environment
US11088961B2 (en) Monitoring data streams and scaling computing resources based on the data streams
US11216310B2 (en) Capacity expansion method and apparatus
US9405572B2 (en) Optimized resource allocation and management in a virtualized computing environment
CN107357405B (en) Power consumption control method and related equipment
WO2021012956A1 (en) Resource processing method for cloud platform, and related device and storage medium
US11150999B2 (en) Method, device, and computer program product for scheduling backup jobs
CN109361750B (en) Resource allocation method, device, electronic equipment and storage medium
CN111858040A (en) Resource scheduling method and device
US10616064B2 (en) Soft reservation techniques and systems for virtualized environments
US10877790B2 (en) Information processing apparatus, control method and storage medium
CN114490048A (en) Task execution method and device, electronic equipment and computer storage medium
US10860369B2 (en) Self-adjusting system for prioritizing computer applications
KR102496115B1 (en) Apparatus and Method of Altruistic Scheduling based on Reinforcement Learning
US20200326770A1 (en) Sleep management method and device, and computer storage medium
CN110347477B (en) Service self-adaptive deployment method and device in cloud environment
US11388050B2 (en) Accelerating machine learning and profiling over a network
US20150181456A1 (en) Frame transmission method and apparatus for controlling one-way delay
CN114138427A (en) SLO guarantee method, SLO guarantee device, node, and storage medium
US20230008176A1 (en) A Multi-Tenant Real-Time Process Controller for Edge Cloud Environments
WO2021262054A1 (en) Method for controlling deployment of cached dependencies on one or more selected nodes in a distributed computing system
CN111722921A (en) Cognitive detection for cloud service prediction
CN112379986B (en) Task processing method and device and electronic equipment
CN117421123B (en) GPU resource adjustment method and system, electronic equipment and storage medium