A method for detecting data pointer aging
Patent Information
- Application Number
- CN202210599567.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-30
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2042-05-30
AI Technical Summary
[0004]本发明要解决的技术问题是如何提供一种数据指针老化的检测方法,以解决现有的数据老化方法在处理数据比较多的时候会消耗大量的时间,并且在资源上会存在浪费的问题
[0021] The present invention proposes a method for detecting the aging of data pointers. The present invention first saves resources in space and uses bitmap to map data. The storage of one data uses 1 bit for management, which greatly saves resources. Therefore, when aging, , since the data of one address only has 1 bit to map, so the aging check takes very little time. When the number of pointers is 32,000, under a 500M system clock, 32,000 pointers can be aged in 100 cycles, which corresponds to an actual time of 200ns to complete all pointer checks.
Smart Images

Figure CN114911660B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of computer networks, and in particular relates to a method for detecting aging of data pointers. Background Art
[0002] At present, the data aging method of CN1581100A compares the difference between the system time, the cutoff value and the cutoff value of the aging object creation time with the aging time of the data to determine whether to age the aging object. This method consumes a lot of time when processing a lot of data, and there will be a waste of resources. Summary of the invention
[0003] 1. Technical issues to be resolved
[0004] The technical problem to be solved by the present invention is how to provide a method for detecting data pointer aging to solve the problem that the existing data aging method consumes a lot of time when processing a large amount of data and wastes resources.
[0005] (II) Technical solution
[0006] In order to solve the above technical problems, the present invention proposes a method for detecting data pointer aging, which includes setting three RAMs, namely, data RAM, management RAM and aging RAM;
[0007] Data is stored in data RAM, and the reading and writing of data RAM is managed by address. Another RAM is used to manage the address of this data RAM, which is called management RAM. Another RAM is used for aging, which is called aging RAM.
[0008] Assume that the data RAM is Mbit wide and the address depth is N=2 n RAM, n = x * y, high xbit represents the row, low ybit represents the column, then the management RAM bit width and address depth are set to 2 x bit and 2 y , the bit width and address depth of the aging RAM are set to 2 x bit and 2 y , the management RAM corresponds to the aging RAM one by one;
[0009] Each bit in the management RAM is used to indicate the data at the corresponding address of the data RAM, which is called the pointer of the data RAM. When initialized, the management RAM is all 0. When writing data to a certain address of the data RAM, 1 is written to the bit of the management RAM corresponding to the address. Writing 1 indicates that the address is occupied. When the pointer of a certain address of the data RAM is released, the values of the management RAM and aging RAM corresponding to the released address are changed from 1 to 0.
[0010] At the beginning of use, the status of the management RAM of the management data is updated to the aging RAM, and the status of the management RAM is refreshed to the aging RAM at every inspection time interval T. The refresh rule is: if 1 in the management RAM is written to the corresponding position of the aging RAM, if the corresponding position of the aging RAM is 0 at this time, it is directly updated to 1; if the corresponding position of the aging RAM is also 1 at this time, it is regarded that the pointer has aged, then an aging warning is reported and the aging pointer is also reported, and finally it is reflected at the software level in the form of an interrupt.
[0011] Furthermore, the data RAM is a RAM with a bit width of 512 bits and an address depth of 8192, so the bit width and depth of the data management RAM are set to 64 bits and 128, and the bit width and depth of the aging RAM are set to 64 bits and 128.
[0012] Furthermore, the management RAM records the usage status of the data RAM, and follows the usage from the front to the back when using the pointer.
[0013] Furthermore, a maximum time T from the use to the release of a pointer in a service using the data RAM is estimated, and the maximum time T is set as a check time interval for aging the RAM.
[0014] Furthermore, in a certain business scenario, the maximum time from the use to the release of a pointer is T=100us, so the check time interval of the aging RAM is set to 100us, that is, the management RAM of the management data is checked every 100us.
[0015] Furthermore, the number of idle pointers is counted and a waterline is set. When the number of idle pointers is less than or equal to the waterline, the timing of the aging time is started.
[0016] Further, the waterline is set to N-1 or N-2.
[0017] Furthermore, when a pointer to a certain address of the data RAM is requested and the aging time checkpoint has not been reached, the corresponding position of the management RAM will change from 0 to 1, and the value corresponding to the aging RAM position will not change.
[0018] Furthermore, when an interrupt is received, the actions taken include: resetting the time interval of the aging detection, re-changing the RAM of the hardware, or re-modifying the software code.
[0019] Furthermore, the aging process includes: first, the waterline of the aging configuration is reached, and the aging check time starts. When the first aging time detection point is reached, since the initialized aging ram contains all 0s, the first time is to import the data in the management ram into the aging ram. In the subsequent time, as long as the pointer is released, the 1 at the corresponding position of the management ram and the aging ram will be modified to 0. When the aging time is reached, when the content in the management ram is imported into the aging ram, it will be checked whether the import value of each position and the value before import are both 1. If the condition is met, an alarm will be issued and the report will be interrupted.
[0020] (III) Beneficial effects
[0021] The present invention proposes a method for detecting data pointer aging. The present invention first saves resources in space, uses bitmap to map data, and uses 1 bit to manage the storage of 1 data, which greatly saves resources. Therefore, when aging is performed, since the data of 1 address is only mapped by 1 bit, the time consumed in the aging check is very small. When the number of pointers is 32,000, under the system clock of 500M, 100 cycles can complete the aging of 32,000 pointers, corresponding to the actual time of 200ns to complete the inspection of all pointers once. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 A diagram showing the pointer bitmap status at a certain moment after the pointer is applied / the first aging bitmap is imported into the pointer usage status;
[0023] Figure 2 It is a schematic diagram of the application pointer;
[0024] Figure 3 This is a schematic diagram of releasing the pointer;
[0025] Figure 4 This is a flowchart of pointer aging. DETAILED DESCRIPTION
[0026] In order to make the purpose, content and advantages of the present invention more clear, the specific implementation methods of the present invention are further described in detail below in conjunction with the drawings and examples.
[0027] The present invention proposes a method for detecting data pointer aging, which includes setting three RAMs, namely, data RAM, management RAM and aging RAM;
[0028] Data is stored in data RAM, and the reading and writing of data RAM is managed by address. Another RAM is used to manage the address of this data RAM, which is called management RAM. Another RAM is used for aging, which is called aging RAM.
[0029] Assume that the data RAM is Mbit wide and the address depth is N=2 n RAM, n = x * y, high xbit represents the row, low ybit represents the column, then the management RAM bit width and address depth are set to 2 x bit and 2 y , the bit width and address depth of the aging RAM are set to 2 x bit and 2 y , the management RAM corresponds to the aging RAM one by one;
[0030] Each bit in the management RAM is used to indicate the data at the corresponding address of the data RAM, which is called the pointer of the data RAM. When initialized, the management RAM is all 0. When writing data to a certain address of the data RAM, 1 is written to the bit of the management RAM corresponding to the address. Writing 1 indicates that the address is occupied. When the pointer of a certain address of the data RAM is released, the values of the management RAM and aging RAM corresponding to the released address are changed from 1 to 0.
[0031] At the beginning of use, the status of the management RAM of the management data is updated to the aging RAM, and the status of the management RAM is refreshed to the aging RAM at every inspection time interval T. The refresh rule is: if 1 in the management RAM is written to the corresponding position of the aging RAM, if the corresponding position of the aging RAM is 0 at this time, it is directly updated to 1; if the corresponding position of the aging RAM is also 1 at this time, it is regarded that the pointer has aged, then an aging warning is reported and the aging pointer is also reported, and finally it is reflected at the software level in the form of an interrupt.
[0032] Furthermore, the data RAM is a RAM with a bit width of 512 bits and an address depth of 8192, so the bit width and depth of the data management RAM are set to 64 bits and 128, and the bit width and depth of the aging RAM are set to 64 bits and 128.
[0033] Furthermore, the management RAM records the usage status of the data RAM, and follows the usage from the front to the back when using the pointer.
[0034] Furthermore, a maximum time T from the use to the release of a pointer in a service using the data RAM is estimated, and the maximum time T is set as a check time interval for aging the RAM.
[0035] Furthermore, in a certain business scenario, the maximum time from the use to the release of a pointer is T=100us, so the check time interval of the aging RAM is set to 100us, that is, the management RAM of the management data is checked every 100us.
[0036] Furthermore, the number of idle pointers is counted and a waterline is set. When the number of idle pointers is less than or equal to the waterline, the timing of the aging time is started.
[0037] Further, the waterline is set to N-1 or N-2.
[0038] Furthermore, when a pointer to a certain address of the data RAM is requested and the aging time checkpoint has not been reached, the corresponding position of the management RAM will change from 0 to 1, and the value corresponding to the aging RAM position will not change.
[0039] Furthermore, when an interrupt is received, the actions taken include: resetting the time interval of the aging detection, re-changing the RAM of the hardware, or re-modifying the software code.
[0040] Furthermore, the aging process includes: first, the waterline of the aging configuration is reached, and the aging check time starts. When the first aging time detection point is reached, since the initialized aging ram contains all 0s, the first time is to import the data in the management ram into the aging ram. In the subsequent time, as long as the pointer is released, the 1 at the corresponding position of the management ram and the aging ram will be modified to 0. When the aging time is reached, when the content in the management ram is imported into the aging ram, it will be checked whether the import value of each position and the value before import are both 1. If the condition is met, an alarm will be issued and the report will be interrupted.
[0041] The purpose of the present invention is to provide a pointer aging method for a data storage method using a pointer as an index, which method can save resources and consumes less time.
[0042] First, set up three RAMs, namely data RAM, management RAM and aging RAM; data is stored in the data RAM, and the reading and writing of the data RAM needs to be managed using addresses. Here, another RAM is used to manage the address of this data RAM, which is called management RAM or pointer RAM. There is also another RAM for aging RAM, called aging RAM.
[0043] Assuming that the data RAM is a RAM with a bit width of 512 bits and an address depth of 8192, the bit width and depth of the data management RAM are set to 64 bits and 128 from the perspective of width and depth. Since 13 bits can cover the addresses 0-8191 of the data RAM, the 13 bits can be divided into the upper 6 bits and the lower 7 bits. The upper 6 bits represent the rows and the lower 7 bits represent the columns, which corresponds to the 64 bits and 128 of the management RAM. Therefore, each bit in 0-8191 in the management RAM can indicate the data corresponding to the data RAM address, which is called the pointer of the data RAM. When writing data to a certain address of the data RAM, write 1 to the bit of the management RAM corresponding to the address. When initialized, the management RAM is all 0, and writing 1 indicates that the address has been occupied; when the pointer of a certain address of the data RAM is released, the values of the management RAM and the aging RAM corresponding to the released address are changed from 1 to 0, and writing 0 indicates that the address has been released or is idle. For example, when writing data to address 0 of the data RAM, 1 is written to the first row and first column of the management RAM. When writing data to address 6 of the data RAM, 1 is written to the first row and seventh column of the management RAM. Therefore, the management RAM can record the usage status of the pointer of the data RAM. When using the pointer, follow the use from the front to the back, so that each pointer will be used.
[0044] Pointer aging means that after a period of time after the pointer is used, if the pointer has not been released, it can be considered that the pointer is aged. In layman's terms, the pointer has been "forgotten" by the user of the RAM and will not be released. This article describes how to effectively and quickly detect aged pointers. The present invention sets up another RAM for aging RAM, which is the same size as the RAM for managing data pointers, with a bit width and depth of 64 bits and 128 bits.
[0045] In order to effectively and accurately detect aged pointers, we also need to understand the business scenarios in which data RAM is used, estimate the maximum time T from the use of pointers to their release in the business, and set the maximum time T as the check interval for aged RAM. Assuming that the maximum time T from the use of pointers to their release in a business scenario is 100us, we set the check interval for aged RAM to 100us, that is, check the management RAM for management data every 100us.
[0046] When starting to use, the state of the management RAM of the management data is updated to the aging RAM, and the state is 0, 1. It is also necessary to pay attention to when to judge the start of use. Generally, there will be a statistics of the number of idle pointers, so we set the watermark here. In this example, the number of pointers is 8192, so we can set the watermark to 8191 or 8190. When the number of idle pointers is less than or equal to this value, it means that the RAM has started to work and the aging time can be started.
[0047] After the timing starts, the state of the management RAM is refreshed to the aging RAM every time interval T = 100us. The rule is that if 1 in the management RAM is written to the corresponding position of the aging RAM, if the corresponding position of the aging RAM is 0 at this time, it is directly updated to 1; if the corresponding position of the aging RAM is also 1 at this time, it is considered that the pointer has aged, because when the pointer is released, the corresponding positions of the management RAM and the aging RAM will be cleared to 0. For example, assuming that when the status is updated, the position in the first row and second column of the aging RAM is 0, and the position in the first row and second column of the management RAM is 1, then the first row and second column of the aging RAM is updated to 1. When the aging RAM is updated again after 100us, it is found that the first row and second column of the management RAM is still 1 at this time, and the first row and second column of the aging RAM is still 1, which means that the pointer has been in an unreleased state. If the pointer has been released, the position of the aging RAM will be 0. In addition, when 1 is written to the aging RAM, if the corresponding position of the aging RAM is 1, an aging warning is reported and the aging pointer is also reported, which is finally reflected at the software level in the form of an interrupt. The software personnel analyzed how to deal with the interrupt. It is possible that the time interval of the aging detection is too small, and the time interval of the aging detection needs to be reset. It is also possible that the physical area of the RAM is damaged. In this case, the hardware RAM may need to be replaced, or there is a bug in the software code that causes a pointer to fail to be released, and the software code needs to be modified.
[0048] When a pointer to a certain address in the data RAM is requested and the aging time checkpoint has not been reached, the corresponding position in the management RAM will change from 0 to 1, and the value corresponding to the aging RAM position will not change;
[0049] When the pointer of a certain address of the data RAM is released, the values of the management RAM and the aging RAM corresponding to the released address are changed from 1 to 0.
[0050] Figure 2 It shows that when a pointer at a certain position at a certain moment is applied and the aging time checkpoint has not been reached, the corresponding position of the management RAM will change from 0 to 1, and the value corresponding to the aging RAM position will not change.
[0051] Figure 3 It shows the status of management RAM and aging RAM at a certain moment. Releasing the pointer will change the values of management RAM and aging RAM at the release position from 1 to 0.
[0052] Figure 4 The flowchart briefly shows the aging process. First, it reaches the waterline of the aging configuration and the aging check time starts. When it reaches the first aging time detection point, since the initialized aging ram contains all 0s, the first time is just to import the data in the management ram into the aging ram. In the subsequent time, as long as the pointer is released, the 1 in the corresponding position of the management ram and the aging ram will be changed to 0. When the aging time is reached, when the content in the management ram is imported into the aging ram, it will check whether the imported value of each position and the value before the import are both 1. If the condition is met, an alarm will be issued and the report will be interrupted.
[0053] The present invention first saves resources in space, uses bitmap to map data, and uses 1 bit to manage the storage of 1 data, which greatly saves resources. Therefore, when aging is performed, since the data of 1 address is only mapped by 1 bit, the time consumed in aging inspection is very small. When the number of pointers is 32,000, under the system clock of 500M, 100 cycles can complete the aging of 32,000 pointers, corresponding to the actual time of 200ns to complete the inspection of all pointers once.
[0054] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for detecting data pointer aging, characterized in that: The method includes setting three RAMs, namely, data RAM, management RAM and aging RAM; Data is stored in data RAM, and the reading and writing of data RAM is managed by address. Another RAM is used to manage the address of this data RAM, which is called management RAM. Another RAM is used for aging, which is called aging RAM. Assume that the data RAM is Mbit wide and the address depth is N=2 n RAM, n = x * y, high xbit represents the row, low ybit represents the column, then the management RAM bit width and address depth are set to 2 x bit and 2 y , the bit width and address depth of the aging RAM are set to 2 x bit and 2 y , the management RAM corresponds to the aging RAM one by one; Each bit in the management RAM is used to indicate the data at the corresponding address of the data RAM, which is called the pointer of the data RAM. When initialized, the management RAM is all 0. When writing data to a certain address of the data RAM, 1 is written to the bit of the management RAM corresponding to the address. Writing 1 indicates that the address is occupied. When the pointer of a certain address of the data RAM is released, the values of the management RAM and aging RAM corresponding to the released address are changed from 1 to 0. At the beginning of use, the state of the management RAM of the management data is updated to the aging RAM, and the state of the management RAM is refreshed to the aging RAM at every inspection time interval T. The refresh rule is: if 1 in the management RAM is written to the corresponding position aging RAM, if the corresponding position of the aging RAM is 0 at this time, it is directly updated to 1; if the corresponding position of the aging RAM is also 1 at this time, it is considered that the pointer has aged, and an aging warning is reported and the aging pointer is also reported, and finally reflected at the software level in the form of an interrupt; in, The aging process includes: first, the aging configuration waterline is reached, and the aging check time starts. When the first aging time detection point is reached, since the initialized aging ram contains all 0s, the first time is to import the data in the management ram into the aging ram. In the subsequent time, as long as the pointer is released, the 1 in the corresponding position of the management ram and the aging ram will be modified to 0. When the aging time is reached, when the content in the management ram is imported into the aging ram, it will check whether the import value of each position and the value before import are both 1. If they are all 1, an alarm will be issued and the report will be interrupted.
2. The method for detecting data pointer aging according to claim 1, characterized in that: The data RAM is a RAM with a bit width of 512 bits and an address depth of 8192. The bit width and depth of the data management RAM are set to 64 bits and 128, and the bit width and depth of the aging RAM are set to 64 bits and 128.
3. The method for detecting data pointer aging according to claim 1, characterized in that: The management RAM records the usage status of the data RAM, and follows the usage from front to back when using the pointer.
4. The method for detecting data pointer aging according to any one of claims 1 to 3, characterized in that: Estimate the maximum time T from the use to the release of the pointer in the business using the data RAM, and set the maximum time T as the inspection time interval of the aging RAM.
5. The method for detecting data pointer aging as claimed in claim 4, characterized in that: In a certain business scenario, the maximum time from the use to the release of a pointer is T = 100us, so the inspection time interval of the aging RAM is set to 100us, that is, the management RAM of the management data is checked every 100us.
6. The method for detecting data pointer aging as claimed in claim 4, characterized in that: Count the number of idle pointers and set a watermark. When the number of idle pointers is less than or equal to the watermark, start the aging time.
7. The method for detecting data pointer aging as claimed in claim 6, characterized in that: The waterline is set to N-1 or N-2.
8. The method for detecting data pointer aging as claimed in claim 6, characterized in that: When a pointer to a certain address of the data RAM is requested and the aging time checkpoint has not been reached, the corresponding position of the management RAM will change from 0 to 1, and the value corresponding to the aging RAM position will not change.
9. The method for detecting data pointer aging as claimed in claim 6, characterized in that: When an interrupt is received, the actions taken include: resetting the time interval of the aging detection, re-changing the RAM of the hardware, or re-modifying the software code.
Citation Information
Patent Citations
Data aging method for network processor
CN1581100A
A data aging processing method
CN101170551A
Cache management method and device
CN102638412A
Method and device for increasing aging efficiency of large batches of network flow tables
CN106789697A
Recycling items in a network device
US7716380B1
