A server computing time slice allocation method based on instruction execution efficiency

By calculating the instruction execution efficiency and net push instruction rate of tasks, idling and waiting tasks are identified and suppressed, solving the problems of processor resource waste and inefficient task starvation, and achieving more efficient task scheduling.

CN123137728APending Publication Date: 2026-11-20SHANGHAI MIAOCAN IND CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611396701.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-09
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

Existing technologies cannot effectively distinguish and schedule high-throughput, low-progress spin-waiting tasks and constrained tasks, resulting in wasted processor resources and inefficient task starvation, creating a positive feedback loop of reduction.

Method used

By collecting the number of retirement instructions, clock cycles, and retirement instruction address sequences of tasks, the instruction execution efficiency and net advance instruction rate are calculated. Idle waiting tasks are identified, and scheduling is constrained by the lower limit of time slice quota to correct time slice allocation in order to suppress resource crowding and inefficient tasks.

Benefits of technology

It improves processor resource utilization, reduces the risk of idle waste and inefficient tasks, and achieves more efficient task scheduling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123137728A_ABST
    Figure CN123137728A_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of task scheduling allocation, and provides a server computing time slice allocation method based on instruction execution efficiency, comprising: collecting the number of retired instructions, the number of clock cycles and the address sequence of retired instructions of each task according to a scheduling period, and calculating the instruction execution efficiency; performing revisit address interval identification on the address sequence of retired instructions, counting the number of revisit retired instructions, and calculating the net advancing instruction rate; performing instruction rate virtual high ratio analysis based on the instruction execution efficiency and the net advancing instruction rate to determine the idle waiting task, determining the net advancing bottom amount and the net advancing bottom period according to the number of revisit retired instructions, obtaining the lower limit of the time slice quota, taking it as a constraint to execute the time slice conversion benchmark correction, and obtaining the server computing time slice of each task; and generating the time slice arrangement table of the next scheduling period according to the server computing time slice and scheduling and running, which is beneficial to identifying busy loop efficiency virtual high, suppressing the Matthew effect of time slice allocation, and taking into account the computing power efficiency and allocation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of task scheduling and allocation technology, specifically a server computing time slice allocation method based on instruction execution efficiency. Background Technology

[0002] In the simultaneous sharing of hardware resources and thread scheduling of multi-threaded processors, there is a deep scheduling dilemma caused by the interplay of instruction execution efficiency signal distortion and feedback-based resource allocation mechanisms.

[0003] Spin-waiting tasks (such as spinlocks and loop probing of busy-waiting flags) have a compact busy-waiting loop as their basic execution form. Their loop bodies are short and stably reside in the instruction cache and branch predictor's working set. The instruction fetch, decode, and execution pipelines hit almost continuously, and the number of retired instructions per cycle remains at a high level. However, the retired instruction stream repeatedly falls back to the same address range on the timeline. Although instructions are continuously retired at the end of the pipeline, the task does not actually advance in terms of program semantics. The instruction execution efficiency indicator, represented by the number of retired instructions per cycle, cannot distinguish this high-throughput, zero-progress execution form, and the efficiency signal is artificially inflated. At the same time, in the existing scheduling strategy that directly drives the allocation of time slices and shared resource quotas based on instruction execution efficiency, the more efficient tasks continue to occupy resources, while the time slices of less efficient tasks are continuously compressed. Once a compressed task relinquishes the pipeline, the microarchitectural state it occupies, such as the cache block and branch prediction history, is evicted or contaminated as other threads run. When it is scheduled again, it must undergo a cold start reconstruction, further reducing execution efficiency and reducing its time slice again. This creates a positive feedback loop of reduction: decreased efficiency - resource compression - cooling down - even lower efficiency.

[0004] Traditional methods treat efficiency statistics such as the number of retired instructions per cycle as unified and reliable scalar signals, directly using them to measure task progress and drive resource allocation. This approach cannot identify the false prosperity of tasks that are idle while the indicators are artificially high during busy-wait cycles, nor can it sever the positive feedback coupling between efficiency signals and resource allocation. Ultimately, this results in processor resources being wasted on tasks that are not actually progressing, while tasks that are truly limited by memory access latency or synchronization waiting fall into a systemic scheduling blind spot between the continuous decay of time slices and cold start oscillations.

