WO2017036041A1 - Data synchronous access method and synchronous access device - Google Patents

Data synchronous access method and synchronous access device Download PDF

Info

Publication number
WO2017036041A1
WO2017036041A1 PCT/CN2015/099893 CN2015099893W WO2017036041A1 WO 2017036041 A1 WO2017036041 A1 WO 2017036041A1 CN 2015099893 W CN2015099893 W CN 2015099893W WO 2017036041 A1 WO2017036041 A1 WO 2017036041A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
accessed
synchronously
bits
atomic operation
Prior art date
Application number
PCT/CN2015/099893
Other languages
French (fr)
Chinese (zh)
Inventor
易鸿斌
Original Assignee
安一恒通(北京)科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 安一恒通(北京)科技有限公司 filed Critical 安一恒通(北京)科技有限公司
Publication of WO2017036041A1 publication Critical patent/WO2017036041A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt

Definitions

  • the present disclosure relates generally to computer technology, and more particularly to data access technologies, and more particularly to a method for synchronous access of data and a synchronous access device.
  • data is located somewhere in the storage area, and each data corresponds to a synchronization object for synchronization.
  • the synchronization object corresponding to the setting data is in a no-signal state, and the data is accessed through the atomic operation instruction, and if the value of the data satisfies the pre-specified correspondence, the corresponding synchronization object is set as There is a signal state.
  • the synchronization object corresponding to all other data is waited for the signal state, and the data is accessed through the atomic operation instruction.
  • the existing synchronous access method needs to wait for a synchronization object for synchronous access of data having an association relationship, which affects efficiency.
  • this method is not available when the processor's interrupt request level is above the thread scheduling level.
  • an embodiment of the present application provides a method for synchronously accessing data, including: allocating a contiguous memory unit to data to be accessed synchronously, wherein a data bit of the contiguous memory unit is a data bit of data to be synchronously accessed.
  • the atomic operation instruction is divided into data segments corresponding to the number of data to be synchronously accessed, wherein the bits of each data segment The number is greater than or equal to the number of bits of data to be accessed synchronously corresponding thereto; and accessing data to be accessed synchronously in one instruction cycle, wherein the instruction cycle is the duration of execution of the atomic operation instruction.
  • the embodiment of the present application further provides a data synchronization access device, including: an allocation module, configured to allocate a contiguous memory unit to data to be accessed synchronously, wherein the data bits of the contiguous memory unit are data The sum of the data bits; the dividing module configured to divide the atomic operation instruction into data corresponding to the number of data to be synchronously accessed based on the number of data to be accessed synchronously and the number of data bits of each data to be synchronously accessed a segment, wherein the number of bits of each data segment is greater than or equal to a corresponding number of bits of data to be accessed synchronously; and an access module configured to access data to be accessed synchronously within one instruction cycle, wherein the instruction cycle The length of time to execute an atomic operation instruction.
  • an allocation module configured to allocate a contiguous memory unit to data to be accessed synchronously, wherein the data bits of the contiguous memory unit are data The sum of the data bits
  • the dividing module configured to divide the atomic operation
  • the solution provided by the embodiment of the present application can simultaneously access multiple data in one atomic operation instruction cycle, thereby improving the efficiency of data reading and writing.
  • synchronous access of data under the premise that the total number of bits of data is less than or equal to the number of atomic operation instructions can avoid modification of data by other threads, and ensure the correctness of the relationship between the data.
  • the association relationship between the data may also be determined by an atomic operation instruction.
  • FIG. 1 is a schematic flowchart of a method for synchronous access of data according to an embodiment of the present application
  • FIG. 2 shows, in FIG. 1, the atomic operation instruction is divided into data to be accessed synchronously based on the number of data to be synchronously accessed and the number of data bits of data to be synchronously accessed.
  • FIG. 3 is a schematic diagram of an application scenario of a method for synchronous access of data according to an embodiment of the present application
  • FIG. 4 shows a schematic structural diagram of a synchronous access device for data according to an embodiment of the present application.
  • FIG. 1 a schematic flowchart 100 of a method for synchronous access of data according to an embodiment of the present application is shown.
  • step 110 contiguous memory locations are allocated to the data to be accessed synchronously.
  • the data bit number of the contiguous memory unit is the sum of the data bits of the data to be accessed synchronously.
  • Memory allocation refers to the operation of allocating or reclaiming storage space during program execution.
  • the continuous allocation of memory refers to allocating a contiguous memory space for a user program.
  • the continuous allocation of memory includes a single continuous allocation, fixed partition allocation, and dynamic partition allocation.
  • each data to be accessed synchronously includes 16 bits. Then, when allocating contiguous memory cells to these data, a 64-bit contiguous memory cell (16 ⁇ 4) can be allocated for storing the data to be accessed synchronously.
  • step 120 based on the number of data to be synchronously accessed and the number of data bits of each data to be synchronously accessed, the atomic operation instruction is divided into data segments corresponding to the number of data to be synchronously accessed, wherein each data The number of bits in the segment is greater than or equal to the number of bits of data to be accessed synchronously.
  • An atomic operation is an operation that cannot be interrupted, or an operation that is not interrupted by the thread scheduling mechanism. There is no context switch during the operation.
  • the access is not interrupted by other threads, that is, the data stored in the memory unit before the execution of the atomic operation instruction instruction is completed. The value will not be changed by other threads.
  • each data to be accessed synchronously includes 16 bits for explanation.
  • the atomic operation instruction may be divided into four data segments to respectively access the four data to be synchronously accessed.
  • the data processing digits of each data segment are not less than 16 bits.
  • each of the data to be synchronously accessed includes 16 bits.
  • the data to be accessed synchronously may have the same number of data bits, or may have different numbers of data bits.
  • the data processing bits of the data segment of the atomic operation instruction corresponding to the data to be synchronously accessed may also be the same or different.
  • the data bit number of the data A to be synchronously accessed is 16 bits
  • the data bit number of the data B to be synchronously accessed is 8 bits
  • at least when the data segment is divided, the data segment for accessing the data A to be synchronously accessed is at least There are 16 bits of data processing bits
  • the data segment for accessing data B to be accessed synchronously has at least 8 bits of data processing bits.
  • step 130 the data to be accessed synchronously is accessed during an instruction cycle, wherein the instruction cycle is the length of time during which the atomic operation instruction is executed.
  • each data segment to be accessed synchronously is accessed through each data segment of the atomic operation instruction.
  • access to each data to be accessed synchronously may include, for example, read, write or other operational categories.
  • step 210 the number of data bits of each data to be synchronously accessed is obtained.
  • the number of data bits of each data to be accessed synchronously may be determined by the number of data bits of consecutive memory cells allocated to the data to be accessed synchronously.
  • contiguous memory locations have been allocated to the data based on the number of data bits of the data in step 110.
  • the number of data bits of each data to be synchronously accessed can be determined based on the number of data bits of the contiguous memory unit and the size of the memory space occupied when the memory unit is allocated to each data.
  • step 220 the sum of the data bits of each data to be synchronously accessed and the number of data processed bits of the atomic operation instruction are compared.
  • step 230 the atomic operation instruction is divided into data segments corresponding to the number of data based on the sum of the data processing bits of the atomic operation instruction being greater than or equal to the data bit number of each data to be synchronously accessed.
  • the data is also shared by four data to be accessed synchronously (A to D), and each data includes 16 bits for explanation. If the number of data processing bits of the atomic operation instruction is 64 bits, that is, the number of data processing bits of the atomic operation instruction is equal to the sum of the data bits of the data to be synchronously accessed (16 ⁇ 4), then the atomic operation can be performed.
  • the instruction is divided into four data segments. Each data segment can respectively access one of the data to be accessed synchronously.
  • the number of data processing bits of the atomic operation instruction is 32 bits, that is, the data processing digit of the atomic operation instruction is smaller than the sum of the data bits of the data to be synchronously accessed (16 ⁇ 4)
  • the atomic operation instruction performs the corresponding data segment division. The reason is because the sum of the number of data bits to be accessed synchronously exceeds the index of an atomic operation instruction. The upper limit of the number of data bits that can be processed by the cycle. These data to be synchronized cannot be accessed synchronously within the instruction cycle of the same atomic operation instruction.
  • the step of performing the atomic operation instructions of step 130 to access the data corresponding thereto may include, for example, reading and/or modifying data in one instruction cycle.
  • the instruction cycle is the length of time during which the atomic operation instruction is executed.
  • the execution of the atomic operation instructions is "read.” Then, after the atomic operation instruction is executed, the value of each data can be returned as a return value.
  • the execution of the atomic operation instructions is "modified.” Then, after the atomic operation instruction is executed, the value of each data will be changed accordingly.
  • the method for synchronously accessing data of the embodiment may further include the step 140, determining, according to the return value of the data to be accessed synchronously, the association relationship of the data to be synchronously accessed in the instruction cycle. .
  • the association relationship of each data to be accessed synchronously may include, for example, a numerical operation relationship or a logical operation relationship.
  • the data is also shared by four data to be accessed synchronously (A to D), and each data includes 16 bits for explanation.
  • the values of other data to be accessed synchronously may be determined according to one of the four data to be accessed synchronously, for example, when the data to be accessed synchronously is B, C, and D. If the value is 0, the value of the data A to be accessed synchronously is set to 1.
  • the value of the remaining data may be calculated according to the values of the data of the four to be accessed synchronously.
  • a continuous memory unit 310 is allocated for the four to-be-synchronized access data A to D (as shown in step 110 in FIG. 1).
  • the data between the to-be-synchronized access data A to D is determined.
  • the association relationship (shown as step 140 in Figure 1). After the association is determined, it may be necessary to update other data based on one or more of the data to be accessed synchronously.
  • synchronous access of data to be synchronously accessed is performed under the premise that the total number of bits of the data is less than or equal to the number of data processing bits of the atomic operation instruction, so that other threads can be prevented from modifying the data to be simultaneously accessed.
  • FIG. 4 there is shown a schematic structural diagram 400 of a synchronous access device for data according to an embodiment of the present application.
  • the synchronous access device of the data of this embodiment may include an allocation module 410, a dividing module 420, and an access module 430.
  • the distribution module 410 can be configured to allocate contiguous memory units to data to be accessed synchronously.
  • the number of data bits of the contiguous memory unit is the sum of the data bits of the data to be accessed synchronously.
  • the partitioning module 420 is configurable to divide the atomic operation instruction into data segments corresponding to the number of data to be accessed synchronously based on the number of data to be accessed synchronously and the number of data bits of data to be accessed synchronously.
  • the number of bits of each data segment is greater than or equal to the number of bits of data to be accessed synchronously corresponding thereto.
  • the access module 430 can be configured to access data to be accessed synchronously within one instruction cycle.
  • the instruction cycle is the length of time during which the atomic operation instruction is executed.
  • the dividing module 420 may be further configured to obtain data bits for each data to be accessed synchronously; compare the sum of the data bits of each data to be synchronously accessed and the data processing of the atomic operation instruction The number of bits; and the number of data processing bits based on the atomic operation instruction is greater than or equal to the sum of the data bits of the data to be synchronously accessed, and the atomic operation instruction is divided into data segments corresponding to the number of data.
  • the access module 430 can be further configured to read and/or modify data to be accessed synchronously within one instruction cycle.
  • the synchronous access device of the data in this embodiment may further include an association determining module 440.
  • the association determining module 440 can be configured to determine an association relationship of each data to be synchronously accessed based on a return value of the data accessed for accessing the synchronization during the instruction cycle.
  • association relationship may include, for example, a numerical operation relationship or a logical operation relationship.
  • each block of the flowchart or block diagrams can represent a module, a program segment, or a portion of code that includes one or more logic for implementing the specified.
  • Functional executable instructions can also occur in a different order than that illustrated in the drawings. For example, two successively represented blocks may in fact be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowcharts, and combinations of blocks in the block diagrams and/or flowcharts can be implemented in a dedicated hardware-based system that performs the specified function or operation. Or it can be implemented by a combination of dedicated hardware and computer instructions.
  • the units or modules described in the embodiments of the present application may be implemented by software or by hardware.
  • the described unit or module may also be provided in the processor, for example, as a processor including an allocation module, a partitioning module, and an access module.
  • the names of these units or modules do not constitute a limitation on the unit or the module itself in some cases.
  • the allocation module may also be described as "a module for allocating contiguous memory units to data".
  • the present application further provides a computer readable storage medium, which may be a computer readable storage medium included in the apparatus described in the foregoing embodiment, or may exist separately, not A computer readable storage medium that is assembled into the device.
  • the computer readable storage medium stores one or more programs that are used by one or more processors to perform the formula input methods described in this application.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multi Processors (AREA)

