Task scheduling method, device, electronic device and storage medium

By presetting the computing power quota and scheduling cycle for the task and limiting the task operation when the computing power consumption reaches the quota, the problem of unstable task execution time and low user experience under the simultaneous multi-threading technology is solved, and a more stable task execution and improved user experience is achieved.

CN119781909APending Publication Date: 2025-04-08ALIBABA CLOUD COMPUTING CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202311297222.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-08
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

When using simultaneous multi-threading technology to execute tasks, multiple tasks compete for processor resources, resulting in unstable task execution time, resulting in delay or jitter, and poor user experience.

Method used

By presetting the computing power quota and scheduling cycle for the task to be executed, the computing power consumption of the task in each scheduling period during the current scheduling cycle is obtained, and when the cumulative value of the computing power consumption reaches the computing power quota, the operation of the task on the processor physical core is restricted.

Benefits of technology

It improves the stability of task execution time, improves user experience, and solves the problems of unstable task execution time and poor user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119781909A_ABST
    Figure CN119781909A_ABST
Patent Text Reader

Abstract

The present application discloses a task scheduling method, device, electronic device and storage medium. The method includes: obtaining a computing power quota and a scheduling period preset for a task to be executed; wherein the computing power quota is used to characterize the rated amount of computing resources used by the task to be executed within the scheduling period; obtaining the computing power consumption corresponding to each scheduling time period of the task to be executed within the current scheduling period; based on the cumulative value of the computing power consumption of the task to be executed within the current scheduling period reaching the computing power quota, limiting the task to be executed to run on the physical core of the processor. The embodiments of the present application can improve the stability of task execution on the processor.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a task scheduling method, device, electronic device and storage medium. Background Art

[0002] A task in a computer represents a work element to be completed by the computer. It consists of one or more instruction sequences processed by the control program. A task can be carried by a thread. Simultaneous multithreading (SMT) is a hardware multithreading technology that can execute instructions from multiple threads within the clock cycle of a physical core of the processor. Most servers in related technologies use SMT technology to execute tasks corresponding to various applications. However, when multiple tasks run on the same processor at the same time, multiple tasks will compete for resources within the processor, which will lead to unstable task execution time, causing delays or jitters during task execution, and poor user experience. Summary of the invention

[0003] In view of the above problems, the present application provides a task scheduling method, device, electronic device and storage medium to at least solve the technical problems of unstable task execution time and poor user experience when SMT technology is used in related technologies to execute tasks corresponding to various applications.

[0004] According to the first aspect of an embodiment of the present application, a task scheduling method is provided, including: obtaining a computing power quota and a scheduling period preset for a task to be executed; wherein the computing power quota is used to characterize the rated amount of computing resources used by the task to be executed within the scheduling period; obtaining the computing power consumption corresponding to each scheduling time period of the task to be executed within the current scheduling period; and based on the cumulative value of the computing power consumption of the task to be executed within the current scheduling period reaching the computing power quota, limiting the task to be executed to run on the physical core of the processor.

[0005] According to the second aspect of an embodiment of the present application, a task scheduling device is provided, and the above-mentioned task scheduling device includes: a first acquisition unit, used to obtain a computing power quota and a scheduling period preset for a task to be executed; wherein the computing power quota is used to characterize the rated amount of computing resources used by the task to be executed within the scheduling period; a second acquisition unit, used to obtain the computing power consumption corresponding to each scheduling time period of the task to be executed within the current scheduling period; and a limiting unit, used to limit the task to be executed to run on the physical core of the processor based on the cumulative value of the computing power consumption of the task to be executed within the current scheduling period reaching the computing power quota.

[0006] According to a third aspect of an embodiment of the present application, there is also provided an electronic device, comprising a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to execute the task scheduling method of the first aspect through the computer program.

[0007] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is further provided, in which a computer program is stored, wherein the computer program is configured to execute the task scheduling method of the first aspect mentioned above when running.

[0008] In an embodiment of the present application, a method is adopted for obtaining a computing power quota and a scheduling cycle preset for a task to be executed; wherein the computing power quota is used to characterize the rated amount of computing resources used by the task to be executed within the scheduling cycle; obtaining the computing power consumption corresponding to each scheduling time period of the task to be executed within the current scheduling cycle; and limiting the task to be executed to run on the physical core of the processor based on the cumulative value of the computing power consumption of the task to be executed within the current scheduling cycle reaching the computing power quota; since the present application sets a computing power quota for the task to be executed on the physical core of the processor, and limits the running of the task to be executed when the cumulative value of the computing power consumption of the task to be executed in each clock cycle reaches the computing power quota, it is possible to achieve the improvement of the stability of the task execution time and the improvement of the user experience when the SMT technology is used to execute the tasks corresponding to various applications, thereby solving the technical problem of unstable task execution time and poor user experience when the SMT technology is used to execute the tasks corresponding to various applications in the related technology. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Moreover, the same reference numerals are used throughout the drawings to represent the same components. In the drawings:

[0010] Figure 1 is a schematic diagram of an application environment of an optional task scheduling method according to an embodiment of the present application;

[0011] Figure 2 is a flowchart of an optional task scheduling method according to an embodiment of the present application;

[0012] Figure 3 is a flowchart of another optional task scheduling method according to an embodiment of the present application;

[0013] Figure 4 is a flowchart of another optional task scheduling method according to an embodiment of the present application;

[0014] Figure 5 is a flowchart of another optional task scheduling method according to an embodiment of the present application;

[0015] Figure 6 is a flowchart of another optional task scheduling method according to an embodiment of the present application;

[0016] Figure 7 is a task processing flow diagram of an optional task scheduling method according to an embodiment of the present application;

