Data request processing method and device and electronic equipment

By using the TBQ data structure and head and tail pointer management mechanism in the request cache area, the cache and management of missed data requests are realized, the problems of processor pauses and low cache space utilization are solved, and the system performance and cache space utilization are improved. .

CN118820131APending Publication Date: 2024-10-22BEIJING T-HEAD INFORMATION TECHNOLOGY CO LTD +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410889169.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-03
Publication Date
2024-10-22

AI Technical Summary

Technical Problem

In computer data operations, missed data requests need to wait for the previous request to be completely resolved, causing processor pauses or blocking, affecting system performance. Existing technologies cannot effectively utilize cache space, resulting in low cache space utilization and data request conflicts.

Method used

By adopting the TBQ (Table and Queue) data structure in the request cache area, and using the head pointer and tail pointer to manage read requests and write requests, the out-of-order writing of read requests and the sequential writing of write requests are realized to avoid processor pauses and blocking. , and improve cache space utilization.

Benefits of technology

It realizes the caching and management of missed data requests, avoids processor pauses and blocking, improves the overall system performance and cache space utilization, and solves the problem of data request conflicts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118820131A_ABST
    Figure CN118820131A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a data request processing method and device and electronic equipment. According to the embodiment of the invention, the method comprises the steps: obtaining a to-be-cached data request, responding to the to-be-cached data request as a to-be-cached read request, taking a corresponding pointer of a request cache region as a starting point, searching a writable position in the request cache region, writing the to-be-cached read request into the searched writable position, and caching the to-be-cached read request. And in response to the condition that the to-be-cached data request is a to-be-cached write request and the position pointed by the head pointer of the request cache region is a writable position, writing the to-be-cached write request to the position pointed by the head pointer. Therefore, according to the embodiment of the invention, the cache and management of the missed data requests can be realized through the request cache region, and the request cache region can also realize out-of-order write-in of the read requests and sequential write-in of the write requests, so that the space utilization rate of the request cache region is improved, and meanwhile, the problem of data request conflict is solved; and the overall performance of the system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and more specifically, to a data request processing method, device and electronic device. Background Art

[0002] In computer data operations, if data requests are not processed, new data requests will have to wait until the previous missed data requests are completely resolved before they can be accepted. This forces the new missed data requests to wait, which may cause the processor to pause or block, affecting the overall performance of the system. Summary of the invention

[0003] In view of this, an embodiment of the present invention provides a data request processing method, device and electronic device, so as to realize caching and management of missed data requests through a request cache area, avoid processor stalls or blocking, and the request cache area of ​​the present embodiment can also realize out-of-order writing of read requests and sequential writing of write requests, thereby improving the space utilization of the request cache area, and at the same time solving the write request conflict problem, thereby improving the overall performance of the system.

[0004] In a first aspect, an embodiment of the present invention provides a data request processing method, the method comprising:

[0005] Get the request for data to be cached;

[0006] In response to the request for data to be cached being a read request to be cached, searching for a writable position in the requested cache area with a corresponding pointer of the requested cache area as a starting point;

[0007] Writing the to-be-cached read request into the searched writable location;

[0008] In response to the to-be-cached data request being a to-be-cached write request, and the position pointed to by the head pointer of the request cache area being a writable position, the to-be-cached write request is written to the position pointed to by the head pointer.

[0009] Further, writing the to-be-cached read request to the searched writable location includes:

[0010] The read request to be cached is written to the first writable location found.

[0011] Further, writing the to-be-cached read request to the searched writable location includes:

[0012] Obtaining an operation address of the read request to be cached;

[0013] Obtaining an operation address of a cached write request in the request cache area;

[0014] In response to the operation address of the to-be-cached read request being different from the operation addresses of each of the cached write requests, the to-be-cached read request is written to the searched writable location.

[0015] Further, writing the to-be-cached write request to the location pointed to by the head pointer includes:

[0016] Obtaining an operation address of the write request to be cached;

[0017] Obtaining an operation address of a cached read request in the request cache area;

[0018] In response to the operation address of the to-be-cached write request being different from the operation addresses of each of the cached read requests, the to-be-cached write request is written to the writable location pointed to by the head pointer.

[0019] Furthermore, the method further comprises:

[0020] Taking the corresponding pointer of the request cache area as a starting point, searching the request cache area for at least one read request;

[0021] The searched read request is outputted.

[0022] Further, the outputting the searched read request includes:

[0023] Output the first read request found; or

[0024] Synchronously output multiple read requests found.

[0025] Furthermore, the method further comprises:

[0026] Taking the tail pointer of the request cache area as a starting point, searching the request cache area for a write request;

[0027] Output the first write request found.

[0028] Further, the method comprises:

[0029] In response to the head pointer pointing to a non-writable location, the head pointer is updated until the updated head pointer points to a writable location.

[0030] Furthermore, the method further comprises:

[0031] In response to the tail pointer of the request cache area pointing to a writable position, the tail pointer is updated until the updated tail pointer points to a non-writable position.

[0032] Furthermore, the tail pointer and the head pointer of the request cache area point to the same position when the request cache area is empty or full.

[0033] In a second aspect, an embodiment of the present invention provides a data request processing device, the device comprising:

[0034] A request obtaining unit, configured to obtain a request for data to be cached;

[0035] a position search unit configured to, in response to the request for data to be cached being a read request to be cached, search for a writable position in the requested cache area with a corresponding pointer of the requested cache area as a starting point;

