Request processing method, device and system

CN118633075APending Publication Date: 2024-09-10HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202280090903.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2022-06-30
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

In the existing technology, the memory access concurrency of remote devices is limited and only supports concurrent access of multiple network devices or local processors, which limits the concurrency and efficiency of remote operations.

Method used

By implementing atomic write and read operations of memory between network devices and processors, and utilizing exclusive rights and shared access rights mechanisms, we ensure the atomicity of write operations and the latest data, reducing bandwidth waste and computing overhead.

Benefits of technology

It improves the concurrency and efficiency of remote memory access, realizes coordinated access of network devices and processors, and reduces operation delays and resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118633075A
    Figure CN118633075A
Patent Text Reader

Abstract

The invention provides a method, a device and a system for processing a request, which can enable a second node to read data of a first node or write data to the first node. A first node can obtain first information from a first position of a first memory space according to a write request sent by a second node; and indicating that the first memory space is in a state of data writing by a processor of the first node based on the first information, acquiring second information from the first position after a preset time, and indicating that the first memory space is not in a state of data writing by the processor based on the second information, and writing the first data into the first memory space. According to the method and the device, the memory access mode supporting both the network equipment and the processor is constructed, and in the mode, both the network equipment and the CPU can access the same memory and realize atomic writing for the memory.
Need to check novelty before this filing date? Find Prior Art

Description

Method, device and system for processing requests Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a method, device, and system for accessing the memory of a remote device. Background Art

[0002] With the development of technology, the use of distributed applications is becoming more and more common. A distributed application refers to an application that is distributed across different physical nodes, which are usually computers. In other words, when a distributed application performs a task or business, data needs to be exchanged between multiple physical nodes. During this process, data is usually stored in the memory of the physical node and loaded into the memory by the processor of the physical node when it is needed. In this way, remote memory access, that is, a computer (local device) accessing the memory of another computer (remote device) to operate the data therein, is a very basic function. Among them, accessing data, from a technical point of view, is essentially accessing the storage medium related to the data, which includes at least two scenarios: reading data and writing data.

[0003] Typically, the memory of a local device is accessed via a bus, while the memory of a remote device is accessed via a network. For example, remote access can be achieved through interaction between network devices (such as network cards). Specifically, a device accessing the memory of another device requires network communication technologies such as Transmission Control Protocol / Internet Protocol (TCP / IP) or Remote Direct Memory Access (RDMA).

[0004] To address the inefficiency of processor memory access, modern computer systems have introduced cache structures. Leveraging the spatial locality of programs, cache technology significantly accelerates processor memory access operations. In a multi-core architecture, each processor core has its own cache. Ensuring cache consistency across cores ensures that each processor core sees consistent memory data.

[0005] In existing implementations, concurrent access to the same memory block of a remote device is supported only by multiple network devices (such as network cards) or only by a local processor, which limits the concurrency of remote operations.

[0006] Summary of the Invention

[0007] The embodiments of the present application provide a method, apparatus, and system for accessing the memory of a remote device, which can improve the concurrency of data access.

[0008] To achieve the above objectives, the present invention adopts the following technical solutions:

[0009] In a first aspect, an embodiment of the present application provides a method for processing a request, which is applied to a network device of a first node, where the first node is a device for processing the request, or a component in the device (such as a chip), the method comprising: obtaining a write request from a second node, the write request indicating that first data is written to a first memory space of the first node; obtaining first information from a first position of the first memory space, the first information indicating that the first memory space is in a state where data is written by a processor of the first node (for example, the CPU can perform a write operation to the first memory space before the network device of the second node obtains the first information from the first position of the first memory space, and set the information at the first position to indicate that the first memory space is in a state where data is written by the processor of the first node); based on the first information, obtaining second information from the first position after a preset time (if the first information indicates that the first memory space is in a state where data is written by the processor of the first node, in this case, in order to ensure the atomicity of the write operation, the information at the first position (the second information) can be re-obtained after a period of time); based on the second information indicating that the first memory space is in a state where data is not written by the processor, writing the first data to the first memory space.

[0010] In existing implementations, only multiple network devices or only the local CPU are supported to access the same memory block. In the embodiments of the present application, a mode is constructed to support both network devices and processors to access memory. In this mode, both network devices and CPUs can access the same memory block and implement atomic writes to the memory.

[0011] In one implementation, information is obtained from a memory space (for example, when obtaining first information from a first location and subsequently obtaining information from other locations, "obtaining" may be understood as reading).

[0012] In one implementation, the information at the first position can indicate whether the first memory space is in a state where data is being written by the network device or other processor of the first node through different identifiers. For example, "1" can be used to indicate that the first memory space is in a state where data is being written by the network device or other processor of the first node, and "0" can be used to indicate that the first memory space is not in a state where data is being written by the network device or other processor of the first node.

[0013] In one implementation, the write request may indicate that the first data is to be written into a first memory space in the memory of the first node. For example, the write request may include an address corresponding to the first memory space (a virtual address or a physical address, based on which the first memory space can be uniquely identified). For example, the address may include a starting address and an address offset.

[0014] In one possible implementation, the first memory space is a memory object, the memory object includes multiple cache lines, and the first position is located at the head of a head cache line among the multiple cache lines. For example, the first predetermined number of bytes of the head cache line, such as the first 8 bytes or the first 16 bytes, can be used to store the first information.

[0015] In one possible implementation, the method further includes: before writing the first data into the first memory space, obtaining an exclusive right to the first memory space, and before completing the writing of the first data into the first memory space, maintaining possession of the exclusive right to the first memory space (or it can be referred to as not releasing the exclusive right to the first memory space). The exclusive right can be the E state specified in the heterogeneous system object consistency protocol, and the E state can indicate that no other cache has a copy of the data, the copy of this data in the memory is also the latest, and the data is directly returned to a read operation. Not releasing the exclusive right means that when the network device performs a write operation, other network devices will not write at the same time, thereby ensuring the atomicity of the write operation.

[0016] In one possible implementation, the method further includes: obtaining exclusive rights to the first memory space before obtaining the first information from a preset location in the first memory space; and releasing the exclusive rights to the first memory space based on the first information indicating that the first memory space is in a state where data is being written by the processor of the first node.

[0017] In one possible implementation, the method further includes: obtaining a read request from the second node, the read request instructing to read data from the second memory space of the first node; and after obtaining shared access rights to the second memory space, reading the data from the second memory space of the first node. The shared access rights may be an S state specified in the heterogeneous system object consistency protocol, indicating that the data of the memory object is up-to-date and that a copy of the data exists in other caches.

[0018] In a possible implementation, if the shared access right to the memory object can be obtained, it means that the memory object is not in a state where data is written by other network devices, but data can be read.

[0019] In one possible implementation, during the process of reading data from the second memory space, it is sensed that the second memory space is in a state where data is being written to by other network devices of the first node, and the process of reading data from the second memory space is terminated; based on the reacquisition of shared access rights to the second memory space, data is read from the second memory space again. If data is written to the memory object during the data reading process, the read data is not the latest data. In this case, the network device of the second node will sense that the memory object is in an invalid state, and it is necessary to interrupt the data reading process and enter a waiting state. After a preset time, the shared access rights to the memory object can be reacquired. If the shared access rights to the memory object are reacquired after the preset time, it means that the memory object is no longer in a state where data is being written to, and data can be read again.

[0020] In one possible implementation, before reading data from the second memory space, third information is obtained from the second position of the first memory space, and the information at the second position indicates the latest version of the data in the first memory space; after reading data from the second memory space, fourth information is obtained from the second position; when the fourth information is inconsistent with the third information, information indicating read failure is returned to the second node.

[0021] Among them, the information at the second position can indicate the latest version of the data in the second memory space. When the fourth information and the third information are inconsistent, it can be considered that in the process of reading data from the second memory space, the processor performed a data write operation on the second memory space, and then it can be considered that the read data is invalid. Through the above method, atomic reading of data can be guaranteed.

[0022] In second aspect, the present application provides a method for processing requests, applied to a processor of a first node, the method comprising: obtaining a first write request, the first write request indicating that first data is written to a first memory space of the first node; obtaining first information from a first position of the first memory space, the first information indicating that the first memory space is not in a state where data is written by a network device or other processor of the first node; and based on the first information, writing the first data to the first memory space.

[0023] In one possible implementation, the write request may indicate that the first data is to be written into a first memory space in the memory of the first node. For example, the write request may include an address corresponding to the first memory space (a virtual address or a physical address, based on which the first memory space can be uniquely identified). For example, the address may include a starting address and an address offset.

[0024] In one possible implementation, the network device of the second node can obtain exclusive rights to the first memory space in response to a write request for the first memory space, and obtain first information from a first position in the first memory space, wherein the information at the first position can be used to indicate whether the first memory space is in a state where data is being written by the processor of the first node.

[0025] In one possible implementation, the first memory space is a memory object, the memory object includes multiple cache lines, and the first position is located at the head of a head cache line among the multiple cache lines. For example, the first predetermined number of bytes of the head cache line, such as the first 8 bytes or the first 16 bytes, can be used to store the first information.

[0026] In one possible implementation, a second write request from a second node is obtained, the second write request instructing to write second data to a second memory space of the first node; second information is obtained from a first location in the second memory space, the second information indicating that the second memory space is in a state where data is being written by a network device or other processor of the first node; and based on the second information, a message indicating a data write failure is returned to the second node. Because the write failure is determined directly after determining that the first memory space is in a state where data is being written, prolonged CPU blocking due to the network device being in a data write state for an extended period of time can be avoided.

[0027] In one possible implementation, the method further includes: obtaining a read request, which indicates reading data from the second memory space of the first node; after reading data from the second memory space based on the read request, obtaining third information from a second position in the second memory space, wherein the third information indicates that the second memory space is in a state where data is being written by a network device or other processor of the first node; and determining that writing data has failed based on the third information.

[0028] In one possible implementation, the method further includes: obtaining a read request, which indicates reading data from the second memory space of the first node; obtaining fourth information at a second position in the second memory space, the information at the second position indicating the latest version of the data in the second memory space; after reading the data from the second memory space based on the read request, obtaining fifth information from the second position; and determining that the read has failed when the fourth information and the fifth information are inconsistent.

[0029] In a third aspect, the present application provides a method for processing requests, which is applied to a network device of a first node, the method comprising: obtaining a write request from a second node, the write request indicating that first data is written to a first memory space of the first node; obtaining exclusive rights to the first memory space, and writing the first data into the first memory space, and maintaining possession of the exclusive right to the first memory space before completing the writing of the first data into the first memory space.

[0030] In the existing implementation, for the same block of memory, only multiple network devices are supported for access, or only the local CPU is supported for access, and in order to achieve atomic read or atomic write of the network, information for indicating whether the memory object is in a state where data is written and the latest version of the data update can be set on the cache line of the memory object. That is, additional storage space is required to store the above information, which results in a certain amount of bandwidth waste. In addition, the CPU is also required to perform a strip operation (in the process of reading data, the above information will be read, but the information is not required by the source end, so the processor is required to remove this part of the data and return it to the source end), which requires additional time and computing overhead. In the embodiment of the present application, for the mode that only supports network devices to access memory, the above information indicating whether the memory object is in a state where data is written and the latest version of the data update can be omitted, and atomic read and write of the memory can be achieved, thereby reducing the waste of bandwidth. In addition, since the CPU does not need to perform a strip operation on the above information, time and computing overhead are reduced.