[0017] Figure 8 is a task processing flow diagram of another optional task scheduling method according to an embodiment of the present application;

[0018] Fig. 9 It is a structural diagram of a task scheduling device provided in an embodiment of the present application;

[0019] Fig.10 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0020] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only embodiments of a part of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0021] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0022] The following are explanations of the technical terms that may be involved in this application:

[0023] Simultaneous multithreading (SMT / HT): also known as hyperthreading, is a hardware multithreading technology that can execute instructions from multiple threads within a processor clock cycle.

[0024] Computing power: the total amount of logical operation units used per unit time.

[0025] Core Scheduling: Core scheduling, referred to as core sched, is a scheduling operation performed on the entire physical core. It selects one task for each logical core to run. Tasks with the same cookie (task identifier) ​​can run on the same physical core at the same time, but tasks with different cookies cannot run on the same physical core at the same time.

[0026] Cookie: A mechanism of core sched, a label or identifier of a task, with a default value of 0. Tasks with the same cookie can run simultaneously on a physical core, but tasks with different cookies cannot.

[0027] force idle: Forced idle, a mechanism of core sched. If there are runnable tasks in the task queue but there is no task with the same cookie as the current task, other logical processors on the same physical core will enter the idle state.

[0028] sib idle: The SMT peer is idle. This is a mechanism implemented with the help of core sched. Since each scheduling is performed on the basis of the entire physical core, it can sense that other logical processors on the same physical core are idle.

[0029] Computing power consumption coefficient: For a task, the total amount of logical operation units consumed per unit time when its exclusive physical core executes the task is a, and the total amount of logical operation units used per unit time when it shares a physical core with other identical tasks is b. The computing power consumption coefficient is a / b.

[0030] Computing power quota (quota): The amount of computing power consumed in each clock cycle. If this quota is exceeded, the flow will be limited.

[0031] Current limiting: The task is not allowed to be scheduled to the processor during the current clock cycle.

[0032] As an optional implementation, the above task scheduling method can be applied to, but is not limited to, Figure 1In the application environment shown. The application environment may include, but is not limited to: a control platform 102 for human-computer interaction with a user, a network 110, and a server 112. An application client for running task scheduling in the control platform 102. The above-mentioned control platform 102 includes a display 108, a processor 106, and a memory 104. The display 108 is used to present the preset computing power quota and scheduling cycle of the task input by the user. The processor 106 is used for the preset computing power quota of the task input by the user. The memory 104 is used to store the computing power quota and scheduling cycle corresponding to each task, as well as the computing power consumption of the task in each scheduling cycle. In addition, the server 112 includes a database 114 and a processing engine 116, and the database is used to store the computing power quota and scheduling cycle corresponding to each task, as well as the computing power consumption of the task in each scheduling cycle. The processing engine 116 is used to obtain the computing power quota and scheduling cycle preset for the task to be executed; wherein the computing power quota is used to characterize the rated amount of computing resources used by the task to be executed within the scheduling cycle; obtain the computing power consumption corresponding to each scheduling time period of the task to be executed within the current scheduling cycle; based on the cumulative value of the computing power consumption of the task to be executed within the current scheduling cycle reaching the computing power quota, limit the task to be executed to run on the physical core of the processor.

[0033] The specific process is as follows: Assume that Figure 1 As shown, a task scheduling client is running in the control platform 102, and the control platform 102 executes steps S102-S104, receives the computing power quota and scheduling period preset for the task to be executed input by the user, and sends the computing power quota and scheduling period preset for the task to be executed to the server 112. The server 112 executes steps S106-S110 to obtain the computing power quota and scheduling period preset for the task to be executed; wherein the computing power quota is used to characterize the rated amount of computing resources used by the task to be executed within the scheduling period; obtains the computing power consumption corresponding to each scheduling time period of the task to be executed within the current scheduling period; based on the cumulative value of the computing power consumption of the task to be executed within the current scheduling period reaching the computing power quota, the task to be executed is restricted to run on the physical core of the processor; the server 112 sends the computing power consumption of the task to be executed to the control platform 102.

[0034] Optionally, the control platform 102 includes but is not limited to running on electronic devices such as mobile phones, laptops, tablet computers, PDAs, MIDs (Mobile Internet Devices), desktop computers, smart TVs, etc. The application client with task scheduling function in the embodiment of the present application includes but is not limited to video clients, instant messaging clients, browser clients, etc. The network may include but is not limited to: wired networks, wireless networks, wherein the wired network includes: local area networks, metropolitan area networks and wide area networks, and the wireless network includes: Bluetooth, WIFI and other networks that realize wireless communication. The server 112 may be a single server, or a server cluster composed of multiple servers, or a cloud server, and the cloud server includes but is not limited to a private cloud server or a public cloud server. The above is only an example, and no limitation is made in this embodiment.

[0035] Most servers in related technologies use SMT technology to execute tasks corresponding to various applications. However, when multiple tasks run on the same processor at the same time, multiple tasks will compete for resources within the processor, resulting in unstable task execution time, causing delays or jitters during task execution, and poor user experience.

[0036] In order to solve the above technical problems, as an optional implementation method, Figure 2 As shown, the embodiment of the present application provides a task scheduling method, comprising the following steps:

[0037] S202, obtaining a computing power quota and a scheduling period preset for the task to be executed; wherein the computing power quota is used to represent a rated amount of computing resources used by the task to be executed within the clock period.