[0036] A first writing unit, configured to write the to-be-cached read request into the searched writable position;

[0037] The second writing unit is configured to write the cached write request to the location pointed to by the head pointer in response to the cached data request being a cached write request and the location pointed to by the head pointer of the request cache area being a writable location.

[0038] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a memory and a processor, wherein the memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method as described above.

[0039] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described above is implemented.

[0040] In a fifth aspect, an embodiment of the present invention provides a computer program product, which, when executed on a computer, enables the computer to execute the method described above.

[0041] The embodiment of the present invention discloses a data request processing method, device and electronic device. The embodiment of the present invention obtains a data request to be cached, responds to the data request to be cached as a read request to be cached, takes the corresponding pointer of the request cache area as the starting point, searches for a writable position in the request cache area, writes the read request to be cached to the searched writable position, responds to the data request to be cached as a write request to be cached, and the position pointed to by the head pointer of the request cache area is a writable position, writes the write request to be cached to the position pointed to by the head pointer. Therefore, the embodiment of the present invention can realize the caching and management of missed data requests through the request cache area, avoid processor pauses or blocking, and the request cache area of ​​this embodiment can also realize out-of-order writing of read requests and sequential writing of write requests, improve the space utilization of the request cache area, and solve the data request conflict problem at the same time, and improve the overall performance of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The above and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings, in which:

[0043] Figure 1 is a schematic diagram of the data structure of the request cache area according to an embodiment of the present invention;

[0044] Figure 2-Figure 4 is a schematic diagram of updating a head pointer of a data structure according to an embodiment of the present invention;

[0045] Figure 5-Figure 6 is a schematic diagram of updating a tail pointer of a data structure according to an embodiment of the present invention;

[0046] Figure 7 is a flow chart of a data request processing method according to an embodiment of the present invention;

[0047] Figure 8 This is a schematic diagram of a read request writing according to an embodiment of the present invention;

[0048] Fig. 9 is a flow chart of a read request writing method according to an embodiment of the present invention;

[0049] Fig.10 This is a schematic diagram of writing a write request according to an embodiment of the present invention;

[0050] Fig.11 is a flow chart of a write request writing method according to an embodiment of the present invention;

[0051] Fig.12 is a schematic diagram of a data request output according to an embodiment of the present invention;

[0052] Fig.13 is a schematic diagram of a data request processing device according to an embodiment of the present invention;

[0053] Fig.14 is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0054] The present application is described below based on embodiments, but the present application is not limited to these embodiments. In the detailed description of the present application below, some specific details are described in detail. It is possible for those skilled in the art to fully understand the present application without the description of these details. In order to avoid confusing the essence of the present application, known methods, processes, flows, components and circuits are not described in detail.

[0055] In addition, persons of ordinary skill in the art will appreciate that the drawings provided herein are for illustration purposes and are not necessarily drawn to scale.

[0056] Unless the context clearly requires otherwise, the words "include", "comprising" and similar words throughout the application should be interpreted as including rather than exclusive or exhaustive; that is, the meaning is "including but not limited to".

[0057] In the description of this application, it should be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of this application, unless otherwise specified, the meaning of "plurality" is two or more.

[0058] In computer data operations, such as reading, writing, deleting and modifying data in a database, if the data request for the corresponding data operation is not cached, the new data request needs to wait until the previous missed data request is completely resolved before it can be accepted, which forces the new missed data request to wait, which may cause the processor to stall or block, affecting the overall performance of the system. In a related comparative example, MSHR (Miss Status Handling Register) is used in the request cache area to process missed data requests, and for data requests in the cache, the order of data operations needs to be guaranteed (for example, the order between read and write operations needs to be guaranteed). In MSHR, a linked list is generally used to maintain the read and write order, which has the problem of large overhead and infinite series connection. In other comparative examples, the request cache area can also use a FIFO (First In First Out) structure to cache data requests. The FIFO structure usually uses a sequential input method, which cannot fully utilize the FIFO space, which makes the space utilization rate in the cache low.

[0059] Based on this, an embodiment of the present invention provides a data request processing method, device and electronic device to implement caching and management of missed data requests through a request cache area to avoid processor stalls or blocking. In addition, the request cache area of ​​this embodiment can also implement out-of-order writing of read requests and sequential writing of write requests, thereby improving the space utilization of the request cache area, and at the same time solving the problem of data request conflicts, thereby improving the overall performance of the system.

[0060] This embodiment uses a predetermined request cache area to obtain and store missed data requests, that is, to store relevant information of missed data requests, such as failure address, access type (such as read or write, etc.), and other control information that may be required. Among them, the data request to be cached is also a missed data operation request. In a computer system, when a received data request is used to access a certain data from a cache (such as L1 Cache, L2 Cache, or L3 Cache, etc.), it is found that the data is not in the cache, that is, a cache miss occurs.

[0061] Among them, the computer system has a corresponding multi-level cache system, which may include L1 Cache (first-level cache), L2 Cache (second-level cache), and even L3 Cache (third-level cache). When a data request is received, the system will first search L1 Cache. When the data request does not hit in L1 Cache, the system continues to search L2 Cache. If the data request does not hit in L2 Cache, it continues to search the next level of cache (such as L3 Cache, etc.) or directly access the main memory. The design of this hierarchical cache system effectively reduces the average data access time and improves the overall system performance. In this embodiment, the data request that misses can be a data request that misses in each level of cache.