[0005] Therefore, the present invention provides a server computing time slice allocation method based on instruction execution efficiency. Summary of the Invention

[0006] In order to overcome the shortcomings of the prior art, at least one technical problem raised in the background art is solved.

[0007] The technical solution adopted by the present invention to solve its technical problem is: a server computing time slice allocation method based on instruction execution efficiency, including the following steps: Step S1: Collect the number of retirement instructions, the number of clock cycles and the retirement instruction address sequence of each task on each computing core of the server according to the scheduling cycle, and calculate the instruction execution efficiency of each task based on the number of retirement instructions and the number of clock cycles. Step S2: Perform revisit address range identification on the retirement instruction address sequence of each task, count the number of revisit retirement instructions within the revisit address range, and calculate the net advance instruction rate for each task based on the number of retirement instructions, combined with the number of revisit retirement instructions and the number of clock cycles. Step S3: Based on instruction execution efficiency and net push instruction rate, perform instruction rate over-inflation analysis to determine idle waiting tasks, determine the net push minimum amount based on the number of revisit retirement instructions, calculate the net push minimum cycle for each task in combination with the net push instruction rate, obtain the time slice quota lower limit, and perform time slice conversion benchmark correction with the time slice quota lower limit as a constraint to obtain the server computing time slice for each task. Step S4: Generate a time slice schedule for the next scheduling cycle based on the server's time slice calculation, and execute the scheduling of each task in the next scheduling cycle according to the time slice schedule.

[0008] As a further aspect of the present invention: the method for obtaining the number of retirement instructions, the number of clock cycles, and the retirement instruction address sequence is as follows: During the scheduling cycle, the number of retired instructions is accumulated and counted to obtain the number of retired instructions; at the same time, the number of clock cycle events of the computing core is accumulated and counted to obtain the number of clock cycles. Capture the program count addresses of retired instructions in chronological order, and arrange the captured program count addresses in the capture order to form a sequence of retired instruction addresses.

[0009] As a further aspect of the present invention: the process of calculating the instruction execution efficiency of each task is as follows: Calculate the ratio of the actual operating frequency to the reference frequency for each frequency band, and multiply the number of clock cycles measured in each frequency band by the corresponding ratio for each frequency band to obtain the equivalent number of cycles for each frequency band. The number of clock cycles is obtained by summing the equivalent number of cycles across all frequency bands. The ratio of the number of retirement instructions to the number of clock cycles is calculated to obtain the instruction execution efficiency of each task.

[0010] As a further aspect of the present invention: the method for determining the revisited address range is as follows: The program count address in the retirement instruction address sequence is divided into address windows according to a fixed address window length; Count the number of program count addresses in each address window, and output the address windows whose ratio of the number of program count addresses to the total length of the retirement instruction address sequence exceeds the window proportion threshold as candidate address windows; Merge candidate address windows with consecutive addresses into a continuous address range, and output the continuous address range as a revisit address interval.

[0011] As a further aspect of the present invention: the net propulsion command rate for each task is calculated as follows: The number of program count addresses within the revisit address range is counted, and then divided by the total length of the retirement instruction address sequence to obtain the revisit ratio. The number of retirement orders is obtained by multiplying the revisit rate by the number of retirement orders. The difference between the number of retirement orders and the number of follow-up retirement orders is the net number of advance orders. The net propulsion command rate for each task is obtained by calculating the ratio of the net propulsion command count to the clock cycle count.

[0012] As a further aspect of the present invention: the process of determining the idling waiting task is as follows: The difference between instruction execution efficiency and net push instruction rate is processed, and then divided by instruction execution efficiency to obtain the instruction rate over-promotion ratio for each task. When the false high ratio of the instruction rate exceeds the false high ratio judgment threshold within a single scheduling cycle, the continuous idle count value of the task is increased by one; When the continuous idle count reaches the number of consecutive judgment cycles, the task is judged as an idle waiting task.

[0013] As a further aspect of the present invention: the method for obtaining the lower limit of the time-slice quota is as follows: Based on the number of retirement follow-up instructions and the preset baseline instruction quantity, the net progress guarantee quantity for each task is obtained. The ratio of the net progress guarantee quantity to the net progress instruction rate is calculated to obtain the net progress guarantee period for each task. Multiply the net push guarantee period by the base frequency order period to convert it into the conversion period for each task; Take the maximum value among all task conversion times as the lower limit of the time slice quota.