[0038] Specifically, it includes but is not limited to presetting the computing power quota and scheduling cycle for the task to be executed according to the type of calculation included in the task to be executed. The computing resources here include but are not limited to the logical operation unit or other operation units of the processor. It should be noted that the scheduling cycle here can be the clock cycle inherent to the processor, or it can be a scheduling cycle set according to preset parameters. For example, the task A to be executed includes 100 floating-point operations, which requires 5000 logical operation units. Here, the computing power quota preset for the task A to be executed in each clock cycle is 1000, that is, the maximum number of logical operation units that can be used by the task A to be executed in each clock cycle is 5000.

[0039] S204, obtaining the computing power consumption corresponding to each scheduling time period of the task to be executed in the current scheduling cycle.

[0040] Specifically, each scheduling cycle includes one or more scheduling time periods. When there are multiple scheduling time periods, the durations of the multiple scheduling time periods may be the same or different. Here, the computing power consumption includes the amount of computing resources. The embodiments of the present application include but are not limited to determining the computing power consumption corresponding to the task to be executed in each scheduling time period by measuring the rate of computing power consumption of the task to be executed.

[0041] S206: Based on the accumulated value of the computing power consumption of the task to be executed in the current scheduling period reaching the computing power quota, the task to be executed is restricted to run on the physical core of the processor.

[0042] Specifically, for example, the computing power quota preset for task A to be executed in each scheduling cycle is 1000 logical operation units. Here, it is assumed that the scheduling cycle is 5 seconds. When the logical operation units accumulated by task A at 4.5 seconds in the current scheduling cycle are 1000, it means that the accumulated computing power consumption of task A has reached its corresponding computing power quota. At this time, task A needs to be restricted to run on the physical core of the processor. Here, restricting task A to run on the physical core of the processor includes but is not limited to automatically skipping task A when the task scheduler selects the task to be executed again; or, moving task A out of the task ready queue to a temporary queue, and then moving it back to the task ready queue in the next scheduling cycle.

[0043] In an embodiment of the present application, a method is adopted for obtaining a computing power quota and a scheduling cycle preset for a task to be executed; wherein the computing power quota is used to characterize the rated amount of computing resources used by the task to be executed within the scheduling cycle; obtaining the computing power consumption corresponding to each scheduling time period of the task to be executed within the current scheduling cycle; and limiting the task to be executed to run on the physical core of the processor based on the cumulative value of the computing power consumption of the task to be executed within the current scheduling cycle reaching the computing power quota; since the present application sets a computing power quota for the task to be executed on the physical core of the processor, and limits the running of the task to be executed when the cumulative value of the computing power consumption of the task to be executed in each clock cycle reaches the computing power quota, it is possible to achieve the improvement of the stability of the task execution time and the improvement of the user experience when the SMT technology is used to execute the tasks corresponding to various applications, thereby solving the technical problem of unstable task execution time and poor user experience when the SMT technology is used to execute the tasks corresponding to various applications in the related technology.

[0044] In one or more embodiments, Figure 3 As shown, the embodiment of the present application also provides a task scheduling method, comprising the following steps:

[0045] S302, obtaining a computing power quota and a scheduling period preset for the task to be executed; wherein the computing power quota is used to represent the rated amount of computing resources used by the task to be executed within the scheduling period.

[0046] S304, obtaining a computing power consumption rate corresponding to the task to be executed in each scheduling time period, wherein the computing power consumption rate is used to indicate the amount of computing resources used by the task to be executed per unit time; wherein the computing resources include a logical operation unit of the processor.

[0047] Specifically, since the number of tasks running on the same physical core in different scheduling time periods is the same or different, it is necessary to calculate the computing power consumption rate corresponding to the tasks to be executed in each scheduling time period. It should be noted that the logical operation unit in the following examples of this application is referred to as a unit.

[0048] S306: Determine the computing power consumption of each task to be executed in the current scheduling time period based on the computing power consumption rate and the duration of the current scheduling time period; wherein the computing types corresponding to each task to be executed are the same.

[0049] Specifically, for example, if the computing power consumption rate of task A is 200 units / second and the duration of the current scheduling time period is 0.8 seconds, then it is determined that the computing power consumption of task A in the current scheduling time period is 160 units. For example, if the computing power consumption rate of task B is 800 units / second and the duration of the current scheduling time period is 0.4 seconds, then it is determined that the computing power consumption of task B in the current scheduling time period is 320 units.

[0050] In one example, in order to calculate the computing power consumption rate corresponding to the task to be executed, including but not limited to scheduling tasks with the same computing type to different logical processors of a physical core, multiple tasks share the computing resources of a physical core and have the same computing power consumption rate. Therefore, the computing power consumption rate corresponding to one task can be quickly determined based on the computing power consumption rate corresponding to one task.

[0051] S308: Based on the accumulated value of the computing power consumption of the task to be executed in the current scheduling period reaching the computing power quota, the task to be executed is restricted to run on the physical core of the processor.

[0052] The above steps S302 and S308 have been clearly explained in the previous text and will not be repeated here.

[0053] In one or more embodiments, obtaining the computing power consumption rate corresponding to the tasks to be executed in each scheduling time period includes:

[0054] Determine the ratio of the number of logical processors included in the physical core to the number of tasks to be executed in the current scheduling time period, and use the ratio as the computing power consumption coefficient corresponding to the current scheduling time period;