[0031] In a possible implementation, the first memory space does not include a location for storing an indication of whether the first memory space is in a state of being written with data by the network device on the first node.

[0032] In a possible implementation, after the write operation of the first data is completed, the network device of the second node can release the exclusive access right to the memory object, so that other network devices can obtain the exclusive right to the memory object when performing a write operation on the memory object.

[0033] In one possible implementation, after executing the write operation indicated by the write request, the network device of the second node may return the execution result to the first node (eg, to the network device of the first node), and the execution result may indicate execution success or execution failure.

[0034] In a possible implementation, the network device of the second node may also receive a read request sent from the second node, where the read request indicates to read data from the second memory space of the first node.

[0035] The read request may indicate reading data from the second memory space in the memory of the first node. For example, the read request may include an address corresponding to the second memory space (a virtual address or a physical address, based on which the second memory space can be uniquely indicated). For example, the address may include a starting address and an address offset.

[0036] The second memory space may be a memory object, that is, the address (one or more) included in the read request may include an address corresponding to a memory object, wherein the memory object may include multiple cache lines.

[0037] In a possible implementation, the network device of the second node may obtain the shared access right to the second memory space in response to the read request, and read data from the second memory space.

[0038] In one possible implementation, the first memory space can be a memory object, which can include multiple cache lines. The network device of the second node can obtain shared access rights to the first cache line of the memory object, thereby obtaining shared access rights to the entire memory object. Shared access rights can be in the S state specified in the heterogeneous system object consistency protocol. Shared access rights indicate that the data in the memory object is up-to-date and that copies of this data exist in other caches.

[0039] In a possible implementation, if the shared access right to the memory object can be obtained, it means that the memory object is not in a state where data is written by other network devices, but data can be read.

[0040] In one possible implementation, during the process of reading data from the second memory space, it is sensed that the second memory space is in a state where data is being written to by other network devices of the first node, and the process of reading data from the second memory space is terminated; based on the reacquisition of shared access rights to the second memory space, data is read from the second memory space again. If data is written to the memory object during the data reading process, the read data is not the latest data. In this case, the network device of the second node will sense that the memory object is in an invalid state, and it is necessary to interrupt the data reading process and enter a waiting state. After a preset time, the shared access rights to the memory object can be reacquired. If the shared access rights to the memory object are reacquired after the preset time, it means that the memory object is no longer in a state where data is being written to, and data can be read again.

[0041] In a fourth aspect, the present application provides an apparatus for processing a request, the apparatus being located in a network device of a first node, the apparatus comprising:

[0042] an acquisition module, configured to acquire a write request from a second node, wherein the write request indicates writing first data into a first memory space of the first node;

[0043] Reading first information from a first position in the first memory space, where the first information indicates that the first memory space is in a state where data is being written by a processor of the first node;

[0044] Based on the first information, obtaining second information from the first location after a preset time, the second information indicating that the first memory space is in a state where no data is written by the processor;

[0045] A data writing module is used to write the first data into the first memory space based on the second information.

[0046] The fourth aspect is a device corresponding to the method of the first aspect, which has the function of implementing the method for processing requests in any one of the implementation methods of the first aspect. This function can be implemented by hardware, or by the combination of software and hardware. The hardware or software includes one or more modules corresponding to the above functions. Many nouns in the fourth aspect correspond to the nouns in the first aspect, and are also related to the method of the second aspect and the system of the third aspect. Therefore, the descriptions of various words or sentences in the first, second and third aspects, the descriptions of various implementation methods and the descriptions of technical effects, if they are involved in the fourth aspect, are also applicable to the fourth aspect and will not be repeated.

[0047] In a possible implementation, the first memory space is a memory object, the memory object includes a plurality of cache lines, and the first position is located at a head position of a head cache line among the plurality of cache lines.

[0048] In a possible implementation, the acquisition module is also used to obtain exclusive rights to the first memory space before writing the first data into the first memory space, and maintain possession of the exclusive rights to the first memory space before completing writing the first data into the first memory space.

[0049] In a possible implementation, the acquisition module is further configured to:

[0050] Before obtaining the first information from the preset location of the first memory space, obtaining exclusive rights to the first memory space;

[0051] The device also includes:

[0052] A releasing module is configured to release the exclusive right of the first memory space based on the first information indicating that the first memory space is in a state where data is being written by the processor of the first node.

[0053] In a possible implementation, the acquisition module is further configured to:

[0054] Obtaining a read request from the second node, where the read request indicates reading data from a second memory space of the first node;

[0055] The device also includes:

[0056] The data reading module is configured to read data from the second memory space of the first node after obtaining the shared access right (shared) to the second memory space.

[0057] In a possible implementation, the data reading module is specifically configured to:

[0058] During the process of reading data from the second memory space according to the read request, it is detected that the second memory space is in a state where data is being written by another network device of the first node, and the process of reading data from the second memory space is terminated;

[0059] Based on the reacquisition of the shared access right to the second memory space, data is read again from the second memory space.

[0060] In a possible implementation, the acquisition module is further configured to:

[0061] Before reading data from the second memory space, obtaining third information from a second position in the first memory space, where the information in the second position indicates a latest version of the data in the first memory space;

[0062] After reading data from the second memory space, obtaining fourth information from the second location;

[0063] The device further comprises:

[0064] A data return module is used to return read failure information to the second node when the fourth information is inconsistent with the third information.

[0065] In a fifth aspect, an embodiment of the present application provides a device for processing a request, the device being located in a processor of a first node, and comprising:

[0066] An acquisition module, configured to receive a first write request, where the first write request indicates that first data is to be written into a first memory space of the first node;

[0067] Acquire first information from a first position of the first memory space, where the first information indicates that the first memory space is not in a state where data is written by a network device or other processor of the first node;

[0068] A data writing module is used to write the first data into the first memory space based on the first information.

[0069] The fifth aspect is a device corresponding to the method of the second aspect, which has the function of implementing the method for processing requests in any one of the implementation methods of the second aspect. This function can be implemented by hardware, or it can be implemented by the combination of software and hardware. The hardware or software includes one or more modules corresponding to the above functions. Many nouns in the fifth aspect correspond to the nouns in the second aspect, and are also related to the method of the first aspect and the system of the third aspect. Therefore, the descriptions of various words or sentences in the first, second and third aspects, the descriptions of various implementation methods and the descriptions of technical effects, if they are involved in the fifth aspect, are also applicable to the fifth aspect and will not be repeated.

[0070] In a possible implementation, the first memory space is a memory object, the memory object includes a plurality of cache lines, and the preset position is located at a head position of a head cache line among the plurality of cache lines.

[0071] In a possible implementation, the acquisition module is further configured to:

[0072] Obtaining a second write request, where the second write request indicates writing second data into a second memory space of the first node;

[0073] Acquire second information from a first position of the second memory space, where the second information indicates that the second memory space is in a state where data is written by a network device or other processor of the first node;

[0074] The device further comprises:

[0075] A data return module is used to return information indicating data write failure to the second node based on the second information.

[0076] In a possible implementation, the acquisition module is further configured to:

[0077] Obtaining a read request, where the read request indicates reading data from a second memory space of the first node;

[0078] After reading data from the second memory space based on the read request, obtaining third information from a second position in the second memory space, the third information indicating that the second memory space is in a state where data is being written by a network device or other processor of the first node;

[0079] The device further comprises:

[0080] The data returning module is configured to determine that data writing fails based on the third information.

[0081] In a possible implementation, the acquisition module is further configured to:

[0082] Obtaining a read request, where the read request indicates reading data from the second memory space of the first node;

[0083] Obtain fourth information from a second position in the second memory space, where the information at the second position indicates a latest version of the data in the second memory space;

[0084] After reading data from the second memory space based on the read request, obtaining fifth information from the second location;

[0085] The device also includes:

[0086] The data returning module is configured to determine that the reading fails when the fourth information and the fifth information are inconsistent.

[0087] In a sixth aspect, an embodiment of the present application provides an apparatus for processing a request, the apparatus being located in a network device of a first node, the apparatus comprising:

[0088] an acquisition module, configured to acquire a write request from a second node, where the write request indicates writing the first data into a first memory space of the first node;

[0089] Acquire exclusive rights to the first memory space;

[0090] The data writing module is configured to write the first data into the first memory space and maintain exclusive possession of the first memory space before completing writing the first data into the first memory space.

[0091] The sixth aspect is a device corresponding to the method of the third aspect, which has the function of implementing the method for processing requests in any one of the implementation methods of the third aspect. This function can be implemented by hardware, or it can be implemented by the combination of software and hardware. The hardware or software includes one or more modules corresponding to the above functions. Many nouns in the fifth aspect correspond to the nouns in the second aspect, and are also related to the method of the first aspect and the system of the third aspect. Therefore, the descriptions of various words or sentences in the first, second and third aspects, the descriptions of various implementation methods and the descriptions of technical effects, if they are involved in the fifth aspect, are also applicable to the fifth aspect and will not be repeated.

[0092] In a possible implementation, the first memory space does not include a location for storing an indication of whether the first memory space is in a state of being written with data by the network device on the first node.

[0093] In a possible implementation, the acquisition module is further configured to:

[0094] Obtaining a read request from the second node, where the read request indicates reading data from a second memory space of the first node;

[0095] Acquiring shared access rights to the second memory space;

[0096] A data reading module is used to read data from the second memory space.

[0097] In a possible implementation, the data reading module is specifically configured to:

[0098] During the process of reading data from the second memory space, it is detected that the second memory space is in a state where data is being written by another network device of the first node, and the process of reading data from the second memory space is terminated;

[0099] Based on the reacquisition of the shared access right to the second memory space, data is read again from the second memory space.

[0100] In the seventh aspect, an embodiment of the present application provides a chip, which includes a processing circuit and a storage medium, in which instructions are stored; when the instruction is executed by the processing circuit, the chip executes the method of processing the request as described in any one of the above aspects.

[0101] In an eighth aspect, an embodiment of the present application provides a device for processing requests, the device comprising: a storage medium, a processing circuit, a memory management unit MMU and a network device, the storage medium being coupled to the processing circuit, the storage medium being used to store computer program code, the computer program code comprising computer instructions, and when the computer instructions are executed by the processing circuit, a method for processing requests as described in any one of the above aspects is executed.

[0102] In an eighth aspect, an embodiment of the present application provides a device for processing requests, the device comprising: a storage medium, a processing circuit, and a network device, the storage medium being coupled to the processing circuit, the storage medium being used to store computer program code, the computer program code comprising computer instructions, which, when executed by the processing circuit, instruct the network device to execute a method for processing a request as described in any one of the above aspects.

[0103] In a ninth aspect, a communication device is provided, comprising: a processor; the processor is configured to be coupled to a memory, and after reading instructions in the memory, execute a method for processing a request as described in any one of the above aspects according to the instructions.

[0104] In a tenth aspect, embodiments of the present application provide a communication device, which may be a system-on-a-chip (SoC), including a processor and a memory, configured to implement the functions of the method described in any of the above aspects. The SoC may consist of a single chip or may include a chip and other discrete components.

