Atomic operation execution method and device
By detecting atomic operation data status in multi-level storage units of multi-core computer equipment and determining execution nodes, the problem of atomic operation conflicts in multi-core equipment is solved and performance and reliability are improved.
Patent Information
- Application Number
- CN201880090540.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-07-11
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2038-07-11
AI Technical Summary
Multi-core computer devices can easily cause execution conflicts when performing atomic operations, leading to performance degradation.
By detecting the data status corresponding to the atomic operation in the multi-level storage unit, the execution node is determined to avoid conflicts, and the first storage unit, the second storage unit or the upper-level storage unit is used to perform the atomic operation to ensure data exclusivity.
It effectively avoids execution conflicts during atomic operations and improves the performance and reliability of computer equipment.
Smart Images

Figure CN111788562B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a method and device for executing atomic operations. Background Art
[0002] An atomic operation is an operation or a series of operations that cannot be interrupted by the thread scheduling mechanism. Currently, many instruction set architectures (ISAs) have instructions for atomic operations, and many current applications rely on such fine-grained atomic operations.
[0003] In the related art, atomic operations are generally performed in the first-level cache (L1 Cache) of a computer device. Among them, cache (Cache Memory) is a temporary storage located between the central processing unit (CPU) and the memory. Its capacity is smaller than that of the memory, but its exchange speed is faster than that of the memory. Generally, the cache can be divided into a first-level cache, a second-level cache, and some CPUs also have a third-level cache. When the CPU wants to read a piece of data, it first searches from the first-level cache. If it is not found, it searches from the second-level cache. If it is still not found, it searches from the third-level cache or the memory.
[0004] For computer devices using multi-core CPUs, when multiple CPU cores simultaneously attempt to execute atomic operations on the same address, the L1 Cache of each CPU core will compete for exclusive rights to the data corresponding to the atomic operation and invalidate the data in the L1 Cache of other CPU cores, resulting in atomic operation execution conflicts and reduced performance of the computer device. Summary of the invention
[0005] The present application provides a method and device for executing atomic operations, which can solve the problem in the related art that when a multi-core computer device executes atomic operations, the performance of the computer device may be reduced.
[0006] On the one hand, a method for executing an atomic operation is provided, which can be applied to a memory in a multi-core computer device, wherein the memory includes a multi-level storage unit, wherein there are two adjacent levels of storage units in the multi-level storage unit, wherein the first level storage unit includes a plurality of first storage units, and the second level storage unit includes at least one second storage unit, wherein each first storage unit is a cache unit, and each second storage unit is a cache unit or a memory, and each second storage unit is shared by a plurality of processor cores; the method may include:
[0007] When a target storage unit among the multiple first storage units receives an atomic operation, if the data corresponding to the atomic operation is in a modified state or an exclusive state in the target storage unit, the atomic operation is executed in the target storage unit; if the data is in an invalid state or a shared state in the target storage unit, the second storage unit is used to detect whether the data is data shared by multiple first storage units; if the data is data shared by multiple first storage units, the atomic operation is executed in the second storage unit; if the data is not data shared by multiple first storage units, the atomic operation is executed in the target storage unit or an upper-level storage unit of the target storage unit.
[0008] According to the method provided by the present application, the first storage unit and the second storage unit in the memory can determine the execution node of the atomic operation according to the status of the data corresponding to the atomic operation in the storage units at each level, thereby avoiding execution conflicts and ensuring the performance of the computer device.
[0009] Optionally, the memory may also include: an upper-level storage unit located above the first-level storage unit; the method may also include: when any storage unit in the upper-level storage unit receives the atomic operation, if the state of the data in any storage unit is a modified state or an exclusive state, the atomic operation is executed in the any storage unit; if the state of the data in any storage unit is an invalid state or a shared state, the atomic operation is sent to the next-level storage unit through the any storage unit.
[0010] When the state of data in any storage unit is a modified state or an exclusive state, it can be determined that the data is exclusively used within the any storage unit, and thus can be directly executed in the any storage unit.
[0011] Optionally, if the state of the data in the target storage unit is an invalid state or a shared state, the process of detecting, by the second storage unit, whether the data is data shared by a plurality of first storage units may include:
[0012] If the state of the data in the target storage unit is a failure state or a shared state, the target storage unit detects whether the address of the data is recorded in a conflict list, and the data indicated by the address recorded in the conflict list may be data shared by a plurality of first storage units;
[0013] If the address is not recorded in the conflict list, it can be determined that no conflict may occur when the atomic operation is executed. In order to ensure the exclusivity of the data, a probe request carrying the address of the data can be sent to the second storage unit through the target storage unit, and the second storage unit can detect whether the data indicated by the address is data shared by multiple first storage units to further verify the sharing of the data.
[0014] If the address is recorded in the conflict list, it can be determined that a conflict may occur when the atomic operation is executed. Therefore, the atomic operation can be directly forwarded to the second storage unit through the target storage unit, and the second storage unit can detect whether the data corresponding to the atomic operation is data shared by multiple first storage units, that is, the second storage unit further determines the execution node of the atomic operation.
[0015] Optionally, if the data indicated by the address is data shared by a plurality of first storage units, the method may further include:
[0016] The second storage unit sends a failure response message to the target storage unit, the failure response message being used to indicate that the state of the data in the target storage unit is invalid; and the target storage unit records the address of the data in the conflict list according to the failure response message.
[0017] After the target storage unit records the address of the data in the conflict list, when the atomic operation is received again, the atomic operation can be directly forwarded to the second storage unit, so that the second storage unit can determine the execution node of the atomic operation.
[0018] Optionally, if the data indicated by the address is not data shared by a plurality of first storage units, the process of performing the atomic operation in the target storage unit or a storage unit above the target storage unit may include:
[0019] If the data indicated by the address is not data shared by a plurality of first storage units, and the state of the data in the target storage unit is a shared state, a success response message is sent to the target storage unit through the second storage unit, and the atomic operation is performed in the target storage unit, wherein the success response message is used to indicate that the state of the data is a modified state or an exclusive state;
[0020] If the data indicated by the address is not data shared by a plurality of first storage units, and the state of the data in the target storage unit is invalid, the success response message and the data are sent to the target storage unit through the second storage unit, and the atomic operation is performed in the target storage unit;
[0021] If the address is the first received address and the data in the target storage unit is in an invalid state, the data corresponding to the atomic operation is sent to the target storage unit or the parent storage unit of the target storage unit through the second storage unit, and the atomic operation is performed in the storage unit that receives the data.
[0022] If the data indicated by the address is not data shared by multiple first storage units, the second storage unit can determine that the data is only shared within the target storage unit, so the atomic operation can be performed by the target storage unit.
[0023] Optionally, if the data corresponding to the atomic operation is not data shared by multiple first storage units, the process of performing the atomic operation in the target storage unit or the upper-level storage unit of the target storage unit may include:
[0024] If the data corresponding to the atomic operation is shared inside the target storage unit, the data corresponding to the atomic operation is sent to the target storage unit, and the atomic operation is performed in the target storage unit;
[0025] If the data corresponding to the atomic operation is exclusively used in the upper-level storage unit of the target storage unit, the data corresponding to the atomic operation is sent to the upper-level storage unit, and the atomic operation is performed in the upper-level storage unit.
[0026] When the data corresponding to the atomic operation is not data shared by a plurality of first storage units, the second storage unit may accurately determine the node for executing the atomic operation based on the shared nodes of the data.
[0027] Optionally, after the target storage unit executes the atomic operation, the method may further include: deleting the address of the data from the conflict list through the target storage unit, and when the atomic operation is received again subsequently, the target storage unit may determine the execution node of the atomic operation by sending a probe request.
[0028] Optionally, the process of detecting, by the second storage unit, whether the data is data shared by a plurality of first storage units may include:
[0029] The second storage unit is used to detect whether the processor cores that initiate the atomic operation within a preset time period share a first storage unit; when the processor cores that initiate the atomic operation within the preset time period share multiple first storage units, it can be determined that the data is data shared by multiple first storage units; when the processor cores that initiate the atomic operation within the preset time period share the same first storage unit, it can be determined that the data is not data shared by multiple first storage units.
[0030] According to the method provided by the present application, the first storage unit and the second storage unit in the memory can determine the execution node of the atomic operation according to the status of the data corresponding to the atomic operation in the storage units at each level, thereby avoiding execution conflicts and ensuring the performance of the computer device.
[0031] On the other hand, a memory is provided for use in a multi-core computer device, the memory comprising: a multi-level storage unit, wherein there are two adjacent levels of storage units in the multi-level storage unit, wherein the first level storage unit comprises a plurality of first storage units, the second level storage unit comprises at least one second storage unit, and each second storage unit is shared by a plurality of processor cores; each storage unit in the memory can be used to implement the execution method of the atomic operation provided in the above aspect.
[0032] On the other hand, a computer-readable storage medium is provided, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the method for executing the atomic operation provided by the above aspect.
[0033] On the other hand, a chip is provided, which includes a programmable logic circuit and / or program instructions, and when the chip is running, it is used to implement the execution method of the atomic operation provided by the above aspects.
[0034] On the other hand, a computer device is provided. The computer device may include a multi-core processor and the memory provided by the above aspect.
[0035] On the other hand, a computer program product including instructions is provided. When the computer program product is run on a computer, the computer executes the method for executing the atomic operation provided in the above-mentioned example.
[0036] In summary, the present application provides a method and device for executing atomic operations. If the state of the data corresponding to the atomic operation in the target storage unit is a modified state or an exclusive state, the atomic operation can be executed in the target storage unit. If the state of the data in the target storage unit is an invalid state or a shared state, the second storage unit can be used to detect whether the data is shared by multiple first storage units. If the data is shared by multiple first storage units, the atomic operation is executed in the second storage unit. If the data is not shared by multiple first storage units, the atomic operation can be executed in the target storage unit or the upper storage unit of the target storage unit. The solution provided by the present application can determine the node that executes the atomic operation according to the sharing of the data corresponding to the atomic operation, avoid conflicts when executing the atomic operation, cause the performance of the computer device to decline, and ensure the reliability when executing the atomic operation. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 It is a schematic diagram of the structure of a memory in a multi-core computer device provided by an embodiment of the present invention;
[0038] Figure 2is a schematic diagram of the structure of another memory provided by an embodiment of the present invention;
[0039] Figure 3 is a flow chart of a method for executing an atomic operation provided by an embodiment of the present invention;
[0040] Figure 4 is a schematic diagram of a partial structure of a memory provided by an embodiment of the present invention;
[0041] Figure 5 It is a schematic diagram of the structure of another memory provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0042] Figure 1 The present invention provides a schematic diagram of the structure of a memory in a multi-core computer device, wherein the CPU in the multi-core computer device includes multiple processor cores, that is, the CPU is a multi-core CPU. The memory may include multiple levels of storage units, each level of storage units may include one or more storage units, and the storage units included in each level of storage units may be cache units, or may be memory.
[0043] There are two adjacent levels of storage units in the multi-level storage unit, and the first level storage unit 10 in the adjacent two levels of storage units may include multiple first storage units 100, and the second level storage unit 20 in the adjacent two levels of storage units includes at least one second storage unit 200. Each first storage unit 100 may be a cache unit, and the cache unit may be an exclusive cache exclusively used by one processor core, or may be a shared cache shared by multiple processor cores. Each second storage unit 200 may be a cache unit, or may be a memory, and each second storage unit 200 is shared by multiple processor cores. In addition, each second storage unit 200 corresponds to at least two first storage units 100, that is, at least two first storage units 100 in the first level storage unit 10 may converge to the same second storage unit 200.
[0044] Figure 2 FIG. 1 is a schematic diagram of another memory structure provided by an embodiment of the present invention. For example, Figure 2As shown, the memory may include four levels of storage units, the storage units included in the first three levels of storage units of the four levels of storage units are all cache units, and the last level of storage units only includes one storage unit, and the storage unit is a memory. The first three levels of cache units may include two levels of exclusive cache and a first level of shared cache. The first level exclusive cache includes multiple first level caches (L1 Cache), the second level exclusive cache includes multiple second level caches (L2 Cache), and the third level shared cache may include multiple third level caches (L3 Cache). The memory included in the last level of storage units may be a double data rate (Double Data Rate, DDR) synchronous dynamic random access memory unit (Synchronous Dynamic Random Access Memory, SDRAM).
[0045] Each exclusive cache (L1 or L2) is exclusively used by one processor core, and each shared cache L3 is shared by multiple processor cores, that is, the exclusive caches exclusively used by the multiple processor cores can be aggregated into the same shared cache L3. The multiple shared caches L3 are aggregated into the memory, that is, the memory can be shared by all processor cores of the computer device.
[0046] for Figure 2 In the memory shown, the first level storage unit 10 in the adjacent two levels of storage units can be the third level shared cache, and the second level storage unit can be the memory 20. Alternatively, the first level storage unit in the adjacent two levels of storage units can be the second level exclusive cache, and the second level storage unit can be the third level shared cache.
[0047] Optionally, the memory may also include only multiple levels of exclusive caches, and the multiple exclusive caches may be directly aggregated to the memory, that is, the memory may not include a shared cache. Accordingly, the first-level storage unit 10 in the adjacent two-level storage unit may be the second-level exclusive cache, and the second-level storage unit 20 may be the memory.
[0048] refer to Figure 2 It can also be seen that in the memory provided by the embodiment of the present invention, each storage unit (ie, cache unit or memory) is provided with an arithmetic logic unit (ALU), and each storage unit can perform atomic operations through the ALU.
[0049] Figure 3 is a flowchart of a method for executing an atomic operation provided by an embodiment of the present invention, which can be applied to Figure 1 or Figure 2 The memory shown. Figure 3 , the method may include:
[0050] Step 201: When any cache unit receives an atomic operation, the state of the data corresponding to the atomic operation in the cache unit of the same level is detected by the cache unit.
[0051] In an embodiment of the present invention, when any cache unit receives an atomic operation initiated by a processor core, it can first detect the state of the data corresponding to the atomic operation in the cache unit of the same level. The state can refer to the four states defined in the cache consistency protocol: Modified (Modify, M) state, Exclusive (Exclusive, E) state, Shared (Share, S) state, and Invalid (Invalid, I) state.
[0052] Among them, the M state means that the data in the cache unit has been modified, and the data is inconsistent with the data in the memory, but the data in the current cache unit shall prevail. The E state means that the data in the cache unit is consistent with the data in the memory, and the data only exists in the cache unit of this level, and the data is not in other cache units, that is, the processor core corresponding to the cache unit of this level has exclusive use of the data. The S state means that the data in the cache unit is consistent with the data in the memory, and the data exists in multiple cache units, that is, multiple processor cores share the data. The I state means that the data in the cache unit is invalid data that is unavailable.
[0053] Optionally, the minimum unit for each cache unit to exchange data with the memory is a cache line, and the size of each cache line is generally 64 bytes or 128 bytes. In addition to data, each cache line also includes the state of the data and the address of the data in the memory. In an embodiment of the present invention, after any cache unit receives an atomic operation, it can obtain the address of the data corresponding to the atomic operation, and then determine the cache line where the data is located based on the address, and obtain the state of the data.
[0054] When any cache unit detects that the state of the data in the cache unit of the same level is M state or E state, step 202 may be executed. When the first-level cache unit detects that the state of the data in the cache unit of the same level is I state or S state, if any cache unit is the upper-level storage unit of the first storage unit, step 203 may be executed; if any cache unit is the first storage unit, step 204 may be executed.
[0055] In an embodiment of the present invention, for a multi-level storage unit in a memory, if the next-level storage unit of a certain level of storage unit is a storage unit shared by multiple cores (such as a shared cache or memory), a conflict list can be configured in each storage unit in the certain level of storage unit, and the conflict list pre-records the addresses of data shared by multiple storage units, that is, the addresses of data corresponding to atomic operations that may cause conflicts. The first-level storage unit configured with the conflict list is the first-level storage unit. Figure 2 It can be seen that the memory may further include an upper-level storage unit 30 located above the first-level storage unit 10. The storage unit included in the upper-level storage unit 30 is generally an exclusive cache, and the exclusive cache does not store a conflict list. Figure 2 As shown, the upper-level storage unit 30 of the first-level storage unit 10 may include two levels of exclusive cache.
[0056] Therefore, when any cache unit detects that the state of the data in the cache unit of this level is I state or S state, it can continue to detect whether a conflict list is stored in the cache unit of this level. If the conflict list is not stored, step 203 can be executed; if the conflict list is stored, step 204 can be executed.
[0057] Step 202: Execute the atomic operation in any cache unit.
[0058] When any cache unit detects that the state of the data in the cache unit of this level is M state or E state, it can be determined that the data is not shared with other cache units, so the atomic operation can be directly executed in any cache unit (ie, the cache unit of this level).
[0059] For example, assuming that the CPU of the computer device is a 4-core CPU, that is, the CPU includes 4 processor cores. If the L1 cache of processor core 1 receives an atomic operation and detects that the state of the data corresponding to the atomic operation in the L1 cache is E state, the L1 cache of processor core 1 can directly execute the atomic operation.
[0060] Step 203: Send the atomic operation to the next level storage unit through any cache unit that receives the atomic operation.
[0061] When any cache unit detects that the state of the data is I state or S state, according to the definition in the above cache consistency protocol, the data may be shared by multiple processor cores. In order to ensure the exclusivity of the data, if any cache unit that receives the atomic operation is the upper storage unit of the first storage unit (that is, the conflict list is not stored in any cache unit), then any cache unit that receives the atomic operation can send the atomic operation to its next level storage unit. The next level storage unit can continue to execute the method shown in step 201.
[0062] For example, Figure 2 The memory shown is taken as an example, and the first-level storage unit 10 in the memory is a third-level shared cache including multiple shared caches L3, and the second-level storage unit 20 is a memory. If the first-level cache L1 of the processor core 1 detects that the state of the data corresponding to the atomic operation in the first-level cache L1 is I state, the first-level cache L1 can send the atomic operation to the second-level cache L2 of the processor core 1. If the second-level cache L2 of the processor core 1 receives the atomic operation and detects that the state of the data corresponding to the atomic operation in the second-level cache L2 is I state, the second-level cache L2 can send the atomic operation to its next-level storage unit, that is, the shared cache L3 of the processor core 1.
[0063] Step 204: Detect whether the address of the data is recorded in the conflict list through the target storage unit that receives the atomic operation.
[0064] If any cache unit that receives the atomic operation is the first storage unit in the memory, then when the target storage unit that receives the atomic operation detects that the state of the data in the target storage unit is I state or S state, it can continue to detect whether the address of the data is recorded in the conflict list. In an embodiment of the present invention, as described above, a conflict list is stored in each first storage unit in the memory, and the conflict list pre-records the addresses of data shared by multiple storage units, that is, the addresses of data corresponding to atomic operations that may cause conflicts.
[0065] If the target storage unit detects that the address is not recorded in the conflict list, that is, the address misses (Miss), step 205 can be executed; if the target storage unit detects that the address is recorded in the conflict list, that is, the address hits (Hit), step 211 can be executed.
[0066] For example, Figure 4 Schematic diagram of a partial structure of a memory provided by an embodiment of the present invention. Figure 4 , each first storage unit (eg Figure 4A conflict monitor (Conflict Monitor) for maintaining the conflict list can be provided in the shared cache L3 shown in Table 1. The conflict list maintained by the conflict monitor can be shown in Table 1. Referring to Table 1, four addresses such as 0x00000001 and 0x00000080 are recorded in the conflict list. After the shared cache L3 of processor core 1 receives the atomic operation sent by the exclusive cache L2, when it is detected that the state of the data corresponding to the atomic operation in the storage unit of this level is S state, and the address of the data corresponding to the atomic operation is obtained as 0x00000001, since the address is recorded in the conflict list shown in Table 1, step 211 can be executed. If the address of the data corresponding to the atomic operation is 0x00000350, since the address is not recorded in the conflict list shown in Table 1, step 205 can be executed.
[0067] Table 1
[0068] 1 0x00000001 2 0x00000080 3 0x00000175 4 0x00000260
[0069] Optionally, in an embodiment of the present invention, when the target storage unit detects that the address does not hit, it can further detect whether the data is stored in the target storage unit. If the data is stored, the atomic operation can be directly performed in the target storage unit; if the data is not stored, step 205 can be performed again.
[0070] Step 205: Send a probe request carrying the address of the data to the second storage unit through the target storage unit.
[0071] If the target storage unit detects that the address is not recorded in the conflict list, in order to further determine the node location for executing the atomic operation, a probe request carrying the address of the data may be sent to the second storage unit through the target storage unit.
[0072] For example, a private probe request CleanUnique_Try may be predefined in the memory, and when the shared cache L3 of the processor core 1 detects that the address of the data corresponding to the atomic operation is not recorded in the conflict monitor, the probe request CleanUnique_Try may be sent to the memory.
[0073] Step 206: Detect, by the second storage unit, whether the data indicated by the address carried in the probe request is data shared by multiple first storage units.
[0074] In the embodiment of the present invention, the second storage unit (eg Figure 4A cache consistency directory (Directory) for maintaining each first storage unit may be provided in the memory shown in the figure, and the state of the data indicated by each address in each first storage unit may be recorded in the directory. Figure 4 The second storage unit may also be provided with a sharing monitor for recording the sharing status of the data indicated by each address. The sharing monitor may record the address of the data corresponding to the atomic operation processed by the second storage unit within the most recent preset time period, the identification (ID) of the processor core where each atomic operation was most recently initiated, and the regularity of the identification of the processor core that initiated each atomic operation (for example, the number of times the processor core indicated by each identification initiates the same atomic operation and the range of the identification of the processor core that initiates each atomic operation).
[0075] After receiving the probe request, the second storage unit can query the directory and / or the sharing monitor to detect whether the data indicated by the address carried in the probe request is data shared by multiple first storage units. If the data is data shared by multiple first storage units, steps 207 and 208 can be executed; if the data is not data shared by multiple first storage units, step 210 can be executed.
[0076] As an optional implementation, the second storage unit can query the sharing monitor to detect whether the processor core that initiated the atomic operation within the preset time period shares a first storage unit. When it is detected that the processor core that initiated the atomic operation within the preset time period occupies multiple first storage units, it can be predicted that the data corresponding to the atomic operation is data shared by multiple first storage units in the recent period, and steps 207 and 208 can be executed. When it is detected that the processor core that initiated the atomic operation within the preset time period shares the same first storage unit, it can be predicted that the data corresponding to the atomic operation is not data shared by multiple first storage units in the recent period, and is only shared within one first storage unit, so step 209 can be executed.
[0077] The preset time period may be a preset fixed time period, or may be a time period determined according to the initiation time of the most recent atomic operations. That is, the second storage unit may detect whether the processor cores that have initiated the most recent atomic operations share a first storage unit.
[0078] As another optional implementation, the second storage unit can detect the state of the data indicated by the address in each first storage unit by querying the directory. If the state of the data in multiple first storage units is S state, it can be determined that the data is shared by multiple first storage units. If the state of the data in a first storage unit is M state or E state, or the state of the data in each first storage unit is I state, the second storage unit can determine that the data is not shared by multiple first storage units.
[0079] For example, assume that the IDs of the processor cores that initiated the atomic operation in the most recent period recorded in the shared monitor include CPU1, CPU2, and CPU4, and CPU1 and CPU2 share the same shared cache L3, and the shared cache of CPU4 is another shared cache L3. The memory can determine that the data corresponding to the atomic operation is shared among multiple shared caches, so steps 207 and 208 can be executed. If the IDs of the processor cores that initiated the atomic operation in the most recent period recorded in the monitor are both CPU1 and CPU2, the memory can determine that the data corresponding to the atomic operation is only shared within one shared cache, that is, it is not data shared by multiple shared caches, so step 210 can be executed.
[0080] Step 207: Execute the atomic operation in the second storage unit.
[0081] When it is detected that the data corresponding to the atomic operation is data shared by a plurality of first storage units, in order to avoid conflicts, the atomic operation may be performed in a second storage unit shared by the plurality of processor cores.
[0082] Step 208: Send a failure response message to the target storage unit through the second storage unit. Execute step 209.
[0083] When it is detected through the second storage unit that the data corresponding to the atomic operation is data shared by multiple first storage units, since the atomic operation needs to be performed in the second storage unit, a failure response message can also be sent to the target storage unit through the second storage unit. The failure response message can be used to indicate that the status of the data corresponding to the atomic operation is I state.
[0084] For example, when the memory detects that the data is data shared by multiple shared caches L3, the atomic operation can be performed in the memory, and a failure response message is sent to the shared cache L3 of processor core 1.
[0085] Step 209: Record the address of the data in the conflict list through the target storage unit.
[0086] After receiving the failure response message, the target storage unit may record the address of the data in a conflict list, so that when receiving an atomic operation of the address next time, the atomic operation may be directly forwarded to the second storage unit.
[0087] Optionally, in an embodiment of the present invention, the depth of the conflict list may be N (N is an integer greater than 1), that is, N addresses may be recorded in the conflict list. When the number of addresses recorded in the conflict list is already N, if there is a newly added address, the target storage unit may delete the first recorded address (that is, the first recorded address overflows). When the target storage unit receives the atomic operation corresponding to the overflowed address again, it may send a probe request to the second storage unit again.
[0088] For example, assuming that the address of the data corresponding to the atomic operation is 0x00000350, the shared cache L3 of the processor core 1 may add the address 0x00000350 to the conflict list shown in Table 1.
[0089] Step 210: Instruct the target storage unit or the upper-level storage unit of the target storage unit to execute the atomic operation through the second storage unit.
[0090] When the second storage unit detects that the data is not shared by a plurality of first storage units, the atomic operation may be performed in the target storage unit or an upper-level storage unit of the target storage unit.
[0091] In an optional implementation, if the data indicated by the address is not data shared by multiple first storage units, and the state of the data in the target storage unit is S state, a success response message can be sent to the target storage unit through the second storage unit, and the atomic operation can be performed in the target storage unit.
[0092] In another optional implementation, if the data indicated by the address is not data shared by multiple first storage units, and the state of the data in the target storage unit is I state, a success response message and the data can be sent to the target storage unit through the second storage unit, and the atomic operation can be performed in the target storage unit.
[0093] Among them, the success response message can be used to indicate that the state of the data in the target storage unit is converted to the M state or the E state. According to the above cache consistency protocol, when the state of the data in the target storage unit is the S state, the data in the target storage unit is consistent with the data in the second storage unit, so the second storage unit can only send a success response message to the target storage unit. When the state of the data in the target storage unit is the I state, the data in the target storage unit is no longer available, so the second storage unit can send the data stored in the second storage unit while sending the success response message.
[0094] For example, assuming that the memory detects that the data corresponding to the atomic operation is not shared by multiple shared caches, and the state of the data in the shared cache L3 of the processor core 1 is in the S state, the memory can directly send a success response message to the shared cache L3 of the processor core 1. After receiving the success response message, the shared cache L3 of the processor core 1 can execute the atomic operation in the cache unit of this level.
[0095] In another optional implementation, if the second storage unit does not detect the address in the directory or the shared monitor, it can be determined that the address is the first received address. At this time, if the state of the data in the target storage unit is I state, it can be determined that the data may be data exclusive to the processor core. At this time, if the target storage unit is a shared cache, the data corresponding to the atomic operation can be sent to the upper storage unit of the target storage unit (for example, it can be sent to a certain exclusive cache located above the target storage unit) through the second storage unit, and the atomic operation is performed in the upper storage unit. If the target storage unit is an exclusive cache, the data corresponding to the atomic operation can be sent to the target storage unit, and the operation is performed in the target storage unit.
[0096] If the memory does not detect the address of the data corresponding to the atomic operation in the cache consistency directory or the shared monitor, it can be determined that the data is accessed for the first time, and the memory can initiate a snoop stash request to send the data corresponding to the atomic operation to the exclusive cache L1 or L2 of processor core 1 for execution.
[0097] Step 211: forward the atomic operation to the second storage unit through the target storage unit.
[0098] In an embodiment of the present invention, if in the above step 204, the target storage unit detects that the address of the data has been recorded in the conflict list, it can be determined that the data may be shared by multiple first storage units, and therefore the atomic operation can be directly forwarded to the second storage unit.
[0099] For example, when the address of the data corresponding to the atomic operation obtained by the shared cache L3 of the processor core 1 is 0x00000001, since the address is recorded in the conflict list shown in Table 1, the atomic operation can be directly forwarded to the memory.
[0100] Step 212: Detect, through the second storage unit, whether the data corresponding to the atomic operation is data shared by multiple first storage units.
[0101] Furthermore, the second storage unit may continue to detect whether the data corresponding to the atomic operation is data shared by multiple first storage units. If the data is data shared by multiple first storage units, step 207 may be executed, i.e., the second storage unit executes the atomic operation. If the data is not data shared by multiple first storage units, i.e., when the sharing situation of the data changes, step 213 may be executed.
[0102] The process of detecting whether the data is shared by a plurality of first storage units through the second storage unit may refer to the above step 206 and will not be described in detail here.
[0103] Step 213: Send the data corresponding to the atomic operation to the target storage unit or the upper-level storage unit of the target storage unit through the second storage unit, and execute the atomic operation in the storage unit that receives the data.
[0104] If the second storage unit detects that the data corresponding to the atomic operation is not shared by multiple first storage units, it can be determined that the sharing situation of the data corresponding to the atomic operation has changed. Therefore, the data corresponding to the atomic operation can be sent to the target storage unit or the parent storage unit of the target storage unit, and the storage unit that receives the data executes the atomic operation.
[0105] Optionally, if the data corresponding to the atomic operation is shared within the target storage unit, the data corresponding to the atomic operation can be sent to the target storage unit, and the atomic operation can be performed in the target storage unit. If the data corresponding to the atomic operation is exclusively shared by the upper-level storage unit of the target storage unit, the data corresponding to the atomic operation can be sent to the upper-level storage unit, and the atomic operation can be performed in the upper-level storage unit.
[0106] When the atomic operation is executed through the target storage unit, the target storage unit can also delete the address of the data from the conflict list. When the atomic operation is received again subsequently, the target storage unit can directly detect whether the data corresponding to the atomic operation is stored locally. If the data is stored, the atomic operation can be executed directly; if the data is not stored, the node location for executing the atomic operation can be determined by sending a probe request.
[0107] In an embodiment of the present invention, if the target storage unit is a shared cache, when the second storage unit detects that the data corresponding to the atomic operation is not data shared by multiple first storage units, the second storage unit can further determine the sharing status of the data by querying the sharing monitor. For example, when the second storage unit detects that the processor cores that initiate the atomic operation within a preset time period are all the same, it can be determined that the data is exclusively shared in the upper storage unit (such as the exclusive cache L2 or L1) of the target storage unit, and therefore the atomic operation can be performed in the upper storage unit. When the second storage unit detects that the processor cores that initiate the atomic operation within a preset time period include multiple processor cores that share the target storage unit, it can be determined that the data is shared within the target storage unit, and therefore the atomic operation can be performed in the target storage unit.
[0108] If the target storage unit is an exclusive cache, when the second storage unit detects that the data corresponding to the atomic operation is not shared by multiple first storage units, it can be determined that the data is exclusive to the target storage unit and the atomic operation can be performed directly in the target storage unit.
[0109] For example, if after receiving an atomic operation, the memory detects that the sharing situation of the data corresponding to the atomic operation has changed from being shared by multiple shared caches to being shared within the shared cache of processor core 1 (that is, the shared cache exclusively uses the data), it can be determined that the data is exclusively used by the shared cache of processor core 1 or the exclusive cache of processor core 1. Therefore, the memory can initiate a Snoop Stash request to send the data corresponding to the atomic operation to the shared cache L3 shared by processor core 1 for execution, or to the exclusive cache L1 or L2 exclusively used by processor core 1 for execution.
[0110] If the memory detects that the processor cores that initiated the atomic operation are all processor core 1 within the most recent preset time period recorded in the monitor, the data corresponding to the atomic operation can be sent to the exclusive cache L1 or L2 of processor core 1 for execution. If the memory detects that the processor cores that initiated the atomic operation include processor core 1 and processor core 2 within the most recent preset time period recorded in the monitor, the data corresponding to the atomic operation can be sent to the shared cache L3 shared by processor core 1 and processor core 2 for execution.
[0111] If the memory sends the data to the shared cache L3 of the processor core 1, the shared cache L3 also needs to delete the address of the data recorded in the conflict list shown in Table 1 to refresh the conflict list.
[0112] Optionally, in an embodiment of the present invention, the second storage unit may also be provided with a module for maintaining cache consistency, and the methods implemented by the second storage unit in the above method embodiment may all be implemented by the module. Figure 4 As shown, the memory 20 may be provided with a Home Agent (HA) module for maintaining cache consistency, and the methods implemented by the second storage unit in the above method embodiments may all be implemented through the HA module.
[0113] for Figure 2 and Figure 4 The memory shown, through the method provided by the embodiment of the present invention, if the data corresponding to a certain atomic operation is exclusive data, the state of the data in each cache unit will be initialized to the I state step by step. After the processor core initiates the atomic operation for the first time, according to the above method flow, the atomic operation will be executed in the HA or shared cache L3, and then the HA will stash the data to the exclusive cache L1 or L2. The atomic operation will be executed in the exclusive cache L1 or L2 later.
[0114] If the data corresponding to the atomic operation is shared within a shared cache L3 (Intra L3), it can be known from the above steps 206 and 210 that after the shared cache L3 sends a probe request to the HA, a successful response message can be received. The state of the data in the shared cache L3 can be converted from the I or S state to the E or M state. Subsequently, each processor core that shares the shared cache L3 will execute the atomic operation in the shared cache L3.
[0115] If the data corresponding to the atomic operation is shared between multiple shared caches L3 (Inter L3), it can be known from the above steps 206 to 209 that after a shared cache L3 sends a probe request to HA, it will receive a failure response message. The state of the data in the shared cache L3 cannot be converted from the I or S state to the E or M state. Afterwards, the shared cache L3 can record the address of the data in the conflict list, and when the atomic operation is received later, it will be directly forwarded to HA for execution.
[0116] If the sharing status of the data corresponding to a certain atomic operation is converted from internal sharing of a certain shared cache L3 (or a certain exclusive cache) to sharing among multiple shared caches L3 (or multiple exclusive caches), the E or M state of the data in the shared cache L3 (or exclusive cache) will be updated to the I or S state.
[0117] If the sharing status of the data corresponding to a certain atomic operation is changed from being shared among multiple shared caches L3 (or multiple exclusive caches) to being shared within a shared cache L3 (or an exclusive cache), after HA detects the change in sharing status, it can stash the data to the shared cache L3 (or exclusive cache) after HA or the shared cache L3 executes the atomic operation. If the shared cache L3 receives the data, it can delete the address of the data from the conflict list.
[0118] It should be noted that the order of the steps of the execution method of the atomic operation provided by the embodiment of the present invention can be appropriately adjusted, and the steps can also be increased or decreased accordingly according to the situation. For example, step 208 can be executed before step 207, or it can be executed synchronously with 207. Alternatively, step 212 and step 213 can also be deleted according to the situation, that is, step 207 can be executed directly after step 211. Any technician familiar with the technical field can easily think of a method of change within the technical scope disclosed in this application, which should be covered within the scope of protection of this application, so it will not be repeated.
[0119] In summary, an embodiment of the present invention provides a method for executing an atomic operation. If the state of the data corresponding to the atomic operation in the target storage unit is a modified state or an exclusive state, the atomic operation can be executed in the target storage unit. If the state of the data in the target storage unit is an invalid state or a shared state, the second storage unit can be used to detect whether the data is shared by multiple first storage units. If the data is shared by multiple first storage units, the atomic operation is executed in the second storage unit. If the data is not shared by multiple first storage units, the atomic operation can be executed in the target storage unit or the upper storage unit of the target storage unit. The method provided in the present application can determine the node that executes the atomic operation according to the sharing of the data corresponding to the atomic operation, avoid conflicts when executing the atomic operation, cause the performance of the computer device to decline, and ensure the reliability when executing the atomic operation.
[0120] The embodiment of the present invention further provides a memory, which can be applied to a multi-core computer device. Figure 1 , the memory may include: a multi-level storage unit, wherein there are two adjacent levels of storage units in the multi-level storage unit, wherein the first level storage unit 10 includes a plurality of first storage units 100, and the second level storage unit 20 includes at least one second storage unit 200, for example Figure 1 The structure shown includes only one second storage unit 200. Each first storage unit 100 is a cache unit, each second storage unit 200 can be a cache unit or a memory, and each second storage unit 200 is shared by multiple processor cores.
[0121] The target storage unit 100 among the multiple first storage units that receives the atomic operation is used to execute the atomic operation in the target storage unit when the state of the data corresponding to the atomic operation in the target storage unit is a modified state or an exclusive state.
[0122] The second storage unit 200 can be used to detect whether the data is shared by multiple first storage units when the state of the data in the target storage unit is an invalid state or a shared state; when the data is shared by multiple first storage units, perform the atomic operation in the second storage unit; when the data is not shared by multiple first storage units, instruct the target storage unit or the upper storage unit of the target storage unit to perform the atomic operation.
[0123] Optional, Figure 5 is a schematic diagram of the structure of another memory provided by an embodiment of the present invention, referring to Figure 5 The memory may further include: an upper-level storage unit 30 located above the first-level storage unit 10, the upper-level storage unit 30 may include a plurality of storage units 300, each storage unit 300 may be an exclusive cache or a shared cache.
[0124] For example, Figure 5 As shown, each storage unit 300 in the upper storage unit 30 can be an exclusive cache. Each first storage unit 100 in the first storage unit 10 can be a shared cache, and the second storage unit 20 includes only one second storage unit 200, and the second storage unit 200 can be a memory.
[0125] Any storage unit 300 in the upper storage unit 30 that receives the atomic operation can be used to:
[0126] When the state of the data in any storage unit is a modified state or an exclusive state, the atomic operation is performed in the any storage unit;
[0127] When the state of the data in any storage unit is an invalid state or a shared state, the atomic operation is sent to the next level storage unit.
[0128] Optionally, the target storage unit 100 may also be used to implement the method shown in step 204, step 205 and step 211 in the above method embodiment.
[0129] The second storage unit 200 can be used to: implement the method shown in step 206 of the above method embodiment when receiving the probe request, and implement the method shown in step 212 of the above method embodiment when receiving the atomic operation.
[0130] Optionally, the second storage unit 200 may also be used to: upon detecting that the data indicated by the address is data shared by a plurality of first storage units, implement the method shown in step 208 and step 209 in the above method embodiment.
[0131] Optionally, the second storage unit 200 may also be used to implement the method shown in step 210 in the above method embodiment when the data indicated by the address is not data shared by multiple first storage units.
[0132] Accordingly, the target storage unit 100 can be used to perform the atomic operation after receiving the success response message. The upper storage unit 300 of the target storage unit can be used to perform the atomic operation after receiving the data corresponding to the atomic operation sent by the second storage unit.
[0133] Optionally, the second storage unit 200 may be used to: when the data corresponding to the atomic operation is shared inside the target storage unit, send the data corresponding to the atomic operation to the target storage unit for execution;
[0134] When the data corresponding to the atomic operation is exclusively used in the upper-level storage unit of the target storage unit, the data corresponding to the atomic operation is sent to the upper-level storage unit for execution.
[0135] Optionally, the target storage unit 100 may also be used to delete the address of the data from the conflict list after executing the atomic operation.
[0136] Optionally, the second storage unit 200 may be used for:
[0137] Detecting whether the processor cores initiating the atomic operation within a preset time period share a first storage unit;
[0138] When the processor cores that initiate the atomic operation within the preset time period share a plurality of first storage units, determining that the data is data shared by the plurality of first storage units;
[0139] When the processor cores that initiate the atomic operation within the preset time period share the same first storage unit, it is determined that the data is not data shared by multiple first storage units.
[0140] In summary, an embodiment of the present invention provides a memory, which includes multiple first storage units and multiple exclusive caches. If the state of the data corresponding to the atomic operation in the target storage unit is a modified state or an exclusive state, the atomic operation can be performed in the target storage unit. If the state of the data in the target storage unit is an invalid state or a shared state, the second storage unit can be used to detect whether the data is shared by multiple first storage units. If the data is shared by multiple first storage units, the atomic operation is performed in the second storage unit. If the data is not shared by multiple first storage units, the atomic operation can be performed in the target storage unit or the upper storage unit of the target storage unit. The method provided in the present application can determine the node that executes the atomic operation according to the sharing of the data corresponding to the atomic operation, avoid conflicts when executing the atomic operation, cause the performance of the computer device to decline, and ensure the reliability when executing the atomic operation.
[0141] An embodiment of the present invention further provides a computer device, which may include a multi-core processor and the memory provided by the above embodiment.
[0142] An embodiment of the present invention further provides a computer-readable storage medium, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the execution method of the atomic operation provided by the above method embodiment.
[0143] An embodiment of the present invention further provides a chip, which includes a programmable logic circuit and / or program instructions, and when the chip is running, is used to implement the execution method of the atomic operation provided by the above method embodiment.
[0144] An embodiment of the present invention further provides a computer program product comprising instructions, and when the computer program product is run on a computer, the computer is enabled to execute the method for executing the atomic operation provided by the above method embodiment.
[0145] The above are only optional implementations of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for executing an atomic operation, characterized in that: A memory applied to a multi-core computer device, the memory comprising a multi-level storage unit, wherein there are two adjacent levels of storage units in the multi-level storage unit, wherein the first level storage unit comprises a plurality of first storage units, and the second level storage unit comprises at least one second storage unit, each of the first storage units is a cache unit, each of the second storage units is a cache unit or a memory, and each of the second storage units is shared by a plurality of processor cores, the method comprising: When a target storage unit among the plurality of first storage units receives an atomic operation, if the state of data corresponding to the atomic operation in the target storage unit is a modified state or an exclusive state, executing the atomic operation in the target storage unit; If the state of the data in the target storage unit is an invalid state or a shared state, detecting by the second storage unit whether the data is data shared by a plurality of first storage units; If the data is data shared by a plurality of first storage units, performing the atomic operation in the second storage unit; If the data is not shared by a plurality of first storage units, the atomic operation is performed in the target storage unit or an upper-level storage unit of the target storage unit.
2. The method according to claim 1, characterized in that The memory further includes: an upper level storage unit located above the first level storage unit; the method further includes: When any storage unit in the upper storage unit receives the atomic operation, if the state of the data in the any storage unit is a modified state or an exclusive state, the atomic operation is performed in the any storage unit; If the state of the data in any of the storage units is a failure state or a shared state, the atomic operation is sent to the next-level storage unit of any of the storage units through the any of the storage units.
3. The method according to claim 1, characterized in that If the state of the data in the target storage unit is a failure state or a shared state, detecting, by the second storage unit, whether the data is data shared by a plurality of first storage units includes: If the state of the data in the target storage unit is a failure state or a shared state, detecting by the target storage unit whether the address of the data is recorded in a conflict list; If the address is not recorded in the conflict list, sending a probe request carrying the address of the data to the second storage unit through the target storage unit, and detecting through the second storage unit whether the data indicated by the address is data shared by multiple first storage units; If the address is recorded in the conflict list, the atomic operation is forwarded to the second storage unit through the target storage unit, and the second storage unit detects whether the data corresponding to the atomic operation is data shared by multiple first storage units.
4. The method according to claim 3, characterized in that If the data indicated by the address is data shared by a plurality of first storage units, the method further includes: Sending a failure response message to the target storage unit through the second storage unit, wherein the failure response message is used to indicate that the state of the data in the target storage unit is invalid; The target storage unit records the address of the data in the conflict list according to the failure response message.
5. The method according to claim 3, characterized in that: If the data indicated by the address is not data shared by the plurality of first storage units, performing the atomic operation in the target storage unit or a storage unit above the target storage unit includes: If the data indicated by the address is not data shared by a plurality of first storage units, and the state of the data in the target storage unit is a shared state, a success response message is sent to the target storage unit through the second storage unit, and the atomic operation is performed in the target storage unit, wherein the success response message is used to indicate that the state of the data is a modified state or an exclusive state; If the data indicated by the address is not data shared by a plurality of first storage units, and the state of the data in the target storage unit is invalid, sending the success response message and the data to the target storage unit through the second storage unit, and performing the atomic operation in the target storage unit; If the address is the first received address and the status of the data in the target storage unit is invalid, the data corresponding to the atomic operation is sent to the target storage unit or the upper storage unit of the target storage unit through the second storage unit, and the atomic operation is performed in the storage unit that receives the data.
6. The method according to claim 3, characterized in that If the data corresponding to the atomic operation is not data shared by the plurality of first storage units, performing the atomic operation in the target storage unit or a storage unit above the target storage unit includes: If the data corresponding to the atomic operation is shared inside the target storage unit, the data corresponding to the atomic operation is sent to the target storage unit, and the atomic operation is performed in the target storage unit; If the data corresponding to the atomic operation is exclusively shared by the upper-level storage unit of the target storage unit, the data corresponding to the atomic operation is sent to the upper-level storage unit, and the atomic operation is performed in the upper-level storage unit.
7. The method according to claim 6, characterized in that After the target storage unit performs the atomic operation, the method further includes: The address of the data is deleted from the conflict list through the target storage unit.
8. The method according to any one of claims 3 to 7, characterized in that: The detecting, by the second storage unit, whether the data is data shared by a plurality of first storage units comprises: Detecting, by the second storage unit, whether the processor cores initiating the atomic operation within a preset time period share a first storage unit; When there are multiple first storage units shared by the processor cores that initiate the atomic operation within the preset time period, determining that the data is data shared by multiple first storage units; When the processor cores that initiate the atomic operation within the preset time period share the same first storage unit, it is determined that the data is not data shared by multiple first storage units.
9. A memory, characterized in that: Applied in a multi-core computer device, the memory includes a multi-level storage unit, there are two adjacent levels of storage units in the multi-level storage unit, in the adjacent two levels of storage units, the first level storage unit includes a plurality of first storage units, the second level storage unit includes at least one second storage unit, each of the first storage units is a cache unit, each of the second storage units is a cache unit or a memory, and each of the second storage units is shared by a plurality of processor cores; A target storage unit among the plurality of first storage units that receives the atomic operation is used to execute the atomic operation in the target storage unit when the state of the data corresponding to the atomic operation in the target storage unit is a modified state or an exclusive state; The second storage unit is used to detect whether the data is shared by multiple first storage units when the state of the data in the target storage unit is an invalid state or a shared state; When the data is shared by multiple first storage units, the atomic operation is performed in the second storage unit; when the data is not shared by multiple first storage units, the target storage unit or the upper storage unit of the target storage unit is instructed to perform the atomic operation.
10. The memory according to claim 9, characterized in that: The memory further includes: an upper level storage unit located above the first level storage unit; Any storage unit in the upper storage unit that receives the atomic operation is used to: When the state of the data in any of the storage units is a modified state or an exclusive state, performing the atomic operation in any of the storage units; When the state of the data in any of the storage units is a failure state or a shared state, the atomic operation is sent to the next level storage unit.
11. The memory according to claim 9, characterized in that: The target storage unit is further used to: when the state of the data in the target storage unit is an invalid state or a shared state, detect whether the address of the data is recorded in the conflict list; if the address is not recorded in the conflict list, send a probe request carrying the address of the data to the second storage unit; if the address is recorded in the conflict list, forward the atomic operation to the second storage unit; The second storage unit is used to: when receiving the probe request, detect whether the data indicated by the address is data shared by multiple first storage units; when receiving the atomic operation, detect whether the data corresponding to the atomic operation is data shared by multiple first storage units.
12. The memory according to claim 11, characterized in that: The second storage unit is further used to: upon detecting that the data indicated by the address is data shared by a plurality of first storage units, send a failure response message to the target storage unit, wherein the failure response message is used to indicate that the state of the data in the target storage unit is an invalid state; The target storage unit is further used to record the address of the data in the conflict list according to the failure response message.
13. The memory according to claim 11, characterized in that: The second storage unit is further used to: when the data indicated by the address is not data shared by multiple first storage units, and the state of the data in the target storage unit is a shared state, send a success response message to the target storage unit, wherein the success response message is used to indicate that the state of the data is a modified state or an exclusive state; When the data indicated by the address is not data shared by the plurality of first storage units, and the state of the data in the target storage unit is invalid, sending the success response message and the data to the target storage unit; When the address is an address received for the first time and the state of the data in the target storage unit is an invalid state, sending the data corresponding to the atomic operation to the target storage unit or an upper-level storage unit of the target storage unit; The target storage unit is configured to perform the atomic operation after receiving the success response message or the data corresponding to the atomic operation sent by the second storage unit; The upper-level storage unit of the target storage unit is used to perform the atomic operation after receiving the data corresponding to the atomic operation sent by the second storage unit.
14. The memory according to claim 11, characterized in that: The second storage unit is used to: when the data corresponding to the atomic operation is shared inside the target storage unit, send the data corresponding to the atomic operation to the target storage unit for execution; When the data corresponding to the atomic operation is exclusively used in the upper-level storage unit of the target storage unit, the data corresponding to the atomic operation is sent to the upper-level storage unit for execution.
15. The memory according to claim 14, characterized in that: The target storage unit is further used to delete the address of the data from the conflict list after executing the atomic operation.
16. The memory according to any one of claims 11 to 15, characterized in that: The second storage unit is used for: Detecting whether the processor cores initiating the atomic operation within a preset time period share a first storage unit; When there are multiple first storage units shared by the processor cores that initiate the atomic operation within the preset time period, determining that the data is data shared by multiple first storage units; When the processor cores that initiate the atomic operation within the preset time period share the same first storage unit, it is determined that the data is not data shared by multiple first storage units.
17. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the computer-readable storage medium is run on a computer, the computer executes the method for executing atomic operations as described in any one of claims 1 to 8.
18. A chip, characterized in that: The chip includes a programmable logic circuit and / or program instructions, which are used to implement the execution method of the atomic operation as described in any one of claims 1 to 8 when the chip is running.
19. A computer device, characterized in that: include: A multi-core processor, and a memory as claimed in any one of claims 9 to 16.
Citation Information
Patent Citations
Data access and storage system and method for weak consistency storage model
CN102591800A
Explicit multi-core Cache consistency active management method facing flow application
CN103279428A