[0055] Specifically, the number of tasks running on the current physical core does not exceed the number of logical cores it contains. In addition, when the present application schedules tasks of the computing type to the same physical core, the computing power consumption coefficients corresponding to each task are the same, that is, the computing power consumption coefficient corresponding to the current time period can be used as the computing power consumption coefficient of each task. For example, the current physical core includes 2 logical processors, that is, the current physical core supports running 2 threads at the same time; assuming that there is only one task to be executed in the current scheduling period, which is task A, then the computing power consumption coefficient corresponding to the current scheduling period is 2; that is, the computing power consumption coefficient corresponding to task A is 2. For example, the current physical core includes 4 logical processors, that is, the current physical core supports running 4 threads at the same time; assuming that there is only one task to be executed in the current scheduling period, which is task A, then the computing power consumption coefficient corresponding to the current scheduling period is 4, that is, the computing power consumption coefficient corresponding to task A is 4. Assuming that there are 2 tasks to be executed in the current scheduling period: task A and task B, then the computing power consumption coefficient corresponding to the current scheduling period is 2, that is, the computing power consumption coefficients corresponding to task A and task B are both 2.

[0056] Based on the product of the computing power consumption coefficient corresponding to the current scheduling time period and the computing power consumption constant, the computing power consumption rate corresponding to the task to be executed in the current scheduling time period is determined; wherein, the computing power consumption constant is the number of logical operation units consumed by any task per unit time when each logical processor of the physical core is assigned a task.

[0057] Specifically, for example, the current physical core includes 2 logical processors. Assuming that there is only one task to be executed in the current scheduling time period, which is task A, then the computing power consumption coefficient corresponding to the current scheduling time period is 2. If both logical processors of the current physical core are assigned tasks, and the number of logical operation units consumed by any of the tasks per unit time is 200, then the computing power consumption constant can be determined to be 200 units / second. The computing power consumption rate corresponding to task A in the current scheduling time period is 400 units / second.

[0058] In one or more embodiments, Figure 4 As shown, the embodiment of the present application also provides a task scheduling method, comprising the following steps:

[0059] S402, obtaining a computing power quota and a scheduling period preset for the task to be executed; wherein the computing power quota is used to represent the rated amount of computing resources used by the task to be executed within the scheduling period;

[0060] S404, calculating the computing power consumption corresponding to each scheduling time period of the task to be executed in the current scheduling cycle.

[0061] S406, subtracting the computing power consumption corresponding to the task to be executed in each scheduling time period in the current scheduling cycle from the computing power quota of the task to be executed, to obtain the remaining computing power quota of the task to be executed;

[0062] S408: When the remaining computing power quota is equal to zero, determine that the computing power consumption of the task to be executed in the current scheduling period reaches the computing power quota.

[0063] Specifically, assuming that the task to be executed is task A, the computing power quota of task A is 1000 units, the scheduling cycle is 5 seconds, and the computing power consumption in the first scheduling time period (0-1 seconds) of the current scheduling cycle is 500 units. The remaining quota corresponding to task A in the second scheduling time period (1-2 seconds) is 500 units, and the computing power consumption in the second scheduling time period is 250 units (sharing a physical core with task B). The remaining quota corresponding to task A in the third scheduling time period (2-3 seconds) is 250 units. At the end of 3 seconds, the remaining computing power quota corresponding to task A is zero. When it is determined that the remaining computing power quota of task A is equal to zero, it is determined that the computing power consumption of task A in the current scheduling cycle reaches the computing power quota. At this time, it is necessary to limit task A to run on the physical core of the processor so that task A uses the same computing unit in multiple scheduling cycles to improve the stability of task execution time.

[0064] S410: Based on the accumulated value of the computing power consumption of the task to be executed in the current scheduling period reaching the computing power quota, the task to be executed is restricted to run on the physical core of the processor.

[0065] Specifically, steps S402-S404 and S410 in the embodiment of the present application have been clearly described above and will not be repeated here.

[0066] In one or more embodiments, Figure 5 As shown, the embodiment of the present application also provides a task scheduling method, comprising the following steps:

[0067] S502, obtaining a computing power quota and a scheduling period preset for the task to be executed; wherein the computing power quota is used to represent the rated amount of computing resources used by the task to be executed within the scheduling period;

[0068] S504, calculating the computing power consumption corresponding to each scheduling time period of the task to be executed in the current scheduling cycle.

[0069] S506: Subtract the computing power quota of the task to be executed from the computing power consumption corresponding to the task to be executed in each scheduling time period in the current scheduling cycle, to obtain the remaining computing power quota of the task to be executed.

[0070] S508: When the remaining computing power quota is equal to zero, determine that the computing power consumption of the task to be executed in the current scheduling period reaches the computing power quota.

[0071] S510: Based on the accumulated value of the computing power consumption of the task to be executed in the current scheduling period reaching the computing power quota, the task to be executed is restricted to run on the physical core of the processor.

[0072] S512: at the start time of the next cycle of the current scheduling cycle, resetting the remaining computing power quota to the computing power quota;

[0073] S514: When the task to be executed is restricted from running in the current scheduling cycle, scheduling the processor to continue to execute the task to be executed in the next cycle.

[0074] Specifically, for example, the task to be executed is Task A, the computing power quota of Task A is 1000 units, and the scheduling cycle is 5 seconds. Task A is restricted to run on the current physical core at the end of the third second in the first scheduling cycle; at the beginning of the second scheduling cycle, the remaining computing power quota is reset to the computing power quota, that is, the computing power quota of Task A is restored to 1000 units. In the second scheduling cycle, the processor is scheduled to continue to execute Task A. In this way, it can be ensured that the logical operation units used by Task A in each scheduling cycle are the same, thereby improving the stability of task operation.

[0075] The above steps S502-S510 have been clearly explained in the previous text and will not be repeated here.

[0076] In one or more embodiments, Figure 6 As shown, the embodiment of the present application also provides a task scheduling method, comprising the following steps:

[0077] S602, based on each task carrying a task identifier in the task queue and the priority of each task, select the tasks to be executed in the current scheduling time period from the task queue; wherein the task identifier is used to characterize the operation type of the task, and the number of the tasks to be executed is less than or equal to the number of logical processors of the physical core.

[0078] S604: Schedule the task to be executed to the logical processor of the physical core.

[0079] Specifically, in an embodiment of the present application, a task identifier (cookie) is set for the tasks in the task queue to characterize the task operation type. For example, the cookie of the task of the system process is set to 0 by default, and the tasks of other non-system processes are set to non-zero values. The same cookie is set for tasks with the same operation type.

[0080] Assume that the current physical core includes two logical processors, and the only task to be executed corresponding to the current logical core obtained from the task queue is task A, and the cookie value is 1001. The task can be scheduled to any logical processor of the current logical core.

[0081] In another example, in order to calculate the computing power consumption rate corresponding to the task to be executed, including but not limited to scheduling tasks with the same computing type to different logical processors of a physical core, multiple tasks share the computing resources of a physical core and have the same computing power consumption rate. Assuming that it is determined from the task queue that the cookie value of another task B is also 1001, then task A and task B can be scheduled to two different logical processors of the current physical core respectively.

[0082] S606, obtaining a computing power quota and a scheduling period preset for the task to be executed; wherein the computing power quota is used to represent the rated amount of computing resources used by the task to be executed within the scheduling period;

[0083] S608, calculating the computing power consumption corresponding to each scheduling time period of the task to be executed in the current scheduling cycle;

[0084] S610: Based on the accumulated value of the computing power consumption of the task to be executed in the current scheduling period reaching the computing power quota, the task to be executed is restricted to run on the physical core of the processor.

[0085] The above steps S606-S604 have been clearly explained in the previous text and will not be repeated here.

[0086] In one or more embodiments, based on each task carrying a task identifier in the task queue and the priority of each task, selecting a task to be executed in the current scheduling time period from the task queue includes:

[0087] Selecting a first task carrying a task identifier and having the highest priority from the task queue, and determining whether there is a second task with the same task identifier as the first task in the task queue;

[0088] If so, determining the first task and the second task as tasks to be executed in the current scheduling time period;

[0089] If it does not exist, the first task is determined as the task to be executed.

[0090] Specifically, when selecting the tasks to be executed in the current scheduling time period for the current physical core, assuming that the task queue includes tasks A, B and C, task A has the highest priority, and the cookie value of A is not zero, then task A is the task to be executed corresponding to the current scheduling time period.

[0091] In one or more embodiments, scheduling the to-be-executed task to the logical processor of the physical core includes:

[0092] The plurality of to-be-executed tasks having the same task identifier are scheduled to different logical processors of the physical core.

[0093] Specifically, assuming that the current physical core includes two logical processors (ht0 and ht1), the tasks to be executed corresponding to the current logical core obtained from the task queue include task A and task B, and the cookie value is 1001. Assuming that it is determined from the task queue that the cookie value of another task B is also 1001, then task A can be scheduled to ht0 and task B to ht1; or, task A can be scheduled to ht1 and task B to ht0.

[0094] In another example, assuming that the current physical core includes two logical processors (ht0 and ht1), the current task queue includes tasks A, B and C, the cookie value of task A is 1001, the cookie value of task B is 1002, and the cookie value of task C is 1001. Task A has the highest priority, so task A can be determined as the task to be executed corresponding to the current physical core, and the cookie value of task C is the same as that of task A, indicating that the two have the same operation type. At this time, task C is also the task to be executed of the current physical core; then task A can be scheduled to ht0 and task C can be scheduled to ht1; or, task A can be scheduled to ht1 and task C can be scheduled to ht0.

[0095] Based on the above embodiment, as an optional implementation mode, the embodiment of the present application further provides a task scheduling method, which includes:

[0096] 1. Measure the computing power consumption coefficient of the task in the test environment. Each physical core has n logical processors, where n is a positive integer.

[0097] a. Let a task occupy a physical core exclusively and record the execution time t1.

[0098] b. Let two identical tasks run simultaneously on two logical processors of a physical core and record the execution time as t2.

[0099] c. Similarly, let i tasks run simultaneously on i logical processors of a physical core, and record the execution time ti until i = n.

[0100] d. Get the corresponding computing power consumption coefficient when n different tasks run on the same physical core: l1 = tn / tn, l2 = tn / t(n-1), ...ln = tn / t1.

[0101] e. Define the computing power consumption rate of each task when n logical processors have tasks running at the same time as sn.

[0102] f. It can be calculated that the computing power consumption rate when i logical processors run tasks simultaneously is sn*li.

[0103] 2. Define the computing power consumption of a task = computing power consumption rate * time, where the computing power consumption rate is the number of logical operation units used by the task per unit time.

[0104] 3. Assign a cookie value to the current task and set the scheduling period and computing power quota (quota) for the task group (cgroup) to which the task belongs.

[0105] 4. When scheduling tasks, if the task running in the previous scheduling time period of the current scheduling time period is a task carrying a cookie, then the interval T between the current scheduling time and the previous scheduling time, and the number of non-idle logical processors m (m<=n) are counted; if the task running in the previous scheduling time period is a task without a cookie, or the cookie is equal to zero, then the current process is terminated and wait for the next task scheduling.

[0106] 5. The computing power consumed by each pending task last run on the current physical core between this scheduling and the last scheduling is: lm*sn*T.

[0107] 6. Subtract the computing power quota of the task to be executed from the computing power consumption lm*sn*T corresponding to the task to be executed in each scheduling time period in the current scheduling cycle, and get the remaining computing power quota of the task to be executed.