[0062] Optionally, the request cache area in the present embodiment adopts a predetermined data structure to process missed data requests, so that it appears as a buffer for read requests and as a queue (FIFO) for write requests. Therefore, the present embodiment merges the buffer presented to read requests and the queue presented to write requests into one storage through a request cache area with a predetermined data structure, thereby realizing unified storage and management of read requests and write requests, saving storage area, improving space utilization of the request cache area, and solving the problem of data request conflicts by presenting a queue for write requests, thereby improving the overall performance of the system.

[0063] Figure 1 Schematic diagram of the data structure of the request cache area in an embodiment of the present invention. Figure 1 As shown, in an embodiment of the present invention, the request cache area of ​​this embodiment adopts the corresponding data structure TBQ (Table and Queue), and the data structure TBQ maintains two pointers: head pointer head ptr and tail pointer tail ptr, so as to realize the unified storage and management of read requests and write requests. In this way, the implementation cost of the data structure can be reduced and it is easy to implement. Among them, the head pointer head ptr is used to indicate the position of the first element in the queue. The tail pointer tail ptr is used to indicate the position of the last element in the queue.

[0064] In an optional implementation, the head pointer head ptr of this embodiment points to a writable position of the request data structure TBQ. Therefore, in this embodiment, when the head pointer head ptr points to a non-writable position, that is, when a new data request is written to the position currently pointed to by the head pointer head ptr, the head pointer head ptr is updated until the updated head pointer headptr points to a writable position. Optionally, when the head pointer head ptr points to a non-writable position, it is updated in the corresponding update cycle, for example, so that head ptr=head ptr+1. Further, if head ptr+1 also points to a non-writable position, head ptr=head ptr+2 can be made. In this embodiment, a writable position indicates that the corresponding position has not yet been written with a data request, and a non-writable position indicates that the corresponding position has been written with a corresponding data request.

[0065] Figure 2-Figure 4 FIG. 4 is a schematic diagram of updating the head pointer of the data structure of an embodiment of the present invention. Figure 2 As shown, in the data structure TBQ, the head pointer head ptr currently points to the non-writable position 3, and head ptr+1 (i.e., position 4) points to the writable position, so the head pointer head ptr can be updated so that head ptr=head ptr+1, so that the updated head pointer head ptr points to the writable position 4. At this time, the step length when the head pointer head ptr is updated is 1.

[0066] Furthermore, if Figure 3 As shown, in the data structure TBQ, new data requests have been written to positions 4 and 5, the head pointer head ptr currently points to the non-writable position 4, head ptr+1 (i.e., position 5) also points to the non-writable position, and headptr+2 (i.e., position 6) points to the writable position, so the head pointer head ptr can be updated so that head ptr=headptr+2, so that the updated head pointer head ptr points to the writable position 6. At this time, the step length of the head pointer head ptr when updating is 2.

[0067] It should be understood that this embodiment does not limit the number of selectable step lengths of the head pointer head ptr in its update cycle, and it is sufficient to achieve that the updated head pointer head ptr points to a writable position. For example, in the above example, when the head pointer head ptr is updated, its step length can be selected as 1 or 2 according to needs. If necessary in actual applications, the selectable range of the step length of the head pointer head ptr can also be set to 1, 2, 3, etc., and no examples are given here one by one.

[0068] In other optional implementations, the head pointer head ptr of this embodiment can also be updated step by step, that is, when the head pointer is updated, head ptr=head ptr+1. For example, assuming that the current head pointer head ptr=ptr1, if the current head pointer head ptr (that is, ptr1) points to an unwritable position, the head pointer head ptr is updated to ptr1+1 (that is, ptr2), and if the updated head ptr (that is, ptr2) still points to an unwritable position, the head pointer head ptr is updated to ptr2+1 (that is, ptr3) until the updated head pointer head ptr points to a writable position.

[0069] like Figure 4 As shown, in the data structure TBQ, the head pointer head ptr currently points to the non-writable position 2, and the head pointer head ptr is updated to head ptr+1 (i.e., position 3). At this time, head ptr (i.e., position 3) still points to the non-writable position, and the head pointer head ptr is updated to head ptr+1 (i.e., position 4) again, so that the updated head pointer headptr points to the writable position 4. At this time, the step length of the head pointer head ptr at each update is 1.

[0070] In an optional implementation, the tail pointer tail ptr of this embodiment points to a non-writable position of the request data structure TBQ. Therefore, in this embodiment, when the tail pointer tail ptr points to a writable position, that is, when the data request cached at the position currently pointed to by the tail pointer tail ptr has been read out, the tail pointer tail ptr is updated until the updated tail pointer tail ptr points to a non-writable position. Optionally, when the tail pointer tail ptr points to a writable position, it is updated in the corresponding update cycle, for example, so that tail ptr=tail ptr+1. Further, if tail ptr+1 also points to a writable position, tail ptr=tail ptr+2 can be made.

[0071] Figure 5-Figure 6 Schematic diagram of updating the tail pointer of the data structure of the embodiment of the present invention. Figure 5As shown, in the data structure TBQ, the data request in the position 0 currently pointed to by the tail pointer tail ptr has been read out, that is, the tail pointer tailptr currently points to the writable position 0, and tail ptr+1 (that is, position 1) points to the non-writable position, thus, the tail pointer tail ptr can be updated so that tail ptr=tail ptr+1, so that the updated tail pointer tail ptr points to the non-writable position 1. At this time, the step length of the tail pointer tail ptr when updating is 1.