[0105] In an eleventh aspect, a communication device is provided. The device may be a circuit system, the circuit system including a processing circuit, and the processing circuit is configured to execute any method as described in any of the above aspects.

[0106] In the twelfth aspect, an embodiment of the present application also provides a computer-readable storage medium, including instructions, which, when executed on a computer, enable the computer to execute any of the above methods.

[0107] In a thirteenth aspect, an embodiment of the present application further provides a computer program product, comprising instructions, which, when executed on a computer, enables the computer to execute any of the above methods.

[0108] In a fourteenth aspect, an embodiment of the present application provides a system, the system comprising a device for processing requests according to any one of the fourth aspects and a device for processing requests according to any one of the fifth aspects. BRIEF DESCRIPTION OF THE DRAWINGS

[0109] FIG1 is a schematic diagram of an architecture for processing requests provided in an embodiment of the present application;

[0110] FIG2 is a schematic diagram of an architecture for processing requests provided in an embodiment of the present application;

[0111] FIG3 is a schematic diagram of an architecture for processing requests provided in an embodiment of the present application;

[0112] FIG4A is a flowchart of a request processing method provided in an embodiment of the present application;

[0113] FIG4B is a schematic diagram of a process of a request processing method provided in an embodiment of the present application;

[0114] FIG4C is a flowchart illustrating a request processing method provided in an embodiment of the present application;

[0115] FIG5 is a schematic diagram of an architecture for processing requests provided in an embodiment of the present application;

[0116] FIG6A is a flowchart of a request processing method provided in an embodiment of the present application;

[0117] FIG6B is a flowchart illustrating a request processing method provided in an embodiment of the present application;

[0118] FIG7A is a flowchart of a request processing method provided in an embodiment of the present application;

[0119] FIG7B is a flowchart of a request processing method provided in an embodiment of the present application;

[0120] FIG7C is a flowchart illustrating a request processing method provided in an embodiment of the present application;

[0121] FIG8 is a schematic diagram of an apparatus for processing a request provided in an embodiment of the present application;

[0122] FIG9 is a schematic diagram of an apparatus for processing a request provided in an embodiment of the present application;

[0123] FIG10 is a schematic diagram of an apparatus for processing a request provided in an embodiment of the present application;

[0124] FIG11 is a schematic diagram of a device for processing requests provided in an embodiment of the present application. DETAILED DESCRIPTION

[0125] First, some expressions that may appear in this application are explained.

[0126] “First” and “second” and the like are used to distinguish different objects, or to distinguish different processing of the same object, rather than to describe a specific order of objects.

[0127] "At least one" means one or more, while "a plurality" means two or more.

[0128] "And / or" describes the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural.

[0129] The character “ / ” generally indicates that the related objects are in an “or” relationship. For example, A / B can mean A or B.

[0130] Furthermore, the terms "comprises," "includes," and "having" as used in the description of this application are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements but may optionally include other steps or elements not listed, or may optionally include other steps or elements inherent to the process, method, product, or apparatus.

[0131] It should be noted that, in this application, words such as "exemplary" or "for example" are used to indicate examples or illustrations. Any implementation (such as the embodiments in this application) or design scheme that is "exemplary" or "for example" should not be interpreted as being preferred or advantageous over other implementations or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete way.

[0132] In the specification and drawings of this application, the terms “of”, “relevant” and “corresponding” may sometimes be used interchangeably. It should be noted that when the distinction between them is not emphasized, the meanings they intend to express are consistent.

[0133] Below, some of the terms that appear in this application are briefly described.

[0134] Enhanced cache coherence (ECC): Cache coherence refers to a mechanism in computer architecture that maintains consistency between cache and main memory data across multiple CPU cores. The enhanced cache coherence capability defined in this patent ensures consistency in memory data access not only between a central processing unit (CPU) or other type of processor, but also between a CPU and network devices.

[0135] Enhanced cache coherence network interface card (ECC NIC): A network device (network card) with enhanced cache coherence is called an ECC NIC. In the present invention, the ECC NIC is used for network transmission.

[0136] Cache coherence domain (cc domain): Devices in a cache coherence domain must follow a common cache coherence protocol.

[0137] Remote memory access: The memory that a computer wants to access is not located on the local computer, but on other computers connected via a network. Remote memory access enables memory sharing within the cluster.

[0138] Unified bus endpoint (UBUS): The UBUS bus is a large-scale, high-performance interconnect bus based on memory semantics, providing a unified interconnect interface and communication protocol for data centers.

[0139] Unified bus endpoint (UBEP): A network device at the UBUS endpoint. The UBUS bus can use this network device to transmit data across nodes. The UBEP functions like a network card and has ECC capabilities.

[0140] Node: A node is a device that has at least one of the following functions: processing data and storing data. Nodes run an operating system, and nodes can be distinguished by their operating system; that is, different nodes run different operating systems. Alternatively, the hardware and software used to run an operating system can be considered to belong to the same node. In this application, a node can be a complete physical machine, such as a terminal or a network device, such as a server or server agent. A node can also be a component within a physical machine, such as a processor, memory, or storage. When a physical machine includes two nodes, and these two nodes run different operating systems—for example, if the physical machine includes a central processing unit (CPU) running operating system 1 and a graphics processing unit (GPU) running operating system 2—the CPU and the GPU can be considered to belong to different nodes. When a node is a component, it is a relatively independent entity in terms of hardware. "Independent entity" can be understood as a circuit or module with specialized functions, packaged or assembled on a physical machine. Data access in this application can be understood as one node accessing data maintained by another node through an instance. Devices in a node refer to the components or parts within the node. For example, if the node is a physical machine, the CPU and memory are both devices within the node. A physical machine is a computer packaged into a single product, such as a server, desktop computer, all-in-one PC (AIO), laptop, or smartphone.

[0141] Terminal: may include desktop, laptop, handheld, and vehicle-mounted user equipment (UE) devices, such as smartphones, cellular phones, desktop computers, tablet computers, smart TVs, smart TV boxes, ultra-mobile personal computers (UMPCs), laptops, personal digital assistants (PDAs), portable multimedia players (PMPs), dedicated media players, consumer communication devices, wearable devices (such as smart watches), AR (augmented reality) / VR (virtual reality) devices, and other types of communication devices.

[0142] Local: For an instance, the node running that instance is considered local. For example, local memory, which should be fully understood as "local memory of an instance," refers to the memory of the node running the instance. The node running an instance can be described at different granularities. For example, it can be just a processor, such as a central processing unit (CPU) or a graphics processing unit (GPU), or a complete physical machine, including processing circuitry and storage media. The specific description used depends on whether the data access process involved spans physical machines.

[0143] Remote: Remote is the opposite of "local." That is, for an instance, all nodes other than the node running the instance are remote. A remote node can be a device with computing power or a device used to store data.

[0144] Identification: used to distinguish one type or one thing from other similar or different types of things. For example, the identification of a node, the identification of a network, the identification of a network card. The identification can be a name, a number, or a distinguishing feature, such as a type identification. This application does not limit the implementation of various identifications, as long as a distinction can be made. For example, in some implementations of this application, the identification of the virtual address space of the instance is used as the identification of the instance, rather than the common method of using the name or number of the instance as the identification of the instance.

[0145] Bus: The bus in the prior art is the internal structure of a computer, and is a public communication trunk for transmitting information between various functional components in the computer. The bus of a computer can be divided into a data bus, an address bus, and a control bus, which are used to transmit data, the address of the data, and control signals, respectively. In this application, bus is the abbreviation of High Performance Interconnect Bus (HPIB), which can not only connect various components inside a computer, but also replace the network and be laid between different computers, thereby connecting different computers. Each computer is connected to the high-performance interconnect bus through a bus terminal device. The bus terminal device is equivalent to a communication module such as a network card or a baseband antenna in network technology. This application describes how to use the function of the bus itself to complete the processing of requests for reading or writing data, that is, a method for accessing remote storage media after the hardware is laid out. This application does not describe the specific structure of the HPIB and the bus terminal device in detail.

[0146] Cache coherence protocols: To address the inefficiency of CPU memory access, modern computer systems have introduced cache structures. Leveraging the spatial locality of programs, cache technology significantly accelerates CPU memory access operations. However, in a multi-core architecture, each CPU core has its own cache, as shown in Figure 1. This requires ensuring cache coherence across cores so that each CPU core sees consistent memory data. To address this, various cache coherence protocols have emerged, the most typical of which is the MESI cache coherence protocol.

[0147] MESI defines a cache line as being in one of four states:

[0148] Modified (M state): In this state, the data is up-to-date and has been modified (Dirty state) and can be written. No other cache has a copy of the data, and the data in memory is out of date. At the same time, it must respond to read requests from other processors.

[0149] Exclusive (E state): No other cache has a copy of the data, the copy of this data in memory is also the latest, and a read operation directly returns the data.

[0150] Shared access rights (S state): The data is up-to-date, but writes are not allowed. The data in memory is also up-to-date, and there are copies of this data in other caches.

[0151] Invalid (I state): The data is invalid.

[0152] For a cache line of a CPU processing core, without considering the impact of the cache of other CPU processing cores, its own MESI state transition is as follows:

[0153] Each processor core's cache snoops on data operations performed by other caches. If it detects another cache operating on valid data in its cache, it will react accordingly, with the specific behavior defined by the MESI protocol. Typically, if a cache line in the shared state receives an invalidate message from another cache, it means that another CPU core is writing to the data. In this case, the shared cache line should transition to the invalid state, indicating that the data is invalid.

[0154] Memory object: The minimum granularity for accessing data in memory. For example, an address (physical address or virtual address) can uniquely indicate a memory object in memory. In one implementation, a memory object can include multiple cache lines, for example, 3 cache lines.

[0155] Based on Figure 1, a kind of architecture diagram applicable to the present application is described below. Among them, the controller (controller) 1001 in the figure can be on the same node as other components, or on different nodes, and the rest can be understood as belonging to one node. It should be understood that the architecture described in Figure 1 includes node 100 and controller 1001, and controller 1001 is illustrated as not included in node 100. It should be understood that the architecture described in Figure 1 is only a kind of illustration for ease of understanding, and is not a limitation on the architecture that can be used by the node mentioned in this application. Other software parts in the node 100, such as operating system and other hardware parts, such as display, etc., are not shown.

[0156] The architecture consists of two parts: hardware and software. Specifically, the hardware includes:

[0157] The central processing unit (CPU) 1004 and the memory management unit (MMU) 1005 are typically packaged into a single chip. The CPU runs applications and initiates requests to read or write data, referred to below as memory access requests. These requests are requests to access storage media, as reading or writing data requires finding an address in the storage medium (e.g., memory). The MMU is responsible for address translation for memory access requests initiated by the CPU.

[0158] Memory 1006: Figure 1 illustrates the storage medium on this node using memory as an example. The physical form of this memory can be cache lines. In the methods of this application, in addition to being available to local instances (e.g., processes), this memory can also be used by instances on other nodes. These instances can use this memory by requesting and using the methods described in this application to write data to or read data from this memory.

[0159] Input / Output Memory Management Unit (IOMMU) 1007: Similar in function to MMU 1005, the IOMMU is responsible for translating memory access requests from hardware other than the CPU. For example, if the hardware is memory, a memory access request is used to write data to or read data from memory. Hardware other than the CPU can also be other devices with Direct Memory Access (DMA).

