Hierarchical scheduling system and method
Patent Information
- Authority / Receiving Office
- EP · EP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-06-09
- Publication Date
- 2026-03-11
AI Technical Summary
Hierarchical schedulers in operating systems face challenges with scalability and performance due to the need to evaluate scheduling strategies across a large tree structure, leading to time-consuming operations that affect system responsiveness.
A hierarchical scheduling system with a controller that dynamically adjusts the scope by determining sub-trees based on task priority and scheduling events, allowing only the necessary nodes to be queried for scheduling decisions, thereby reducing tree depth and improving efficiency.
This approach enhances scalability and performance by limiting operations to the smallest sub-tree possible, optimizing scheduling decisions without sacrificing flexibility or handling of complex tasks, while maintaining multi-core support and OS independence.
Smart Images

Figure EP2023065506_12122024_PF_FP_ABST
Abstract
Description
[0001] HIERARCHICAL SCHEDULING SYSTEM AND METHOD
[0002] TECHNICAL FIELD
[0003] The present disclosure relates to task or process scheduling, for example, task or process scheduling in an Operating System (OS), in order to assign resources to perform or execute specific tasks or processes. The present disclosure presents a hierarchical scheduling system and method for scheduling such tasks or processes.
[0004] BACKGROUND
[0005] Generally, task scheduling can be regarded as one of the roles of an OS. In order to select the next task to execute, the OS may use a scheduler or scheduling module, which can be a software module defined by a set of rules. The scheduler may select the most important task to be executed from a pool of tasks ready for execution. Different schedulers may have different rules and may influence the choice of the task in different ways.
[0006] In this regard, a hierarchical scheduler can be understood as a composition of cooperating schedulers that may select the tasks to be executed in the OS. The hierarchical scheduler may comprise a tree of schedulers identified by a root node and linked to other nodes, which may eventually end up into one or more leaves. Each scheduler in the tree may select for execution either a task or a lower level scheduler.
[0007] Although hierarchical schedulers may be highly flexible in terms of scheduling policies, they may have a non-negligible impact on the run-time performance. Furthermore, the scalability of the hierarchical schedulers can be an issue with respect to the tree depth as well as the efficiency in performing scheduling operations, for example, due to the need to evaluate the schedule strategy starting from the root of the tree and traverse the entire structure in order to perform the scheduling decision. Such operations may be time-consuming and may directly affect the system responsiveness. SUMMARY
[0008] In view of the above, this disclosure aims to provide an improved hierarchical scheduling system and a method for hierarchical scheduling of tasks. An objective is to improve the scalability and performance of scheduling operations.
[0009] These and other objectives are achieved by the solutions described in the independent claims. Advantageous implementations are further defined in the dependent claims.
[0010] According to a first aspect of this disclosure, a hierarchical scheduling system is provided. The hierarchical scheduling system comprises a hierarchical scheduler comprising a tree of scheduling nodes with at least one root scheduling node and one or more hierarchically arranged layers of scheduling nodes originating in the root scheduling node; and a controller configured to communicate with the hierarchical scheduler to distribute one or more tasks in the hierarchical scheduler. In this regard, each of the scheduling nodes is configured to execute at least one task of the one or more tasks, and further to produce one or more scheduling events. Furthermore, the controller is configured to determine one or more sub-trees of the tree of scheduling nodes comprising at least one of the scheduling nodes based on a priority of execution of the one or more tasks and / or based on the one or more scheduling events produced by one or more scheduling nodes, and to exclusively control the at least one scheduling node of the sub-trees to execute at least one of the one or more tasks.
[0011] According to the above, this disclosure presents a solution to improve the scalability and efficiency of scheduling operations by defining strategies to limit the operation to the smallest sub-tree or scope possible at all times. In this regard, the term scope can be understood as a subtree of the hierarchical scheduler. By limiting the scope, optimal scheduling decisions can be taken without considering the portion of the tree outside the scope itself. As such, the strategies or dynamic scope resolution presented in this disclosure may improve the scalability and performance of hierarchical scheduling operations without sacrificing desirable properties of the hierarchical scheduler, such as multi-core, flexibility, multiple types of supported tasks, OS independency, handling of blocking tasks, and the like.
[0012] In an implementation form of the first aspect, the controller is configured to determine one or more scheduling paths in the hierarchical scheduler originating from the at least one root scheduling node to at least one task of the one or more tasks based on the priority of execution of the at least one task. The controller is further configured to determine a respective sub-tree of the one or more sub-trees for the one or more scheduling paths based on the priority of execution of the at least one task. Moreover, the controller is configured to extend the sub-tree in a higher layer or reduce the sub-tree in a lower layer along the one or more scheduling paths based on the one or more scheduling events produced by one or more scheduling nodes. This may allow to query only the smallest sub-tree possible in the hierarchical scheduler, e.g., to reevaluate the current schedule, and the scheduling operation may experience a reduced tree depth and a reduced number of nodes and edges.
[0013] In an implementation form of the first aspect, the hierarchical scheduler is configured to transmit one or more notifications to the controller corresponding to the one or more scheduling events produced by the one or more scheduling nodes. For example, a scheduling event may correspond to an event that may alter the internal state of one of the scheduling nodes, e.g., depletion of the Round Robin budget, end of an earliest deadline first (EDF) period, preemption of a task unblocked by a resource became available, task switch, and the like. This may allow the controller to adjust the scope over time, e.g., to reflect the internal state of the hierarchical scheduler at all times.
[0014] In an implementation form of the first aspect, the controller is configured to distribute the plurality of tasks in the hierarchical scheduler based on the one or more notifications transmitted by the hierarchical scheduler. In other words, the controller may change the current scope and may flag a task schedule based on the one or more notifications transmitted by the hierarchical scheduler. This may allow the controller to distribute the tasks based on the internal state of the hierarchical scheduler.
[0015] In an implementation form of the first aspect, the hierarchical scheduler is configured to transmit the one or more notifications to the controller based on a state of the one or more scheduling nodes. For example, the one or more scheduling nodes can be considered in an active state if the scheduling node is part of the branch between the root scheduling node and the currently running task. Additionally or alternatively, one or more scheduling node may notify the controller whether a scheduling event is active or inactive, e.g., to reflect the state of the scheduling node. In an implementation form of the first aspect, the controller is configured to extend or reduce the sub-tree based on the one or more notifications transmitted by the hierarchical scheduler. Additionally or alternatively, the controller is configured to transmit one or more further notifications to the hierarchical scheduler to instruct the hierarchical scheduler to extend or reduce the sub-tree. This may allow for the dynamic expansion or reduction of the sub-tree, e.g., based on the notifications exchanged between the controller and the hierarchical scheduler, to facilitate the dynamic scope resolution.
[0016] In an implementation form of the first aspect, the hierarchical scheduler is configured to add a task from the one or more tasks to a particular scheduling node, to bind the particular scheduling node to a scheduling node in a higher layer, and to transmit a notification to the controller corresponding to a scheduling event produced by the particular scheduling node. This may allow a specific task to enter the hierarchical scheduler, e.g., to become schedulable, and may further allow to bind a scheduling node to another, e.g., in the tree structure.
[0017] In an implementation form of the first aspect, the hierarchical scheduler is configured to remove a task from the particular scheduling node, and to unbind the particular scheduling node from the scheduling node in the higher layer. This may allow a specific task to exit the hierarchical scheduler, e.g., to become un-schedulable, and may further allow to unbind a scheduling node to another, e.g., to reshape the tree structure.
[0018] In an implementation form of the first aspect, the hierarchical scheduler is configured to select at least one task of the one or more tasks based on the priority of execution of the at least one task. This may allow the hierarchical scheduler to react to critical and / or time-sensitive events and to preempt lower priority events.
[0019] In an implementation form of the first aspect, the hierarchical scheduling system further comprises a profiler configured to provide hardware-based profile information or softwarebased profile information to at least one scheduling node of the hierarchical scheduler. In this regard, the hierarchical scheduler is configured to determine a change of a state of the at least one scheduling node based on the profile information, and to transmit a notification to the controller corresponding to the change of the state of at least one scheduling node. This may allow the hierarchical scheduling system to employ a hardware or software profiler, e.g., for scheduling purposes, where the profiler’s estimations may be directly provided to the scheduling nodes as an input.
[0020] In an implementation form of the first aspect, the one or more hierarchically arranged layers of scheduling nodes originating in the root scheduling node are arranged in a N-ary tree formation. This may allow to extend or to grow the layers of scheduling nodes in the vertical direction due to, for example, the number of N sub-nodes available to a given node.
[0021] In an implementation form of the first aspect, the hierarchical scheduling system is implemented in an operating system and the controller is implemented in a user module or is a central controller or Kernel of the operating system. For example, the user module may correspond to a user-space module, library, or a generic software component of an operating system.
[0022] According to a second aspect of this disclosure, a method for hierarchical scheduling is provided. The method comprises the step of forming a hierarchical scheduler by providing a tree of scheduling nodes with at least one root scheduling node and one or more hierarchically arranged layers of scheduling nodes originating in the root scheduling node. In addition, the method comprises the step of distributing one or more tasks in the hierarchical scheduler, whereby each of the scheduling nodes executes at least one task of the one or more tasks and further produces one or more scheduling events. Furthermore, the method comprises the step of determining one or more sub-trees of the tree of scheduling nodes comprising at least one of the scheduling nodes based on a priority of execution of the one or more tasks and / or based on one or more scheduling events produced by one or more scheduling nodes. Moreover, the method comprises the step of controlling exclusively the at least one scheduling node of the sub-trees to execute at least one of the one or more tasks.
[0023] In an implementation form of the second aspect, the method further comprises the steps of determining one or more scheduling paths in the hierarchical scheduler originating from the at least one root scheduling node to at least one task of the one or more tasks based on the priority of execution of the at least one task, determining a respective sub-tree of the one or more subtrees for the one or more scheduling paths based on the priority of execution of the at least one task, and extending the sub-tree in a higher layer or reducing the sub-tree in a lower layer along the one or more scheduling paths based on the one or more scheduling events produced by one or more scheduling nodes. According to a third aspect of this disclosure, a computer program is provided. The computer program comprises instructions which, when the program is executed by a computer, cause the computer to perform the method according to the second aspect of this disclosure.
[0024] According to a fourth aspect of this disclosure, a data processing device is provided. The data processing device comprises a processor configured to perform the method according to the second aspect of this disclosure and / or to implement the hierarchical scheduling system according to the first aspect of this disclosure.
[0025] It is to be noted that the method according to the second aspect corresponds to the hierarchical scheduling system according to the first aspect and its implementation forms. Accordingly, the method of the second aspect may have corresponding implementation forms. Further, the method of the second aspect achieves the same advantages and effects as the hierarchical scheduling system of the first aspect and its respective implementation forms.
[0026] BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The above described aspects and implementation forms will be explained in the following description of specific exemplary embodiments in relation to the enclosed drawings, in which:
[0028] Fig. 1 shows a first exemplary embodiment of the hierarchical scheduling system according to this disclosure;
[0029] Fig. 2 shows an exemplary high-level architecture for hierarchical scheduling in UML;
[0030] Figs. 3A-3D show a first exemplary dynamic scope resolution scheme according to this disclosure;
[0031] Fig. 4 shows a second exemplary dynamic scope resolution scheme according to this disclosure;
[0032] Fig. 5 shows a second exemplary embodiment of the hierarchical scheduling system according to this disclosure; Fig. 6 shows an exemplary flow diagram of the method according to this disclosure; and
[0033] Fig. 7 shows an exemplary data processing device according to this disclosure.
[0034] DETAILED DESCRIPTION OF EMBODIMENTS
[0035] Reference will now be made in detail to exemplary embodiments of the present disclosure, which are illustrated in the accompanying drawings. However, the following embodiments of the present disclosure may be variously modified and the range of the disclosure is not limited by the following embodiments. Reference signs for similar entities in different embodiments are partially omitted.
[0036] In Fig. 1, a first exemplary embodiment of the hierarchical scheduling system 100 according to the first aspect of this disclosure is illustrated. The hierarchical scheduling system 100 may comprise a controller 101 and a hierarchical scheduler 103, where the controller 101 and the hierarchical scheduler 103 may communicate with each other, e.g., via the communication link
[0037] 102.
[0038] The hierarchical scheduler 103 may comprise a tree of scheduling nodes or schedulers (not shown), which may be arranged in one or more hierarchically arranged layers with respect to a root node of the hierarchical scheduler 103. In this regard, each of the scheduling nodes may execute one or more tasks, e.g., distributed by the controller 101 in the hierarchical scheduler
[0039] 103, and may further produce one or more scheduling events, e.g., events corresponding to a change of state of the scheduling nodes.
[0040] The controller 101 may select a sub-tree of the tree of scheduling nodes, e.g., one sub-tree per CPU core, which may comprise one or more scheduling nodes, based on a priority of execution of the one or more task assigned to the scheduling nodes. Additionally or alternatively, the controller 101 may select the sub-tree of the tree of scheduling nodes, which may comprise one or more scheduling nodes, based on the scheduling events produced by the scheduling nodes. In all cases, the controller 101 may only control the scheduling node or scheduling nodes of a selected sub-tree to execute the tasks, e.g., assigned to the scheduling nodes of the sub-tree. For example, the hierarchical scheduling system 100 may correspond to an OS or may be implemented in an OS, and the controller may correspond to the Kernel of the OS or may be implemented in user-specified modules of the OS.
[0041] With respect to the selection of the sub-trees, the controller 101 may determine a scheduling path in the hierarchical scheduler 103, e.g., one scheduling path per CPU core, that may originate from the root scheduling node to the task to be executed based on the priority of execution of the task. Accordingly, the controller 101 may determine the sub-tree for the scheduling path based on the priority of execution of the task. In this regard, the controller 101 may extend the sub-tree in a higher layer or reduce the sub-tree in a lower layer along the scheduling path based on the scheduling events produced by the scheduling nodes.
[0042] Furthermore, the hierarchical scheduler 103 may transmit notifications, e.g., via the communication link 102, to the controller 101. Additionally, the controller 101 may also transmit notifications, via the communication link 102, to the hierarchical scheduler 103. For example, the notifications from the hierarchical scheduler 103 may correspond to the scheduling events produced by the scheduling nodes. Additionally or alternatively, the notifications from the hierarchical scheduler 103 may correspond or be based on the internal states of the scheduling nodes.
[0043] For example, the notifications from the controller 101 may comprise instructions to distribute the tasks in the hierarchical scheduler 103, e.g., based on the notifications from the hierarchical scheduler 103. Additionally or alternatively, the notifications from the controller 101 may comprise instructions to extend the sub-tree in the higher layer or to reduce the sub-tree in the lower layer of the hierarchical scheduler 103, e.g., based on the notifications from the hierarchical scheduler 103.
[0044] It is to be noted that this disclosure defines “scope” as the sub-tree of the hierarchical scheduler 103 such that optimal scheduling decisions can be taken without taking into account the state of the portion of the tree outside the scope, which may be identified by its root scheduling node. This disclosure further refers to the dynamic variation of the scope of the hierarchical scheduler 103 with the term “dynamic scope”, and the strategies to determine the dynamic scope at any point in time according to this disclosure is defined herein by the term “dynamic scope resolution (DSR)”. In Fig. 2, an exemplary high-level architecture 200 for hierarchical scheduling is illustrated in the Unified Modeling Language (UML). The architecture 200 exemplarily describes the various classes, attributes, operations or methods, and the relationships among objects in hierarchical scheduling.
[0045] The architecture 200 shows different classes, such as Kernel, Scheduler, Task, Edge, and Node, e.g., to represent a concept that may encapsulate the state and the behavior of an object. For example, the Kernel may comprise attributes such as root(N), curr-task, need resched, and migration enabled, where each may have a type, e.g., Boolean. Additionally, the attributes may be public attributes, e.g., denoted with the + sign, or may be private attributes, e.g., denoted with the - sign. Furthermore, the Kernel may comprise operations such as set root and schedule, where each may have a type, e.g., integer. Additionally, the operations may be public operations, e.g., denoted with the + sign, or may be private operations, e.g., denoted with the - sign.
[0046] Furthermore, as shown in the architecture 200, the Scheduler may comprise attributes such as task and preemptive, where each may have a type, e.g., Boolean. Additionally, the attributes may be public attributes, e.g., denoted with the + sign, or may be private attributes, e.g., denoted with the - sign. Furthermore, the Scheduler may comprise operations such as add, remove, and next, where each may have a type, e.g., integer. Additionally, the operations may be public operations, e.g., denoted with the + sign, or may be private operations, e.g., denoted with the - sign.
[0047] In the architecture 200, the number of CPU cores is denoted with M, which can be one or more. Furthermore, according to the architecture 200, the scheduler can be understood as an entity that may provide a basic set of scheduling capabilities to its user and may hide the internal scheduling strategy. The basic set of scheduling capabilities can be summarized as follows:
[0048] • ADD: This capability may allow a specific task to enter the scheduler and become schedulable depending on the scheduling strategy implemented by itself. For example, this can happen on task activation, when the task unblocks because a resource became available or when its execution got interrupted by preemption or termination. • REMOVE: This capability may allow a specific task to exit the scheduler and become no more schedulable. For instance, this can happen on task dispatch, when the task blocks because a resource is busy or when it terminated its execution.
[0049] • NEXT: This capability may allow the Kernel to retrieve the most important, e.g., with the highest priority, task amongst the currently schedulable ones within the scheduler. The concept of importance may depend on the underlying implementation of the scheduler; however, it may not affect how the Kernel interacts with the scheduler itself.
[0050] In terms of hierarchical scheduling, a hierarchical scheduling node may correspond to a scheduler that may extend scheduling capabilities by adding logic to build the hierarchical scheduling tree and to keep its internal state up-to-date when a scheduling operation is performed. A hierarchical scheduling node may have the following specific capabilities:
[0051] • BIND: This capability may bind a hierarchical scheduler node to another forming a tree structure.
[0052] • UNBIND: This capability may unbind a hierarchical scheduler node from another, reshaping the tree structure. This may be required, e.g., to allow the OS to dynamically change the hierarchical scheduler tree.
[0053] Along Figs. 3A-3D a first exemplary strategy according to the DSR is illustrated. In essence, the DSR can be understood as a set of strategies based on the mutual communication and operations of the controller 101 and the hierarchical scheduler 103 to identify the dynamic scope inside the hierarchical scheduler 103 at any point in time.
[0054] For example, the DSR may define the following strategies for keeping the internal state of the hierarchical scheduler 103 consistent at all times:
[0055] • The scope may be set to the root scheduling node at the STARTUP.
[0056] • For the ADD operation, the capability may be propagated to parent scheduling nodes, e.g., the scheduling nodes one hierarchical level above, and may be stopped if the internal state is unchanged. Furthermore, the DSR may define the following strategies for visiting the hierarchical scheduler tree:
[0057] • For the NEXT operation, the tree may be visited in-depth starting from the current scope, and may step up one hierarchical level if there is no schedulable task in visited sub-tree, excluding the already visited branch, and the NEXT operation may be repeated. It is to be noted that, if it is not possible to step up one hierarchical level then the root scheduling node may be reached, e.g., no schedulable task may be available.
[0058] Moreover, the DSR may define the following strategies for changing the scope dynamically:
[0059] • By means of SCHEDULING EVENT, which may be any event that may alter the internal state of one of the scheduling nodes of the hierarchical scheduler 103. For instance, if the scheduling node indicates the event as an active event, the scope may be set to the scheduling node owning the currently running task. However, if the event is not active, no action may be performed.
[0060] • By means of TASK SWITCH, to set the scope to the scheduling node owning the currently running task.
[0061] Turning back to Fig. 3A, a hierarchical scheduler tree 300 is illustrated, e.g., according to the hierarchical scheduler 103. The hierarchical scheduler tree 300 may comprise the scheduling nodes SI, S2, S3, and S4, and the tasks distributed therein.
[0062] For instance, from the lower scheduling layer towards the higher scheduling layer, the scheduling node S4 may be assigned to execute the tasks T5, T6, and T7, the scheduling node S3 may be assigned to execute the tasks T3 and T4, the scheduling node S2 (parent) may be assigned to execute the task T 1 and further to the scheduling node S4 (child), and the scheduling node SI (parent) may be assigned to execute the task T2 and further to the scheduling nodes S2 and S3 (child, sibling).
[0063] In Fig. 3B, the state of the hierarchical scheduler tree 300 during the startup is illustrated. For instance, the scope may be set to the root scheduling node SI of the hierarchical scheduler tree 300. If, for instance, the most important task in the hierarchical scheduler tree 300 is T5, in order for the controller 101 to schedule the next running task or task switch, the hierarchical scheduler tree 300 may be traversed from the scheduling node SI to T5, e.g., via the scheduling path connecting the scheduling nodes SI, S2, and S4 to the task T5. In order to dispatch task T5, the controller 101 may move the scope from the root scheduling node SI to the scheduling node S4.
[0064] In Fig. 3C, the setting of the scope to the scheduling node S4 is illustrated. The scheduling node S4 may produce a scheduling event 301. For instance, the scheduling node S4 may be a Round Robin and the time slice of the current task T5 may be over. As such, the task T5 may be added to the scheduling node S4 again, where the scheduling node S4 may choose the task T6 as next task and may remove it. Since the scope is still set to the scheduling node S4, no node outside the scheduling node S4 may be required to be queried to make this decision.
[0065] In Fig. 3D, a further exchange of the scope is illustrated. For example, while the task T6 in execution, it may release a semaphore, e.g., in terms of a resource value or a variable. This may wake up the task T1 and a scheduling event 302 may take place on the scheduling node S2, where the controller 101 may move the scope to the scheduling node S2 accordingly.
[0066] In order to re-evaluate the current schedule, the task T6 may be added back to the scheduling node S4, and the scheduling node S2 may be queried to evaluate whether to choose the task T1 or the scheduling node SI, e.g., based on the priority of execution. If the scheduling node S4 has higher priority, the scheduling node S4 may be queried and the task T6 may be chosen again. As such, only the smallest sub-tree possible may be queried to re-evaluate the current schedule so that an optimal search can be performed, which may effectively reduce the runtime overhead.
[0067] In Fig. 4, a second exemplary strategy according to the DSR is illustrated. The exemplary hierarchical scheduler tree 400 may comprise the scheduling nodes SI and S2, and the tasks distributed therein. For instance, from the lower scheduling layer towards the higher scheduling layer, the scheduling node S2 may be assigned to execute the tasks Tl, T2, T3 and T4, and the scheduling node SI (parent) may be assigned to execute the task T5 and further to the scheduling node S2 (child). For instance, the scheduling path 401 may correspond to Core 1 and the scheduling path 402 may correspond to Core 2 of the CPU. For instance, the controller 101 may set the scope to the scheduling node SI, e.g., the root scheduling node. In order for the controller 101 to retrieve the most important task for the Core
[0068] 1, the hierarchical scheduler 103 may use NEXT on the scheduling node SI and the scheduling node SI may select the scheduling node S2 since, e.g., the task T5 may be running on the Core
[0069] 2. Accordingly, the hierarchical scheduler 103 may use NEXT on the scheduling node S2, and the scheduling node S2 may select the task Tl, e.g., based on the priority.
[0070] Furthermore, in order for the controller 101 to dispatch the task Tl on the Core 1, the controller 101 may use REMOVE on the scheduling node S2 for the task Tl, may set the scope to the scheduling node S2, and may perform a task switch.
[0071] In order for the controller 101 to schedule a new task on Core 1 if, for example, task Tl may be blocked on a resource, the hierarchical scheduler 103 may use NEXT on the scheduling node S2 (current scope), and the scheduling node S2 may select the task T2, e.g., based on the priority. Furthermore, in order for the controller 101 to dispatch the task T2 on the Core 1, the controller 101 may use REMOVE on the scheduling node S2 for the task T2, and may perform a task switch without changing the current scope.
[0072] If, for example, the task T5 exit the Core 2 but can preempt the task T2 on the Core 1, e.g., due to a higher priority, the controller 101 may set the scope for the Core 1 to the scheduling node SI because of the preemption event, and the hierarchical scheduler 103 may notify the controller 101 regarding the scheduling for the Core 1.
[0073] In order for the controller 101 to retrieve the most important task for the Core 1, the hierarchical scheduler 103 may use NEXT on the scheduling node SI (current scope) and the scheduling node SI may select the task T5. Furthermore, in order for the controller 101 to dispatch the task T5 on the Core 1, the controller 101 may use ADD on the scheduling node S2 for the task T2, may use REMOVE on the scheduling node SI for the task T5, and may perform a task switch without changing the current scope.
[0074] In the following, pseudo-code description of the hierarchical schedulers 103 are exemplarily disclosed, e.g., the functionalities or capabilities of the edge or node, e.g., the connection between scheduling nodes that may behave like a task from the scheduling point of view of the parent scheduling node. Firstly, the exemplary Kernel class of Fig. 2 may be extended to add a private attribute “scopefN]: Scheduler” and a public operation or function “notify(s: Scheduler, cpu: Integer)”.
[0075] The Kernel. notify() function can be illustrated as follows:
[0076] Kernel. notify(s, cpu): Kernel. set_root(s, cpu):
[0077] Kernel, scopefcpu] = s Kernel, rootfcpu] = s
[0078] Kernel. need resched = true Kernel, scopefcpu] = s
[0079] The Kernel. notify () function may allow the controller 101 to adjust the scope over time in order to reflect the internal state of the hierarchical scheduler 103 at all times. For instance:
[0080] • a Round Robin scheduler might require the current task to end its execution because its budget is over;
[0081] • an EDF scheduler might require the current task to end its execution because its period ended;
[0082] • a FIFO scheduler received a new task with a higher priority than the running task and this triggers preemption;
[0083] • a task switch brought into execution, e.g., dispatch, a task.
[0084] Upon notification, the controller 101 may change the current scope and may flag a task reschedule.
[0085] The state of the nodes can be identified, e.g., to keep track of their active state, as follows: edge.bind(owner, parent, cpu): edge.detach(): if BOUND not in edge. flags: attached = ATTACHED in edge. flags edge. affinity = {cpu} if attached: cpu = edge.affinity[O] edge.endpointfOWNER] = parent = edge. endpointfP ARENT] owner parent.remove(edge, cpu) edge. endpointfP ARENT] = edge .flags -= ATTACHED parent edge. flags += INACTIVE edge. flags = {BOUND,
[0086] INACTIVE}
[0087] The ADD and REMOVE functionalities of the hierarchical scheduler 103 can be illustrated as: node.add(task, cpu): add edge(edge): s = Scheduler(node) root = BOUND not in edge .flags task, scheduler = s attached = ATTACHED in edge. flags s.add(task, cpu) if root or attached: if Kernel . migration enabl ed : owner = foreach c in task.affinity: edge.endpointfOWNER] add_edge(node.edge[c]) s = Scheduler(owner) else: active = INACTIVE not add_edge(node.edge[cpu]) in edge. flags if s. preemptive and active:
[0088] Kernel. notify(s, cpu) return edge, attach}) node.remove(task, cpu): s = Scheduler(node) s.remove(task, cpu) if Kernel . migration enabl ed : foreach c in task.affinity: if s.taskfc] is empty: node, edgefc] ,detach() else: if s.taskfcpu] is empty: node, edgefcpu] . detach()
[0089] It is to be noted that the above implementation may further support task migration as well as preemptive schedulers. For instance, when a task is added to a hierarchical scheduling node, the scheduling node may:
[0090] • add the task to the underlying scheduler, e.g., as an entity implementing a specific scheduling strategy that may be extended by that specific hierarchical scheduling node;
[0091] • attach the edge(s) to respective parent(s);
[0092] • notify the controller or Kernel when a scheduling event took place, e.g., preemption if scheduler is preemptive; and
[0093] • propagate adjustments to upper nodes.
[0094] For instance, when a task is removed from a hierarchical scheduling node, the scheduling node may: • remove the task from the underlying scheduler;
[0095] • detaches the edge(s) to respective parent(s); and
[0096] • propagates adjustments to upper nodes. The NEXT functionality of the hierarchical scheduler 103 can be illustrated as: node.next(cpu): step down(edge) s = Scheduler(node) edge. flags -= INACTIVE task = s.next(cpu) owner = edge.endpointfOWNER] if type(task) is Task: return owner. next() return task if type(task) is Edge: step up(edge) edge = Edge(task) root = BOUND not in edge. flags return step_down(edge) if root: edge = node.edgefcpu] return null return step up(edge) edge.detach() parent = edge. endpointfP ARENT] cpu = edge.affinityfO] return parent, next(cpu)
[0097] It is to be noted that the active branch may get updated online in the above implementation. Additionally, when a node is queried for next task, the search may always start from the current scope for the selected CPU core. The queried node in turn may query the underlying scheduler and may return:
[0098] • An actual task, which may also the most important task inside the entire hierarchical scheduling tree.
[0099] • A hierarchical scheduler edge, and the function may have to visit in-depth the hierarchical scheduling tree and may query the owner node of this edge.
[0100] • A null value, if there is no schedulable task in the entire sub-tree rooted in the currently targeted node. The function may have to step up one level higher in the tree and may visit a different branch of the tree. This may lead to the following situations: o The root node of tree may have been reached so it may not be possible to step up one level, e.g., no schedulable task may be available in the entire hierarchical scheduler tree. o It may be possible to step up one level higher in the hierarchy, however, before querying the new target node, the already visited branch may have to be detached to avoid visiting the same dead branch again.
[0101] As mentioned before, the controller 101 may flag a task reschedule as follows:
[0102] Kernel . schedule(cpu) : disable_interrupts() prev = Kernel, curr taskfcpu] if prev is not null: node = Node(prev. scheduler) node.add(prev, cpu)
[0103] Kernel. need resched = false node = Kernel, scopefcpu] next = node.next(cpu)
[0104] Kernel, curr taskfcpu] = next if next is not null: node = Node(next. scheduler) node . remove(next) if next != prev:
[0105] Kernel, scopefcpu] = next, scheduler context_switch() enable_interrupts() In Fig. 5, a second exemplary embodiment of the hierarchical scheduling system 500 according to the first aspect of this disclosure is illustrated. The hierarchical scheduling system 500 may differ from the hierarchical scheduling system 100 in that the hierarchical scheduling system 500 may additionally comprise a profiler 501, e.g., a software-based profiler or a hardwarebased profiler.
[0106] In this regard, the profiler 501 may monitor the tasks 502, e.g., by means of the mutual link 503, and may provide estimations 504, e.g., hardware-based profile estimations or softwarebased profile estimations, to the hierarchical scheduler 103. Accordingly, the hierarchical scheduler 103 may send notifications 505 to the controller 101, and the controller 101 may execute the tasks 502 accordingly, as exemplarily illustrated as the link 506.
[0107] As such, the estimations 504 from the profiler 501 may be directly provided to the hierarchical scheduling nodes as an input so that the underlying scheduler can determine whether this changed its internal state.
[0108] In this regard, the exemplary Scheduler class of Fig. 2 may be extended to add a public operation or function “profiler_cb(data: Data, cpu Integer)” and the exemplary Node class of Fig. 2 may also be extended to add the public operation or function “profiler_cb(data: Data, cpu Integer). This functionality can be shown as follows: node.profiler_cb(data, cpu): s = Scheduler(node) changed state = s.profiler_cb(data, cpu) active = INACTIVE not in edgefcpu], flags if changed state and active:
[0109] Kernel. notify(schedul er, cpu)
[0110] In case the estimations 504 altered the current state of the scheduler, the scheduler may notify the controller 101, e.g., to change the scope and to trigger task reschedule. In Fig. 6, an exemplary embodiment of the method 600 according to the second aspect of this disclosure is illustrated. In a first step 601, a hierarchical scheduler is formed by providing a tree of scheduling nodes with at least one root scheduling node and one or more hierarchically arranged layers of scheduling nodes originating in the root scheduling node. In a second step 602, one or more tasks are distributed in the hierarchical scheduler, where each of the scheduling nodes executes at least one task of the one or more tasks and further produces one or more scheduling events.
[0111] In a third step 603, one or more sub-trees of the tree of scheduling nodes are determined to comprise at least one of the scheduling nodes based on a priority of execution of the one or more tasks and / or based on one or more scheduling events produced by one or more scheduling nodes. In a fourth step 604, the at least one scheduling node of the sub-trees is exclusively controlled to execute at least one of the one or more tasks.
[0112] In Fig. 7, an exemplary data processing device 700 according to the fourth aspect of this disclosure is illustrated. The data processing device 700 may comprise a processor 701 that may be operably coupled to the hierarchical scheduling system 100, 500, for example to the controller 101 of the hierarchical scheduling system 100, 500 as exemplarily illustrated via the link 702, and may execute to the hierarchical scheduling system 100, 500. The processor 701 may correspond to the CPU cores mentioned before, either individually or collectively.
[0113] It is important to note that, in the description as well as in the claims, the word “comprising” does not exclude other elements or steps and the indefinite article “a” or “an” does not exclude a plurality. A single element or other unit may fulfill the functions of several entities or items recited in the claims. Furthermore, the word “coupled” implies that the elements may be directly coupled together or may be coupled through one or more intervening elements. Moreover, the disclosure with regard to any of the aspects is also relevant with regard to the other aspects of the disclosure.
[0114] Although the disclosure has been illustrated and described with respect to one or more implementations, equivalent alterations and modifications will occur to others skilled in the art upon the reading and understanding of this specification and the annexed drawings. In addition, while a particular feature of this disclosure may have been disclosed with respect to only one of several implementations, such feature may be combined with one or more other features of the other implementations as may be desired and advantageous for any given or particular application.
Claims
CLAIMS1. A hierarchical scheduling system (100, 500) comprising: a hierarchical scheduler (103) comprising a tree of scheduling nodes (300) with at least one root scheduling node and one or more hierarchically arranged layers of scheduling nodes originating in the root scheduling node; and a controller (101) configured to communicate with the hierarchical scheduler (103) to distribute one or more tasks in the hierarchical scheduler; wherein each of the scheduling nodes is configured to execute at least one task of the one or more tasks, and further to produce one or more scheduling events, and wherein the controller (101) is configured to determine one or more sub-trees (301, 302) of the tree of scheduling nodes comprising at least one of the scheduling nodes based on a priority of execution of the one or more tasks and / or based on the one or more scheduling events produced by one or more scheduling nodes, and to exclusively control the at least one scheduling node of the sub-trees (301, 302) to execute at least one of the one or more tasks.
2. The hierarchical scheduling system according to claim 1, wherein the controller (101) is configured to: determine one or more scheduling paths in the hierarchical scheduler (103) originating from the at least one root scheduling node to at least one task of the one or more tasks based on the priority of execution of the at least one task, determine a respective sub-tree of the one or more sub-trees (301, 302) for the one or more scheduling paths based on the priority of execution of the at least one task, and extend the sub-tree in a higher layer or reduce the sub-tree in a lower layer along the one or more scheduling paths based on the one or more scheduling events produced by one or more scheduling nodes.
3. The hierarchical scheduling system according to claim 1 or 2, wherein the hierarchical scheduler (103) is configured to transmit one or more notifications to the controller (101) corresponding to the one or more scheduling events produced by the one or more scheduling nodes.
4. The hierarchical scheduling system according to claim 3, wherein the controller (101) is configured to distribute the plurality of tasks in the hierarchical scheduler (103) based on the one or more notifications transmitted by the hierarchical scheduler (103).
5. The hierarchical scheduling system according to claim 3 or 4, wherein the hierarchical scheduler (103) is configured to transmit the one or more notifications to the controller (101) based on a state of the one or more scheduling nodes.
6. The hierarchical scheduling system according to any of claims 3 to 5, wherein: the controller (101) is configured to extend or reduce the sub-tree based on the one or more notifications transmitted by the hierarchical scheduler (103), and / or the controller (101) is configured to transmit one or more further notifications to the hierarchical scheduler (103) to instruct the hierarchical scheduler (103) to extend or reduce the sub-tree.
7. The hierarchical scheduling system according to any of claims 1 to 6, wherein the hierarchical scheduler (103) is configured to: add a task from the one or more tasks to a particular scheduling node, bind the particular scheduling node to a scheduling node in a higher layer, and transmit a notification to the controller (101) corresponding to a scheduling event produced by the particular scheduling node.
8. The hierarchical scheduling system according to claim 7, wherein the hierarchical scheduler (103) is configured to: remove a task from the particular scheduling node, and unbind the particular scheduling node from the scheduling node in the higher layer.
9. The hierarchical scheduling system according to claims 1 to 8, wherein the hierarchical scheduler (103) is configured to select at least one task of the one or more tasks based on the priority of execution of the at least one task.
10. The hierarchical scheduling system according to any of claims 1 to 9, further comprising a profiler (501) configured to provide hardware-based profile information or software-basedprofile information (504) to at least one scheduling node of the hierarchical scheduler (103), wherein the hierarchical scheduler (103) is configured to: determine a change of a state of the at least one scheduling node based on the profile information (504), and transmit a notification (505) to the controller (101) corresponding to the change of the state of at least one scheduling node.
11. The hierarchical scheduling system according to any of claims 1 to 10, wherein the one or more hierarchically arranged layers of scheduling nodes originating in the root scheduling node are arranged in a N-ary tree formation.12 The hierarchical scheduling system according to any of claims 1 to 11, wherein the hierarchical scheduling system (100, 500) is implemented in an operating system and the controller (101) is implemented in a user module or is a central controller or Kernel of the operating system.
13. A method (600) for hierarchical scheduling comprising: forming (601) a hierarchical scheduler by providing a tree of scheduling nodes with at least one root scheduling node and one or more hierarchically arranged layers of scheduling nodes originating in the root scheduling node, distributing (602) one or more tasks in the hierarchical scheduler, whereby each of the scheduling nodes executes at least one task of the one or more tasks and further produces one or more scheduling events, determining (603) one or more sub-trees of the tree of scheduling nodes comprising at least one of the scheduling nodes based on a priority of execution of the one or more tasks and / or based on one or more scheduling events produced by one or more scheduling nodes, and controlling (604) exclusively the at least one scheduling node of the sub-trees to execute at least one of the one or more tasks.
14. The method according to claim 13, further comprising: determining one or more scheduling paths in the hierarchical scheduler originating from the at least one root scheduling node to at least one task of the one or more tasks based on the priority of execution of the at least one task,determining a respective sub-tree of the one or more sub-trees for the one or more scheduling paths based on the priority of execution of the at least one task, and extending the sub-tree in a higher layer or reducing the sub-tree in a lower layer along the one or more scheduling paths based on the one or more scheduling events produced by one or more scheduling nodes.
15. A computer program, comprising instructions which, when the program is executed by a computer, cause the computer to perform the method according to claim 13 or 14.
16. A data processing device (700) comprising a processor (701) configured to perform the method of claim 13 and / or to implement the hierarchical scheduling system of one of the claims 1 to 12.