[0108] 7. When the remaining computing power quota is equal to zero, it is determined that the computing power consumption of the task to be executed in the current scheduling period reaches the quota.

[0109] 8. At the beginning of the next cycle of the current scheduling cycle, the remaining computing power quota is reset to the computing power quota;

[0110] 9. In the case where the pending tasks are restricted from running in the current scheduling cycle, the scheduling processor continues to execute the pending tasks in the next cycle.

[0111] The task scheduling method of this application is described in detail below through specific examples.

[0112] Figure 7 The application scenario shown is a task scheduling application scenario where one physical core has two logical processors (ht0 and ht1), such as Figure 7 As shown, assuming that the consumption rate of logical operation units when the task monopolizes the physical core is S1, and the consumption rate of logical operation units when sharing the physical core with other tasks is S2, the computing power consumption coefficients are measured as l1=2, l2=1, S1=2000 units / second, S2=1000 units / second, and the computing power consumption coefficients are l1=2, l2=1.

[0113] Assume that there is only task A in the task group where task A is located, the quota of A is 4000 units, and the scheduling period is 5 milliseconds.

[0114] From 0 to 1 millisecond, Task A occupies the physical core exclusively and consumes logical operation units at the rate of S1. Scheduling occurs at 1 millisecond. At this time, the computing power is settled and it is found that Task A consumes 2000 units / second * 1 second = 2000 units. 2000 units are subtracted from the quota, and the quota currently has 2000 units left.

[0115] 1-2 milliseconds, Task A and Task B share the physical core and consume logical operation units at the rate of S2. Scheduling occurs at 2 seconds. At this time, the computing power is settled and it is found that Task A consumes 1000 units / millisecond * 1 millisecond = 1000 units. 1000 units are subtracted from the quota, and 1000 units are left in the quota.

[0116] 2-3 milliseconds, Task A and Task B share the physical core and consume logical operation units at the rate of S2. Scheduling occurs at 3 seconds. At this time, the computing power is settled and it is found that Task A consumes 1000 units / millisecond*1 second=1000 units. 1000 units are subtracted from the quota, and there are 0 units left in the quota.

[0117] At this time, the group where Task A is located is limited. Task A cannot participate in task scheduling from 3 to 4.9 milliseconds. At 5 milliseconds, the quota is reset to 4000 units. Task A can then be rescheduled and perform the corresponding calculations.

[0118] Figure 8 The application scenario shown is a task scheduling application scenario where one physical core has four logical processors (ht0, ht1, ht2, and ht3), such as Figure 8As shown, assuming that the consumption rate of logical operation units when a task monopolizes a physical core is S1, the consumption rate of logical operation units when two tasks share a physical core is S2, the consumption rate of logical operation units when three tasks share a physical core is S3, and the consumption rate of logical operation units when four tasks share a physical core is S4. It is measured that l1=4, l2=2, l3=4 / 3, l4=1, S1=4000 units / second, S2=2000 units / second, S3=4000 / 3 units / second, S4=1000 units / second.

[0119] There is only task A in the group where task A is located. The quota of task A is 8000 units and the scheduling period is 5 milliseconds.

[0120] From 0 to 1 millisecond, task A occupies the physical core exclusively and consumes logical operation units at the rate of S1. Scheduling occurs at 1 millisecond. At this time, the computing power is settled and it is found that A consumes 4000 units / millisecond*1 millisecond=4000 units. 4000 units are subtracted from the quota, and 4000 units are left in the quota.

[0121] From 1 to 2 milliseconds, Task A and Task B share the physical core and consume logical operation units at a rate of S2*4 / 2=S2*(2 / 2+1)=2000 units / millisecond. Scheduling occurs at 2 milliseconds, and the computing power is settled at this time, and it is found that A consumes 2000 units / millisecond*1 millisecond=2000 units. 2000 units are subtracted from the quota, and 2000 units are left in the quota.

[0122] From 2 to 3 milliseconds, task A shares the physical core with tasks B and C, and consumes logical operation units at a rate of S2*4 / 3=S2*(1 / 3+1)=4000 / 3 units / millisecond. Scheduling occurs at 3 milliseconds, and the computing power is settled at this time, and it is found that A consumes 4000 / 3 units / millisecond*1 millisecond=4000 / 3 units. 4000 / 3 units are subtracted from the quota, and 2000 / 3 units are left in the quota.

[0123] From 3 to 3.666 milliseconds, Task A shares a physical core with Tasks B, C, and D, and consumes logical units at the rate of S2. Scheduling occurs at 3.666 milliseconds, and the computing power is calculated to show that Task A consumes 1000 units / millisecond*0.666 milliseconds=3666 units, and the quota is reduced to zero. At this time, the group to which Task A belongs is limited, and Task A cannot participate in scheduling between 3.666 and 4.9 milliseconds. The quota is reset to 8000 units at 5 milliseconds, and Task A can be scheduled.

[0124] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.

[0125] According to another aspect of the embodiment of the present application, a task scheduling device for implementing the above-mentioned task scheduling method is also provided. Fig. 9 As shown, the device comprises:

[0126] The first acquisition unit 902 is used to acquire a computing power quota and a scheduling period preset for the task to be executed; wherein the computing power quota is used to represent the rated amount of computing resources used by the task to be executed within the scheduling period;

[0127] The second acquisition unit 904 is used to acquire the computing power consumption corresponding to each scheduling time period of the task to be executed in the current scheduling cycle;

[0128] The limiting unit 906 is used to limit the execution of the task to be executed on the physical core of the processor based on the accumulated value of the computing power consumption of the task to be executed in the current scheduling period reaching the computing power quota.