[0160] Network device 1008: This device is used to connect the node to a high-performance interconnect bus and functions as a network card. Network device 1008 can be an ECC NIC (i.e., a network device with ECC features), for example, a bus end device, also referred to as an end point (EP). Taking a bus end device as an example, a bus end device is typically a hardware module with address translation capabilities. Similar to a network, a bus end device requires a driver installed in the node's operating system for the node's operating system to use it. A node can include multiple bus end devices, just as a node can have multiple network cards installed. A node can include both a bus end device and a network card. Figure 1 does not show a network card; only the bus end device is schematically indicated. If all remote communications for the node are via a high-performance interconnect bus, meaning that all information is exchanged using memory semantics, then the node can also include only a bus end device. In actual wiring, a bus end device can be connected to the CPU, memory, or MMU on one end and to the high-performance bus or a switch for the high-performance bus on the other end.

[0161] In one scenario, the node 100 may include multiple network devices 1008 , each of which may access the memory 1006 .

[0162] In one implementation, other devices involved in data reading and writing (such as a CPU and memory) in the node may also be integrated with bus-end devices, which are packaged together with these devices as interfaces or communication modules.

[0163] In one implementation, the functions of the IOMMU 1007 and the bus end device 1008 can be integrated on a single chip, that is, they can be combined into a single hardware device. In this case, the bus end device can also be considered to have the functions of the IOMMU.

[0164] The software modules deployed on the same node as the aforementioned hardware include:

[0165] The EP driver 1002 is a software module within the kernel of the operating system (OS) running on the node that drives the EP hardware module. This driver, like other hardware drivers, enables the operating system to sense and use the corresponding hardware.

[0166] Agent 1003: Manages shared memory on the local node and communicates with controller 1001. Communication between Agent 1003 and controller 1001 can occur via a high-performance interconnect bus or Ethernet. In one implementation, the driver for the bus-side device can also perform the agent's function of managing shared memory on the local node. The two modules described above are merely schematic functional divisions.

[0167] Among them, the source end can perform data write operations or data read operations on the destination end. The source end can be a node introduced above, and the destination end can be a node introduced above. For example, the source end is the second node, and the destination end is the first node. The second node can send a request (for example, a write request or a read request) to the first node. Specifically, the processor or other control module of the second node can determine the operation that needs to be performed on the memory of the first node (for example, instructing a network device of the second node to perform a write operation or a read operation on the memory), and send the information containing the operation to the network device local to the second node. The network device local to the second node can pass the request (for example, by sending a message) to the network device of the first node. The network device of the first node can perform a read operation or a write operation on the memory according to the request, and return the execution result to the network device of the second node.

[0168] This application focuses on describing how, after receiving a request from a second node, a first node performs an operation corresponding to the request, i.e., the process of processing the request. It should be understood that in the above scenario, the second node is the source node (also known as the source end) and the first node is the destination node (also known as the destination end), while in other scenarios, the second node can be the destination node. Furthermore, since a node can communicate with multiple nodes or multiple devices within a node simultaneously, a node can be both a source node and a destination node at the same time.

[0169] In some scenarios, a node may contain multiple network devices, and multiple network devices can access a local block of memory. In this mode, the CPU cannot access this memory. In some scenarios, multiple network devices can access a local block of memory, and the local CPU can also access this memory. Referring to Figure 2, Figure 2 is a more detailed diagram of an architecture applicable to this application. Among them, a node may contain multiple network devices, and multiple network devices can access a local block of memory.

[0170] In terms of hardware, the framework can include a CPU, which may have multiple cores. A multi-core system follows a cache coherence protocol when accessing main memory. The framework can also include memory, specifically main memory. The object mentioned in this disclosure can refer to a block of memory within the main memory. The framework can also include an ECC NIC: a network device with ECC features. Although Figure 2 shows a single one, multiple ECC NICs can be included.

[0171] From a software perspective,

[0172] The CPU may include a CPU atomic read and write module, for example, the CPU atomic read module (CPU Atomic Read Module) and the CPU atomic write module (CPU Atomic Write Module) in Figure 2. The module is specifically manifested as a code that can run on the CPU, defining the behavior that the CPU must comply with in the heterogeneous system object consistency protocol.

[0173] The ECC NIC may include a protocol parsing and execution module. Depending on the different access objects supported by the memory and the access methods, for example, it may include the Multi-NIC Read Module, Multi-NIC Write Module, NIC-CPU Hybrid Read Module, and NIC-CPU Hybrid Write Module shown in Figure 2. The ECC NIC supports programmable definition of the behavior of these operations. The protocol parsing and execution module here defines the behavior that the ECC network device must comply with in the heterogeneous system object consistency protocol. The differences in how each of the above modules processes requests will be described in subsequent embodiments and will not be repeated here.

[0174] In existing implementations, for the same block of memory, only multiple network devices are supported for access, or only the local CPU is supported for access. In order to achieve atomic reads or atomic writes on the network, information indicating whether the memory object is in a state where data is being written, as well as information indicating the latest version of the data update, can be set on the cache line of the memory object. In other words, additional storage space is required to store the above information, resulting in a certain amount of bandwidth waste. In addition, the CPU is required to perform a strip operation (in the process of reading data, the above information will be read, but this information is not required by the source end, so the processor is required to remove this part of the data and return it to the source end), which requires additional time and computing overhead.

[0175] Specifically, during a write operation, the source end attempts to acquire a lock on the object to be written. Specifically, the source end obtains information indicating whether the object is currently being written. If this information indicates that the object is currently being written, the lock acquisition fails and the transaction is aborted. If the lock acquisition succeeds, the destination end can lock the object to be written, then perform the write operation and update the information indicating the most recently modified version of the data. As can be seen above, an atomic write operation requires at least two round-trip times (RTT), resulting in a high latency for write operations.

[0176] In an embodiment of the present application, for a mode that only supports network devices accessing memory, the above-mentioned information indicating whether the memory object is in a state of data writing and the information indicating the latest version of the data update may not be required, and atomic reading and writing of the memory can be achieved, thereby reducing bandwidth waste. In addition, since the CPU does not need to perform culling operations on the above-mentioned information, time and computing overhead are reduced.

[0177] In a possible implementation, the mode that only supports network devices accessing memory can be referred to as Mode 1: one or more network devices have the ability to access memory (Multi-NIC Mode).

[0178] Mode 1 implements a multi-network device model for heterogeneous system object consistency protocols in a distributed environment. This allows access to remote atomic objects (memory objects). This model utilizes only the ECC NIC to access objects, requires only a single RTT, and supports concurrent operations across multiple network devices. Figure 3 shows the component architecture of Mode 1, which specifically involves the following modules and components:

[0179] Memory: Specifically, it is the destination memory, that is, the memory of the first node, which stores the memory objects that need to be remotely read and written atomically;

[0180] Memory objects: Objects of remote atomic operations may span cache lines. In the implementation of the Multi-NIC Mode of the heterogeneous system object consistency protocol, objects do not need information indicating whether the memory object is in the data writing state (such as the existing header identifier) ​​or the latest modified version (such as the existing version). The above information can be called meta data. Memory objects can only store valid data payloads.

[0181] ECC NIC: A network device that supports ECC on the destination side. Figure 3 uses two ECC NICs as an example. In an actual system, there may be more such network devices performing concurrent atomic reads and writes.

[0182] Multi-NIC Read Module (8002): This module supports concurrent atomic reads by multiple ECC NICs in the heterogeneous system object consistency protocol in Multi-NIC mode. It defines the specific behavior of the ECC NIC when performing atomic reads in this mode.

[0183] Multi-NIC Write Module (8003): This module supports concurrent atomic writes by multiple ECC NICs in the heterogeneous system object consistency protocol in Multi-NIC mode. It defines the specific behavior of the ECC NICs when performing atomic writes in this mode.

[0184] Packet Send / Receive Module (8004): This module is responsible for receiving request messages and sending reply messages within the ECC NIC. In this embodiment, after receiving a request message, this module sends it to the Multi-NIC Read module or the Multi-NIC Write module for processing. At the same time, the data that the Multi-NIC Read module or the Multi-NIC Write module needs to return to the initiator is also passed to this module and further sent to the network.

[0185] 4A , which is a flowchart of a request processing method provided in an embodiment of the present application, as shown in FIG4A , the request processing method provided in an embodiment of the present application includes:

[0186] 401. Obtain a write request from a second node, where the write request indicates writing first data into a first memory space of the first node.

[0187] Step 401 can be applied to the network device of the first node, and the second node can pass the write request to the network device of the first node, and then the network device of the first node can obtain the write request from the second node. It should be understood that the mechanism provided in the embodiment of the present application can be used in the scenario of node interaction in the cloud, the scenario of interaction between terminals, and the scenario of device interaction between the terminal and the cloud. In other words, either of the two nodes can be a device in the terminal or network that can initiate a memory access request or can share storage resources, such as a server.

[0188] The write request may indicate that the first data is to be written into a first memory space in the memory of the first node. For example, the write request may include an address corresponding to the first memory space (a virtual address or a physical address, based on which the first memory space can be uniquely indicated). For example, the address may include a starting address and an address offset.

[0189] It should be understood that the relationship between the first memory space and the second memory space is not limited in the embodiments of the present application, and the first memory space may be different from or the same as the second memory space.

[0190] In which, the first memory space can be a memory object, that is, the address (one or more) contained in the write request can include an address corresponding to a memory object, wherein the memory object can include multiple cache lines, such as the three cache lines in the memory shown in Figure 3.

[0191] Next, let’s introduce the write request:

[0192] In one possible implementation, the processor and network device of the first node need to perform some initialization actions. Taking the processor as a CPU and the network device as an ECC NIC as an example, the CPU and ECC NIC performing the necessary initialization actions may include: defining the behavior of the ECC NIC when receiving an invalid invalidate message in the heterogeneous system object consistency protocol, as well as retry-related parameters such as the retry interval retry_interval and the waiting time timeout.

[0193] In one implementation, the processor of the second node serving as the initiator may determine the operation to be performed (a write operation or a read operation on the memory of the first node) and issue a work request to the local network device.

[0194] The initiator can specify the specific type of atomic read and write of the remote object to be initiated, including four operations: Multi-NIC Mode Read, Multi-NIC Mode Write, NIC-CPU Hybrid Read, and NIC-CPU Hybrid Write. Multi-NIC Mode Read and Multi-NIC Mode Write only support reading and writing the target object through the destination ECC NIC and do not support the simultaneous participation of the destination CPU. NIC-CPU Hybrid Read and NIC-CPU Hybrid Write support not only the destination ECC network device but also the destination CPU participating in the reading and writing of the target object.

[0195] The local network device (the network device of the first node) may receive the request sent down, and send a message (carrying the write request) to the destination network device (the network device of the second node).

[0196] For example, the CPU of the first node can send a work request to the local ECC NIC. The ECC NIC parses the work request, encapsulates the message, and sends the message to the destination network device (the network device of the second node) through the network. The destination network device (the network device of the second node) parses the received request and performs operations according to predefined behaviors.