[0014] As a further aspect of the present invention: the method for obtaining the server's computation time slice is as follows: The time slice conversion benchmark for idling and waiting tasks is corrected from instruction execution efficiency to net propulsion instruction rate, while the time slice conversion benchmark for tasks not identified as idling and waiting tasks is maintained at instruction execution efficiency; The total available time is obtained by calculating the deviation between the total scheduling cycle duration and the reserved overhead duration. Normalize the time slice conversion benchmark for each task, calculate the ratio of the time slice conversion benchmark for each task to the sum of the time slice conversion benchmarks for all tasks, and obtain the benchmark percentage for each task. The total allocable time is divided into each task according to the baseline proportion to obtain the initial time slice for each task; When the initial time slice is less than the lower limit of the time slice quota, the initial time slice is raised to the lower limit of the time slice quota. The difference between the lower limit of the time slice quota and the initial time slice is calculated and summed to obtain the total increase. The total increase is deducted from the tasks whose initial time slice is greater than the lower limit of the time slice quota according to the baseline proportion of each task, so as to obtain the time slice of each task after the lower limit of the time slice quota is verified. The time slice for each task, after verification of the time slice quota lower limit, is output as the server-calculated time slice for each task.

[0015] As a further aspect of the present invention: the process of generating the time slice schedule for the next scheduling cycle is as follows: Read the computing cores used by each task in the previous scheduling cycle, and determine the affinity computing cores of each task based on the computing cores used in the previous scheduling cycle. The server compute time slices for each task are preferentially scheduled on the timeline of the affinity compute core; When the sum of the server computing time slices arranged on the same computing core exceeds the available time of the affinity computing core, the excess server computing time slices will be redistributed to the computing core with the longest available time. Reclaim the server computing time slices corresponding to tasks that do not appear in the next scheduling cycle, and add the reclaimed server computing time slices to the remaining tasks in proportion to the remaining server computing time slices of each task. Generate the time slice schedule for the next scheduling cycle based on the arrangement results.

[0016] As a further aspect of the present invention: the process of scheduling and running each task is as follows: Each task is set with a start time and a preemption time according to the time slice schedule. When the preemption time is reached, a context switch is triggered. After the scheduling operation is completed, return to step S1 to begin the data collection and calculation for the next scheduling cycle.

[0017] The beneficial effects of this invention are as follows: This invention collects the number of retirement instructions, the number of clock cycles, and the retirement instruction address sequence of each task according to the scheduling cycle, and identifies and calculates the net advance instruction rate based on the revisit address range of the retirement instruction address sequence. In the allocation of server computing time slices, it realizes the scheduling and operation of idle waiting tasks by identifying the virtual high ratio of instruction rate and supporting the scheduling of all tasks by using the lower limit of time slice quota. That is, for tasks determined to be idle waiting tasks, the time slice conversion benchmark is corrected from instruction execution efficiency to net advance instruction rate, and the lower limit of time slice quota that adapts to the load state is derived according to the net advance guarantee amount and the net advance instruction rate. In this way, while maintaining high instruction execution efficiency and computing core utilization, it suppresses the time slice occupation of busy waiting loop tasks and the positive feedback reduction of time slices of inefficient tasks, effectively reducing the risk of processor resource waste and starvation of inefficient tasks. Attached Figure Description

[0018] The invention will now be further described with reference to the accompanying drawings.

[0019] Figure 1 This is a flowchart of the steps of a server computing time slice allocation method based on instruction execution efficiency as described in Embodiment 1 of the present invention; Figure 2 This is a logical judgment diagram of a server computing time slice allocation method based on instruction execution efficiency as described in Embodiment 1 of the present invention; Figure 3 This is a time slice arrangement flowchart of a server computing time slice allocation method based on instruction execution efficiency as described in Embodiment 1 of the present invention. Detailed Implementation

[0020] To make the technical means, creative features, objectives and effects of this invention easier to understand, the invention will be further described below in conjunction with specific embodiments.