Abstract

A data synchronous access method (100) and a synchronous access device. The data synchronous access method (100) comprises the following steps: allocating a continuous memory unit to data to be synchronously accessed (110), the data digit of the continuous memory unit being a sum of the data digits of all pieces of data to be synchronously accessed; dividing an atomic operation instruction into data segments corresponding to the amount of the data to be synchronously accessed according to the amount of the data to be synchronously accessed and the data digit of each piece of data to be synchronously accessed, (120), the digit of each data segment being greater than or equal to the digit of the corresponding data to be synchronously accessed; and accessing the data to be synchronously accessed within an instruction period (130), the instruction period being a duration for executing the atomic operation instruction. By means of the method and the apparatus, multiple pieces of data having an association relationship can be synchronously accessed in the same atomic operation instruction period, thereby improving the data access efficiency and accordingly quickening the data processing speed of a computer.

Description

数据的同步访问方法和同步访问装置Synchronous access method of data and synchronous access device
相关申请的交叉引用Cross-reference to related applications
本申请要求于2015年08月31日提交的中国专利申请号为“201510548924.X”的优先权,其全部内容作为整体并入本申请中。The present application claims priority to Chinese Patent Application No. 201510548924.X filed on Aug. 31, 2015, the entire content of which is incorporated herein in its entirety.
技术领域Technical field
本公开一般涉及计算机技术,具体涉及数据访问技术,尤其涉及数据的同步访问方法和同步访问装置。The present disclosure relates generally to computer technology, and more particularly to data access technologies, and more particularly to a method for synchronous access of data and a synchronous access device.
背景技术Background technique
在现有技术中,数据位于存储区域的某个位置,每个数据对应一个用于同步的同步对象。In the prior art, data is located somewhere in the storage area, and each data corresponds to a synchronization object for synchronization.
在对共享、可变数据各自的同步访问时,设置数据对应的同步对象为无信号状态,通过原子操作指令访问数据,判断数据的值如果满足预先指定的对应关系,则设置对应的同步对象为有信号状态。In the synchronous access of the shared and variable data, the synchronization object corresponding to the setting data is in a no-signal state, and the data is accessed through the atomic operation instruction, and if the value of the data satisfies the pre-specified correspondence, the corresponding synchronization object is set as There is a signal state.
在对存在关联关系数据的同步访问时,等待所有其他数据对应的同步对象为有信号状态,再通过原子操作指令访问本数据。When the synchronous access to the associated data exists, the synchronization object corresponding to all other data is waited for the signal state, and the data is accessed through the atomic operation instruction.
然而,现有的同步访问方法对于存在关联关系的数据的同步访问,需要等待同步对象,影响效率。此外,当处理器的中断请求级别在线程调度级别之上时,这种方法不可用。However, the existing synchronous access method needs to wait for a synchronization object for synchronous access of data having an association relationship, which affects efficiency. In addition, this method is not available when the processor's interrupt request level is above the thread scheduling level.
发明内容Summary of the invention
鉴于现有技术中的上述缺陷或不足,期望提供一种数据的同步访问方法和同步访问装置,可以在同一原子操作指令周期内对多个存在关联关系的数据进行同步访问,提高了数据访问的效率,从而加快了计算机数据处理的速度。 In view of the above-mentioned defects or deficiencies in the prior art, it is desirable to provide a synchronous access method and a synchronous access device for data, which can synchronously access data of multiple associated relationships in the same atomic operation instruction cycle, thereby improving data access. Efficiency, which speeds up the processing of computer data.
第一方面,本申请实施例提供了一种数据的同步访问方法,包括:向待同步访问的数据分配连续内存单元,其中,连续内存单元的数据位数为各待同步访问的数据的数据位数之和;基于待同步访问的数据的数量和各待同步访问的数据的数据位数,将原子操作指令划分为与待同步访问的数据的数量对应的数据段,其中,各数据段的位数大于或等于与之对应的待同步访问的数据的位数;以及在一个指令周期内,访问待同步访问的数据,其中,指令周期为执行原子操作指令的时长。In a first aspect, an embodiment of the present application provides a method for synchronously accessing data, including: allocating a contiguous memory unit to data to be accessed synchronously, wherein a data bit of the contiguous memory unit is a data bit of data to be synchronously accessed. The sum of the numbers; based on the number of data to be accessed synchronously and the number of data bits of each data to be synchronously accessed, the atomic operation instruction is divided into data segments corresponding to the number of data to be synchronously accessed, wherein the bits of each data segment The number is greater than or equal to the number of bits of data to be accessed synchronously corresponding thereto; and accessing data to be accessed synchronously in one instruction cycle, wherein the instruction cycle is the duration of execution of the atomic operation instruction.
第二方面,本申请实施例还提供了一种数据的同步访问装置,包括:分配模块,配置用于向待同步访问的数据分配连续内存单元,其中,连续内存单元的数据位数为各数据的数据位数之和;划分模块,配置用于基于待同步访问的数据的数量和各待同步访问的数据的数据位数,将原子操作指令划分为与待同步访问的数据的数量对应的数据段,其中,各数据段的位数大于或等于与之对应的待同步访问的数据的位数;以及访问模块,配置用于在一个指令周期内,访问待同步访问的数据,其中,指令周期为执行原子操作指令的时长。In a second aspect, the embodiment of the present application further provides a data synchronization access device, including: an allocation module, configured to allocate a contiguous memory unit to data to be accessed synchronously, wherein the data bits of the contiguous memory unit are data The sum of the data bits; the dividing module configured to divide the atomic operation instruction into data corresponding to the number of data to be synchronously accessed based on the number of data to be accessed synchronously and the number of data bits of each data to be synchronously accessed a segment, wherein the number of bits of each data segment is greater than or equal to a corresponding number of bits of data to be accessed synchronously; and an access module configured to access data to be accessed synchronously within one instruction cycle, wherein the instruction cycle The length of time to execute an atomic operation instruction.
本申请实施例提供的方案,可以在一个原子操作指令周期中同时访问多个数据,提高了数据读写的效率。The solution provided by the embodiment of the present application can simultaneously access multiple data in one atomic operation instruction cycle, thereby improving the efficiency of data reading and writing.
此外,在数据的总位数小于等于原子操作指令位数的前提下进行数据的同步访问,可以避免其他线程对数据的修改,保证了各数据之间关联关系的正确性。In addition, synchronous access of data under the premise that the total number of bits of data is less than or equal to the number of atomic operation instructions can avoid modification of data by other threads, and ensure the correctness of the relationship between the data.
在本申请实施例的一些实现方式中,还可以通过一个原子操作指令确定各数据之间的关联关系。In some implementations of the embodiments of the present application, the association relationship between the data may also be determined by an atomic operation instruction.
附图说明DRAWINGS
通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本申请的其它特征、目的和优点将会变得更明显:Other features, objects, and advantages of the present application will become more apparent from the detailed description of the accompanying drawings.
图1示出了根据本申请一个实施例的数据的同步访问方法的示意性流程图;FIG. 1 is a schematic flowchart of a method for synchronous access of data according to an embodiment of the present application;
图2示出了图1中,基于待同步访问的数据的数量和各待同步访问的数据的数据位数,将原子操作指令划分为与待同步访问的数据的 数量对应的数据段的示意性流程图;2 shows, in FIG. 1, the atomic operation instruction is divided into data to be accessed synchronously based on the number of data to be synchronously accessed and the number of data bits of data to be synchronously accessed. Schematic flow chart of the data segment corresponding to the quantity;
图3示出了根据本申请实施例的数据的同步访问方法的一个应用场景的示意图;FIG. 3 is a schematic diagram of an application scenario of a method for synchronous access of data according to an embodiment of the present application;
图4示出了根据本申请一个实施例的数据的同步访问装置的示意性结构图。FIG. 4 shows a schematic structural diagram of a synchronous access device for data according to an embodiment of the present application.
具体实施方式detailed description
下面结合附图和实施例对本申请作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释相关发明,而非对该发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与发明相关的部分。The present application will be further described in detail below with reference to the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are merely illustrative of the invention, rather than the invention. It should also be noted that, for the convenience of description, only parts related to the invention are shown in the drawings.
需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本申请。It should be noted that the embodiments in the present application and the features in the embodiments may be combined with each other without conflict. The present application will be described in detail below with reference to the accompanying drawings.
参见图1所示,为根据本申请一个实施例的数据的同步访问方法的示意性流程图100。Referring to FIG. 1, a schematic flowchart 100 of a method for synchronous access of data according to an embodiment of the present application is shown.
具体而言,在步骤110中,向待同步访问的数据分配连续内存单元。其中,连续内存单元的数据位数为各待同步访问的数据的数据位数之和。Specifically, in step 110, contiguous memory locations are allocated to the data to be accessed synchronously. The data bit number of the contiguous memory unit is the sum of the data bits of the data to be accessed synchronously.
内存分配,是指在程序执行的过程中分配或者回收存储空间的操作。而内存的连续分配方式,是指为一个用户程序分配一个连续的内存空间。内存的连续分配方式包括单一连续分配、固定分区分配和动态分区分配等。Memory allocation refers to the operation of allocating or reclaiming storage space during program execution. The continuous allocation of memory refers to allocating a contiguous memory space for a user program. The continuous allocation of memory includes a single continuous allocation, fixed partition allocation, and dynamic partition allocation.
在本实施例中,通过对数据分配连续内存单元,可以便于后续步骤中对各数据的快速、高效地访问,从而提高处理效率。In this embodiment, by allocating a contiguous memory unit to the data, it is possible to facilitate quick and efficient access to each data in subsequent steps, thereby improving processing efficiency.
在一些可选的实现方式中,例如,共有四个待同步访问的数据,每个待同步访问的数据均包含16位。那么,在向这些数据进行连续内存单元的分配时,可以分配64位连续内存单元(16×4),用于存放这些待同步访问的数据。 In some optional implementations, for example, there are four data to be accessed synchronously, and each data to be accessed synchronously includes 16 bits. Then, when allocating contiguous memory cells to these data, a 64-bit contiguous memory cell (16×4) can be allocated for storing the data to be accessed synchronously.
接着,在步骤120中,基于待同步访问的数据的数量和各待同步访问的数据的数据位数,将原子操作指令划分为与待同步访问的数据的数量对应的数据段,其中,各数据段的位数大于或等于与之对应的待同步访问的数据的位数。Next, in step 120, based on the number of data to be synchronously accessed and the number of data bits of each data to be synchronously accessed, the atomic operation instruction is divided into data segments corresponding to the number of data to be synchronously accessed, wherein each data The number of bits in the segment is greater than or equal to the number of bits of data to be accessed synchronously.
原子操作,是指不可中断的一个或者一系列操作,也就是不会被线程调度机制打断的操作,运行期间不会有任何的上下文切换(context switch)。An atomic operation is an operation that cannot be interrupted, or an operation that is not interrupted by the thread scheduling mechanism. There is no context switch during the operation.
这样一来,当采用原子操作指令对各待同步访问的数据进行访问时,该访问不会被其它线程打断,也即是说,在原子操作指令指令执行完毕前,内存单元内存储的数据的值不会被其它线程所改变。In this way, when the data to be synchronously accessed is accessed by the atomic operation instruction, the access is not interrupted by other threads, that is, the data stored in the memory unit before the execution of the atomic operation instruction instruction is completed. The value will not be changed by other threads.
同样以共有四个待同步访问的数据,每个待同步访问的数据包含16位来进行说明。为了对四个待同步访问的数据进行并行访问,可以将原子操作指令划分为四个数据段,来分别对应访问这四个待同步访问的数据。而且,每个数据段的数据处理位数不小于16位。Similarly, with a total of four data to be accessed synchronously, each data to be accessed synchronously includes 16 bits for explanation. In order to perform parallel access to the four data to be accessed synchronously, the atomic operation instruction may be divided into four data segments to respectively access the four data to be synchronously accessed. Moreover, the data processing digits of each data segment are not less than 16 bits.
在这里,需要说明的是,为了说明原子操作指令的数据处理位数和待同步访问的数据的数据位数的大小关系,此处以每个待同步访问的数据均包括16位进行了说明。然而在实际情况中,各待同步访问的数据可能具有相同的数据位数,也可能具有不同的数据位数。相应地,为了适应于各待同步访问的数据的数据位数,与各待同步访问的数据对应的原子操作指令的数据段的数据处理位数也可能相同或者不同。Here, it should be noted that, in order to explain the relationship between the number of data processing bits of the atomic operation instruction and the data bit number of the data to be synchronously accessed, here, each of the data to be synchronously accessed includes 16 bits. However, in actual situations, the data to be accessed synchronously may have the same number of data bits, or may have different numbers of data bits. Correspondingly, in order to adapt to the number of data bits of the data to be accessed synchronously, the data processing bits of the data segment of the atomic operation instruction corresponding to the data to be synchronously accessed may also be the same or different.
例如待同步访问的数据A的数据位数为16位,待同步访问的数据B的数据位数为8位,那么在进行数据段划分时,用于访问待同步访问的数据A的数据段至少具有16位的数据处理位数,而用于访问待同步访问的数据B的数据段至少具有8位的数据处理位数。For example, the data bit number of the data A to be synchronously accessed is 16 bits, and the data bit number of the data B to be synchronously accessed is 8 bits, then at least when the data segment is divided, the data segment for accessing the data A to be synchronously accessed is at least There are 16 bits of data processing bits, and the data segment for accessing data B to be accessed synchronously has at least 8 bits of data processing bits.
接着,在步骤130中,在一个指令周期内,访问待同步访问的数据,其中,指令周期为执行原子操作指令的时长。Next, in step 130, the data to be accessed synchronously is accessed during an instruction cycle, wherein the instruction cycle is the length of time during which the atomic operation instruction is executed.
也即是说,在本步骤中,通过原子操作指令的各数据段来对应访问各个待同步访问的数据。That is to say, in this step, each data segment to be accessed synchronously is accessed through each data segment of the atomic operation instruction.
在这里,对各待同步访问的数据的访问例如可以包括读取、写入或者其它的操作类别。 Here, access to each data to be accessed synchronously may include, for example, read, write or other operational categories.
采用本实施例的数据的同步访问方法,可以在一个指令周期内,同时对多个待同步访问的数据进行并行的访问。此外,由于通过原子操作指令来访问这些待同步访问的数据,该访问不会被其它的线程调度机制打断。With the synchronous access method of the data of this embodiment, parallel accesses to multiple data to be synchronously accessed can be simultaneously performed in one instruction cycle. In addition, since these data to be accessed synchronously are accessed through atomic operation instructions, the access is not interrupted by other thread scheduling mechanisms.
参见图2所示,为本实施例的数据的同步访问方法中,基于各数据的数据位数,调用处理器的原子操作指令的步骤(即如图1所示的步骤120)的示意性流程图200。Referring to FIG. 2, in the synchronous access method for data of the embodiment, the schematic flow of the step of calling the atomic operation instruction of the processor (ie, step 120 shown in FIG. 1) based on the number of data bits of each data is shown. Figure 200.
具体而言,在步骤210中,获取各待同步访问的数据的数据位数。Specifically, in step 210, the number of data bits of each data to be synchronously accessed is obtained.
在一些可选的实现方式中,例如,可以通过向待同步访问的数据分配的连续内存单元的数据位数来确定各待同步访问的数据的数据位数。In some optional implementations, for example, the number of data bits of each data to be accessed synchronously may be determined by the number of data bits of consecutive memory cells allocated to the data to be accessed synchronously.
如图1所示,在步骤110中已经基于数据的数据位数向数据分配了连续内存单元。这样一来,可以基于连续内存单元的数据位数和向每个数据分配内存单元时所占的内存空间的大小来确定各待同步访问的数据的数据位数。As shown in FIG. 1, contiguous memory locations have been allocated to the data based on the number of data bits of the data in step 110. In this way, the number of data bits of each data to be synchronously accessed can be determined based on the number of data bits of the contiguous memory unit and the size of the memory space occupied when the memory unit is allocated to each data.
返回继续参考图2。在步骤220中,比较各待同步访问的数据的数据位数之和与原子操作指令的数据处理位数。Return to continue with Figure 2. In step 220, the sum of the data bits of each data to be synchronously accessed and the number of data processed bits of the atomic operation instruction are compared.
接着,在步骤230中基于原子操作指令的数据处理位数大于或等于各待同步访问的数据的数据位数之和,将原子操作指令划分为与数据的数量对应的数据段。Next, in step 230, the atomic operation instruction is divided into data segments corresponding to the number of data based on the sum of the data processing bits of the atomic operation instruction being greater than or equal to the data bit number of each data to be synchronously accessed.
例如,同样以共有四个待同步访问的数据(A~D),每个数据包含16位来进行说明。若原子操作指令的数据处理位数为64位,也即是说,原子操作指令的数据处理位数等于各待同步访问的数据的数据位数之和(16×4),那么可以将原子操作指令划分为四个数据段。每个数据段可以分别对应访问其中一个待同步访问的数据。For example, the data is also shared by four data to be accessed synchronously (A to D), and each data includes 16 bits for explanation. If the number of data processing bits of the atomic operation instruction is 64 bits, that is, the number of data processing bits of the atomic operation instruction is equal to the sum of the data bits of the data to be synchronously accessed (16×4), then the atomic operation can be performed. The instruction is divided into four data segments. Each data segment can respectively access one of the data to be accessed synchronously.
反之,若原子操作指令的数据处理位数为32位,也即是说,原子操作指令的数据处理位数小于各待同步访问的数据的数据位数之和(16×4),则不将原子操作指令进行相应的数据段划分。其原因是,由于该四个待同步访问的数据位数之和超出了一个原子操作指令的指 令周期能够处理的数据位数的上限,这些待同步访问数据无法在同一个原子操作指令的指令周期内完成同步访问。On the other hand, if the number of data processing bits of the atomic operation instruction is 32 bits, that is, the data processing digit of the atomic operation instruction is smaller than the sum of the data bits of the data to be synchronously accessed (16×4), The atomic operation instruction performs the corresponding data segment division. The reason is because the sum of the number of data bits to be accessed synchronously exceeds the index of an atomic operation instruction. The upper limit of the number of data bits that can be processed by the cycle. These data to be synchronized cannot be accessed synchronously within the instruction cycle of the same atomic operation instruction.
返回继续参考图1。在一些可选的实现方式中,步骤130的执行各原子操作指令同步访问与之对应的数据的操作例如可以包括,在一个指令周期内读取和/或修改数据。在这里,指令周期为执行原子操作指令的时长。Return to continue with Figure 1. In some optional implementations, the step of performing the atomic operation instructions of step 130 to access the data corresponding thereto may include, for example, reading and/or modifying data in one instruction cycle. Here, the instruction cycle is the length of time during which the atomic operation instruction is executed.
例如,在一些可选的实现方式中,原子操作指令的执行内容为“读取”。那么,原子操作指令执行后,可将各数据的数值作为返回值返回。For example, in some alternative implementations, the execution of the atomic operation instructions is "read." Then, after the atomic operation instruction is executed, the value of each data can be returned as a return value.
或者,在另一些实现方式中,原子操作指令的执行内容为“修改”。那么,原子操作指令执行后,各数据的数值将被相应地改变。Alternatively, in other implementations, the execution of the atomic operation instructions is "modified." Then, after the atomic operation instruction is executed, the value of each data will be changed accordingly.
在一些可选的实现方式中,本实施例的数据的同步访问方法还可以包括步骤140,在指令周期内,基于访问待同步访问的数据的返回值,确定各待同步访问的数据的关联关系。In some optional implementation manners, the method for synchronously accessing data of the embodiment may further include the step 140, determining, according to the return value of the data to be accessed synchronously, the association relationship of the data to be synchronously accessed in the instruction cycle. .
各待同步访问的数据的关联关系例如可以包括数值运算关系或逻辑运算关系。The association relationship of each data to be accessed synchronously may include, for example, a numerical operation relationship or a logical operation relationship.
例如,同样以共有四个待同步访问的数据(A~D),每个数据包含16位来进行说明。在一些可选的实现方式中,可根据这四个待同步访问的数据中其中一个值,来确定其它待同步访问的数据的值,例如,当B、C、D三个待同步访问的数据的数值为0,则将待同步访问的数据A的值设为1。或者,还可以根据这四个待同步访问的数据中其中几个的数值,来计算其余数据的数值,例如,可以根据A~D的待同步访问的数据的值,来更新A的值,也即是说,计算A=A+B+C+D。For example, the data is also shared by four data to be accessed synchronously (A to D), and each data includes 16 bits for explanation. In some optional implementations, the values of other data to be accessed synchronously may be determined according to one of the four data to be accessed synchronously, for example, when the data to be accessed synchronously is B, C, and D. If the value is 0, the value of the data A to be accessed synchronously is set to 1. Alternatively, the value of the remaining data may be calculated according to the values of the data of the four to be accessed synchronously. For example, the value of A may be updated according to the value of the data to be synchronously accessed by A to D. That is to say, calculate A=A+B+C+D.
下面,将结合图3所示的应用场景来进一步阐述本申请实施例的数据的同步访问方法的执行过程,以使其特点能够得到更充分的说明。In the following, the execution process of the synchronous access method of the data in the embodiment of the present application will be further described in conjunction with the application scenario shown in FIG. 3, so that the features can be more fully explained.
如图3所示,假设有四个待同步访问数据A、B、C、D。参照图1所示的流程,首先,为这四个待同步访问数据A~D分配连续的内存单元310(如图1中的步骤110所示)。As shown in FIG. 3, it is assumed that there are four data A, B, C, and D to be accessed synchronously. Referring to the flow shown in FIG. 1, first, a continuous memory unit 310 is allocated for the four to-be-synchronized access data A to D (as shown in step 110 in FIG. 1).
接着,为了在一个原子操作指令的指令周期内对这四个待同步访问的数据A~D进行同步访问,若数据A~D的数据位数之和不超过原子操作指令的数据处理位数,则将原子操作指令划分为四个数据段 320,即分别与四个待同步访问的数据A~D对应的数据段一、数据段二、数据段三和数据段四(如图1中的步骤120所示),并在一个指令周期内,通过各数据段并行地访问与各数据段对应的各待同步访问的数据A~D(如图1中的步骤130所示)。Then, in order to synchronously access the four data A to D to be synchronously accessed during the instruction cycle of an atomic operation instruction, if the sum of the data bits of the data A to D does not exceed the number of data processing bits of the atomic operation instruction, Divide the atomic operation instruction into four data segments 320, that is, data segment 1, data segment 2, data segment 3, and data segment 4 corresponding to the data A to D to be accessed synchronously, respectively (as shown in step 120 in FIG. 1), and within one instruction cycle. The data A to D corresponding to each data segment corresponding to each data segment are accessed in parallel through the data segments (as shown in step 130 in FIG. 1).
接着,如附图标记330所示,还可以根据各数据段对各待同步访问数据A~D的访问结果,在同一个原子操作指令周期中,确定各待同步访问数据A~D之间的关联关系(如图1中的步骤140所示)。关联关系确定后,可能需要基于其中一个或多个待同步访问的数据对其它数据进行更新。Then, as shown by reference numeral 330, according to the access result of each data segment to each of the data to be synchronized accesses A to D, in the same atomic operation instruction cycle, the data between the to-be-synchronized access data A to D is determined. The association relationship (shown as step 140 in Figure 1). After the association is determined, it may be necessary to update other data based on one or more of the data to be accessed synchronously.
采用上述的数据的同步访问方法,可以在一个原子操作指令周期中同时访问多个待同步访问的数据,提高了数据读写的效率。By adopting the synchronous access method of the above data, multiple data to be accessed synchronously can be accessed simultaneously in one atomic operation instruction cycle, thereby improving the efficiency of reading and writing data.
此外,在数据的总位数小于等于原子操作指令的数据处理位数的前提下进行多个待同步访问的数据的同步访问,可以避免其他线程对这些多个待同步访问的数据的修改,保证了各个待同步访问的数据之间关联关系的正确性。In addition, synchronous access of data to be synchronously accessed is performed under the premise that the total number of bits of the data is less than or equal to the number of data processing bits of the atomic operation instruction, so that other threads can be prevented from modifying the data to be simultaneously accessed. The correctness of the association relationship between the data to be accessed synchronously.
参见图4所示,为根据本申请一个实施例的数据的同步访问装置的示意性结构图400。Referring to FIG. 4, there is shown a schematic structural diagram 400 of a synchronous access device for data according to an embodiment of the present application.
本实施例的数据的同步访问装置可以包括分配模块410、划分模块420和访问模块430。The synchronous access device of the data of this embodiment may include an allocation module 410, a dividing module 420, and an access module 430.
其中,分配模块410可配置用于向待同步访问的数据分配连续内存单元。The distribution module 410 can be configured to allocate contiguous memory units to data to be accessed synchronously.
在这里,连续内存单元的数据位数为各待同步访问的数据的数据位数之和。Here, the number of data bits of the contiguous memory unit is the sum of the data bits of the data to be accessed synchronously.
划分模块420可配置用于基于待同步访问的数据的数量和各待同步访问的数据的数据位数,将原子操作指令划分为与待同步访问的数据的数量对应的数据段。The partitioning module 420 is configurable to divide the atomic operation instruction into data segments corresponding to the number of data to be accessed synchronously based on the number of data to be accessed synchronously and the number of data bits of data to be accessed synchronously.
在这里,各数据段的位数大于或等于与之对应的待同步访问的数据的位数。Here, the number of bits of each data segment is greater than or equal to the number of bits of data to be accessed synchronously corresponding thereto.
访问模块430可配置用于在一个指令周期内,访问待同步访问的数据。 The access module 430 can be configured to access data to be accessed synchronously within one instruction cycle.
在这里,指令周期为执行原子操作指令的时长。Here, the instruction cycle is the length of time during which the atomic operation instruction is executed.
在一些可选的实现方式中,划分模块420还可进一步配置用于获取各待同步访问的数据的数据位数;比较各待同步访问的数据的数据位数之和与原子操作指令的数据处理位数;以及基于原子操作指令的数据处理位数大于或等于各待同步访问的数据的数据位数之和,将原子操作指令划分为与数据的数量对应的数据段。In some optional implementation manners, the dividing module 420 may be further configured to obtain data bits for each data to be accessed synchronously; compare the sum of the data bits of each data to be synchronously accessed and the data processing of the atomic operation instruction The number of bits; and the number of data processing bits based on the atomic operation instruction is greater than or equal to the sum of the data bits of the data to be synchronously accessed, and the atomic operation instruction is divided into data segments corresponding to the number of data.
在一些可选的实现方式中,访问模块430还可进一步配置用于在一个指令周期内读取和/或修改待同步访问的数据。In some alternative implementations, the access module 430 can be further configured to read and/or modify data to be accessed synchronously within one instruction cycle.
在一些可选的实现方式中,本实施例的数据的同步访问装置还可以包括关联关系确定模块440。In some optional implementation manners, the synchronous access device of the data in this embodiment may further include an association determining module 440.
关联关系确定模块440可配置用于在指令周期内,基于访问待同步访问的数据的返回值,确定各待同步访问的数据的关联关系。The association determining module 440 can be configured to determine an association relationship of each data to be synchronously accessed based on a return value of the data accessed for accessing the synchronization during the instruction cycle.
在这里,关联关系例如可以包括数值运算关系或逻辑运算关系。Here, the association relationship may include, for example, a numerical operation relationship or a logical operation relationship.
附图中的流程图和框图,图示了按照本发明各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,所述模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the Figures illustrate the architecture, functionality and operation of possible implementations of systems, methods and computer program products in accordance with various embodiments of the invention. In this regard, each block of the flowchart or block diagrams can represent a module, a program segment, or a portion of code that includes one or more logic for implementing the specified. Functional executable instructions. It should also be noted that in some alternative implementations, the functions noted in the blocks may also occur in a different order than that illustrated in the drawings. For example, two successively represented blocks may in fact be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block of the block diagrams and/or flowcharts, and combinations of blocks in the block diagrams and/or flowcharts, can be implemented in a dedicated hardware-based system that performs the specified function or operation. Or it can be implemented by a combination of dedicated hardware and computer instructions.
描述于本申请实施例中所涉及到的单元或模块可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的单元或模块也可以设置在处理器中,例如,可以描述为:一种处理器包括分配模块、划分模块和访问模块。其中,这些单元或模块的名称在某种情况下并不构成对该单元或模块本身的限定,例如,分配模块还可以被描述为“用于向数据分配连续内存单元的模块”。 The units or modules described in the embodiments of the present application may be implemented by software or by hardware. The described unit or module may also be provided in the processor, for example, as a processor including an allocation module, a partitioning module, and an access module. The names of these units or modules do not constitute a limitation on the unit or the module itself in some cases. For example, the allocation module may also be described as "a module for allocating contiguous memory units to data".
作为另一方面,本申请还提供了一种计算机可读存储介质,该计算机可读存储介质可以是上述实施例中所述装置中所包含的计算机可读存储介质;也可以是单独存在,未装配入设备中的计算机可读存储介质。计算机可读存储介质存储有一个或者一个以上程序,所述程序被一个或者一个以上的处理器用来执行描述于本申请的公式输入方法。In another aspect, the present application further provides a computer readable storage medium, which may be a computer readable storage medium included in the apparatus described in the foregoing embodiment, or may exist separately, not A computer readable storage medium that is assembled into the device. The computer readable storage medium stores one or more programs that are used by one or more processors to perform the formula input methods described in this application.
以上描述仅为本申请的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本申请中所涉及的发明范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离所述发明构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本申请中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。 The above description is only a preferred embodiment of the present application and a description of the principles of the applied technology. It should be understood by those skilled in the art that the scope of the invention referred to in the present application is not limited to the specific combination of the above technical features, and should also be covered by the above technical features without departing from the inventive concept. Other technical solutions formed by any combination of their equivalent features. For example, the above features are combined with the technical features disclosed in the present application, but are not limited to the technical features having similar functions.