[0197] Exemplarily, the requesting end may send a Multi-NIC Read Request or a Multi-NIC Write Request to the local ECC NIC, which is then sent by the local ECC NIC to the peer NIC.

[0198] Typically, the work request sent by the initiator to an ECC NIC contains but is not limited to the following fields:

[0199]

[0200] The definition of nic_opcode includes but is not limited to:

[0201] struct nic_opcode{

[0202] OBJ_MUL_NIC_RD,

[0203] OBJ_MUL_NIC_WR,

[0204] OBJ_CPU_NIC_RD,

[0205] OBJ_CPU_NIC_WR,}

[0206] In this embodiment, the initiator can assemble a work request message, specifying the remote address (remote_addr) and length (length) to be operated on, and specifying the opcode as OBJ_MUL_NIC_RD or OBJ_MUL_NIC_WR, which respectively represent atomic reads and writes of the remote object. The initiator then calls the ECC NIC driver interface to issue the work request. The local ECC NIC parses the work request and assembles the message to send to the peer ECC NIC. The destination receives the request message and sends it to different modules for execution based on the request type. After receiving the message, the destination ECC NIC parses it. If the opcode is OBJ_MUL_NIC_RD, it is sent to the Multi-NIC Read Module for processing. If the opcode is OBJ_MUL_NIC_WR, it is sent to the Multi-NIC Write Module for processing.

[0207] 402. Acquire exclusive ownership of the first memory space, and write the first data into the first memory space. Before completing writing the first data into the first memory space, maintain exclusive ownership of the first memory space.

[0208] In a possible implementation, the network device of the second node may obtain exclusive rights to the first memory space in response to a write request for the first memory space.

[0209] In one possible implementation, the first memory space may be a memory object, which may include multiple cache lines. The network device of the second node may obtain exclusive access rights to the first cache line of the memory object, thereby obtaining exclusive rights to the entire memory object.

[0210] In a possible implementation, the first memory space can be a memory object. When the network device of the second node performs a write operation on the memory object, it can obtain the exclusive right of the memory object. The exclusive right can be the E state specified in the heterogeneous system object consistency protocol. The E state can indicate that no other cache has a copy of the data, the copy of this data in the memory is also the latest, and the data is directly returned to a Read operation. After the second node obtains the exclusive right to the memory object, it can continuously write the first data into the memory object. Referring to Figure 4B, in order to ensure the atomicity of writing data, it can not respond to the snoop message of other network devices during the execution of data writing. The snoop message can indicate the acquisition of the exclusive right to the memory object. That is to say, the second node will not release the exclusive right to the memory object during the execution of data writing, so that other network devices do not have the authority to perform write operations on the memory object, thereby ensuring the atomicity of the write operation. Moreover, since the exclusive right of the first memory space is not released before the first data is written into the first memory space, there is no need to store information indicating whether the memory object has been subjected to data writing, and the atomicity of the write operation can be achieved, thereby reducing bandwidth waste. In addition, since the CPU does not need to perform a culling operation on the above information, time and computing overhead are reduced.

[0211] In a possible implementation, the first memory space does not include a location for storing an indication of whether the first memory space is in a state of having data written thereto by the network device on the first node.

[0212] In a possible implementation, after the write operation of the first data is completed, the network device of the second node can release the exclusive access right to the memory object, so that other network devices can obtain the exclusive right to the memory object when performing a write operation on the memory object.

[0213] In one possible implementation, after executing the write operation indicated by the write request, the network device of the second node may return the execution result to the first node (eg, to the network device of the first node), and the execution result may indicate execution success or execution failure.

[0214] In a possible implementation, the network device of the second node may also receive a read request sent from the second node, where the read request indicates to read data from the second memory space of the first node.

[0215] The read request may indicate reading data from the second memory space in the memory of the first node. For example, the read request may include an address corresponding to the second memory space (a virtual address or a physical address, based on which the second memory space can be uniquely indicated). For example, the address may include a starting address and an address offset.

[0216] In which, the second memory space can be a memory object, that is, the address (one or more) contained in the read request can include an address corresponding to a memory object, wherein the memory object can include multiple cache lines, such as the three cache lines in the memory shown in Figure 3.

[0217] In a possible implementation, the network device of the second node may obtain the shared access right to the second memory space in response to the read request, and read data from the second memory space.

[0218] In one possible implementation, the first memory space can be a memory object, which can include multiple cache lines. The network device of the second node can obtain shared access rights to the first cache line of the memory object, thereby obtaining shared access rights to the entire memory object. Shared access rights can be in the S state specified in the heterogeneous system object consistency protocol. Shared access rights indicate that the data in the memory object is up-to-date and that copies of this data exist in other caches.

[0219] In a possible implementation, if the shared access right to the memory object can be obtained, it means that the memory object is not in a state where data is written by other network devices, but data can be read.

[0220] In one possible implementation, during the process of reading data from the second memory space, it is sensed that the second memory space is in a state where data is being written to by other network devices of the first node, and the process of reading data from the second memory space is terminated; based on the reacquisition of shared access rights to the second memory space, data is read from the second memory space again. If data is written to the memory object during the data reading process, the read data is not the latest data. In this case, the network device of the second node will sense that the memory object is in an invalid state, and it is necessary to interrupt the data reading process and enter a waiting state. After a preset time, the shared access rights to the memory object can be reacquired. If the shared access rights to the memory object are reacquired after the preset time, it means that the memory object is no longer in a state where data is being written to, and data can be read again.

[0221] Referring to FIG4C , assuming the network device is an ECC NIC, the destination ECC NIC (i.e., the network device at the second node) can attempt to obtain the S state of the first cache line of the memory object based on its address, then continuously copy the object's contents to an on-chip buffer and send it to the network. During this process, if the ECC NIC receives an invalidate message, indicating that another ECC NIC has begun writing to the object, the object data read at this time may be dirty. Therefore, the object read operation is interrupted and the retry_interval parameter configured during initialization is waited for the retry_interval time. If the total retry time exceeds the timeout configured during initialization, the Packet Send / Receive Module (8004) notifies the initiator of the failure of the operation. Otherwise, retries are continued until the object read is successful or a timeout occurs.

[0222] The above embodiment implements a multi-network device write mode of a heterogeneous system object consistency protocol. Under this scheme, atomic operations on remote objects can be performed without the need for a lock mechanism or a version number mechanism (that is, storing information in memory to indicate the write status and the latest version) for control, thereby reducing bandwidth waste and saving CPU computing power. Moreover, the entire process only requires one network round trip, which significantly reduces the latency of atomic operations on remote objects and improves the efficiency of atomic operations on remote objects.

[0223] In existing implementations, only multiple network devices or only the local CPU are supported to access the same memory block. In the embodiments of the present application, a mode is constructed to support both network devices and processors to access memory. In this mode, both network devices and CPUs can access the same memory block and implement atomic read and write operations on the memory.

[0224] In a possible implementation, the above-mentioned mode of supporting both the network device and the processor to access the memory can be referred to as Mode 2: the network device and the processor have the ability to access the memory (Multi-NIC Mode).

[0225] Mode 2 is a hybrid network device-CPU model that implements a heterogeneous system object consistency protocol in a distributed environment. This model enables access to remote atomic objects (memory objects). In this model, multiple NICs and multiple CPU cores perform atomic reads and writes concurrently. Figure 5 shows the component structure of Mode 2, which specifically involves the following modules and components:

[0226] Memory: Specifically, it is the destination memory, that is, the memory of the first node, which stores the memory objects that need to be remotely read and written atomically;

[0227] Memory objects: Objects of remote atomic operations may span cache lines. In the implementation of the NIC-CPU Hybrid Mode of the heterogeneous system object consistency protocol, the Lock (10008) and Version (10009) fields are added as metadata at the preset location of the memory object. This is necessary to support concurrent atomic reading and writing by the CPU and NIC.

[0228] CPU core: The CPU processing core on the destination end. In NIC-CPU Hybrid Mode, the CPU core, like the NIC, participates in atomic reads and writes of objects. Figure 8 uses two CPU cores as an example. In actual systems, more CPU cores may participate in this process.

[0229] CPU Atomic Read Module (10002): This module performs concurrent atomic reads on the CPU side in the NIC-CPU Hybrid mode in the heterogeneous system object consistency protocol. It defines the specific behavior of the CPU core when performing atomic reads in this mode.

[0230] CPU Atomic Write Module (10003): This module performs concurrent atomic writes on the CPU side in the NIC-CPU Hybrid mode of the heterogeneous system object consistency protocol. It defines the specific behavior of the CPU core when performing atomic writes in this mode.

[0231] ECC NIC: A network device that supports ECC on the destination side. Figure 10 uses two ECC NICs as an example. In an actual system, there may be more such network devices participating in this process.

[0232] NIC-CPU Hybrid Read Module (10004): This module implements concurrent atomic reads on the ECC NIC side in NIC-CPU Hybrid mode in the heterogeneous system object consistency protocol. It defines the specific behavior of the ECC NIC when performing atomic reads in this mode.

[0233] NIC-CPU Hybrid Write Module (10005): This module performs concurrent atomic writes on the ECC NIC side in NIC-CPU Hybrid mode in the heterogeneous system object consistency protocol. It defines the specific behavior of the ECC NIC when performing atomic writes in this mode.

[0234] Packet Send / Receive Module (10006): The module in the ECC NIC responsible for receiving request messages and sending reply messages. In this embodiment, after receiving a request message, this module sends it to the NIC-CPU Hybrid Read Module (10004) or NIC-CPU Hybrid Write Module (10005) for processing. At the same time, the data that the NIC-CPU Hybrid Read Module (10004) or NIC-CPU Hybrid Write Module (10005) needs to return to the initiator is also passed to this module and then sent to the network.

[0235] 6A , which is a flowchart of a request processing method provided in an embodiment of the present application. As shown in FIG6A , the request processing method provided in an embodiment of the present application includes:

[0236] 601. Obtain a write request from a second node, where the write request indicates writing first data into a first memory space of the first node.

[0237] Step 601 can be applied to the network device of the first node, and the second node can pass the write request to the network device of the first node, and then the network device of the first node can obtain the write request from the second node. It should be understood that the mechanism provided in the embodiment of the present application can be used in the scenario of node interaction in the cloud, the scenario of interaction between terminals, and the scenario of device interaction between the terminal and the cloud. In other words, either of the two nodes can be a device in the terminal or network that can initiate a memory access request or can share storage resources, such as a server.

[0238] The write request may indicate that the first data is to be written into a first memory space in the memory of the first node. For example, the write request may include an address corresponding to the first memory space (a virtual address or a physical address, based on which the first memory space can be uniquely indicated). For example, the address may include a starting address and an address offset.

[0239] In which, the first memory space can be a memory object, that is, the address (one or more) contained in the write request can include an address corresponding to a memory object, wherein the memory object can include multiple cache lines, such as the three cache lines in the memory shown in Figure 3.

[0240] Next, let’s introduce the write request:

[0241] In one possible implementation, the processor and network device of the first node need to perform some initialization actions. Taking the processor as a CPU and the network device as an ECC NIC as an example, the CPU and ECC NIC performing the necessary initialization actions may include: defining the behavior of the ECC NIC when receiving an invalid invalidate message in the heterogeneous system object consistency protocol, as well as retry-related parameters such as the retry interval retry_interval and the waiting time timeout.