[0021] Example 1: Please refer to Figure 1-3 As shown in the embodiment of the present invention, a server computing time slice allocation method based on instruction execution efficiency includes the following steps: Step S1: Collect the number of retirement instructions, the number of clock cycles, and the retirement instruction address sequence for each task on each computing core of the server according to the scheduling cycle, and calculate the instruction execution efficiency of each task based on the number of retirement instructions and the number of clock cycles. In step S1, the process of collecting the number of retirement instructions, the number of clock cycles, and the retirement instruction address sequence for each task on each computing core of the server according to the scheduling cycle is as follows: The scheduling period is set to a fixed duration, with a value ranging from 5 milliseconds to 20 milliseconds. In this embodiment, the scheduling period is set to 10 milliseconds. At the end of each scheduling cycle, the scheduler initiates a read from the hardware performance counting unit of each computing core of the server. The hardware performance counting unit performs an increment count on the instruction retirement events during the scheduling cycle to obtain the number of retired instructions. The hardware performance counting unit simultaneously performs an accumulation count on the clock cycle events of the computing core to obtain the number of clock cycles; The method for reading the retirement instruction address sequence is as follows: the program count address of the retired instruction is captured in chronological order by calculating the branch record register of the core, and the captured program count addresses are arranged in the capture order to form the retirement instruction address sequence; The maximum number of address records is between 32 and 128, and in this embodiment, the maximum number of address records is 64. When a task undergoes a computing core migration during the scheduling cycle, the number of first retirement instructions, the number of first clock cycles, and the address sequence of the first retirement instructions are read from the hardware performance counting unit of the computing core before the migration. The number of second retirement instructions, the number of second clock cycles, and the address sequence of the second retirement instructions are read from the hardware performance counting unit of the computing core after the migration. The number of first retirement instructions and the number of second retirement instructions are added together to obtain the number of retirement instructions. The number of clock cycles is obtained by adding the number of the first clock cycles to the number of the second clock cycles. The first retirement instruction address sequence and the second retirement instruction address sequence are concatenated in the order of migration time to obtain the retirement instruction address sequence; In step S1, the process of calculating the instruction execution efficiency of each task based on the number of retirement instructions and the number of clock cycles is as follows: When the operating frequency of the computing core changes during the scheduling cycle, the number of clock cycles measured in different frequency bands is converted into the equivalent number of cycles measured at the reference frequency. The equivalent number of cycles in all frequency bands is then summed to obtain the number of clock cycles. The conversion method is as follows: calculate the ratio of the actual operating frequency of each frequency band to the reference frequency, and multiply the number of clock cycles measured in each frequency band by the corresponding ratio for each frequency band to obtain the equivalent number of cycles for each frequency band. For example, if the actual operating frequency in a frequency band is 2 GHz and the reference frequency is 3 GHz, the ratio is approximately 0.667, the number of clock cycles measured in the frequency band is 60,000, and the equivalent number of cycles is 40,000. Calculate the ratio of the number of retirement instructions to the number of clock cycles to obtain the instruction execution efficiency of each task; Understandably, the significance of step S1 is as follows: using the scheduling cycle as the granularity, the actual execution behavior of each task on each computing core of the server is quantified into three data sets: the number of retirement instructions, the number of clock cycles, and the retirement instruction address sequence. The number of retirement instructions and the number of clock cycles constitute the full caliber of instruction execution efficiency, while the retirement instruction address sequence retains the spatial distribution information of instructions, providing a data basis for subsequent steps to distinguish between actual progress and idle loops. At the same time, through cross-computing core accumulation and merging and frequency conversion, the interference of task migration and frequency fluctuations on the collection results is eliminated. Step S2: Perform revisit address range identification on the retirement instruction address sequence of each task, count the number of revisit retirement instructions within the revisit address range, and calculate the net advance instruction rate for each task based on the number of retirement instructions, combined with the number of revisit retirement instructions and the number of clock cycles. In step S2, the process of identifying the revisit address range for the retirement instruction address sequence of each task is as follows: The program count address in the retirement instruction address sequence is divided into address windows according to a fixed address window length. For example, the fixed address window length can range from 128 bytes to 1024 bytes. In this embodiment, the fixed address window length is 256 bytes. Count the number of program count addresses in each address window, and output the address windows whose ratio of the number of program count addresses to the total length of the retirement instruction address sequence exceeds the window percentage threshold (e.g., 20%) as candidate address windows; Merge candidate address windows with consecutive addresses into a continuous address range, and output the continuous address range as a revisit address interval; In step S2, the process of counting the number of retirement instructions within the revisit address range is as follows: The number of program count addresses within the revisit address range is counted, and the ratio of the number of program count addresses within the revisit address range to the total length of the retirement instruction address sequence is calculated to obtain the revisit ratio. Multiply the revisit rate by the number of retirement orders to obtain the number of retirement orders requiring revisit. In step S2, the process of calculating the net advance instruction rate for each task based on the number of retirement instructions, combined with the number of revisit retirement instructions and the number of clock cycles, is as follows: The net number of advance orders is obtained by taking the difference between the number of retirement orders and the number of follow-up retirement orders. Calculate the ratio of net propulsion commands to clock cycles to obtain the net propulsion command rate for each task; Understandably, the significance of step S2 is as follows: by identifying the revisit address range, the spatial clusters of repeatedly executed instructions are separated from the retirement instruction address sequence; then, the number of revisited retirement instructions is counted by proportional extrapolation; finally, the net advance instruction rate is calculated by subtracting the number of revisited retirement instructions from the number of retirement instructions. The net advance instruction rate reflects the actual advance capability of the task after removing the idle loop, and provides a net caliber metric for subsequent steps to determine idle waiting tasks and derive the lower limit of the time slice quota. Step S3: Based on instruction execution efficiency and net push instruction rate, perform instruction rate over-inflation analysis to determine idle waiting tasks, determine the net push minimum amount based on the number of revisit retirement instructions, calculate the net push minimum cycle for each task in combination with the net push instruction rate, obtain the time slice quota lower limit, and perform time slice conversion benchmark correction with the time slice quota lower limit as a constraint to obtain the server computing time slice for each task. In step S3, based on instruction execution efficiency and net propulsion instruction rate, an instruction rate overshoot ratio analysis is performed to determine the process of idling and waiting for tasks as follows: The difference between instruction execution efficiency and net push instruction rate is processed, and then divided by instruction execution efficiency to obtain the instruction rate over-promotion ratio for each task. Set the threshold for determining the false high ratio and the number of consecutive determination cycles; It should be noted that in this embodiment, the threshold for determining the false high ratio is 0.5, and the number of consecutive determination cycles is 3 scheduling cycles. The reason for setting the threshold for determining the false high ratio to 0.5 is that the proportion of the number of revisit retirement instructions for idle waiting tasks to the total number of retirement instructions is usually greater than 0.8. For normal computing tasks, due to the existence of address-forwarding code, the proportion of the number of revisit retirement instructions to the total number of retirement instructions is usually less than 0.4. The gap between 0.4 and 0.6 is the gap between idle waiting tasks and normal computing tasks. The midpoint of 0.5 is used to retain classification margin on both sides. When the false high ratio of the instruction rate exceeds the false high ratio judgment threshold within a single scheduling cycle, the continuous idle count value of the task is increased by one; If the false high ratio of the instruction rate does not exceed the false high ratio judgment threshold within a single scheduling cycle, the continuous idle count value of the task will be cleared to zero. When the continuous idle count reaches the number of consecutive judgment cycles, the task is judged as an idle waiting task. Set the number of recovery cycles, which is 2 scheduling cycles. If the instruction rate false high ratio of a task that has been identified as an idle waiting task does not exceed the false high ratio judgment threshold within several consecutive scheduling cycles of recovery, the idle waiting task judgment will be lifted and the idle continuous count value will be cleared to zero. In step S3, the process of determining the net push minimum based on the number of retirement follow-up instructions, calculating the net push minimum cycle for each task based on the net push instruction rate, and obtaining the time slice quota lower limit is as follows: The sum of the number of retirement follow-up instructions and the preset baseline number of instructions is calculated to obtain the net minimum progress for each task; It should be noted that the preset baseline instruction quantity is 10% of the average number of retirement instructions for all tasks in the historical scheduling cycle. The historical scheduling cycle is the most recent 10 scheduling cycles. The average number of retirement instructions in each historical scheduling cycle is equal to the sum of the number of retirement instructions for all tasks in the most recent 10 scheduling cycles divided by 10 and the product of the total number of tasks. When there is no historical scheduling cycle in the first scheduling cycle, the preset baseline instruction quantity is the preset initial instruction quantity, which is 10,000. The preset initial instruction quantity is stopped after accumulating 10 scheduling cycles and is switched to 10% of the average number of retirement instructions in the historical scheduling cycle. Calculate the ratio of net propulsion reserve to net propulsion command rate to obtain the net propulsion reserve period for each mission; Multiply the net push guarantee period by the base frequency order period to convert it into the conversion period for each task; Take the maximum value among all task conversion times as the lower limit of the time slice quota; If the lower limit of the time slice quota exceeds the product of the total duration of the scheduling cycle and the upper limit coefficient, then the lower limit of the time slice quota will be truncated to the product of the total duration of the scheduling cycle and the upper limit coefficient (the upper limit coefficient is taken as half); For example, the number of retirement follow-up instructions is 15,000, the preset baseline instruction quantity is 2,000, the net advance instruction rate is 0.417, the single cycle duration at the baseline frequency is approximately 0.333 nanoseconds, the total scheduling cycle duration is 10 milliseconds, and the specific calculation process of the time slice quota lower limit is shown in Table 1 below: Table 1. Calculation Calculation Table for the Lower Limit of Time Capacity