[0129] In an embodiment of the present application, a method is adopted in which a computing power quota and a scheduling cycle preset for a task to be executed are obtained; wherein the computing power quota is used to characterize the rated amount of computing resources used by the task to be executed within the scheduling cycle; the computing power consumption corresponding to each scheduling time period of the task to be executed within the current scheduling cycle is calculated; and based on the cumulative value of the computing power consumption of the task to be executed within the current scheduling cycle reaching the computing power quota, a method is used to limit the task to be executed to run on the physical core of the processor; since the present application sets a computing power quota for the task to be executed on the physical core of the processor, and limits the running of the task to be executed when the cumulative value of the computing power consumption of the task to be executed in each scheduling cycle reaches the computing power quota, it is possible to achieve the improvement of the stability of the task execution time and the improvement of the user experience when the SMT technology is used to execute the tasks corresponding to various applications, thereby solving the technical problem of unstable task execution time and poor user experience when the SMT technology is used to execute the tasks corresponding to various applications in the related technology.

[0130] In one or more embodiments, the second obtaining unit 904 includes:

[0131] A first acquisition module is used to acquire a computing power consumption rate corresponding to the task to be executed in each scheduling time period, wherein the computing power consumption rate is used to indicate the amount of computing resources used by the task to be executed per unit time; wherein the computing resources include a logical operation unit of the processor;

[0132] The first determination module is used to determine the computing power consumption of each task to be executed within the current scheduling time period based on the computing power consumption rate and the duration of the current scheduling time period; wherein the operation types corresponding to each task to be executed are the same.

[0133] In one or more embodiments, the first acquisition module includes:

[0134] A first determining subunit is used to determine the ratio of the number of logical processors included in the physical core to the number of tasks to be executed in the current scheduling time period, and use the ratio as a computing power consumption coefficient corresponding to the current scheduling time period;

[0135] The second determination subunit is used to determine the product of the computing power consumption coefficient corresponding to the current scheduling time period and the computing power consumption constant as the computing power consumption rate corresponding to the task to be executed in the current scheduling time period; wherein the computing power consumption constant is the number of logical operation units consumed by any task per unit time when each logical processor of the physical core is assigned a task.

[0136] In one or more embodiments, the task scheduling device further includes:

[0137] A first calculation unit is used to sequentially subtract the computing power consumption corresponding to the task to be executed in each scheduling time period in the current scheduling cycle from the computing power quota of the task to be executed, so as to obtain the remaining computing power quota of the task to be executed;

[0138] A determination unit is used to determine, when the remaining computing power quota is equal to zero, that the computing power consumption of the task to be executed in the current scheduling period reaches the computing power quota.

[0139] In one or more embodiments, the task scheduling device further includes:

[0140] A resetting unit, configured to reset the remaining computing power quota to the computing power quota at the start time of the next cycle of the current scheduling cycle;

[0141] The execution unit is used to schedule the processor to continue to execute the task to be executed in the next cycle when the task to be executed is restricted from running in the current scheduling cycle.

[0142] In one or more embodiments, the task scheduling device further includes:

[0143] A selection unit, configured to select tasks to be executed in a current scheduling time period from the task queue based on tasks carrying task identifiers in the task queue and the priorities of the tasks; wherein the task identifier is used to characterize a computing type of the task, and the number of the tasks to be executed is less than or equal to the number of logical processors of the physical core;

[0144] A scheduling unit is used to schedule the task to be executed to the logical processor of the physical core.

[0145] In one or more embodiments, the selection unit comprises:

[0146] A second determination module is used to select a first task carrying a task identifier and having the highest priority from the task queue, and determine whether there is a second task with the same task identifier as the first task in the task queue;

[0147] A third determining module, configured to determine the first task and the second task as tasks to be executed in the current scheduling time period if they exist;

[0148] The fourth determining module is used to determine the first task as the task to be executed if the first task does not exist.

[0149] According to another aspect of the embodiment of the present application, an electronic device for implementing the above-mentioned task scheduling method is also provided. The electronic device may be Figure 1 The terminal device or server shown in the figure. This embodiment is described by taking the electronic device as a server as an example. Fig.10 As shown, the electronic device includes a memory 1002 and a processor 1004. The memory 1002 stores a computer program, and the processor 1004 is configured to execute the steps in any of the above method embodiments through the computer program.

[0150] Optionally, in this embodiment, the electronic device may be at least one network device among a plurality of network devices of a computer network.

[0151] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0152] S1, obtaining a computing power quota and a scheduling period preset for a task to be executed; wherein the computing power quota is used to represent a rated amount of computing resources used by the task to be executed within the scheduling period;

[0153] S2, obtaining the computing power consumption corresponding to each scheduling time period of the task to be executed in the current scheduling cycle;

[0154] S3: Based on the accumulated value of the computing power consumption of the task to be executed in the current scheduling period reaching the computing power quota, the task to be executed is restricted to run on the physical core of the processor.

[0155] Among them, the memory 1002 can be used to store software programs and modules, such as the program instructions / modules corresponding to the task scheduling method and device in the embodiment of the present application. The processor 1004 executes various functional applications and data processing by running the software programs and modules stored in the memory 1002, that is, the above-mentioned task scheduling method is realized. The memory 1002 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 1002 may further include a memory remotely arranged relative to the processor 1004, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. Among them, the memory 1002 may be specifically used, but not limited to, for storing the computing power quota and clock cycle preset for the task to be executed.

[0156] As an example, Fig.10 As shown, the memory 1002 may include but is not limited to the first acquisition unit 902, the second acquisition unit 904 and the restriction unit 906 in the task scheduling device. In addition, it may also include but is not limited to other module units in the task scheduling device, which will not be repeated in this example.