[0242] In one implementation, the processor of the second node serving as the initiator may determine the operation to be performed (a write operation or a read operation on the memory of the first node) and issue a work request to the local network device.

[0243] The initiator can specify the specific type of atomic read and write of the remote object to be initiated, including four operations: Multi-NIC Mode Read, Multi-NIC Mode Write, NIC-CPU Hybrid Read, and NIC-CPU Hybrid Write. Multi-NIC Mode Read and Multi-NIC Mode Write only support reading and writing the target object through the destination ECC NIC and do not support the simultaneous participation of the destination CPU. NIC-CPU Hybrid Read and NIC-CPU Hybrid Write support not only the destination ECC network device but also the destination CPU participating in the reading and writing of the target object.

[0244] The local network device (the network device of the first node) may receive the request sent down, and send a message (carrying the write request) to the destination network device (the network device of the second node).

[0245] For example, the CPU of the first node can send a work request to the local ECC NIC. The ECC NIC parses the work request, encapsulates the message, and sends the message to the destination network device (the network device of the second node) through the network. The destination network device (the network device of the second node) parses the received request and performs operations according to predefined behaviors.

[0246] For example, the requesting end can send a NIC-CPU Hybrid Read Request or a NIC-CPU Hybrid Write Request to the local ECC NIC, which then sends it to the peer NIC. After receiving the message, the destination ECC NIC parses it. If the opcode is OBJ_CPU_NIC_RD, it sends it to the NIC-CPU Hybrid Read Module (10004) for processing. If the opcode is OBJ_CPU_NIC_WR, it sends it to the NIC-CPU Hybrid Write Module (10005) for processing.

[0247] 602. Obtain first information from a first position in the first memory space, where the first information indicates that the first memory space is in a state where data is written by a processor of the first node.

[0248] In one possible implementation, the network device of the second node can obtain exclusive rights to the first memory space in response to a write request for the first memory space, and obtain first information from a first position in the first memory space, wherein the information at the first position can be used to indicate whether the first memory space is in a state where data is being written by the processor of the first node.

[0249] For example, the CPU may perform a write operation to the first memory space before the network device of the second node obtains the first information from the first location of the first memory space, and set the information at the first location to indicate that the first memory space is in a state where data is written by the processor of the first node.

[0250] The first memory space is a memory object, the memory object includes multiple cache lines, and the first position is located at the head of a head cache line among the multiple cache lines. For example, the first predetermined number of bytes of the head cache line, such as the first 8 bytes or the first 16 bytes, can be used to store the first information.

[0251] 603. Based on the first information, obtain second information from the first location after a preset time, where the second information indicates that the first memory space is in a state where data is not written by the processor.

[0252] Among them, the information at the first position can indicate whether the first memory space is in a state where data is being written by the processor of the first node through different identifiers. For example, "1" can be used to indicate that the first memory space is in a state where data is being written by the processor of the first node, and "0" can be used to indicate that the first memory space is not in a state where data is being written by the processor of the first node.

[0253] In one possible implementation, if the first information indicates that the first memory space is in a state where data is being written by the processor of the first node, in this case, in order to ensure the atomicity of the write operation, the information at the first position (second information) can be retrieved after waiting for a period of time.

[0254] In a possible implementation, after determining that the first information indicates that the first memory space is in a state where data is being written by the processor of the first node, the exclusive right for the first memory space may be released.

[0255] In one possible implementation, after determining that the first information indicates that the first memory space is in a state where data is being written by the processor of the first node, you can wait for a preset time to re-acquire the information at the first position (second information) and re-acquire the exclusive right to the first memory space.

[0256] In a possible implementation, if the time during the retry exceeds the preset timeout value, failure is returned.

[0257] 604. Based on the second information, write the first data into the first memory space.

[0258] In a possible implementation, based on the second information indicating that the first memory space is in a state where data has not been written by the processor, the first data is written into the first memory space.

[0259] In a possible implementation, after the write operation of the first data is completed, the network device of the second node can release the exclusive access right to the memory object, so that other network devices can obtain the exclusive right to the memory object when performing a write operation on the memory object.

[0260] In one possible implementation, after executing the write operation indicated by the write request, the network device of the second node may return the execution result to the first node (eg, to the network device of the first node), and the execution result may indicate execution success or execution failure.

[0261] In a possible implementation, the network device of the second node may also receive a read request sent from the second node, where the read request indicates to read data from the second memory space of the first node.

[0262] The read request may indicate reading data from the second memory space in the memory of the first node. For example, the read request may include an address corresponding to the second memory space (a virtual address or a physical address, based on which the second memory space can be uniquely indicated). For example, the address may include a starting address and an address offset.

[0263] In which, the second memory space can be a memory object, that is, the address (one or more) contained in the read request can include an address corresponding to a memory object, wherein the memory object can include multiple cache lines, such as the three cache lines in the memory shown in Figure 4.

[0264] In a possible implementation, the network device of the second node may obtain the shared access right to the second memory space in response to the read request, and read data from the second memory space.

[0265] In one possible implementation, the first memory space can be a memory object, which can include multiple cache lines. The network device of the second node can obtain shared access rights to the first cache line of the memory object, thereby obtaining shared access rights to the entire memory object. Shared access rights can be in the S state specified in the heterogeneous system object consistency protocol. Shared access rights indicate that the data in the memory object is up-to-date and that copies of this data exist in other caches.

[0266] In a possible implementation, if the shared access right to the memory object can be obtained, it means that the memory object is not in a state where data is written by other network devices, but data can be read.

[0267] In one possible implementation, during the process of reading data from the second memory space, it is sensed that the second memory space is in a state where data is being written to by other network devices of the first node, and the process of reading data from the second memory space is terminated; based on the reacquisition of shared access rights to the second memory space, data is read from the second memory space again. If data is written to the memory object during the data reading process, the read data is not the latest data. In this case, the network device of the second node will sense that the memory object is in an invalid state, and it is necessary to interrupt the data reading process and enter a waiting state. After a preset time, the shared access rights to the memory object can be reacquired. If the shared access rights to the memory object are reacquired after the preset time, it means that the memory object is no longer in a state where data is being written to, and data can be read again.

[0268] In one possible implementation, before reading data from the second memory space, third information is obtained from the second position of the first memory space, and the information at the second position indicates the latest version of the data in the first memory space; after reading data from the second memory space, fourth information is obtained from the second position; when the fourth information is inconsistent with the third information, information indicating read failure is returned to the second node.

[0269] Among them, the information at the second position can indicate the latest version of the data in the second memory space. When the fourth information and the third information are inconsistent, it can be considered that in the process of reading data from the second memory space, the processor performed a data write operation on the second memory space, and then it can be considered that the read data is invalid. Through the above method, atomic reading of data can be guaranteed.

[0270] Taking the ECC NIC as an example, referring to Figure 6B , the ECC NIC obtains exclusive access to the first cache line (E state) and reads the Lock value of the first cache line. If the value is 1, it indicates that the CPU has locked the object for a CPU write operation. At this time, the E state is released, and the process waits for the retry_interval time before retrying (including obtaining the E state). If the retry time exceeds the timeout value, a failure is returned. If the lock is not locked after reading the lock value, the lock is set to 1 and the version number is incremented, and data from the network is copied to the object. If a snoop message is received during this period, no response is given. After the object is written, the lock is set to 0 to unlock it and the E state of the first cache line of the object is released. This completes an atomic write operation of an ECC NIC in NIC-CPU Hybrid Mode.

[0271] Through the above method, both the network device and the CPU can access the same memory and implement atomic write operations on the memory, which improves the flexibility, concurrency and efficiency of atomic operations on remote objects.

[0272] 7A , which is a flowchart of a request processing method provided in an embodiment of the present application. As shown in FIG7A , the request processing method provided in an embodiment of the present application includes:

[0273] 701. Obtain a first write request, where the first write request indicates writing first data into a first memory space of the first node.

[0274] Step 701 may be applied to a processor of a first node.

[0275] An instance in the source end (ie, the first node) executes the first request and obtains a result of executing the first request. The first request may be used to instruct writing first data into a first memory space of the first node.

[0276] The write request may indicate that the first data is to be written into a first memory space in the memory of the first node. For example, the write request may include an address corresponding to the first memory space (a virtual address or a physical address, based on which the first memory space can be uniquely indicated). For example, the address may include a starting address and an address offset.

[0277] In which, the first memory space can be a memory object, that is, the address (one or more) contained in the write request can include an address corresponding to a memory object, wherein the memory object can include multiple cache lines, such as the three cache lines in the memory shown in Figure 3.

[0278] 702. Obtain first information from a first position in the first memory space, where the first information indicates that the first memory space is not in a state where data is being written by a network device or other processor of the first node.

[0279] In one possible implementation, the network device of the second node can obtain exclusive rights to the first memory space in response to a write request for the first memory space, and obtain first information from a first position in the first memory space, wherein the information at the first position can be used to indicate whether the first memory space is in a state where data is being written by the processor of the first node.

[0280] For example, the network device or other CPU of the second node may perform a write operation to the first memory space before the execution subject (CPU) of step 701 and arrangement 702 obtains the first information from the first position of the first memory space, and sets the information at the first position to indicate that the first memory space is in a state where data is written by the network device or other CPU of the first node.

[0281] The first memory space is a memory object, the memory object includes multiple cache lines, and the first position is located at the head of a head cache line among the multiple cache lines. For example, the first predetermined number of bytes of the head cache line, such as the first 8 bytes or the first 16 bytes, can be used to store the first information.

[0282] 703. Based on the first information, write the first data into the first memory space.

[0283] Among them, the information at the first position can indicate whether the first memory space is in a state where data is being written by the network device or other processor of the first node through different identifiers. For example, "1" can be used to indicate that the first memory space is in a state where data is being written by the network device or other processor of the first node, and "0" can be used to indicate that the first memory space is not in a state where data is being written by the network device or other processor of the first node.

[0284] In a possible implementation, after the first information indicates that the first memory space is in a state where no data is written to the first memory space by the network device or other processor of the first node, the processor may write the first data into the first memory space.

[0285] In one possible implementation, a second write request is received from a second node, where the second write request indicates that second data is to be written into a second memory space of the first node; second information is obtained from a first location in the second memory space; and when the second information indicates that the second memory space is in a state where data is being written by a network device or other processor of the first node, a write failure message is returned to the second node. Because the write failure is determined directly after determining that the first memory space is in a state where data is being written, prolonged CPU blocking due to the network device being in a data writing state for an extended period of time can be avoided.

[0286] 7B , taking the ECC NIC as an example, the CPU can read the information at the first location. If it indicates that the first memory space is in a written state (e.g., 0), a failure can be returned to the user. This is to prevent the ECC NIC from occupying the E state for a long time, causing the CPU to be blocked for too long. The CPU can attempt to set the information at the first location to 1 using a CAS operation. If the CAS operation fails, the CPU aborts and returns. Otherwise, a memory barrier is added to increment the version number, the data is updated, and the memory barrier is added again. Finally, the lock is unlocked by setting it to 0 through a CAS operation, completing the entire write operation.