[0022] In step S3, the time slice conversion benchmark correction is performed using the lower limit of the time slice quota as a constraint, and the process of calculating the server time slice for each task is as follows: The time slice conversion benchmark for tasks identified as idling or waiting tasks will be corrected from instruction execution efficiency to net propulsion instruction rate, while the time slice conversion benchmark for tasks not identified as idling or waiting tasks will remain at instruction execution efficiency. The deviation between the total scheduling cycle duration and the reserved overhead duration is calculated to obtain the total allocable time, where the reserved overhead duration is 10% of the total scheduling cycle duration. Normalize the time slice conversion benchmark for each task, calculate the ratio of the time slice conversion benchmark for each task to the sum of the time slice conversion benchmarks for all tasks, and obtain the benchmark percentage for each task. The total allocable time is divided into each task according to the baseline proportion to obtain the initial time slice for each task; When the initial time slice is less than the lower limit of the time slice quota, the initial time slice is raised to the lower limit of the time slice quota. The difference between the lower limit of the time slice quota and the initial time slice is calculated. The difference of all raised tasks is summed to obtain the total raised amount. The total increase is deducted from the tasks whose initial time slice is greater than the lower limit of the time slice quota according to the baseline proportion of each task, so as to obtain the time slice of each task after verification of the lower limit of the time slice quota. Among them, the time slice after verification of the lower limit of the time slice quota is: the time slice after the initial time slice of the task whose initial time slice is less than the lower limit of the time slice quota is increased to the lower limit of the time slice quota; the initial time slice of the task whose initial time slice is equal to the lower limit of the time slice quota; and the time slice after deducting the allocated share of the total increase from the initial time slice of the task whose initial time slice is greater than the lower limit of the time slice quota. The time slice of each task, after verification of the time slice quota lower limit, is output as the server calculation time for each task; It should be noted that the reason for taking the net advance minimum as the sum of the number of revisit retirement instructions and the preset baseline instruction quantity is that: the larger the number of revisit retirement instructions, the more instructions the task consumes in the idle loop within the scheduling cycle, and the larger the minimum effective advance required by the task in the next scheduling cycle; the net advance minimum cycle is calculated by dividing the net advance minimum by the net advance instruction rate. The lower the net advance instruction rate, the longer it takes for the task to complete the same amount of effective advance. The maximum value among the converted durations of all tasks is taken as the lower limit of the time slice quota to ensure that the lower limit of the time slice quota is consistently effective for all tasks; Understandably, the significance of step S3 is as follows: it distinguishes between the actual progress component and the idle component in instruction execution efficiency by using the artificially high instruction rate ratio, and corrects it through the time slice conversion benchmark, so that idle waiting tasks no longer occupy more server computing time slices due to artificially high instruction execution efficiency; at the same time, it derives the lower limit of time slice quota by the number of revisited retirement instructions and the net progress instruction rate, so that the server computing time slices of all tasks have a guaranteed boundary that adapts to the load status, and simultaneously suppresses the time slice occupation of idle tasks and the continuous reduction of inefficient tasks from two directions: allocation basis and allocation time slice quota lower limit. Step S4: Generate a time slice schedule for the next scheduling cycle based on the server's calculated time slices, and execute the scheduling of each task in the next scheduling cycle according to the time slice schedule; In step S4, the process of generating the time slice schedule for the next scheduling cycle based on the server's calculated time slices is as follows: Read the computing cores used by each task in the previous scheduling cycle, and determine the affinity computing cores of each task based on the computing cores used in the previous scheduling cycle. The server compute time slices for each task are preferentially scheduled on the timeline of the affinity compute core; When the sum of the server computing time slices arranged on the same computing core exceeds the available time of the affinity computing core, the excess server computing time slices will be redistributed to the computing core with the longest available time. The server computing time slices corresponding to tasks that do not appear in the next scheduling cycle are reclaimed. The reclaimed server computing time slices are added to the remaining tasks in proportion to the remaining server computing time slices of each task. Here, a task that does not appear in the next scheduling cycle refers to a task that has exited the running state before the start of the next scheduling cycle. The reclamation is determined before the time slice schedule is generated. Generate the time slice arrangement table for the next scheduling cycle based on the arrangement results; In step S4, the process of scheduling and running each task according to the time-slice schedule in the next scheduling cycle is as follows: Each task is set with a start time and a preemption time according to the time slice schedule. When the preemption time is reached, a context switch is triggered. After the scheduling operation is completed, return to step S1 to begin the data collection and calculation for the next scheduling cycle; It is understandable that the significance of step S4 is to: prioritize the arrangement of affinity computing cores to reduce cache and microarchitectural state invalidation caused by task migration across computing cores, and ensure that the time axis of each computing core of the server is fully utilized by over-reordering and time slice reclamation, so that the server computing time slice of each task output in step S3 is implemented into an executable time slice arrangement table, forming a complete allocation process with closed-loop iteration according to the scheduling cycle. The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of the present invention is defined by the appended claims and their equivalents.

