Time-out processing device, chip, network interface card and computer device
By adding slots to the time wheel structure and using a timeout control unit, the conflict between task output and input in the traditional time wheel algorithm is resolved, achieving more efficient task management and simplified cache queue processing.
Patent Information
- Application Number
- CN202511293278.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-11
- Publication Date
- 2025-12-23
- Estimated Expiration
- 2045-09-11
AI Technical Summary
In traditional time wheel algorithms, the random timing of input tasks leads to situations where old timed tasks are dequeued and new timed tasks are enqueued in the first-level time wheel slots, increasing the complexity of cache queue management and the boundary control conditions for conflict handling.
A multi-layer time wheel structure is adopted, with each layer of the time wheel adding a slot. The timeout control unit determines the target slot based on the task's output time and the time wheel unit, thereby realizing task timeout control and avoiding conflicts between task output and input.
By designing a multi-layered time wheel structure and a timeout control unit, conflicts between task outputs and inputs are reduced, cache queue management is simplified, and the timing accuracy and processing efficiency of the time wheel are improved.
Smart Images

Figure CN120803674B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a timeout time processing device, a chip, a network interface card and a computer device. BACKGROUND
[0002] The time wheel algorithm is a high-efficiency time management and scheduling algorithm, and is widely applied to task timing operation in various systems, such as connection timeout management in a network server, timing service in an operating system, and periodic task scheduling in a database.
[0003] In the traditional technology, since the timing time of an input task is relatively random, the first layer time wheel slot of a time axis exists a situation that an old timing task is dequeued and a new timing task is enqueued. Thus, more boundary control conditions for conflict processing of enqueuing and dequeuing are introduced, and the cache queue management is more complex. SUMMARY
[0004] Therefore, it is necessary to provide a timeout time processing device, a chip, a network interface card and a computer device capable of reducing conflicts in view of the above technical problems.
[0005] In a first aspect, the present application provides a timeout time processing device, comprising a time wheel unit and a timeout control unit, wherein:
[0006] The time wheel unit comprises X-layer time wheel slots, each slot of the same layer time wheel represents the same time interval, and the number of time wheel slots of adjacent two layers and the time interval satisfy the following conditions:
[0007]
[0008] wherein, is the number of time wheel slots of the kth layer, is the time interval represented by a slot of the kth layer time wheel, is the time interval represented by a slot of the (k+1)th layer time wheel, k is a positive integer between 1 and X-1, and X is a positive integer greater than or equal to 1;
[0009] The timeout control unit is configured to determine a target slot based on the sending time of a timeout task and the time wheel unit, and perform timeout control on the timeout task.
[0010] In one of the optional embodiments, the timeout control unit is specifically configured to:
[0011] determine a current time wheel slot corresponding to the timeout task according to the current time of receiving the timeout task, the output time of the timeout task and the time interval represented by each layer time wheel, and write the timeout task into the current time wheel slot;
[0012] determining whether the current time wheel slot is a first layer time wheel slot, if yes, reading and outputting the timeout task when the trigger time of the current time wheel slot is reached, if not, reading the timeout task when the trigger time of the current time wheel slot is reached, and performing degradation, determining a target slot after degradation according to the current slot of the degraded time wheel and the current remaining waiting time of the timeout task, writing the timeout task into the target slot after degradation, reading the timeout task when the trigger time of the target slot after degradation is reached, and performing re-degradation until the first layer time wheel slot is reached, and reading and outputting the timeout task when the trigger time of the target slot of the first layer time wheel is reached.
[0013] In one of the optional embodiments, the timeout control unit is specifically configured to:
[0014] determining the current slot time of each layer time wheel based on the current time and the time interval corresponding to each slot of each layer time wheel in the time wheel unit;
[0015] determining the current layer time wheel corresponding to the timeout task according to the output time of the timeout task, the current slot time of each layer time wheel, and the time interval of each layer time wheel in the time wheel unit;
[0016] determining the current slot of the current layer time wheel according to the current time, the number of slots of the current layer time wheel, and the time interval corresponding to each slot of the current layer time wheel;
[0017] determining the first slot interval according to the output time of the timeout task and the current slot time of the current layer time wheel;
[0018] determining the current time wheel slot according to the current slot and the first slot interval.
[0019] In one of the optional embodiments, the timeout control unit is specifically configured to determine the current layer time wheel by the following way:
[0020] if the condition is met , the current layer time wheel is the first layer time wheel;
[0021] if the condition is met , and the condition is not met , the current layer time wheel is the second layer time wheel;
[0022] if the condition is met , and the condition is not met , i is a positive integer between 3 and X, and the current layer time wheel is the i-th layer time wheel;
[0023] wherein, is a time interval corresponding to each slot of the current layer time wheel corresponding to the timeout task, is a number of slots corresponding to the current layer time wheel corresponding to the timeout task, and send_time is an output time of the timeout task, is the current slot time of the i-th layer time wheel.
[0024] In one of the optional embodiments, the timeout control unit is specifically configured to:
[0025] When degradation is needed, a second slot interval is determined according to an output time of the timeout task, the trigger time corresponding to the current time wheel slot, and a time interval corresponding to each slot of the current layer time wheel;
[0026] A current slot of the degraded time wheel is determined based on the trigger time of the current time wheel slot, the number of slots of the degraded time wheel, and the time interval corresponding to each slot of the degraded time wheel;
[0027] A target slot of the degraded time wheel is determined according to the current slot of the degraded time wheel and the second slot interval;
[0028] The timeout task is written into the target slot of the degraded time wheel.
[0029] In one of the optional embodiments, the timeout control unit is further configured to determine the current slot by the following formula:
[0030]
[0031] wherein, is a floor function, % is a remainder function; and cur_time is a current time at which the timeout task is received, is a time interval corresponding to each slot of the current layer time wheel corresponding to the timeout task, is a number of slots corresponding to the current layer time wheel corresponding to the timeout task, is a current slot of the current layer time wheel corresponding to the timeout task; cur_time is a trigger time of a time wheel slot in which the timeout task is located before degradation, is a time interval corresponding to each slot of the degraded time wheel, is a number of slots corresponding to the degraded time wheel, is a current slot of the degraded time wheel of the timeout task, and i is a positive integer between 1 and X, i indicating an i-th layer time wheel in the time wheel unit.
[0032] In one of the optional embodiments, the timeout control unit is configured to determine the current slot time according to the following formula:
[0033]
[0034] wherein, represents rounding down, cur_time is the current time when the timeout task is received, is the time interval corresponding to each slot of the i-th time wheel.
[0035] In one of the optional embodiments, the timeout control unit is further configured to determine the first slot interval and the second slot interval according to the following formula:
[0036]
[0037] wherein, send_time is the output time of the timeout task, cur_time is the current slot time corresponding to the i-th time wheel, is the current slot time of the i-th time wheel, is the time interval corresponding to each slot of the i-th time wheel, is the first slot interval, is the trigger time of the time wheel slot where the timeout task is located after degradation, is the time interval corresponding to each slot of the i-th time wheel where the timeout task is located after degradation, is the second slot interval, represents rounding down.
[0038] In one of the optional embodiments, the trigger time of the current time wheel slot is determined according to the following formula:
[0039]
[0040] wherein, represents rounding down, is the trigger time of the current time wheel slot corresponding to the i-th time wheel, c_time is the current time determined based on the time axis, is the time interval corresponding to each slot of the i-th time wheel.
[0041] In a second aspect, the present application further provides a chip comprising a memory and a processor, wherein the memory stores a computer program, and the chip comprises the timeout time processing device in any one of the above embodiments.
[0042] In a third aspect, the present application provides a network interface card, comprising the chip and the multi-layer interface in any one of the above embodiments.
[0043] The chip processes data or communicates externally through the interface.
[0044] In a fourth aspect, the present application provides a computer device, comprising the network interface card in any one of the above embodiments, and the network interface card is used for processing data or communicating externally.
[0045] The above timeout processing device, chip, network interface card and computer device comprise a time wheel unit and a timeout control unit, wherein the time wheel unit comprises X-layer time wheel slots, each slot of the same layer time wheel represents the same time interval, and the number of adjacent two-layer time wheel slots and the time interval satisfy the following conditions , wherein, is the number of slots of the kth layer time wheel, is the time interval represented by one slot of the kth layer time wheel, is the time interval represented by one slot of the k+1th layer time wheel, k is a positive integer between 1 and X-1, and X is a positive integer greater than or equal to 1; the timeout control unit is used for determining a target slot based on the waiting time of a timeout task and the time wheel unit, and performing timeout control on the timeout task, so that the output of the timeout task and the input of the timeout task in the first layer time wheel are located in different slots due to the increase of one slot in each of the first layer time wheel to the X-1th layer time wheel, thereby avoiding the conflict between the task output and the task input. BRIEF DESCRIPTION OF DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related art, the drawings needed to be used in the description of the embodiments of the present application or the related art will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other related drawings can be obtained by those skilled in the art without creative labor.
[0047] Figure 1 is a schematic diagram of a time wheel system in the prior art;
[0048] Figure 2 is a schematic diagram of the working principle of a time wheel in the prior art;
[0049] Figure 3 is a working flowchart of a time wheel in the prior art;
[0050] Figure 4 is a schematic diagram of a timeout processing device in an embodiment;
[0051] Figure 5 a schematic diagram of a time wheel unit in one embodiment;
[0052] Figure 6 a flow chart of a time out task storage step in one embodiment;
[0053] Figure 7 a schematic diagram of a time out task processing in one embodiment;
[0054] Figure 8 a flow chart of an output step of a time out task in one embodiment;
[0055] Figure 9 a flow chart of a time out task processing in one embodiment;
[0056] Figure 10 a schematic diagram of an internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0057] In order to make the objects, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and should not be used to limit the present application.
[0058] It should be noted that the terms "comprising" and "having" and any variations thereof used herein are intended to cover non-exclusive inclusion. The term "a plurality of" used herein refers to two or more.
[0059] In combination Figure 1 as shown, Figure 1 a schematic diagram of a time wheel system in a conventional technology, in this embodiment, time is divided into a plurality of slots, each slot represents a time interval, and a timing task is allocated to a corresponding slot according to a time out time, and then the expired timing task is triggered to output according to the time slot scale as time goes on. If the time out time of the task exceeds a time wheel period, it can be managed by a multi-layer time wheel structure. Higher level time wheels manage longer time out times, and when a lower level time wheel turns a full circle, it triggers the previous layer time wheel to advance one scale, and the high level time wheel triggers the expired task by time wheel degradation to improve the timing accuracy.
[0060] The slot scale division of the conventional time wheel system can be combined Figure 1 as shown: the time slot of each time wheel corresponds to the waiting time scale of the task, and the slot scale corresponding to the slot of the large time wheel is the sum of the slot scales of all the slots of the small time wheel. For example, Figure 1As shown, the first layer time wheel slot scale is 10 ms, and there are 8 slots in total, so the second layer time wheel slot scale is 80 ms. The third layer time wheel slot scale is 640 ms according to the same principle.
[0061] The timing task storage of the traditional time wheel system: input the timing task, and select the corresponding time wheel according to the waiting time. If the waiting time is less than 80 ms, select the first layer time wheel; if the waiting time is greater than or equal to 80 ms and less than 640 ms, select the second layer time wheel; and if the waiting time is greater than or equal to 640 ms and less than 5120 ms, select the third layer time wheel. Then, the waiting time is used to round the slot scale of the selected time wheel, and the number of slot scales that the current time axis needs to advance is calculated to store the timing task. In this way, the slot selection of the time wheel will be constantly reused as the time axis advances.
[0062] The timeout task output of the traditional time wheel system: according to the advancement of the time axis, at the integer multiple of 10 ms, the timeout output of the timing task stored in the corresponding slot of the first layer time wheel is triggered; when the time axis is the integer multiple of 80 ms, the timeout output of the timing task stored in the corresponding slot of the second layer time wheel is triggered; when the time axis is the integer multiple of 640 ms, the timeout output of the timing task stored in the corresponding slot of the third layer time wheel is triggered. Since the higher the level of the time wheel, the larger the storage time range and the lower the slot precision. In order to improve the timing precision of the time wheel, for the tasks that have not really timed out, the time wheel will be downgraded and stored in the adjacent small time wheel for further timing processing.
[0063] In combination Figure 2 As shown, Figure 2 is a schematic diagram of the working principle of the time wheel in the prior art. In this embodiment, the time wheel access example includes:
[0064] 1. When the time axis is 0 ms, the timing task with a waiting time greater than or equal to 80 ms and less than 160 ms is stored in slot 1 of the second layer time wheel.
[0065] 2. When the time axis is 20 ms, the timing task with a waiting time of 60 ms is stored in slot 0 of the first layer time wheel.
[0066] 3. When the time axis is 80 ms, the task stored in slot 0 of the first layer time wheel is triggered to output, the tasks with a waiting time greater than or equal to 80 ms and less than 90 ms in slot of the second layer time wheel are triggered to output, and the tasks with a waiting time greater than or equal to 90 ms and less than 160 ms are downgraded to the first layer time wheel for further timing storage.
[0067] In combination Figure 3 As shown, Figure 3For the working flow chart of the time wheel in the traditional technology, in this embodiment, according to the advancement of the time axis, the time-out output moment of the second layer time wheel slot is the same as the time-out output moment of the first layer time wheel slot, and the time-out output moment of the third layer time wheel slot is the same as the time-out output moment of the first layer and the second layer time wheel slot. The simultaneous arrival of the time-out time of the multiple layers of time wheels and the moment triggered simultaneously will introduce conflicts in the processing process. The conflicts at least include:
[0068] 1. The first layer time wheel enqueue and dequeue exist conflicts, for example, for the same slot, at a certain moment, there is both enqueue and dequeue.
[0069] 2. The first layer time wheel dequeue and the second layer time wheel enqueue exist conflicts.
[0070] 3. The first layer time wheel, the second layer time wheel and the third layer time wheel exist dequeue conflicts when they are simultaneously dequeued, that is, if the serial processing of the time wheels is performed, since there may be tasks in the high layer time wheel that need to be timed down by the time wheel, the tasks that have timed out in the higher layer time wheel cannot be output in time; if parallel processing is performed, the tasks that have timed out in the high layer time wheel are output first, and then the tasks that need to be timed down by the time wheel are hung to the small time wheel for continued timing processing, which increases the complexity of the processing, and the more the time wheels, the more complex the determination conditions.
[0071] In order to solve at least one of the above technical problems, the present application provides a time-out time processing device, which combines Figure 4 As shown in the figure, the time-out time processing device includes a time wheel unit and a time-out control unit. The time wheel unit includes multiple layers of time wheels, and the time-out control unit is configured to determine a target slot based on the output time of a time-out task and the time wheel unit, and perform time-out control on the time-out task.
[0072] As shown in Figure 5 As shown in Figure 5 For a schematic diagram of the time wheel unit in an embodiment, the time wheel unit includes X layers of time wheel slots, each slot of the same layer of time wheels represents the same time interval, and the number of time wheel slots of adjacent two layers and the time interval satisfy the following conditions:
[0073]
[0074] Among them, is the number of slots of the kth layer of time wheels, is the time interval represented by a slot of the kth layer of time wheels, is the time interval represented by a slot of the k+1th layer of time wheels, k is a positive integer between 1 and X-1, and X is a positive integer greater than or equal to 1.
[0075] CombiningFigure 5 as shown, Figure 5 In the time wheel unit shown, one slot is added to each layer of time wheel except the last layer of time wheel. In adjacent two layers of time wheel, the time interval represented by each slot of the higher layer of time wheel is equal to the time interval represented by each slot of the lower layer of time wheel multiplied by the number of slots of the lower layer of time wheel minus 1. Wherein Figure 5 The first layer of time wheel includes 9 slots, each slot representing a time interval of 10 ms, the second layer of time wheel includes 9 slots, each slot representing a time interval of 80 ms, and the third layer of time wheel includes 8 slots, each slot representing a time interval of 640 ms.
[0076] The above timeout processing device, since the first layer of time wheel to the X-1 layer of time wheel are all increased by one slot, and combined Figure 5 The output time of the timeout task corresponding to the second slot in the first layer of time wheel is 0 ms to 10 ms, the output time of the timeout task corresponding to the third slot is 10 ms to 20 ms, and so on. This ensures that when each slot in the first layer of time wheel is triggered, the timeout task stored in the slot has already timed out, and when there is a new input timeout task, since it has not timed out, it will not be stored in the triggered output timeout task slot, so that the output of the timeout task in the first layer of time wheel and the input of the timeout task are located in different slots, solving the first conflict, i.e. the conflict between the first layer of time wheel enqueue and dequeue.
[0077] In some optional embodiments, the timeout control unit is specifically configured to: determine the current time wheel slot corresponding to the timeout task according to the current time of receiving the timeout task, the output time of the timeout task, and the time interval represented by each layer of time wheel, and write the timeout task into the current time wheel slot; determine whether the current time wheel slot is a first layer of time wheel slot, if yes, read and output the timeout task when the trigger time of the current time wheel slot arrives; if not, read the timeout task when the trigger time of the current time wheel slot arrives, and downgrade, determine the target slot after downgrading according to the current slot of the time wheel after downgrading and the current remaining waiting time of the timeout task, write the timeout task into the target slot after downgrading, read the timeout task when the trigger time of the target slot after downgrading arrives, and downgrade again until the first layer of time wheel slot is reached, read and output the timeout task when the trigger time of the target slot of the first layer of time wheel arrives.
[0078] The control of the timeout control unit mainly includes two aspects: storage of new timeout tasks and output of timeout tasks.
[0079] The storage of timeout tasks mainly involves: determining the current time wheel slot corresponding to the timeout task based on the output time of the timeout task, the current time of receiving the timeout task, and the time interval represented by each time wheel layer, and then writing the timeout task into the current time wheel slot.
[0080] For timeout task output, if the timeout task is located in a slot of the first-level time wheel, the timeout task is read and output when the trigger time of that slot arrives. If the timeout task is not located in a slot of the first-level time wheel, the timeout task is demoted to the next level time wheel when the trigger time of that slot arrives. That is, at the same trigger time, only the first-level time wheel outputs the timeout task, and other time wheels demote the timeout task, and only to the adjacent next-level time wheel. This resolves the third conflict mentioned above, namely the dequeue conflict that occurs when the first, second, and third-level time wheels dequeue simultaneously.
[0081] For each input timeout task, first determine its corresponding current layer time wheel, then determine the current slot of the current layer time wheel and the first slot interval between the current time wheel slot of the timeout task and the current slot. In this way, the current time wheel slot of the timeout task can be determined based on the current slot and the first slot interval.
[0082] In some of these alternative embodiments, reference is made to Figure 6 As shown, Figure 6 This is a flowchart of the timeout task storage step in one embodiment. In this embodiment, the timeout control unit is specifically used for:
[0083] S602: Based on the current time and the time interval corresponding to each slot of each time wheel in each layer of the time wheel unit, determine the time of each current slot corresponding to each layer of the time wheel.
[0084] The current time is the time when the timeout task is received. For example, if the first timeout task with an output time of 92ms is received at 15ms, then the current time is 15ms.
[0085] The time interval corresponding to each slot of each time wheel in each layer of the time wheel unit is preset in the time wheel unit, combined with... Figure 5 As shown, the time interval corresponding to each slot in the first time wheel is 10ms, the time interval corresponding to each slot in the second time wheel is 80ms, and the time interval corresponding to each slot in the third time wheel is 640ms.
[0086] The time of each slot corresponding to each time wheel is the trigger time of the slot that is currently triggered in each time wheel.
[0087] In some optional embodiments, the timeout control unit is used to determine the current slot time using the following formula:
[0088]
[0089] wherein, denotes rounding down, cur_time is the current time at which the timeout task is received, is the time interval corresponding to each slot of the i-th layer time wheel.
[0090] For the convenience of understanding, combined with Figure 5 , assuming that the current time cur_time = 0ms-9ms, the current slot time slot_time of each layer time wheel is 0ms. Assuming that the current time cur_time = 10ms-19ms, the current slot time slot_time of the first layer time wheel is 10ms, and the current slot time slot_time of the other layer time wheels is 0ms. Assuming that the current time cur_time = 80ms-89ms, the current slot time slot_time of the first layer time wheel is 80ms, the current slot time slot_time of the first layer time wheel is 80ms, and the current slot time slot_time of the third layer time wheel is 0ms.
[0091] S604: According to the output time of the timeout task, the current slot time of each layer time wheel, and the time interval of each layer time wheel in the time wheel unit, the current layer time wheel corresponding to the timeout task is determined.
[0092] The current layer time wheel is the time wheel in which the newly input timeout task needs to be stored, which is determined based on the output time of the timeout task, the current slot time of each layer time wheel, and the time interval of each layer time wheel in the time wheel unit. For example, the difference between the output time of the timeout task and the current slot time of each layer time wheel can be calculated, and then the current layer time wheel is determined based on the difference and the time interval of each layer time wheel in the time wheel unit.
[0093] It should be noted that the calculation of the current slot time of each layer time wheel and the calculation of the difference between the output time of the timeout task and the current slot time of each layer time wheel can be parallel computing to improve processing efficiency.
[0094] In some optional embodiments, the timeout control unit is specifically configured to determine the current layer time wheel by:
[0095] If the condition is met, the current layer time wheel is the first layer time wheel;
[0096] If the condition is met, and the condition is not met, the current layer time wheel is the second layer time wheel;
[0097] If condition is met, and condition is not met, i is a positive integer between 3 and X, then the current layer time wheel is the i-th layer time wheel.
[0098] wherein, is the time interval corresponding to each slot of the current layer time wheel corresponding to the timeout task, is the number of slots corresponding to the current layer time wheel corresponding to the timeout task, send_time is the output time of the timeout task, is the current slot time of the i-th layer time wheel.
[0099] In some optional embodiments, it can be determined whether the timeout task meets the time wheel selection condition corresponding to the first layer time wheel first. If it does, the first layer time wheel is taken as the current layer time wheel. If it does not, it is determined whether the timeout task meets the time wheel selection condition corresponding to the second layer time wheel. If it does, the second layer time wheel is taken as the current layer time wheel. If it does not, the next layer time wheel is determined until the current layer time wheel is determined. Wherein it is determined whether the timeout task meets the time wheel selection condition, i.e. whether the difference between the output time of the timeout task and the current slot time of the layer time wheel meets the time wheel selection condition. Wherein the time wheel selection condition at this time only includes the maximum range. In combination with Figure 5 , for example, whether the first layer time wheel meets the time wheel selection condition (send_time-slot_time)<8 x10ms. If it does, the first layer time wheel is the current layer time wheel. Otherwise, it is determined whether the second layer time wheel meets the time wheel selection condition (send_time-slot_time)<9 x80ms. If it does, the second layer time wheel is the current layer time wheel. Otherwise, it is determined whether the third layer time wheel meets the time wheel selection condition (send_time-slot_time)<8 x640ms.
[0100] In some optional embodiments, it can be judged in parallel whether the timeout task meets the time wheel selection condition of the corresponding layer time wheel, and the time wheel selection condition includes a maximum range and a minimum range, wherein the maximum range is determined based on the slot interval corresponding to one slot in the corresponding layer time wheel, and the minimum range is determined based on the slot interval corresponding to one slot in the lower layer time wheel. For example, whether the first layer time wheel meets the time wheel selection condition (send_time-slot_time) <8 x10ms, whether the second layer time wheel meets the time wheel selection condition 8x10ms<= (send_time-slot_time) <9x80ms, and whether the third layer time wheel meets the time wheel selection condition 9x80ms<= (send_time-slot_time) <8x640ms.
[0101] In the above embodiments, the output time of the timeout task and the current slot time of the current layer time wheel are used to avoid conflicts. For example, still taking the timeout task with an output time of 92ms input at 15ms as an example, at 15ms, the current slot time of the first layer time wheel is 10ms, that is, the slot slot1 of the first layer time wheel is triggered to output the timeout task stored in the slot slot1. At this time, the difference between the output time of the timeout task and the current slot time of the current layer time wheel is 82ms, which does not meet the time wheel selection condition of the first layer time wheel and meets the time wheel selection condition of the second layer time wheel. Therefore, the second layer time wheel is the current layer time wheel, and the timeout task with an output time of 92ms is stored in the second layer time wheel. If the difference between the output time of the timeout task and the current time is used to determine the current layer time wheel, the difference is 77ms, which meets the time wheel selection condition of the first layer time wheel. Therefore, the timeout task is placed in the first layer time wheel, and based on the method below, it can be determined that the current slot is slot1 and the slot interval is 9. Therefore, the current time wheel slot is still slot1, so that slot1 exists both the input of the timeout task and the output of the timeout task, causing a conflict. However, by using the method of the present application, the difference between the output time of the timeout task and the current slot time of the current layer time wheel is used to determine the current layer time wheel, so that the above conflict does not occur.
[0102] S606: determining the current slot of the current layer time wheel according to the current time, the number of slots of the current layer time wheel, and the time interval corresponding to each slot of the current layer time wheel.
[0103] The current slot is the currently triggered slot in the current layer time wheel, which can be determined based on the current time, the number of slots of the current layer time wheel, and the time interval corresponding to each slot of the current layer time wheel.
[0104] In some optional embodiments, the timeout control unit is further configured to determine the current slot of the current layer time wheel corresponding to the timeout task according to the following formula:
[0105]
[0106] wherein, is rounded down, % is a remainder, cur_time is a current time at which the timeout task is received, is a time interval corresponding to each slot of the current layer time wheel corresponding to the timeout task, is a number of slots corresponding to the current layer time wheel corresponding to the timeout task, is a current slot of the current layer time wheel corresponding to the timeout task, i is a positive integer between 1 and X, and i represents the i-th layer time wheel in the time wheel unit.
[0107] In combination with Figure 5 , assuming that the current time cur_time=0ms-9ms, the current layer time wheel is the first layer time wheel, the corresponding current slot is slot0, the current layer time wheel is the second layer time wheel, the corresponding current slot is slot0, and the current layer time wheel is the third layer time wheel, the corresponding current slot is slot0; assuming that the current time cur_time=80ms-89ms, the current layer time wheel is the first layer time wheel, the corresponding current slot is slot8, the current layer time wheel is the second layer time wheel, the corresponding current slot is slot1, and the current layer time wheel is the third layer time wheel, the corresponding current slot is slot0.
[0108] S608: determining a first slot interval according to the output time of the timeout task and the current slot time of the current layer time wheel.
[0109] S610: determining a current time wheel slot according to the current slot and the first slot interval.
[0110] The first slot interval is a slot interval between the current slot and the current time wheel slot to be stored by the timeout task. In some optional embodiments, the timeout control unit is further configured to determine the first slot interval based on the following formula:
[0111]
[0112] wherein, send_time is the output time of the timeout task, is the current slot time of the i-th layer time wheel when is the current slot time of the current layer time wheel, i.e., the i-th layer time wheel, is a time interval corresponding to each slot of the i-th layer time wheel, is the first slot interval, represents rounding down.
[0113] For example, when the current layer time wheel is the first layer time wheel, the current time is cur_time = 0m-9ms, the current slot time slot_time = 0ms, the current slot is slot0, the output time of the timeout task is 6ms, and the first slot interval is (6-0) / 10 +1 = 1, and slot0+1 = slot1 is selected.
[0114] When the current layer time wheel is the second layer time wheel, the current time is cur_time = 0ms-79ms, the current slot time slot_time = 0ms, the current slot is slot0, the output time of the timeout task is send_time = 716ms, and the first slot interval is calculated as (716-0) / 80 = 8, and slot0+8 = slot8 is selected. The current time is cur_time = 560ms-639ms, the current slot time slot_time = 560ms, the current slot is slot7, the output time of the timeout task is send_time = 1276ms, and the slot interval is calculated as (1276-560) / 80 = 8, and slot7+8 = slot6 is selected.
[0115] When the current layer time wheel is the third layer time wheel, the current time is cur_time = 0m-639ms, the current slot time slot_time = 0ms, the current slot is slot0, the output time of the timeout task is send_time = 1286ms, and the first slot interval is calculated as (1286-0) / 640 = 2, and slot0+2 = slot2 is selected. The current time is cur_time = 640m-1279ms, the current slot time slot_time = 640ms, the current slot is slot1, the output time of the timeout task is send_time = 1286ms, and the first slot interval is calculated as (1286-640) / 640 = 1, and slot1+1 = slot2 is selected.
[0116] In order to explain the conflict solved by the above timeout task storage, the following is combined: Figure 7As shown in (a), taking 80 ms as an example of the time axis, the trigger slot of the first layer time wheel is slot 7, and the output time task with an output time of 70 ms-80 ms is output. When the time axis is 80 ms-90 ms, only the timeout task with an output time greater than 80 ms can be received, and these timeout tasks cannot be stored in slot 7, but can be stored in the slots other than slot 7 in the first layer time wheel and in the other layer time wheels, thereby avoiding the case that a slot in the first layer time wheel simultaneously outputs a timeout task and receives a timeout task.
[0117] In the above embodiment, when the current layer time wheel is the first layer time wheel, the first slot interval is the difference between the output time of the timeout task and the current time, which is rounded to the time interval corresponding to each slot in the current layer time wheel plus one. In this way, the timeout task output by each slot in the first layer time wheel has reached the output time, so there is no case that a slot in the first layer time wheel simultaneously outputs a timeout task and receives a timeout task.
[0118] When the current layer time wheel is not the first layer time wheel, the first slot interval is the difference between the output time of the timeout task and the current time, which is rounded to the time interval corresponding to each slot in the current layer time wheel. In this way, the timeout task output by each slot in the non-first layer time wheel is a degraded task, and the slot in the first layer time wheel to which the task is degraded is not the same as the slot in the first layer time wheel that currently outputs a timeout task.
[0119] In some optional embodiments, in combination with Figure 8 As shown in (a), Figure 8 is a flowchart of the output step of the timeout task in an embodiment. In this embodiment, the timeout control unit is specifically configured to:
[0120] S802: When degradation is needed, a second slot interval is determined according to the output time of the timeout task, the trigger time corresponding to the current time wheel slot, and the time interval corresponding to each slot in the current layer time wheel.
[0121] The trigger time corresponding to the current time wheel slot is the time when the current time wheel slot in the current layer time wheel is triggered, including the time when the timeout task is output (corresponding to the first layer time wheel) or the time when the timeout task is degraded (corresponding to the non-first layer time wheel).
[0122] The trigger time of the current time wheel slot is determined by the following formula:
[0123]
[0124] wherein, represents rounding down, The trigger time of the current time slot corresponding to the i-th layer time wheel, c_time is the current time determined based on the time axis, The time interval corresponding to each slot of the i-th layer time wheel.
[0125] That is, each current time on the time axis can be determined whether to trigger the corresponding slot of the corresponding layer time wheel. In some optional embodiments, the trigger time corresponding to each layer time wheel can be calculated in advance and stored. Subsequently, only when the trigger time is reached, the output or degradation of the timeout task of the slot corresponding to the layer time wheel can be triggered.
[0126] The second slot interval is the slot interval of the current slot of the next layer time wheel when the timeout task is degraded to the next layer time wheel. The trigger time corresponding to the current slot of the time wheel before degradation is also the trigger time of the time wheel after degradation.
[0127] In some optional embodiments, the timeout control unit is further configured to determine the second slot interval based on the following formula:
[0128]
[0129] Wherein, send_time is the output time of the timeout task, when The trigger time of the slot of the time wheel after degradation of the timeout task, The time interval corresponding to each slot of the i-th layer time wheel after degradation of the timeout task, The second slot interval, Indicates rounding down.
[0130] Specifically, assuming that the timeout task before degradation is in the second layer time wheel, the trigger time of the time wheel slot is slot_time=80ms, that is, the trigger time of the time wheel after degradation is slot_time=80ms, and the output time of the timeout task is send_time=86ms (the range of the second layer trigger is [80ms, 160)). The calculated second slot interval is (86-80) / 10 +1=1.
[0131] Specifically, assuming that the timeout task before degradation is in the second layer time wheel, the trigger time of the time wheel slot is slot_time=80ms, that is, the trigger time of the time wheel after degradation is slot_time=80ms, and the output time of the timeout task is send_time=156ms (the range of the second layer trigger is [80ms, 160)). The calculated second slot interval is (156-80) / 10 +1=8.
[0132] Specifically, assuming that the timeout task before degradation is in the third layer time wheel, the trigger time of the time wheel slot slot_time=560ms, that is, the trigger time of the degraded time wheel slot_time=560ms, the output time of the timeout task send_time=1276ms (the range of the third layer trigger is [720ms, 1280)), the calculated second slot interval is (1276-560) / 80 =8.
[0133] S804: determining the current slot of the degraded time wheel based on the trigger time of the current time wheel slot, the number of slots of the degraded time wheel, and the time interval corresponding to each slot of the degraded time wheel.
[0134] One of the timeout tasks needs to be degraded, which means that the timeout task is located in a non-first layer time wheel, and the current time wheel slot where the timeout task is located is triggered, that is, the trigger time of the current time wheel slot is reached, and the trigger time of the current time wheel slot is the slot time of the layer time wheel, and since the timeout task is degraded at the trigger time of the current time wheel slot, the trigger time of the current time wheel slot is the current time.
[0135] In some optional embodiments, the timeout control unit is further configured to determine the current slot by the following formula:
[0136]
[0137] wherein, is rounded down, % is a remainder, cur_time is the trigger time of the time wheel slot where the timeout task is located before degradation, is the time interval corresponding to each slot of the degraded time wheel, is the number of slots corresponding to the degraded time wheel, is the current slot of the degraded time wheel of the timeout task, i is a positive integer between 1 and X, i represents the i-th layer time wheel in the time wheel unit.
[0138] Continue to combine Figure 7 shown, the trigger time of the time wheel slot where the timeout task is located before degradation cur_time=80m, the timeout task is in the second layer time wheel before degradation, and is in the first layer time wheel after degradation, the time interval corresponding to each slot is 10ms, and the number of slots is 9, so the current slot of the first layer time wheel is slot8.
[0139] The trigger time of the time wheel slot position where the timeout task is located before being degraded is cur time = 560m, the timeout task is located in the third layer time wheel before being degraded, and is located in the second layer time wheel after being degraded. The time interval corresponding to each slot position is 80ms, and the number of slot positions is 9. Therefore, the current slot position of the second layer time wheel is slot7.
[0140] S806: determining the target slot position after degradation according to the current slot position of the degraded time wheel and the second slot interval.
[0141] S808: writing the timeout task into the target slot position after degradation.
[0142] After the current slot position and the second slot interval are determined, the target slot position, i.e., the target slot position in the degraded time wheel, can be determined based on the current slot position and the second slot interval, so as to write the timeout task into the target slot position.
[0143] For the convenience of understanding, continue to combine Figure 7 In (a) shown, when the trigger time is 80ms, the current time wheel slot position of the second layer time wheel is slot1. The timeout tasks of 80ms-160ms stored in the slot position are degraded. Since the trigger time is 80ms, the first layer time wheel outputs tasks of 70ms-80ms. Therefore, the tasks in the current time wheel slot position slot1 of the second layer time wheel can only be degraded to the first layer time wheel. Since the output times of the timeout tasks are different, the trigger time of the first layer time wheel is 80ms, and the time interval corresponding to each slot position is 10ms. Therefore, each second slot interval can be calculated, so that the tasks of 80-90ms are placed in the slot position slot0 of the first layer time wheel, the tasks of 90-100ms are placed in the slot position slot1 of the first layer time wheel, and so on. However, the tasks will not be placed in the slot position slot8 of the first layer time wheel. In this way, the above-mentioned second conflict, i.e., the conflict between the dequeuing of the first layer time wheel and the enqueuing of the second layer time wheel into the first layer time wheel, is solved. In the present application, the slot positions involved in the dequeuing of the first layer time wheel and the enqueuing of the second layer time wheel into the first layer time wheel do not overlap. Therefore, the above-mentioned conflict does not exist.
[0144] Continue to combine Figure 7In the middle (b), in the case of a trigger time of 560 ms, the first layer time wheel triggers an output of a timeout task with an output time of 550 ms-560 ms; the second layer time wheel triggers an output of a timeout task with an output time greater than or equal to 560 ms and less than 640 ms, which is degraded to the first layer time wheel; the third layer time wheel triggers an output of a timeout task with an output time greater than or equal to 640 ms and less than 1200 ms, which is degraded to the second layer time wheel. In this way, only the first layer time wheel outputs the timeout task, and the other layers of time wheels are degraded. This solves the third conflict described above, i.e., the conflict in the de-queueing when the first layer time wheel, the second layer time wheel, and the third layer time wheel are simultaneously dequeued. In addition, the timeout task in the slot involved in the degradation of the second layer time wheel has an output time greater than or equal to 560 ms and less than 640 ms, and the timeout task in the slot involved in the third layer has an output time greater than or equal to 640 ms and less than 1200 ms. In this way, the slots involved in the degradation of the third layer to the second layer and the degradation of the second layer to the first layer are different slots. This ensures that the output and input of the timeout task in the same layer involve different slots, thereby avoiding the conflict in which a slot in the same layer has both an output and an input.
[0145] For ease of understanding, the flowchart shown in FIG. 6 is taken as an example to illustrate the process of the timeout task in an embodiment. Figure 9 Figure 9 The flowchart shown in FIG. 6 is a flowchart of the process of the timeout task in an embodiment. In this embodiment, the process mainly includes the following steps:
[0146] First, a timeout task is received. The timeout task carries an output time (this time is the world time, absolute time). The receiving time of the timeout task is determined as the current time.
[0147] Second, the current slot time of each time wheel unit is determined, and the current layer time wheel is determined based on the output time of the timeout task, the current slot time of each time wheel, and the time interval corresponding to each time wheel.
[0148] Third, the current slot of the current layer time wheel is determined based on the current time of the received timeout task, the number of slots included in the current layer time wheel, and the time interval corresponding to each slot of the current layer time wheel.
[0149] Fourth, the first slot interval is determined based on the output time of the timeout task, the current slot time of the current layer time wheel, and the time interval corresponding to each slot of the current layer time wheel.
[0150] Fifth, the current time wheel slot is determined based on the current slot and the first slot interval, and then the timeout task is placed in the current time wheel slot.
[0151] The above is the process of storing the timeout task. The subsequent process is the process of outputting the timeout task, which includes:
[0152] Sixth, over time, the time slot corresponding to each time wheel triggers the output of the timeout task in the corresponding time slot of the corresponding time wheel. If the currently triggered time slot is in the first layer of time wheels, that is, the timeout task is in a time slot of the first layer of time wheels, and the trigger time is reached, the timeout task is directly output. If the currently triggered time slot is not in the first layer of time wheels, that is, the timeout task is not in a time slot of the first layer of time wheels, and the trigger time of the timeout task is reached, the timeout task is downgraded to the next layer of time wheels.
[0153] Seventh, when the timeout task needs to be downgraded to the next layer of time wheels, the current time slot corresponding to the next layer of time wheels needs to be determined. The calculation method is based on the trigger time of the timeout task (this is because the trigger time of the upper layer of time wheels is certainly the trigger time of the lower layer of time wheels, that is, the time slot time of these layers of time wheels is the same, such as 80ms, which is the trigger time of the first layer of time wheels and the trigger time of the second layer of time wheels), the number of time slots included in the next layer of time wheels, and the time interval corresponding to each time slot of the next layer of time wheels, to determine the current time slot of the next layer of time wheels.
[0154] Eighth, the second time slot interval is determined. The calculation method is based on the output time of the timeout task, the current time slot time of the current layer of time wheels (that is, the trigger time of the timeout task), and the time interval corresponding to each time slot of the current layer of time wheels, to determine the second time slot interval.
[0155] Ninth, according to the determined current time slot of the next layer of time wheels and the second time slot interval determined in the eighth step, the target time slot after the downgrade is determined, and then the timeout task is placed in the target time slot after the downgrade.
[0156] In the above embodiments, the above three conflicts are solved.
[0157] It should be understood that although each layer of steps in the flowchart involved in each of the above embodiments is displayed in sequence according to the direction of the arrow, these steps are not necessarily executed in sequence according to the direction of the arrow. Unless otherwise stated herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other sequences. Moreover, at least part of the steps in the flowchart involved in each of the above embodiments can include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these steps or stages is not necessarily sequential, but can be executed in rotation or alternation with at least part of other steps or steps or stages in other steps. It can be understood that the steps in different embodiments can be freely combined as needed, and various non-contradictory schemes formed by the combination are within the scope of protection of the present application.
[0158] Based on the same inventive concept, the embodiment of the present application also provides a time wheel system management device for implementing the time wheel system management method described above. The implementation scheme of the device for solving the problem is similar to the implementation scheme described in the above method, so the specific limitations in one or more time wheel system management device embodiments provided below can refer to the limitations of the time wheel system management method described above, which will not be repeated here.
[0159] In an exemplary embodiment, a chip is provided, comprising a memory and a processor, the memory storing a computer program, and the processor implementing the steps of the method in any one of the above embodiments when executing the computer program.
[0160] In an exemplary embodiment, a network interface card is provided, comprising a chip and a plurality of interfaces as in any one of the above embodiments, and the chip processes data or communicates externally through the interfaces.
[0161] In an exemplary embodiment, a computer device is provided, which can be a terminal, and its internal structure diagram can be as shown in Figure 10 The computer device comprises a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device comprises a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals in a wired or wireless manner. The wireless manner can be achieved through WIFI, mobile cellular network, near field communication (NFC) or other technologies. The computer program is executed by the processor to implement a time wheel system management method. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer overlaid on the display screen, or a key, trackball or touchpad arranged on the shell of the computer device, or an external keyboard, touchpad or mouse, etc.
[0162] Those skilled in the art can understand, Figure 10The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0163] In an embodiment, a computer device is also provided, including a memory and a processor, the memory storing a computer program, and the processor implementing the steps in the above method embodiments when executing the computer program.
[0164] In an embodiment, a computer readable storage medium is provided, storing a computer program, and the computer program implementing the steps in the above method embodiments when executed by a processor.
[0165] In an embodiment, a computer program product is provided, including a computer program, and the computer program implementing the steps in the above method embodiments when executed by a processor.
[0166] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when executed, can include the processes of the above-mentioned embodiment methods. Any reference to memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. The non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. The volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration but not limitation, the RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., without being limited thereto.
[0167] The technical features of the above embodiments can be combined in any manner. To make the description concise, all possible combinations of the technical features in the above embodiments are not described, but as long as the combinations of the technical features do not exist, they should be considered as the scope of the present application.
[0168] The above-described embodiments are merely illustrative of several embodiments of the present application, and the description is relatively specific and detailed, but should not be understood as a limitation on the scope of the patent. It should be noted that for those skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are all within the scope of the present application. Therefore, the scope of protection of the present application should be subject to the appended claims.
Claims
1. An expiration time processing apparatus characterized by comprising: The time wheel unit comprises X-layer time wheel slots, each slot of the same layer of time wheel represents the same time interval, and the number of adjacent two layers of time wheel slots and the time interval satisfy the following conditions: The timeout control unit is configured to determine a target slot based on a sending time of a timeout task and the time wheel unit, and perform timeout control on the timeout task. wherein, is the number of time wheel slots of the kth layer, is the time interval represented by one slot of the kth layer time wheel, is the time interval represented by one slot of the k+1th layer time wheel, k is a positive integer between 1 and X-1, and X is a positive integer greater than or equal to 1. The timeout control unit is specifically configured to: determine a current time wheel slot corresponding to the timeout task according to a current time of receiving the timeout task, an output time of the timeout task, and a time interval represented by each layer of time wheel, and write the timeout task into the current time wheel slot; determine whether the current time wheel slot is a first layer of time wheel slot, if yes, read and output the timeout task when a trigger time of the current time wheel slot is reached, if not, read out the timeout task when the trigger time of the current time wheel slot is reached, and perform degradation, determine a target slot after degradation according to a current slot of the time wheel after degradation and a current remaining waiting time of the timeout task, write the timeout task into the target slot after degradation, read out the timeout task when a trigger time of the target slot after degradation is reached, and perform again degradation until the first layer of time wheel slot is reached, and read and output the timeout task when a trigger time of the target slot of the first layer of time wheel is reached. The timeout control unit is specifically configured to:
2. The apparatus of claim 1, wherein, determine each current slot time corresponding to each layer of time wheel based on the current time and a time interval corresponding to each slot of each layer of time wheel in the time wheel unit; determine a current layer of time wheel corresponding to the timeout task according to an output time of the timeout task, each current slot time and a time interval of each layer of time wheel in the time wheel unit; determine a current slot of the current layer of time wheel according to the current time, a slot number of the current layer of time wheel and a time interval corresponding to each slot of the current layer of time wheel; determine a first slot interval according to an output time of the timeout task and a current slot time of the current layer of time wheel; determine the current time wheel slot according to the current slot and the first slot interval. The timeout control unit is specifically configured to determine the current layer of time wheel in the following manner:
3. The apparatus of claim 2, wherein, The timeout control unit is specifically configured to: If the condition is met then the current tier time wheel is a first tier time wheel; If the condition is met, and the condition is not met, the current tier time wheel is a second tier time wheel. If condition is met, and condition is not met, i is a positive integer between 3 and X, then the current tier time wheel is the i-th tier time wheel. wherein, a time interval corresponding to each slot of the current layer time wheel corresponding to the timeout task, a number of slots corresponding to the current layer time wheel corresponding to the timeout task, and send_time is an output time of the timeout task, the current slot time of the i-th layer time wheel.
4. The apparatus of claim 1, wherein, when degradation is needed, determine a second slot interval according to an output time of the timeout task, the trigger time corresponding to the current time wheel slot and a time interval corresponding to each slot of the current layer of time wheel; determine a current slot of the time wheel after degradation based on a trigger time of the current time wheel slot, a slot number of the time wheel after degradation and a time interval corresponding to each slot of the time wheel after degradation; determine the target slot after degradation according to the current slot of the time wheel after degradation and the second slot interval; write the timeout task into the target slot after degradation. The timeout control unit is further configured to determine the current slot in the following formula:
5. The apparatus of any one of claims 2 to 4, wherein, wherein, floor, % is a remainder; in cur_time is the current time receiving the timeout task, is the time interval corresponding to each slot of the current layer time wheel corresponding to the timeout task, is the number of slots corresponding to the current layer time wheel corresponding to the timeout task, is the current slot of the current layer time wheel corresponding to the timeout task; in cur_time is the trigger time of the time wheel slot where the timeout task is located before degradation, is the time interval corresponding to each slot of the degraded time wheel, is the number of slots corresponding to the degraded time wheel, is the current slot of the degraded time wheel of the timeout task, i is a positive integer between 1 and X, i represents the i-th layer time wheel in the time wheel unit.
6. The apparatus of any one of claims 2 to 4, wherein, The timeout control unit is configured to determine the current slot time according to the following formula: wherein, denotes rounding down, cur_time is the current time of receiving the timeout task, is the time interval corresponding to each slot of the i-th time wheel.
7. The apparatus of any one of claims 2 to 4, wherein, The timeout control unit is further configured to determine the first slot interval and the second slot interval according to the following formula: wherein the send_time is an output time of the timeout task, is a current slot time corresponding to the i-th time wheel, is a current slot time of the current time wheel, i.e., the i-th time wheel, is a time interval corresponding to each slot of the i-th time wheel, is a first slot interval, is a trigger time of a slot of a time wheel where the timeout task is located after degradation, is a time interval corresponding to each slot of the i-th time wheel where the timeout task is located after degradation, is a second slot interval, represents a floor operation.
8. The apparatus of claim 1, wherein, The trigger time of the current time wheel slot is determined according to the following formula: wherein, denotes rounding down, is the trigger time of the current time wheel slot corresponding to the i-th layer time wheel, and c_time is the current time determined based on the time axis, is the time interval corresponding to each slot of the i-th layer time wheel.
9. A chip comprising a memory and a processor, the memory storing a computer program, characterized in that, The chip comprises the timeout time processing device according to any one of claims 1 to 8.
10. A network interface card, comprising: The chip comprises the chip according to claim 9 and a multi-layer interface, The chip processes data or communicates externally through the interface.
11. A computer device, comprising: The network interface card according to claim 10 is used to process data or communicate externally.
Citation Information
Patent Citations
Realization system and method of electric layer protection of wavelength division equipment based on FPGA (Field Programmable Gate Array)
CN107734404A
Task timeout monitoring method, device, equipment and system and storage medium
CN112181614A