[0287] In one possible implementation, a read request from the second node can be obtained, wherein the read request indicates reading data from the second memory space of the first node; after reading data from the second memory space based on the read request, third information is obtained from the second position in the second memory space; when the third information indicates that the second memory space is in a state where data is being written by a network device or other processor of the first node, information indicating that data writing has failed is returned to the second node.

[0288] In one possible implementation, a read request is obtained from the second node, wherein the read request indicates reading data from the second memory space of the first node; fourth information is obtained from a second position in the second memory space, wherein the information at the second position indicates the latest version of the data in the second memory space; after reading the data from the second memory space based on the read request, fifth information is obtained from the second position; and when the fourth information and the fifth information are inconsistent, information indicating a read failure is returned to the second node.

[0289] For example, referring to Figure 7C , the CPU can store the lock and version of the memory object header. If the lock is 1, the operation fails and exits. Otherwise, a memory barrier is added, the entire object is read, and then the memory barrier is added again. The object header is read again, and the Lock and Version values ​​are obtained again. If the object is now locked, or the current Version is different from the initially read Version, the read operation fails. Otherwise, the read operation succeeds. The CPU reads objects using a lock-free read method, using the Lock and Version values ​​to determine the object's integrity. The reason for not retrying after a failure is to give the user more autonomy, allowing the user to initiate or abort a retry.

[0290] 8 , which is a schematic diagram of the structure of an apparatus for processing a request according to an embodiment of the present application, as shown in FIG8 , the apparatus 800 may be located in a network device of a first node, and the apparatus 800 includes:

[0291] An acquisition module 801 is configured to acquire a write request from a second node, where the write request indicates writing first data into a first memory space of the first node;

[0292] Reading first information from a first position in the first memory space, where the first information indicates that the first memory space is in a state where data is being written by a processor of the first node;

[0293] Based on the first information, second information is obtained from the first location after a preset time, where the second information indicates that the first memory space is in a state where no data is written by the processor.

[0294] For the description of the acquisition module 801 , reference may be made to the introduction of steps 701 to 703 in the above embodiment, which will not be repeated here.

[0295] The data writing module 802 is configured to write the first data into the first memory space based on the second information.

[0296] For the description of the data writing module 802 , reference may be made to the introduction of step 704 in the above embodiment, which will not be repeated here.

[0297] In a possible implementation, the first memory space is a memory object, the memory object includes a plurality of cache lines, and the first position is located at a head position of a head cache line among the plurality of cache lines.

[0298] In a possible implementation, the acquisition module is also used to obtain exclusive rights to the first memory space before writing the first data into the first memory space, and maintain possession of the exclusive rights to the first memory space before completing writing the first data into the first memory space.

[0299] In a possible implementation, the acquisition module is further configured to:

[0300] Before obtaining the first information from the preset location of the first memory space, obtaining exclusive rights to the first memory space;

[0301] The device also includes:

[0302] A releasing module is configured to release the exclusive right of the first memory space based on the first information indicating that the first memory space is in a state where data is being written by the processor of the first node.

[0303] In a possible implementation, the acquisition module is further configured to:

[0304] Obtaining a read request from the second node, where the read request indicates reading data from a second memory space of the first node;

[0305] The device also includes:

[0306] The data reading module is configured to read data from the second memory space of the first node after obtaining the shared access right (shared) to the second memory space.

[0307] In a possible implementation, the data reading module is specifically configured to:

[0308] During the process of reading data from the second memory space according to the read request, it is detected that the second memory space is in a state where data is being written by another network device of the first node, and the process of reading data from the second memory space is terminated;

[0309] Based on the reacquisition of the shared access right to the second memory space, data is read again from the second memory space.

[0310] In a possible implementation, the acquisition module is further configured to:

[0311] Before reading data from the second memory space, obtaining third information from a second position in the first memory space, where the information in the second position indicates a latest version of the data in the first memory space;

[0312] After reading data from the second memory space, obtaining fourth information from the second location;

[0313] The device further comprises:

[0314] A data return module is used to return read failure information to the second node when the fourth information is inconsistent with the third information.

[0315] 9 , which is a schematic diagram of the structure of an apparatus for processing a request provided in an embodiment of the present application, wherein the apparatus is located in a processor of a first node, and the apparatus 900 may include:

[0316] An acquisition module 901 is configured to receive a first write request, where the first write request indicates that first data is to be written into a first memory space of the first node.

[0317] Acquire first information from a first position of the first memory space, where the first information indicates that the first memory space is not in a state where data is written by a network device or other processor of the first node;

[0318] For the description of the acquisition module 901 , reference may be made to the introduction of step 601 and step 602 in the above embodiment, which will not be repeated here.

[0319] The data writing module 902 is configured to write the first data into the first memory space based on the first information.

[0320] For the description of the data writing module 902 , reference may be made to the introduction of step 603 in the above embodiment, which will not be repeated here.

[0321] In a possible implementation, the first memory space is a memory object, the memory object includes a plurality of cache lines, and the preset position is located at a head position of a head cache line among the plurality of cache lines.

[0322] In a possible implementation, the acquisition module is further configured to:

[0323] Obtaining a second write request, where the second write request indicates writing second data into a second memory space of the first node;

[0324] Acquire second information from a first position of the second memory space, where the second information indicates that the second memory space is in a state where data is written by a network device or other processor of the first node;

[0325] The device further comprises:

[0326] A data return module is used to return information indicating data write failure to the second node based on the second information.

[0327] In a possible implementation, the acquisition module is further configured to:

[0328] Obtaining a read request, where the read request indicates reading data from a second memory space of the first node;

[0329] After reading data from the second memory space based on the read request, obtaining third information from a second position in the second memory space, the third information indicating that the second memory space is in a state where data is being written by a network device or other processor of the first node;

[0330] The device further comprises:

[0331] The data returning module is configured to determine that data writing fails based on the third information.

[0332] In a possible implementation, the acquisition module is further configured to:

[0333] Obtaining a read request, where the read request indicates reading data from the second memory space of the first node;

[0334] Obtain fourth information from a second position in the second memory space, where the information at the second position indicates a latest version of the data in the second memory space;

[0335] After reading data from the second memory space based on the read request, obtaining fifth information from the second location;

[0336] The device also includes:

[0337] The data returning module is configured to determine that the reading fails when the fourth information and the fifth information are inconsistent.

[0338] 10 , which is a schematic diagram of the structure of an apparatus for processing a request according to an embodiment of the present application, wherein the apparatus is located in a network device of a first node, and the apparatus 1000 includes:

[0339] An acquisition module 1001 is configured to acquire a write request from a second node, where the write request indicates writing first data into a first memory space of the first node;

[0340] Acquire exclusive rights to the first memory space;

[0341] For the description of the acquisition module 1001 , reference may be made to the introduction of step 401 and step 402 in the above embodiment, which will not be repeated here.

[0342] The data writing module 1002 is configured to write the first data into the first memory space and maintain exclusive ownership of the first memory space before completing writing the first data into the first memory space.

[0343] For the description of the data writing module 1002 , reference may be made to the introduction of step 403 in the above embodiment, which will not be repeated here.

[0344] In a possible implementation, the first memory space does not include a location for storing an indication of whether the first memory space is in a state of having data written thereto by the network device on the first node.

[0345] In a possible implementation, the acquisition module is further configured to:

[0346] Obtaining a read request from the second node, where the read request indicates reading data from a second memory space of the first node;

[0347] Acquire shared access rights to the second memory space;

[0348] A data reading module is used to read data from the second memory space.

[0349] In a possible implementation, the data reading module is specifically configured to:

[0350] During the process of reading data from the second memory space, it is detected that the second memory space is in a state where data is being written by another network device of the first node, and the process of reading data from the second memory space is terminated;

[0351] Based on the reacquisition of the shared access right to the second memory space, data is read again from the second memory space.

[0352] Figure 11 shows a possible logical structure diagram of a device for processing requests provided by an embodiment of the present application. The device 1100 includes: a storage medium 11001, a processing circuit 11002, a memory management unit 11003 and a network device 11004. The storage medium 11001 is coupled to the processing circuit 11002. The storage medium 11001 is used to store computer program code and data. The computer program code includes computer instructions. When the computer instructions are executed by the processing circuit 11002, the aforementioned method can be executed together with the memory management unit 11003 and the network device 11004. The processing circuit 11002 is used to control and manage the actions of the computer device 1100. The network device 11004 is used to support the device 1100 to communicate with other devices through a bus (e.g., a high-performance interconnect bus).

[0353] The processing circuit 11002 can be a central processing unit, a graphics processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a transistor logic device, a hardware component or any combination thereof. It can implement or execute the various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processing circuit 11002 can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a digital signal processor and a microprocessor, and the like. The storage medium 11001 can be a read-only memory (ROM) or other type of storage module that can store static information and instructions, or a random access memory (RAM) or other type of storage module that can dynamically store information and instructions, or an electrically erasable programmable read-only memory (EEPROM) or other magnetic storage device.

[0354] The storage medium 11001, the processing circuit 11002 and the network device 11004 can be connected via a bus. In Figure 11, the memory management unit 11003 and the processing circuit 11002 are packaged together, the two are electrically connected, and the memory management unit 11003 is directly connected to the bus, and the processing circuit 11002 is connected through the memory management unit 11003. In an actual device, the memory management unit 11003 may also be an independent device, or the processing circuit 11002 and the memory management unit 11003 may be packaged together, and the processing circuit 11002 is directly connected to the bus. This application does not limit the layout of the various components in the device 1100. The bus here is a bus within the device, which can specifically be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, FIG11 only uses one thick line, but this does not mean that there is only one bus or one type of bus in the device 1100 .

[0355] The device 1100 corresponding to Figure 11 can be the device where the aforementioned destination end or second node is located, or the aforementioned source end or second node, and is used to execute the method executed by the aforementioned destination end or first node. Therefore, the specific implementation, description and technical effects can all refer to the corresponding paragraphs of the previous methods, devices and systems, and will not be repeated here.

[0356] As an embodiment, the device 1100 may include multiple processors. Each of these processors may be a single-core processor or a multi-core processor. The processor here may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions). In addition, the computer program code in the embodiments of the present application may also be referred to as a computer program or code, or other names, and the computer instructions may also be referred to as instructions or commands, which are not specifically limited in the embodiments of the present application.

[0357] In addition, those skilled in the art will appreciate that device 1100 may include fewer or more components than those shown in FIG. 11 , and FIG. 11 only illustrates components that are more relevant to the multiple implementations disclosed in the embodiments of the present invention. As an embodiment, device 1100 may also include an output device and an input device. The output device communicates with the aforementioned processing circuit (such as processing circuit 11002 or the processing circuit) and can display information in a variety of ways. For example, the output device can be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector. The input device communicates with the processor and can receive user input in a variety of ways. For example, the input device can be a mouse, keyboard, touch screen device, or sensor device. In addition, FIG. 11 does not illustrate a high-performance interconnect bus, that is, a bus used for communication between devices, accessed through a network device, and functioning similarly to a wireless network.

[0358] It is understandable that, in order to realize the above functions, the above-mentioned equipment or devices include hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the embodiments of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of the present application.

[0359] In the embodiment of the present application, the functional modules of the above-mentioned device (such as 1100) can be divided according to the above-mentioned method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.