Claims

1. A server computing time slice allocation method based on instruction execution efficiency, characterized in that: Includes the following steps: Step S1: Collect the number of retirement instructions, the number of clock cycles, and the retirement instruction address sequence for each task on each computing core of the server according to the scheduling cycle, and calculate the instruction execution efficiency of each task based on the number of retirement instructions and the number of clock cycles. Step S2: Perform revisit address range identification on the retirement instruction address sequence of each task, count the number of revisit retirement instructions within the revisit address range, and calculate the net advance instruction rate for each task based on the number of retirement instructions, combined with the number of revisit retirement instructions and the number of clock cycles. Step S3: Based on instruction execution efficiency and net push instruction rate, perform instruction rate over-inflation analysis to determine idle waiting tasks, determine the net push minimum amount based on the number of revisit retirement instructions, calculate the net push minimum cycle for each task in combination with the net push instruction rate, obtain the time slice quota lower limit, and perform time slice conversion benchmark correction with the time slice quota lower limit as a constraint to obtain the server computing time slice for each task. Step S4: Generate a time slice schedule for the next scheduling cycle based on the server's time slice calculation, and execute the scheduling of each task in the next scheduling cycle according to the time slice schedule.

2. The server computing time slice allocation method based on instruction execution efficiency according to claim 1, characterized in that: The methods for obtaining the number of retirement instructions, the number of clock cycles, and the retirement instruction address sequence are as follows: During the scheduling cycle, the number of retired instructions is accumulated and counted to obtain the number of retired instructions; at the same time, the number of clock cycle events of the computing core is accumulated and counted to obtain the number of clock cycles. Capture the program count addresses of retired instructions in chronological order, and arrange the captured program count addresses in the capture order to form a sequence of retired instruction addresses.