[0157] Optionally, the transmission device 1006 is used to receive or send data via a network. Specific examples of the above-mentioned network may include a wired network and a wireless network. In one example, the transmission device 1006 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 1006 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0158] In addition, the electronic device mentioned above further includes: a connection bus 1008, which is used to connect various module components in the electronic device mentioned above.

[0159] In other embodiments, the electronic device may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes in the form of network communication. Among them, the nodes may form a peer-to-peer (P2P) network, and any form of computing device, such as a server, terminal, or other electronic device, may become a node in the blockchain system by joining the peer-to-peer network.

[0160] In one or more embodiments, the present application also provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the above-mentioned task scheduling method. Wherein, the computer program is configured to execute the steps of any of the above-mentioned method embodiments when running.

[0161] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:

[0162] S1, obtaining a computing power quota and a clock cycle preset for a task to be executed; wherein the computing power quota is used to represent a rated amount of computing resources used by the task to be executed within the clock cycle;

[0163] S2, obtaining the computing power consumption corresponding to each scheduling time period of the task to be executed in the current clock cycle;

[0164] S3: Based on the accumulated value of the computing power consumption of the task to be executed in the current clock cycle reaching the computing power quota, the task to be executed is restricted to run on the physical core of the processor.

[0165] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.

[0166] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0167] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which can be personal computers, servers or network devices, etc.) to perform all or part of the steps of the methods of various embodiments of the present invention.

[0168] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0169] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0170] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0171] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0172] The above are only preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

[0173] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

Claims

1. A task scheduling method, characterized in that: The method comprises: Obtaining a computing power quota and a scheduling period preset for the task to be executed; wherein the computing power quota is used to represent the rated amount of computing resources used by the task to be executed within the scheduling period; Obtain the computing power consumption corresponding to each scheduling time period of the task to be executed in the current scheduling cycle; Based on the accumulated value of the computing power consumption of the task to be executed in the current scheduling period reaching the computing power quota, the task to be executed is restricted from running on the physical core of the processor.

2. The method according to claim 1, characterized in that The calculating the computing power consumption corresponding to each scheduling time period of the task to be executed in the current scheduling cycle includes: Obtain the computing power consumption rate corresponding to the tasks to be executed in each scheduling time period, where the computing power consumption rate is used to indicate the amount of computing resources used by the tasks to be executed per unit time; Based on the computing power consumption rate and the duration of the current scheduling time period, the computing power consumption of each task to be executed in the current scheduling time period is determined; wherein the computing types corresponding to each task to be executed are the same.

3. The method according to claim 2, characterized in that The obtaining of the computing power consumption rate corresponding to the tasks to be executed in each scheduling time period includes: Determine the ratio of the number of logical processors included in the physical core to the number of tasks to be executed in the current scheduling time period, and use the ratio as the computing power consumption coefficient corresponding to the current scheduling time period; Based on the product of the computing power consumption coefficient corresponding to the current scheduling time period and the computing power consumption constant, the computing power consumption rate corresponding to the task to be executed in the current scheduling time period is determined; wherein, the computing power consumption constant is the number of logical operation units consumed by any task per unit time when each logical processor of the physical core is assigned a task.

4. The method according to claim 1, characterized in that The limiting the task to be executed to run on the physical core of the processor based on the computing power consumption of the task to be executed in the current scheduling period reaching the computing power quota includes: The computing power quota of the task to be executed is deducted from the computing power consumption corresponding to the task to be executed in each scheduling time period in the current scheduling cycle in turn, to obtain the remaining computing power quota of the task to be executed; When the remaining computing power quota is equal to zero, it is determined that the computing power consumption of the task to be executed in the current scheduling period reaches the computing power quota.

5. The method according to claim 4, characterized in that The method further comprises: At the start time of the next cycle of the current scheduling cycle, resetting the remaining computing power quota to the computing power quota; In the case where the task to be executed is restricted from running in the current scheduling cycle, the processor is scheduled to continue to execute the task to be executed in the next cycle.

6. The method according to claim 1, characterized in that Before obtaining the computing power quota and clock cycle preset for the task to be executed, the method further includes: Based on each task carrying a task identifier in the task queue and the priority of each task, selecting a task to be executed in the current scheduling time period from the task queue; wherein the task identifier is used to characterize the operation type of the task, and the number of the tasks to be executed is less than or equal to the number of logical processors of the physical core; The task to be executed is scheduled to the logical processor of the physical core.

7. The method according to claim 6, characterized in that The selecting, based on each task carrying a task identifier in the task queue and the priority of each task, a task to be executed in the current scheduling time period from the task queue comprises: Selecting a first task carrying a task identifier and having the highest priority from the task queue, and determining whether there is a second task with the same task identifier as the first task in the task queue; If so, determining the first task and the second task as tasks to be executed in the current scheduling time period; If not, the first task is determined as the task to be executed.

8. A task scheduling device, characterized in that: The device comprises: A first acquisition unit is used to acquire a computing power quota and a scheduling period preset for the task to be executed; wherein the computing power quota is used to represent the rated amount of computing resources used by the task to be executed within the scheduling period; A second acquisition unit is used to acquire the computing power consumption corresponding to each scheduling time period of the task to be executed in the current scheduling cycle; The limiting unit is used to limit the execution of the task to be executed on the physical core of the processor based on the accumulated value of the computing power consumption of the task to be executed in the current scheduling period reaching the computing power quota.

9. An electronic device, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: The program is executed by a processor to implement the method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Task execution method, system and device, storage medium and program product

    CN120295798A