[0360] An embodiment of the present application also provides a chip system, which is applied to the above-mentioned device. The chip system includes: one or more interface circuits and one or more processors. The interface circuits and the processors are interconnected via a circuit. The interface circuits are configured to receive signals from the device's memory and send the signals to the processors. The signals include computer instructions stored in the memory. When the processors execute the computer instructions, the device performs any of the methods performed by the first node in the above-mentioned method embodiments.

[0361] An embodiment of the present application further provides a computer storage medium, which includes computer instructions. When the computer instructions are executed on a device, the device executes any method executed by the first node in the above method embodiment.

[0362] An embodiment of the present application further provides a computer program product. When the computer program product is run on a computer, it enables a device to execute any method executed by the first node in the above method embodiment.

[0363] Among them, the devices, chip systems, computer storage media or computer program products provided in this application are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.

[0364] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

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

[0366] The units described as separate components may or may not be physically separate, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0367] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0368] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling 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 of each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0369] The above content is only a specific embodiment of this application, but the scope of protection of this application is not limited to this. Any changes or replacements within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A method for processing a request, characterized in that: A network device applied to a first node, the method comprising: Obtaining a write request from a second node, where the write request indicates writing first data into a first memory space of the first node; Acquire first information from a first position of the first memory space, where the first information indicates that the first memory space is in a state where data is being written by a processor of the first node; Based on the first information, obtaining second information from the first location after a preset time, the second information indicating that the first memory space is in a state where no data is written by the processor; Based on the second information, the first data is written into the first memory space.

2. The method according to claim 1, characterized in that The first memory space is a memory object, the memory object includes a plurality of cache lines, and the first position is located at a head position of a head cache line among the plurality of cache lines.

3. The method according to claim 1 or 2, characterized in that The method further comprises: Before writing the first data into the first memory space, an exclusive right to the first memory space is acquired, and before completing writing the first data into the first memory space, possession of the exclusive right to the first memory space is maintained.

4. The method according to any one of claims 1 to 3, characterized in that The method further comprises: Before obtaining the first information from the preset location of the first memory space, obtaining exclusive rights to the first memory space; Based on the first information indicating that the first memory space is in a state where data is being written by the processor of the first node, the exclusive right of the first memory space is released.

5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: Obtaining a read request from the second node, where the read request indicates reading data from a second memory space of the first node; After obtaining the shared access right (shared) to the second memory space, data is read from the second memory space of the first node.

6. The method according to claim 5, characterized in that The reading data from the second memory space of the first node includes: During the process of reading data from the second memory space according to the read request, it is detected that the second memory space is in a state where data is being written by another network device of the first node, and the process of reading data from the second memory space is terminated; Based on the reacquisition of the shared access right to the second memory space, data is read again from the second memory space.

7. The method according to claim 5 or 6, characterized in that The method further comprises: Before reading data from the second memory space, obtaining third information from a second position in the first memory space, where the information in the second position indicates a latest version of the data in the first memory space; After reading data from the second memory space, obtaining fourth information from the second location; When the fourth information is inconsistent with the third information, information indicating read failure is returned to the second node.

8. A method for processing a request, characterized in that Applied to a processor of a first node, the method includes: Obtaining a first write request, where the first write request indicates writing first data into a first memory space of the first node; Acquire first information from a first position of the first memory space, where the first information indicates that the first memory space is not in a state where data is written by a network device or other processor of the first node; Based on the first information, the first data is written into the first memory space.

9. The method according to claim 8, characterized in that The first memory space is a memory object, the memory object includes a plurality of cache lines, and the preset position is located at a head position of a head cache line among the plurality of cache lines.

10. The method according to claim 8 or 9, characterized in that The method further comprises: Obtaining a second write request, where the second write request indicates writing second data into a second memory space of the first node; Acquire second information from a first position of the second memory space, where the second information indicates that the second memory space is in a state where data is written by a network device or other processor of the first node; Based on the second information, information indicating data write failure is returned to the second node.

11. The method according to any one of claims 8 to 10, characterized in that: The method further comprises: Obtaining a read request, where the read request indicates reading data from a second memory space of the first node; After reading data from the second memory space based on the read request, obtaining third information from a second position in the second memory space, the third information indicating that the second memory space is in a state where data is being written by a network device or other processor of the first node; Based on the third information, it is determined that writing data has failed.

12. The method according to any one of claims 8 to 10, characterized in that: The method further comprises: Obtaining a read request, where the read request indicates reading data from a second memory space of the first node; Obtaining fourth information from a second location in the second memory space, where the information at the second location indicates a latest version of data in the second memory space; After reading data from the second memory space based on the read request, obtaining fifth information from the second location; When the fourth information and the fifth information are inconsistent, it is determined that the reading has failed.

13. A method for processing a request, characterized in that: A network device applied to a first node, the method comprising: Obtaining a write request from a second node, where the write request indicates writing first data into a first memory space of the first node; Acquire the exclusive right of the first memory space, and write the first data into the first memory space, and maintain the exclusive right to the first memory space before completing writing the first data into the first memory space.

14. The method according to claim 13, characterized in that The first memory space does not include a location for storing an indication of whether the first memory space is in a state of being written with data by the network device on the first node.

15. The method according to claim 13 or 14, characterized in that The method further comprises: Obtaining a read request from the second node, where the read request indicates reading data from a second memory space of the first node; Acquire shared access rights to the second memory space, and read data from the second memory space.

16. The method according to claim 15, characterized in that The method further comprises: During the process of reading data from the second memory space, it is detected that the second memory space is in a state where data is being written by another network device of the first node, and the process of reading data from the second memory space is terminated; Based on the reacquisition of the shared access right to the second memory space, data is read again from the second memory space.

17. A device for processing a request, the device being located in a network device of a first node, characterized in that: The device comprises: an acquisition module, configured to acquire a write request from a second node, wherein the write request indicates writing first data into a first memory space of the first node; Reading first information from a first position in the first memory space, where the first information indicates that the first memory space is in a state where data is being written by a processor of the first node; Based on the first information, obtaining second information from the first location after a preset time, the second information indicating that the first memory space is in a state where no data is written by the processor; A data writing module is used to write the first data into the first memory space based on the second information.

18. The device according to claim 17, characterized in that The first memory space is a memory object, the memory object includes a plurality of cache lines, and the first position is located at a head position of a head cache line among the plurality of cache lines.

19. The device according to claim 17 or 18, characterized in that The acquisition module is further configured to acquire exclusive rights to the first memory space before writing the first data into the first memory space, and to maintain possession of the exclusive rights to the first memory space before completing writing the first data into the first memory space.

20. The device according to any one of claims 17 to 19, characterized in that The acquisition module is further used to: Before obtaining the first information from the preset location of the first memory space, obtaining exclusive rights to the first memory space; The device further comprises: A releasing module is configured to release the exclusive right of the first memory space based on the first information indicating that the first memory space is in a state where data is being written by the processor of the first node.

21. The device according to any one of claims 17 to 20, characterized in that The acquisition module is further used to: Obtaining a read request from the second node, where the read request indicates reading data from a second memory space of the first node; The device further comprises: A data reading module is configured to read data from the second memory space of the first node after obtaining the shared access right (shared) to the second memory space.

22. The device according to claim 21, characterized in that The data reading module is specifically used for: During the process of reading data from the second memory space according to the read request, it is detected that the second memory space is in a state where data is being written by another network device of the first node, and the process of reading data from the second memory space is terminated; Based on the reacquisition of the shared access right to the second memory space, data is read again from the second memory space.

23. The device according to claim 21 or 22, characterized in that The acquisition module is further used to: Before reading data from the second memory space, obtaining third information from a second position in the first memory space, where the information in the second position indicates a latest version of the data in the first memory space; After reading data from the second memory space, obtaining fourth information from the second location; The device further comprises: A data return module is used to return read failure information to the second node when the fourth information is inconsistent with the third information.

24. A device for processing a request, characterized in that: The device is located in a processor of the first node, and the device includes: An acquisition module, configured to receive a first write request, where the first write request indicates that first data is to be written into a first memory space of the first node; Acquire first information from a first position of the first memory space, where the first information indicates that the first memory space is not in a state where data is written by a network device or other processor of the first node; A data writing module is used to write the first data into the first memory space based on the first information.

25. The device according to claim 24, characterized in that The first memory space is a memory object, the memory object includes a plurality of cache lines, and the preset position is located at a head position of a head cache line among the plurality of cache lines.

26. The device according to claim 24 or 25, characterized in that The acquisition module is further used to: Obtaining a second write request, where the second write request indicates writing second data into a second memory space of the first node; Acquire second information from a first position of the second memory space, where the second information indicates that the second memory space is in a state where data is written by a network device or other processor of the first node; The device further comprises: A data return module is used to return information indicating data write failure to the second node based on the second information.

27. The device according to any one of claims 24 to 26, characterized in that The acquisition module is further used to: Obtaining a read request, where the read request indicates reading data from a second memory space of the first node; After reading data from the second memory space based on the read request, obtaining third information from a second position in the second memory space, the third information indicating that the second memory space is in a state where data is being written by a network device or other processor of the first node; The device further comprises: The data returning module is configured to determine that data writing fails based on the third information.

28. The device according to any one of claims 24 to 26, characterized in that The acquisition module is further used to: Obtaining a read request, where the read request indicates reading data from a second memory space of the first node; Obtaining fourth information from a second location in the second memory space, where the information at the second location indicates a latest version of data in the second memory space; After reading data from the second memory space based on the read request, obtaining fifth information from the second location; The device further comprises: The data returning module is configured to determine that the reading fails when the fourth information and the fifth information are inconsistent.

29. A device for processing a request, characterized in that: The device is located in a network device of a first node, and the device includes: an acquisition module, configured to acquire a write request from a second node, wherein the write request indicates writing first data into a first memory space of the first node; Acquire exclusive rights to the first memory space; The data writing module is configured to write the first data into the first memory space, and maintain exclusive possession of the first memory space before completing writing the first data into the first memory space.

30. The device according to claim 29, characterized in that The first memory space does not include a location for storing an indication of whether the first memory space is in a state of being written with data by the network device on the first node.

31. The device according to claim 29 or 30, characterized in that The acquisition module is further used to: Obtaining a read request from the second node, where the read request indicates reading data from a second memory space of the first node; Acquire shared access rights to the second memory space; A data reading module is used to read data from the second memory space.

32. The device according to claim 31, characterized in that The data reading module is specifically used for: During the process of reading data from the second memory space, it is detected that the second memory space is in a state where data is being written by another network device of the first node, and the process of reading data from the second memory space is terminated; Based on the reacquisition of the shared access right to the second memory space, data is read again from the second memory space.

33. A chip, characterized in that: The chip includes a processing circuit and an interface circuit, the interface circuit is interconnected with the processing circuit through a line, the interface circuit is used to receive a signal from a storage medium and send the signal to the processor, the signal includes a computer instruction stored in the storage medium; when the computer instruction is executed by the processing circuit, the chip executes the method for processing a request as described in any one of claims 1 to 16.

34. A computer storage medium, characterized in that The method comprises computer instructions, which, when executed on a computer, cause the computer to execute the method for processing a request according to any one of claims 1 to 16.

35. A computer program product, characterized in that The invention comprises a computer program for implementing the method according to any one of claims 1 to 16 when the computer program is executed by one or more processors.