3. The server computing time slice allocation method based on instruction execution efficiency according to claim 2, characterized in that: The process of calculating the instruction execution efficiency for each task is as follows: Calculate the ratio of the actual operating frequency to the reference frequency for each frequency band, and multiply the number of clock cycles measured in each frequency band by the corresponding ratio for each frequency band to obtain the equivalent number of cycles for each frequency band. The number of clock cycles is obtained by summing the equivalent number of cycles across all frequency bands. The ratio of the number of retirement instructions to the number of clock cycles is calculated to obtain the instruction execution efficiency of each task.

4. The server computing time slice allocation method based on instruction execution efficiency according to claim 1, characterized in that: The method for determining the revisit address range is as follows: The program count address in the retirement instruction address sequence is divided into address windows according to a fixed address window length; Count the number of program count addresses in each address window, and output the address windows whose ratio of the number of program count addresses to the total length of the retirement instruction address sequence exceeds the window proportion threshold as candidate address windows; Merge candidate address windows with consecutive addresses into a continuous address range, and output the continuous address range as a revisit address interval.

5. A server computing time slice allocation method based on instruction execution efficiency according to claim 4, characterized in that: The net propulsion command rate for each task is calculated as follows: The number of program count addresses within the revisit address range is counted, and then divided by the total length of the retirement instruction address sequence to obtain the revisit ratio. The number of retirement orders is obtained by multiplying the revisit rate by the number of retirement orders. The difference between the number of retirement orders and the number of follow-up retirement orders is the net number of advance orders. The net propulsion command rate for each task is obtained by calculating the ratio of the net propulsion command count to the clock cycle count.