Claims (12)

  1. 一种数据的同步访问方法,其特征在于,包括:A method for synchronous access of data, comprising:
    向待同步访问的数据分配连续内存单元,其中,所述连续内存单元的数据位数为各所述待同步访问的数据的数据位数之和;Allocating a contiguous memory unit to the data to be accessed synchronously, wherein the data bit number of the contiguous memory unit is a sum of data bits of each of the data to be synchronously accessed;
    基于所述待同步访问的数据的数量和各所述待同步访问的数据的数据位数,将原子操作指令划分为与待同步访问的数据的数量对应的数据段,其中,各所述数据段的位数大于或等于与之对应的所述待同步访问的数据的位数;以及Determining, according to the number of data to be synchronously accessed and the number of data bits of each of the data to be synchronously accessed, a data operation instruction into a data segment corresponding to the number of data to be accessed synchronously, wherein each of the data segments The number of bits is greater than or equal to the number of bits of the data to be accessed synchronously corresponding thereto;
    在一个指令周期内,访问所述待同步访问的数据,其中,所述指令周期为执行所述原子操作指令的时长。The data to be accessed synchronously is accessed during an instruction cycle, wherein the instruction cycle is a duration of execution of the atomic operation instruction.
  2. 根据权利要求1所述的方法,其特征在于,所述基于所述待同步访问的数据的数量和各所述待同步访问的数据的数据位数,将原子操作指令划分为与待同步访问的数据的数量对应的数据段包括:The method according to claim 1, wherein the atomic operation instruction is divided into accesses to be synchronized according to the number of data to be synchronously accessed and the number of data bits of each of the data to be synchronously accessed. The data segment corresponding to the number of data includes:
    获取各所述待同步访问的数据的数据位数;Obtaining data digits of each of the data to be accessed synchronously;
    比较各所述待同步访问的数据的数据位数之和与所述原子操作指令的数据处理位数;以及Comparing a sum of data bits of each of the data to be accessed synchronously with a data processing digit of the atomic operation instruction;
    基于所述原子操作指令的数据处理位数大于或等于各所述待同步访问的数据的数据位数之和,将原子操作指令划分为与数据的数量对应的数据段。The atomic operation instruction is divided into data segments corresponding to the number of data based on the sum of the data processing bits of the atomic operation instruction being greater than or equal to the data bit number of each of the data to be synchronously accessed.
  3. 根据权利要求1所述的方法,其特征在于,所述在一个指令周期内,访问所述待同步访问的数据包括:The method according to claim 1, wherein the accessing the data to be accessed synchronously in one instruction cycle comprises:
    在一个指令周期内读取和/或修改所述待同步访问的数据。The data to be accessed synchronously is read and/or modified in one instruction cycle.
  4. 根据权利要求3所述的方法,其特征在于,所述方法还包括:The method of claim 3, wherein the method further comprises:
    在所述指令周期内,基于访问所述待同步访问的数据的返回值,确定各所述待同步访问的数据的关联关系。 And determining, according to the return value of the data to be synchronously accessed, the association relationship of each of the data to be synchronously accessed.
  5. 根据权利要求4所述的方法,其特征在于:The method of claim 4 wherein:
    所述关联关系包括数值运算关系或逻辑运算关系。The association relationship includes a numerical operation relationship or a logical operation relationship.
  6. 一种数据的同步访问装置,其特征在于,包括:A synchronous access device for data, comprising:
    分配模块,配置用于向待同步访问的数据分配连续内存单元,其中,所述连续内存单元的数据位数为各所述数据的数据位数之和;An allocation module, configured to allocate a contiguous memory unit to data to be accessed synchronously, wherein a data bit of the contiguous memory unit is a sum of data bits of each of the data;
    划分模块,配置用于基于所述待同步访问的数据的数量和各所述待同步访问的数据的数据位数,将原子操作指令划分为与待同步访问的数据的数量对应的数据段,其中,各所述数据段的位数大于或等于与之对应的所述待同步访问的数据的位数;以及a dividing module, configured to divide an atomic operation instruction into a data segment corresponding to the number of data to be synchronously accessed, based on the number of data to be synchronously accessed and the number of data bits of each of the data to be synchronously accessed, wherein The number of bits of each of the data segments is greater than or equal to the number of bits of the data to be accessed synchronously corresponding thereto;
    访问模块,配置用于在一个指令周期内,访问所述待同步访问的数据,其中,所述指令周期为执行所述原子操作指令的时长。And an access module configured to access the data to be accessed synchronously in one instruction cycle, wherein the instruction cycle is a duration of executing the atomic operation instruction.
  7. 根据权利要求6所述的装置,其特征在于,所述划分模块进一步配置用于:The apparatus according to claim 6, wherein the dividing module is further configured to:
    获取各所述待同步访问的数据的数据位数;Obtaining data digits of each of the data to be accessed synchronously;
    比较各所述待同步访问的数据的数据位数之和与所述原子操作指令的数据处理位数;以及Comparing a sum of data bits of each of the data to be accessed synchronously with a data processing digit of the atomic operation instruction;
    基于所述原子操作指令的数据处理位数大于或等于各所述待同步访问的数据的数据位数之和,将原子操作指令划分为与数据的数量对应的数据段。The atomic operation instruction is divided into data segments corresponding to the number of data based on the sum of the data processing bits of the atomic operation instruction being greater than or equal to the data bit number of each of the data to be synchronously accessed.
  8. 根据权利要求6所述的装置,其特征在于,所述访问模块进一步配置用于:The apparatus according to claim 6, wherein the access module is further configured to:
    在一个指令周期内读取和/或修改所述待同步访问的数据。The data to be accessed synchronously is read and/or modified in one instruction cycle.
  9. 根据权利要求6-8任意一项所述的装置,其特征在于,所述装置还包括: The device according to any one of claims 6-8, wherein the device further comprises:
    关联关系确定模块,配置用于在所述指令周期内,基于访问所述待同步访问的数据的返回值,确定各所述待同步访问的数据的关联关系。The association determining module is configured to determine an association relationship of each of the data to be synchronously accessed based on a return value of the data to be accessed synchronously during the instruction cycle.
  10. 根据权利要求9所述的装置,其特征在于:The device of claim 9 wherein:
    所述关联关系包括数值运算关系或逻辑运算关系。The association relationship includes a numerical operation relationship or a logical operation relationship.
  11. 一种设备,包括:A device that includes:
    处理器;和Processor; and
    存储器,Memory,
    所述存储器中存储有能够被所述处理器执行的计算机可读指令,在所述计算机可读指令被执行时,所述处理器执行权利要求1至5中任一项所述的方法。The memory stores computer readable instructions executable by the processor, the processor executing the method of any one of claims 1 to 5 when the computer readable instructions are executed.
  12. 一种非易失性计算机存储介质,所述计算机存储介质存储有能够被处理器执行的计算机可读指令,当所述计算机可读指令被处理器执行时,所述处理器执行权利要求1至5中任一项所述的方法。 A non-volatile computer storage medium storing computer readable instructions executable by a processor, the processor executing claim 1 to when the computer readable instructions are executed by a processor The method of any of 5.