[0072] Furthermore, if Figure 6 As shown, in the data structure TBQ, it is assumed that the data requests at position 1 and position 2 have been read out, that is, the tail pointer tail ptr currently points to the writable position 1, tail ptr+1 (i.e., position 2) also points to the writable position, and tail ptr+2 (i.e., position 3) points to the non-writable position, thus, the tail pointer tail ptr can be updated so that tail ptr=tail ptr+2, so that the updated tail pointer tail ptr points to the non-writable position 3. At this time, the step length of the tail pointer tail ptr when updating is 2.

[0073] It should be understood that the present embodiment does not limit the number of selectable step lengths of the tail pointer tail ptr in its update cycle, and it is sufficient that the updated tail pointer tail ptr points to a non-writable position. For example, in the above example, when the tail pointer tail ptr is updated, its step length can be selected as 1 or 2 according to the requirements. If necessary in practical applications, the selectable range of the step length of the tail pointer tail ptr can also be set to 1, 2, 3, etc., which will not be explained one by one here.

[0074] In other optional implementations, the tail pointer tail ptr of this embodiment can also be updated step by step, that is, when the tail pointer tail ptr is updated, tail ptr=tail ptr+1. For example, assuming that the current tail pointer tail ptr=ptr1', if the current tail pointer tail ptr (that is, ptr1') points to a writable position, the tail pointer tail ptr is updated to ptr1'+1 (that is, ptr2'), and if the updated tail pointer tail ptr (that is, ptr2') still points to a writable position, the tail pointer tail ptr is updated to ptr2'+1 (that is, ptr3') until the updated tail pointer tail ptr points to a non-writable position.

[0075] In an optional implementation, the head pointer head ptr and the tail pointer tail ptr of the data structure TBQ point to the same position when the request cache area is empty or full.

[0076] Therefore, the request cache area of ​​this embodiment adopts the corresponding data structure TBQ, so as to realize the unified storage and management of read requests and write requests by maintaining the head pointer head ptr and the tail pointer tail ptr of the data structure TBQ. Therefore, the implementation cost of the data structure can be reduced and it is easy to implement. Compared with the method of using a linked list that needs to maintain the head pointer, the tail pointer and the next pointer, the implementation complexity is lower, the processing time is easier to converge, and the wireless series connection and the long and short chain problems of the linked list are avoided. Compared with the FIFO-like structure, the data structure TBQ of this embodiment can realize the disordered writing of read requests, improve the space utilization of the cache, tolerate worse return delay differences, and realize the sequential writing of write requests, avoid the conflict of write requests, and further improve the system performance. At the same time, the data structure TBQ of this embodiment can provide multiple step lengths for the head pointer head ptr and the tail pointer tail ptr and provide a step with a step length greater than 1 for updating, which can further avoid abnormal situations inside the request cache area to solve the bubble problem inside the request cache area, and compared with the traditional linked list implementation method, the implementation complexity is lower and the execution power consumption is also lower.

[0077] Figure 7 1 is a flow chart of a data request processing method according to an embodiment of the present invention. The data request processing method according to the embodiment of the present invention is implemented based on the data structure TBQ adopted by the request cache area. Figure 7 As shown, the data request processing method of the embodiment of the present invention includes the following steps:

[0078] Step S110, obtaining a data request to be cached, wherein the data request to be cached is also a data operation request that has not been hit.

[0079] Step S120, determine whether the data request to be cached is a read request to be cached or a write request to be cached. Since the read data operation corresponding to the read request cannot change the data in the data cache during data access, the read request to be cached does not need to be written sequentially into the request cache area, while the write data operation corresponding to the write request needs to be written sequentially into the request cache area to avoid write request conflicts (WAW) in the data cache. In this embodiment, therefore, it is necessary to first determine the type of the acquired data request to be cached to determine the method of writing it into the request cache area to ensure the out-of-order writing of the read request and the sequential writing of the write request, thereby avoiding write request conflicts while caching and managing the read request and the write request in the same storage. Further, when the data request to be cached is a read request to be cached, continue to execute steps S130-S140, and when the data request to be cached is a write request to be cached, continue to execute step S150.

[0080] Step S130 , in response to the request for the data to be cached being a read request to be cached, searching for a writable position in the requested cache area with the corresponding pointer of the requested cache area as a starting point.

[0081] Step S140, writing the read request to be cached into the searched writable location.

[0082] In an optional implementation, since the head pointer head ptr of the data structure TBQ points to a writable position, even if a new data request has been written and the head pointer head ptr has not been updated (that is, the head pointer head ptr currently points to a non-writable position), the distance between the head pointer head ptr and the next writable position is relatively close. Therefore, this embodiment can use the head pointer head ptr corresponding to the request cache area as a starting point to search for a writable position in the request cache area. It should be understood that since read requests do not need to be written sequentially, as long as there are writable positions in the data structure TBQ, the read request to be cached can be written. In other optional implementations, this embodiment can also use the tail pointer tail ptr as a starting point or other positions as a starting point to search for a writable position in the request cache area. This embodiment does not limit the search starting point.

[0083] In an optional implementation, the present embodiment may write the read request to be cached into the first writable position found. In another optional implementation, the present embodiment may search multiple writable positions from the starting point and select any writable position to write the read request to be cached.

[0084] In other optional implementations, if multiple read requests to be cached are received at the same time, this embodiment can search for a corresponding number (i.e., the same number as the read requests to be cached) of writable locations starting from a starting point, and write these read requests to be cached into the corresponding writable locations in sequence, or write them in parallel into the multiple writable locations searched, thereby further improving the writing efficiency of data requests.

[0085] Figure 8 FIG. 1 is a schematic diagram of a read request writing method according to an embodiment of the present invention. Figure 8 As shown, after receiving a cached read request req1, the head pointer head ptr (i.e., position 4) of the data structure TBQ is used as the starting point to search for a writable position in the request cache area, for example, the first writable position 4 is searched, and the cached read request req1 is written to the writable position 4. Further, as Figure 8As shown, after the read request req1 is written, the head pointer head ptr points to a non-writable position. It can be updated based on the above update method during the update cycle of the head pointer head ptr so that the updated head pointer head ptr points to a writable position, which is not described in detail here.

[0086] Furthermore, if Figure 8 As shown, assuming that two to-be-cached read requests req1 and req2 are received, the head pointer head ptr (i.e., position 4) of the data structure TBQ is used as the starting point to search for writable positions in the request cache area, for example, writable positions 4 and 6 are searched, and the to-be-cached read request req1 is written to the writable position 4, and the to-be-cached read request req2 is written to the writable position 6. It should be understood that this embodiment does not limit the writing positions of the to-be-cached read requests req1 and req2, and the to-be-cached read request req1 may also be written to the writable position 6, and the to-be-cached read request req2 may be written to the writable position 4. Further, as Figure 8 As shown, after the read requests req1 and req2 are written, the head pointer head ptr points to a non-writable position. It can be updated based on the above update method during the update cycle of the head pointer head ptr so that the updated head pointer head ptr points to a writable position, which is not described in detail here.

[0087] Fig. 9 is a flow chart of a read request writing method according to an embodiment of the present invention. In an optional implementation, since reading and writing the same data at the same time may cause certain conflicts, before writing the cached read request to the data structure TBQ, this embodiment needs to determine whether the operation address of the cached read request is the same as the operation address of the cached write request in the data structure TBQ to avoid read-write conflicts. Fig. 9 As shown, the method for writing a cached read request in this embodiment includes the following steps:

[0088] Step S141, obtaining the operation address of the read request to be cached. That is, after receiving the read request to be cached, this embodiment determines the operation address of the read operation corresponding to the read request to be cached in the data cache.

[0089] Step S142, obtaining the operation address of the cached write request in the request cache area. That is, after receiving the read request to be cached, this embodiment determines the operation address of the write operation corresponding to each cached write request in the request cache area in the data cache. It should be understood that this embodiment does not limit the execution order of step 141 and step S142, which can be executed successively or simultaneously.

[0090] Step S143, determine whether the operation address of the read request to be cached is the same as the operation address of each cached write request. When the operation address of the read request to be cached is not the same as the operation address of each cached write request, continue to execute step S144, and when the operation address of the read request to be cached is the same as the operation address of one or more cached write requests, make the read request to be cached wait until the operation address of the read request to be cached is not the same as the operation address of each cached write request. Optionally, when the operation address of the read request to be cached is the same as the operation address of one or more cached write requests, step S142 can be periodically executed to determine whether the cached write request with the same operation address as the read request to be cached in the request cache area has been output, until the operation addresses of all cached write requests in the request cache area obtained are not the same as the operation address of the read request to be cached, then execute step S144. In other optional implementations, this embodiment can also only continue to query whether the cached write request with the same operation address as the read request to be cached has been output, and after it is output, execute step S142 to query the entire request cache area. In this way, the query workload can be further reduced and the query efficiency can be improved.

[0091] Step S144, in response to the fact that the operation address of the read request to be cached is different from the operation address of each cached write request, the read request to be cached is written to the searched writable location. The writing method of the read request to be cached in this embodiment is similar to the above embodiment (for example Figure 8 The embodiments shown in the figure are similar to those in the embodiment shown in the figure, etc., and will not be described in detail here.

[0092] In another optional implementation, the read-write conflict judgment between the read request to be cached and the cached write request in the request cache area can also be performed after determining that the data request to be cached is a read request to be cached, that is, before searching for the writable position. This embodiment does not limit the execution timing of the read-write conflict judgment, and it can be executed before the read request to be cached is written to the searched writable position.

[0093] Step S150, in response to the cached data request being a cached write request and the location pointed to by the head pointer being a writable location, the cached write request is written to the location pointed to by the head pointer. Since the data operation sequence of the write request needs to correspond to the acquisition sequence of the write request, conflicts in data write operations are prevented.

[0094] Among them, the data cache area of ​​this embodiment can realize the FIFO function for write requests through the head pointer head ptr. Specifically, in this embodiment, when the position pointed to by the head pointer head ptr corresponding to the data cache area is a writable position, the write request to be cached is written to the position pointed to by the head pointer. When the position pointed to by the head pointer head ptr is a non-writable position, the write request to be cached is written to the writable position pointed to by the head pointer after waiting for the head pointer head ptr to be updated. In this way, the cache order of the write request can be guaranteed, and the conflict of data write operations can be effectively prevented.

[0095] Fig.10 Schematic diagram of a write request writing in an embodiment of the present invention. Fig.10 As shown, after receiving a cache write request req3, the cache write request req3 is written to position 4, with the position 4 pointed to by the head pointer head ptr of the data structure TBQ as the writable position. Further, as Fig.10 As shown, after the write request req3 is written, the head pointer head ptr points to a non-writable position. The head pointer head ptr can be updated based on the above update method during the update cycle of the head pointer head ptr so that the updated head pointer head ptr points to a writable position, which is not described in detail here.

[0096] Fig.11 is a flow chart of a write request writing method according to an embodiment of the present invention. In an optional implementation, since reading and writing the same data at the same time may cause certain conflicts, before writing the cached write request to the data structure TBQ, this embodiment needs to determine whether the operation address of the cached write request is the same as the operation address of the cached read request in the data structure TBQ to avoid read-write conflicts. Fig.11 As shown, the method for writing a cached write request in this embodiment includes the following steps:

[0097] Step S151, obtaining the operation address of the write request to be cached. That is, after receiving the write request to be cached, this embodiment determines the operation address of the write operation corresponding to the write request to be cached in the data cache.

[0098] Step S152, obtaining the operation address of the cached read request in the request cache area. That is, after receiving the write request to be cached, this embodiment determines the operation address of the read operation corresponding to each cached read request in the request cache area in the data cache. It should be understood that this embodiment does not limit the execution order of step 151 and step S152, which can be executed successively or simultaneously.

[0099] Step S153, determine whether the operation address of the write request to be cached is the same as the operation address of each cached read request. When the operation address of the write request to be cached is not the same as the operation address of each cached read request, continue to execute step S154, and when the operation address of the write request to be cached is the same as the operation address of one or more cached read requests, make the write request to be cached wait until the operation address of the write request to be cached is not the same as the operation address of each cached read request. Optionally, when the operation address of the write request to be cached is the same as the operation address of one or more cached read requests, step S152 can be periodically executed to determine whether the cached read request with the same operation address as the write request to be cached in the request cache area has been output, until the operation addresses of all cached read requests in the request cache area obtained are not the same as the operation address of the write request to be cached, then execute step S154. In other optional implementations, this embodiment can also only continue to query whether the cached read request with the same operation address as the write request to be cached has been output, and after it is output, execute step S152 to query the entire request cache area. In this way, the query workload can be further reduced and the query efficiency can be improved.

[0100] Step S154, in response to the fact that the operation address of the cached write request is different from the operation address of each cached read request, the cached write request is written to the writable location pointed to by the head pointer. The writing method of the cached write request of this embodiment is similar to the above embodiment (for example Fig.10 The embodiments shown in the figure are similar to those in the embodiment shown in the figure, etc., and will not be described in detail here.

[0101] The embodiment of the present invention implements caching and management of missed data requests through a head pointer of a request cache area, and implements out-of-order writing of read requests and sequential writing of write requests by maintaining the head pointer of the request cache area, that is, it implements the use of the same storage to provide a cache area (buffer) that can be written out of order for read requests, and a FIFO queue that can be written sequentially for write requests, thereby improving the space utilization of the request cache area, solving the problem of data request conflicts, and improving the overall performance of the system.

[0102] In an optional implementation, the request cache area of ​​this embodiment provides an output channel for read requests and an output channel for write requests.

[0103] In an optional implementation, this embodiment uses the corresponding pointer of the request cache area as a starting point, searches for at least one read request in the request cache area, and outputs the searched read request.

[0104] Since read requests do not need to be output sequentially, that is, they can be output out of order, as long as the read request is output from the data structure TBQ, the corresponding data cache can be accessed to perform a read operation. Therefore, this embodiment can use the tail pointer of the request cache area as the starting point to search for at least one read request in the request cache area for output, so as to improve the output efficiency of the read request.

[0105] In other optional implementations, this embodiment may also use the head pointer as a starting point or other positions as starting points to search for read requests cached in the request cache area. This embodiment does not limit the search starting point.

[0106] In an optional implementation, the present embodiment outputs the first read request found, or searches for multiple read requests at the same time and outputs these read requests in sequence. In another optional implementation, the present embodiment may also synchronously output multiple read requests found to achieve concurrent processing of read requests and further improve processing efficiency.

[0107] In an optional implementation, since the data operation order of the write request needs to correspond to the acquisition order of the write request, conflicts in data write operations can be prevented. The data cache area of ​​this embodiment can implement a FIFO function for write requests through a tail pointer. Specifically, this embodiment uses the tail pointer of the request cache area as a starting point, searches for write requests in the request cache area, and outputs the first write request found. In this way, the output order of the write request can be guaranteed, effectively preventing conflicts in data write operations.

[0108] Fig.12 FIG. 1 is a schematic diagram of a data request output according to an embodiment of the present invention. Fig.12 As shown, the data structure TBQ corresponding to the request cache area of ​​this embodiment has a corresponding output channel R for read requests and an output channel W for write requests. With the tail pointer tail ptr as the starting point, the read request and the write request in the data structure TBQ are searched, and the first read request r_req1 found is output through the output channel R of the read request to perform the corresponding read operation. The first write request w_req1 found is output through the output channel W of the write request to perform the corresponding write operation. Further, as Fig.12 As shown, after the read request r_req1 and / or the write request w_req1 are output, position 0 and position 1 in the data structure TBQ are updated to writable positions, and the current tail pointer tail ptr points to the writable position. The update cycle of the tail pointer tail ptr can be updated based on the above update method so that the updated tail pointer tail ptr points to the non-writable position, which is not described in detail here.

[0109] In another optional implementation, this embodiment can also use the tail pointer tail ptr as a starting point to search for read requests in the data structure TBQ, and output the searched multiple read requests (for example, read request r_req2, read request r_req3, etc.) in parallel through the read request output channel R to execute corresponding read operations in parallel.

[0110] The embodiment of the present invention obtains a request for data to be cached, responds to the request for data to be cached as a read request to be cached, takes the corresponding pointer of the request cache area as the starting point, searches for a writable position in the request cache area, writes the read request to be cached to the searched writable position, responds to the request for data to be cached as a write request to be cached, and the position pointed to by the head pointer of the request cache area is a writable position, writes the write request to be cached to the position pointed to by the head pointer. Thus, the embodiment of the present invention can realize the caching and management of missed data requests through the request cache area, and the request cache area of ​​this embodiment can also realize the disorderly writing and disorderly output of read requests and the sequential writing and sequential output of write requests, thereby improving the space utilization of the request cache area, and solving the data request conflict problem at the same time, and improving the overall performance of the system. At the same time, compared with the method of using a linked list that needs to maintain the head pointer, the tail pointer and the next pointer, the embodiment of the present invention can achieve lower complexity, reduce the implementation cost of the data structure, and is easy to implement. Compared with the FIFO-like structure, the data structure TBQ of this embodiment can realize out-of-order writing and out-of-order output of read requests, improve the space utilization of the cache, tolerate worse return delay differences, and realize sequential writing and sequential output of write requests, avoiding write request conflicts and further improving system performance.

[0111] Fig.13 Schematic diagram of a data request processing device according to an embodiment of the present invention. Fig.13 As shown, the data request processing device 13 of the embodiment of the present invention includes a request obtaining unit 131 , a position searching unit 132 , a first writing unit 133 and a second writing unit 134 .

[0112] The request acquisition unit 131 is configured to acquire a request for data to be cached. The location search unit 132 is configured to search for a writable location in the request cache area with the corresponding pointer of the request cache area as a starting point in response to the request for data to be cached being a read request to be cached. The first write unit 133 is configured to write the read request to be cached to the searched writable location. The second write unit 134 is configured to write the write request to be cached to the location pointed to by the head pointer in response to the request for data to be cached being a write request to be cached and the location pointed to by the head pointer being a writable location.

[0113] In an optional implementation, the first writing unit 133 is further configured to execute: writing the to-be-cached read request to the first writable position found by searching.

[0114] In an optional implementation, the first write unit 133 is further configured to perform: obtaining the operation address of the read request to be cached, obtaining the operation address of the cached write request in the request cache area, and in response to the operation address of the read request to be cached being different from the operation addresses of each of the cached write requests, writing the read request to be cached to the searched writable location.

[0115] In an optional implementation, the second write unit 134 is further configured to perform: obtaining the operation address of the write request to be cached, obtaining the operation address of the cached read request in the request cache area, and in response to the operation address of the write request to be cached being different from the operation address of each of the cached read requests, writing the write request to be cached to the writable location pointed to by the head pointer.

[0116] In an optional implementation, the request processing device 13 further includes a first output unit. The first output unit is configured to perform: starting from the corresponding pointer of the request cache area, searching for at least one read request in the request cache area, and outputting the searched read request.

[0117] In an optional implementation, the request processing device 13 is further configured to execute: output the first searched read request, or synchronously output multiple searched read requests.

[0118] In an optional implementation, the request processing device 13 further includes a second output unit. The second output unit is configured to perform: starting from the tail pointer of the request cache area, searching for write requests in the request cache area, and outputting the first write request found.

[0119] In an optional implementation, the request processing device 13 further includes a first pointer updating unit. The first pointer updating unit is configured to execute: in response to the head pointer pointing to a non-writable position, update the head pointer until the updated head pointer points to a writable position.

[0120] In an optional implementation, the request processing device 13 further includes a second pointer updating unit. The second pointer updating unit is configured to execute: in response to the tail pointer of the request cache area pointing to a writable position, update the tail pointer until the updated tail pointer points to a non-writable position.

[0121] In an optional implementation, the tail pointer and the head pointer of the request cache area point to the same position when the request cache area is empty or full.

[0122] The embodiment of the present invention obtains a request for data to be cached, responds to the request for data to be cached as a read request to be cached, takes the corresponding pointer of the request cache area as the starting point, searches for a writable position in the request cache area, writes the read request to be cached to the searched writable position, responds to the request for data to be cached as a write request to be cached, and the position pointed to by the head pointer of the request cache area is a writable position, writes the write request to be cached to the position pointed to by the head pointer. Thus, the embodiment of the present invention can realize the caching and management of missed data requests through the request cache area, and the request cache area of ​​this embodiment can also realize the disorderly writing and disorderly output of read requests and the sequential writing and sequential output of write requests, thereby improving the space utilization of the request cache area, and solving the data request conflict problem at the same time, and improving the overall performance of the system. At the same time, compared with the method of using a linked list that needs to maintain the head pointer, the tail pointer and the next pointer, the embodiment of the present invention can achieve lower complexity, reduce the implementation cost of the data structure, and is easy to implement. Compared with the FIFO-like structure, the data structure TBQ of this embodiment can realize out-of-order writing and out-of-order output of read requests, improve the space utilization of the cache, tolerate worse return delay differences, and realize sequential writing and sequential output of write requests, avoiding write request conflicts and further improving system performance.

[0123] Fig.14 1 is a schematic diagram of an electronic device according to an embodiment of the present invention. In this embodiment, the electronic device 14 includes a server, a terminal, etc. Fig.14 As shown, the electronic device 14: includes at least one processor 141; and a memory 142 communicatively connected to at least one processor 141; and a communication component 143 communicatively connected to a scanning device, the communication component 143 receives and sends data under the control of the processor 141; wherein the memory 142 stores instructions executable by at least one processor 141, and the instructions are executed by at least one processor 141 to implement the above-mentioned data request processing method.

[0124] Specifically, the electronic device includes: one or more processors 141 and a memory 142, Fig.14 A processor 141 is taken as an example. The processor 141 and the memory 142 may be connected via a bus or other means. Fig.14 In the example, the bus connection is used. The memory 142 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The processor 141 executes various functional applications and data processing of the device by running the non-volatile software programs, instructions and modules stored in the memory 142, that is, realizing the above-mentioned data request processing method.

[0125] The memory 142 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and applications required for at least one function; the data storage area may store a list of options, etc. In addition, the memory 142 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 142 may optionally include a memory remotely arranged relative to the processor 141, and these remote memories may be connected to an external device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0126] One or more modules are stored in the memory 142 , and when executed by one or more processors 141 , the data request processing method in any of the above method embodiments is executed.

[0127] The above-mentioned product can execute the method provided in the embodiment of the present application, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not fully described in this embodiment, please refer to the method provided in the embodiment of the present application.

[0128] The embodiment of the present invention discloses a data request processing method, device and electronic device. The embodiment of the present invention obtains a data request to be cached, responds to the data request to be cached as a read request to be cached, takes the corresponding pointer of the request cache area as the starting point, searches for a writable position in the request cache area, writes the read request to be cached to the searched writable position, responds to the data request to be cached as a write request to be cached, and the position pointed to by the head pointer of the request cache area is a writable position, writes the write request to be cached to the position pointed to by the head pointer. Therefore, the embodiment of the present invention can realize the caching and management of missed data requests through the request cache area, avoid processor pauses or blocking, and the request cache area of ​​this embodiment can also realize out-of-order writing of read requests and sequential writing of write requests, improve the space utilization of the request cache area, and solve the data request conflict problem at the same time, and improve the overall performance of the system.

[0129] Another embodiment of the present invention relates to a non-volatile storage medium for storing a computer-readable program, wherein the computer-readable program is used for a computer to execute part or all of the above method embodiments.

[0130] That is, those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a program, and the program is stored in a storage medium, including a number of instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0131] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A data request processing method, characterized in that: The method comprises: Get the request for data to be cached; In response to the request for data to be cached being a read request to be cached, searching for a writable position in the requested cache area with a corresponding pointer of the requested cache area as a starting point; Writing the to-be-cached read request into the searched writable location; In response to the to-be-cached data request being a to-be-cached write request, and the position pointed to by the head pointer of the request cache area being a writable position, the to-be-cached write request is written to the position pointed to by the head pointer.

2. The method according to claim 1, characterized in that Writing the to-be-cached read request to the searched writable location includes: The read request to be cached is written to the first writable location found.

3. The method according to claim 1, characterized in that Writing the to-be-cached read request to the searched writable location includes: Obtaining an operation address of the read request to be cached; Obtaining an operation address of a cached write request in the request cache area; In response to the operation address of the to-be-cached read request being different from the operation addresses of each of the cached write requests, the to-be-cached read request is written to the searched writable location.

4. The method according to claim 1, characterized in that: Writing the to-be-cached write request to the location pointed to by the head pointer comprises: Obtaining an operation address of the write request to be cached; Obtaining an operation address of a cached read request in the request cache area; In response to the operation address of the write request to be cached being different from the operation addresses of each of the cached read requests, the write request to be cached is written to the writable location pointed to by the head pointer.

5. The method according to claim 1, characterized in that: The method further comprises: Taking the corresponding pointer of the request cache area as a starting point, searching the request cache area for at least one read request; The searched read request is output.

6. The method according to claim 5, characterized in that The outputting the searched read request comprises: Output the first read request found; or Synchronously output multiple read requests found.

7. The method according to claim 1, characterized in that The method further comprises: Taking the tail pointer of the request cache area as a starting point, searching the request cache area for a write request; Output the first write request found.

8. The method according to claim 1, characterized in that The method comprises: In response to the head pointer pointing to a non-writable location, the head pointer is updated until the updated head pointer points to a writable location.

9. The method according to claim 1, characterized in that: The method further comprises: In response to the tail pointer of the request cache area pointing to a writable position, the tail pointer is updated until the updated tail pointer points to a non-writable position.

10. The method according to claim 1, characterized in that The tail pointer and the head pointer of the request cache area point to the same position when the request cache area is empty or full.

11. A data request processing device, characterized in that: The device comprises: A request obtaining unit, configured to obtain a request for data to be cached; a position search unit configured to, in response to the request for data to be cached being a read request to be cached, search for a writable position in the requested cache area with a corresponding pointer of the requested cache area as a starting point; A first writing unit, configured to write the to-be-cached read request into the searched writable position; The second writing unit is configured to write the cached write request to the location pointed to by the head pointer in response to the cached data request being a cached write request and the location pointed to by the head pointer of the request cache area being a writable location.

12. An electronic device comprising a memory and a processor, characterized in that: The memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method according to any one of claims 1-10.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.

14. A computer program product, characterized in that When the computer program product is run on a computer, the computer is caused to execute the method according to any one of claims 1 to 10.

Citation Information

Cited By

  • Data processing method, storage system, device, storage medium and program product

    CN119718215A