6. The server computing time slice allocation method based on instruction execution efficiency according to claim 1, characterized in that: The process of determining the idle waiting task is as follows: The difference between instruction execution efficiency and net push instruction rate is processed, and then divided by instruction execution efficiency to obtain the instruction rate over-promotion ratio for each task. When the false high ratio of the instruction rate exceeds the false high ratio judgment threshold within a single scheduling cycle, the continuous idle count value of the task is increased by one; When the continuous idle count reaches the number of consecutive judgment cycles, the task is judged as an idle waiting task.

7. A server computing time slice allocation method based on instruction execution efficiency according to claim 6, characterized in that: The method for obtaining the minimum time-sharing quota is as follows: Based on the number of retirement follow-up instructions and the preset baseline instruction quantity, the net progress guarantee quantity for each task is obtained. The ratio of the net progress guarantee quantity to the net progress instruction rate is calculated to obtain the net progress guarantee period for each task. Multiply the net push guarantee period by the base frequency order period to convert it into the conversion period for each task; Take the maximum value among all task conversion times as the lower limit of the time slice quota.

8. A server computing time slice allocation method based on instruction execution efficiency according to claim 7, characterized in that: The server calculates the time slices as follows: The time slice conversion benchmark for idling and waiting tasks is corrected from instruction execution efficiency to net propulsion instruction rate, while the time slice conversion benchmark for tasks not identified as idling and waiting tasks is maintained at instruction execution efficiency; The total available time is obtained by calculating the deviation between the total scheduling cycle duration and the reserved overhead duration. Normalize the time slice conversion benchmark for each task, calculate the ratio of the time slice conversion benchmark for each task to the sum of the time slice conversion benchmarks for all tasks, and obtain the benchmark percentage for each task. The total allocable time is divided into each task according to the baseline proportion to obtain the initial time slice for each task; When the initial time slice is less than the lower limit of the time slice quota, the initial time slice is raised to the lower limit of the time slice quota. The difference between the lower limit of the time slice quota and the initial time slice is calculated and summed to obtain the total increase. The total increase is deducted from the tasks whose initial time slice is greater than the lower limit of the time slice quota according to the baseline proportion of each task, so as to obtain the time slice of each task after the lower limit of the time slice quota is verified. The time slice for each task, after verification of the time slice quota lower limit, is output as the server-calculated time slice for each task.

9. A server computing time slice allocation method based on instruction execution efficiency according to claim 1, characterized in that: The process of generating the time slice schedule for the next scheduling cycle is as follows: Read the computing cores used by each task in the previous scheduling cycle, and determine the affinity computing cores of each task based on the computing cores used in the previous scheduling cycle. The server compute time slices for each task are preferentially scheduled on the timeline of the affinity compute core; When the sum of the server computing time slices arranged on the same computing core exceeds the available time of the affinity computing core, the excess server computing time slices will be redistributed to the computing core with the longest available time. Reclaim the server computing time slices corresponding to tasks that do not appear in the next scheduling cycle, and add the reclaimed server computing time slices to the remaining tasks in proportion to the remaining server computing time slices of each task. Generate the time slice schedule for the next scheduling cycle based on the arrangement results.

10. A server computing time slice allocation method based on instruction execution efficiency according to claim 9, characterized in that: The process of scheduling and executing each task is as follows: Each task is set with a start time and a preemption time according to the time slice schedule. When the preemption time is reached, a context switch is triggered. After the scheduling operation is completed, return to step S1 to begin the data collection and calculation for the next scheduling cycle.