PCT/CN2015/099893 2015-08-31 2015-12-30 Data synchronous access method and synchronous access device WO2017036041A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510548924.X 2015-08-31
CN201510548924.XA CN105159766B (en) 2015-08-31 2015-08-31 The synchronization of access method of data and synchronization of access device

Publications (1)

Publication Number Publication Date
WO2017036041A1 true WO2017036041A1 (en) 2017-03-09

Family

ID=54800629

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/099893 WO2017036041A1 (en) 2015-08-31 2015-12-30 Data synchronous access method and synchronous access device

Country Status (2)

Country Link
CN (1) CN105159766B (en)
WO (1) WO2017036041A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105159766B (en) * 2015-08-31 2018-05-25 安一恒通(北京)科技有限公司 The synchronization of access method of data and synchronization of access device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101052947A (en) * 2004-11-03 2007-10-10 皇家飞利浦电子股份有限公司 Programmable data processing circuit that supports simd instruction
CN101133396A (en) * 2005-01-24 2008-02-27 国际商业机器公司 Method for managing access to shared resources in a multi-processor environment
US20140181421A1 (en) * 2012-12-21 2014-06-26 Advanced Micro Devices, Inc. Processing engine for complex atomic operations
CN103970506A (en) * 2008-03-28 2014-08-06 英特尔公司 Vector instruction to enable efficient synchronization and parallel reduction operations
CN104025031A (en) * 2011-12-28 2014-09-03 英特尔公司 Reducing the number of sequential operations in an application to be performed on a shared memory cell
CN105159766A (en) * 2015-08-31 2015-12-16 安一恒通(北京)科技有限公司 Synchronous access method and synchronous access device of data

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9256476B2 (en) * 2011-12-10 2016-02-09 International Business Machines Corporation Expedited module unloading for kernel modules that execute read-copy update callback processing code

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101052947A (en) * 2004-11-03 2007-10-10 皇家飞利浦电子股份有限公司 Programmable data processing circuit that supports simd instruction
CN101133396A (en) * 2005-01-24 2008-02-27 国际商业机器公司 Method for managing access to shared resources in a multi-processor environment
CN103970506A (en) * 2008-03-28 2014-08-06 英特尔公司 Vector instruction to enable efficient synchronization and parallel reduction operations
CN104025031A (en) * 2011-12-28 2014-09-03 英特尔公司 Reducing the number of sequential operations in an application to be performed on a shared memory cell
US20140181421A1 (en) * 2012-12-21 2014-06-26 Advanced Micro Devices, Inc. Processing engine for complex atomic operations
CN105159766A (en) * 2015-08-31 2015-12-16 安一恒通(北京)科技有限公司 Synchronous access method and synchronous access device of data

Also Published As

Publication number Publication date
CN105159766A (en) 2015-12-16
CN105159766B (en) 2018-05-25

Similar Documents

Publication Publication Date Title
US20160034397A1 (en) Method and Apparatus for Processing Data and Computer System
US9710306B2 (en) Methods and apparatus for auto-throttling encapsulated compute tasks
CN106951488B (en) Log recording method and device
JP2008507034A5 (en)
US9798543B2 (en) Fast mapping table register file allocation algorithm for SIMT processors
JPH03282958A (en) Electronic computer
US11720496B2 (en) Reconfigurable cache architecture and methods for cache coherency
US20160371082A1 (en) Instruction context switching
US20230367637A1 (en) Shared memory management method and device
US8359459B2 (en) Using hardware support to reduce synchronization costs in multithreaded applications
US20170300255A1 (en) Method and Apparatus for Detecting Transaction Conflict and Computer System
US9442759B2 (en) Concurrent execution of independent streams in multi-channel time slice groups
WO2017036041A1 (en) Data synchronous access method and synchronous access device
US10976934B2 (en) Prioritizing pages to transfer for memory sharing
US20230185991A1 (en) Multi-processor simulation on a multi-core machine
CN105378652A (en) Method and apparatus for allocating thread shared resource
US9501328B2 (en) Method for exploiting parallelism in task-based systems using an iteration space splitter
US11656905B2 (en) Delegation control based on program privilege level and page privilege level
CN112527502A (en) Method, device, medium and equipment for optimizing memory of audio/video codec
US9753670B2 (en) Prioritizing memory pages to copy for memory migration
JPH04120652A (en) Parallel processors
CN112506660A (en) Method and device for optimizing memory of audio/video codec and storage medium
KR20210021848A (en) Method and apparatus for memory allocation in a multi-core processor system, and recoding medium therefor
CN117687805A (en) Multithreading data synchronization method and system applied to PLC and device
WO2012101538A1 (en) Emulation of strongly ordered memory models

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15902845

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 11.06.2018)

122 Ep: pct application non-entry in european phase

Ref document number: 15902845

Country of ref document: EP

Kind code of ref document: A1