Data processing method and device
By directly copying data to the memory address of the cache queue for serialization and enqueueing in the industrial vision scene, the problem of low data processing efficiency in traditional technology is solved, and efficient data enqueuing and dequeuing operations are realized, and through mutual interaction The exclusive lock mechanism ensures data consistency.
Patent Information
- Application Number
- CN202410520918.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-28
- Publication Date
- 2024-08-23
AI Technical Summary
Existing technology is difficult to efficiently process large amounts of data, especially in industrial vision scenarios. The traditional enqueuing and dequeuing methods are inefficient and cannot meet the needs of large data volumes.
By directly copying the target data to the memory address of the cache queue, data serialization and enqueueing are achieved, avoiding the additional steps of using a serialization protocol or library, improving the efficiency of data enqueuing, and avoiding race conditions through the mutex lock mechanism. inconsistent with the data.
It significantly improves the efficiency of data entering and exiting the queue, reduces the number of data copies, and ensures the efficiency and consistency of data processing.
Smart Images

Figure CN118535122A
Abstract
Description
Technical Field
[0001] The present application belongs to the field of data processing technology, and in particular, relates to a data processing method and device. Background Art
[0002] Some of the data used in industrial vision scenes are large in size. For example, the original images collected by industrial cameras mostly range from tens of megabytes to hundreds of megabytes, which is a large amount of data.
[0003] In the related art, the traditional queueing and dequeuing methods are usually only applicable to small data volumes, and cannot achieve efficient processing of large data volumes. For example, using a serialization protocol or library, the data is serialized before the queueing operation is performed. Summary of the invention
[0004] The present application aims to solve at least one of the technical problems existing in the prior art. To this end, the present application proposes a data processing method and device, which directly copies the target data to the corresponding cache queue through the memory address of the cache queue. Compared with the prior art that uses a serialization protocol or library to serialize the data and then perform a queue operation, the present application realizes data serialization and queueing through a copy operation, thereby improving the efficiency of data queueing.
[0005] In a first aspect, the present application provides a data processing method, the method comprising:
[0006] Determine, according to the type of the target data, at least one cache queue for storing the target data, wherein the target data includes one or more data corresponding to at least one type, and the one or more data of the same type are stored in the same cache queue;
[0007] According to the memory address pointing to each cache queue, one or more data corresponding to the at least one type are sequentially copied to the corresponding cache queue.
[0008] According to the data processing method of the present application, the target data is directly copied to the corresponding cache queue through the memory address of the cache queue. Compared with the prior art of using a serialization protocol or library to serialize the data before enqueuing, the present application implements data serialization and enqueuing through a copy operation, thereby improving the efficiency of data enqueuing.
[0009] According to an embodiment of the present application, the step of sequentially copying one or more data corresponding to the at least one type to the corresponding cache queues according to the memory address pointing to each cache queue includes:
[0010] For each cache queue, each cache queue includes one or more cache spaces, and the number of data stored in each cache space is determined according to the number of bytes that can be stored in the cache space and the number of bytes occupied by each data:
[0011] Obtaining a first target address for storing one or more data corresponding to the same type in the cache queue, wherein the first target address is determined according to a first address and an offset, wherein the first address points to a first cache space in the cache queue for storing the first data of the same type, and the offset is determined according to the number of cache spaces occupied by the data written in the cache queue;
[0012] According to the first target address, the one or more data of the same type are sequentially copied to the cache queue.
[0013] According to an embodiment of the present application, after sequentially copying one or more data corresponding to the at least one type to the corresponding cache queue according to the memory address pointing to each cache queue, the method further includes:
[0014] For each cache queue, one or more data of the same type stored in the cache queue are copied to a preset memory space.
[0015] According to an embodiment of the present application, after sequentially copying one or more data corresponding to the at least one type to the corresponding cache queue according to the memory address pointing to each cache queue, the method further includes:
[0016] For each cache queue:
[0017] Respectively obtain pointer addresses of one or more data of the same type stored in the cache queue;
[0018] One or more data of the same type stored in the cache queue are obtained according to the pointer address.
[0019] According to the data processing method of the present application, the data stored in the cache queue can be operated without copying the data by assigning a pointer address, thereby reducing one data copy and improving the efficiency of data dequeueing.
[0020] According to an embodiment of the present application, after sequentially copying one or more data corresponding to the at least one type to the corresponding cache queue according to the memory address pointing to each cache queue, the method further includes:
[0021] For each cache queue:
[0022] According to the first address and the number of bytes that can be stored in each cache space, obtain a second target address of the data of the target batch number in the cache queue, wherein each data corresponds to a batch number, and the second target address includes a first address and a second address, the first address points to a first cache space for storing the data of the target batch number, and the second address points to a last cache space for storing the data of the target batch number;
[0023] According to the second target address, data of the target batch number is obtained.
[0024] According to one embodiment of the present application, the cache queue is configured with a mutual exclusion lock mechanism.
[0025] According to the data processing method of the present application, through the configured mutual exclusion lock mechanism, it can be ensured that only one process can modify the data at any time, thereby avoiding the problems of competition conditions and data inconsistency.
[0026] In a second aspect, the present application provides a data processing device, the device comprising:
[0027] An acquisition module, configured to determine, according to a type of target data, at least one cache queue for storing the target data, wherein the target data includes one or more data corresponding to at least one type, and the one or more data of the same type are stored in the same cache queue;
[0028] The storage module is used to sequentially copy one or more data corresponding to the at least one type to the corresponding cache queue according to the memory address pointing to each cache queue.
[0029] According to the data processing device of the present application, the target data is directly copied to the corresponding cache queue through the memory address of the cache queue. Compared with the prior art of using a serialization protocol or library to serialize the data before enqueuing, the present application implements data serialization and enqueuing through a copy operation, thereby improving the efficiency of data enqueuing.
[0030] In a third aspect, the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the data processing method as described in the first aspect above is implemented.
[0031] In a fourth aspect, the present application provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the data processing method as described in the first aspect above.
[0032] In a fifth aspect, the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the data processing method as described in the first aspect.
[0033] In a sixth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the data processing method as described in the first aspect above.
[0034] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0036] Figure 1 It is a flowchart of a data processing method provided in an embodiment of the present application;
[0037] Figure 2 It is a schematic diagram of the structure of the cache queue provided in an embodiment of the present application;
[0038] Figure 3 It is a schematic diagram of the process of data enqueueing provided by an embodiment of the present application;
[0039] Figure 4 It is a schematic diagram of the process of dequeuing data provided by an embodiment of the present application;
[0040] Figure 5 is a structural schematic diagram of a data processing device provided in an embodiment of the present application;
[0041] Figure 6 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0042] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0043] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0044] The data processing method, data processing device, electronic device and readable storage medium provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.
[0045] The data processing method may be applied to a terminal, and may be specifically executed by hardware or software in the terminal.
[0046] The terminal includes, but is not limited to, a portable communication device such as a mobile phone or tablet computer with a touch-sensitive surface (e.g., a touch screen display and / or a touch pad). It should also be understood that in some embodiments, the terminal may not be a portable communication device, but a desktop computer with a touch-sensitive surface (e.g., a touch screen display and / or a touch pad).
[0047] In the following various embodiments, a terminal including a display and a touch-sensitive surface is described. However, it should be understood that the terminal may include one or more other physical user interface devices such as a physical keyboard, a mouse and a joystick.
[0048] The data processing method provided in the embodiments of the present application may be executed by an electronic device or a functional module or functional entity in the electronic device that can implement the data processing method. The electronic devices mentioned in the embodiments of the present application include but are not limited to mobile phones, tablet computers, computers, cameras, and wearable devices. The data processing method provided in the embodiments of the present application is described below using an electronic device as an example of an execution subject.
[0049] like Figure 1 As shown, the data processing method includes: step 110 and step 120.
[0050] Step 110: Determine at least one cache queue for storing the target data according to the type of the target data, wherein the target data includes one or more data corresponding to at least one type, and the one or more data of the same type are stored in the same cache queue.
[0051] It can be understood that the target data can be some data used in industrial vision scenes, which may include image type data, variable rectangle type data and variable rectangle caliper type data, etc. The image type data is image data collected by an industrial camera, the variable rectangle type data is the detection target or region of interest (ROI) in the image data represented and described by a variable rectangle, and the variable rectangle caliper type data is the size, distance and angle of the target in the image data measured by a variable rectangle caliper.
[0052] In an example, the image type data is defined as VLImage, the variable rectangle data type is defined as TOOLFOUNDATIONKIT_API_VLVariableRect, and the variable rectangle caliper data type is defined as TOOLFOUNDATIONKIT_API_VLVarRectcaliper. The corresponding data structures are as follows:
[0053]
[0054]
[0055] Specifically, each image type data may include width, height, frame number, trigger number, image data and pixel type; each variable rectangle type data may include center point, width, height, rotation angle and shear angle; each variable rectangle caliper type data may include origin, width, height, rotation angle and bending angle.
[0056] It is understandable that the cache queue can be a conventional queue, and each cache queue can be used to store one or more data of the same type. According to different data types, a cache queue corresponding to one or more data of each type can be determined.
[0057] Step 120 : According to the memory address pointing to each cache queue, one or more data corresponding to the at least one type are sequentially copied to the corresponding cache queue.
[0058] like Figure 2 As shown, the cache queue is located in the data center (DataCenter), and different cache queues have different memory addresses (headers).
[0059] According to the different memory addresses pointing to each cache queue, the cache queue corresponding to one or more data of various types is determined, and the data are copied to the corresponding cache queue in sequence according to the order defined in the data structure.
[0060] In one example, for image type data, they are copied to the memory address pointing to the cache queue storing the image type data in the order of width, height, frame number, trigger number, image data and pixel type.
[0061] According to the data processing method provided in the embodiment of the present application, the target data is directly copied to the corresponding cache queue through the memory address of the cache queue. Compared with the prior art that uses a serialization protocol or library to serialize the data and then perform a queue operation, the present application realizes data serialization and queueing through a copy operation, thereby improving the efficiency of data queueing.
[0062] In some embodiments, step 120, sequentially copying one or more data corresponding to the at least one type to the corresponding cache queue according to the memory address pointing to each cache queue, may specifically include:
[0063] For each cache queue, each cache queue includes one or more cache spaces, and the number of data stored in each cache space is determined according to the number of bytes that can be stored in the cache space and the number of bytes occupied by each data:
[0064] Obtaining a first target address for storing one or more data corresponding to the same type in the cache queue, wherein the first target address is determined according to a first address and an offset, wherein the first address points to a first cache space in the cache queue for storing the first data of the same type, and the offset is determined according to the number of cache spaces occupied by the data written in the cache queue;
[0065] According to the first target address, the one or more data of the same type are sequentially copied to the cache queue.
[0066] like Figure 2 As shown, for each cache queue: each cache queue includes one or more cache spaces "data", and the cache spaces in each cache queue are used to store data of the same type. The number of data that can be stored in each cache space is determined by the number of bytes that can be stored in the cache space and the number of bytes occupied by data of this type. For example, as defined above, for the image type data, the width and height in the image type data are both int types, then they each occupy 4 bytes. If the number of bytes that can be stored in the cache space in the cache queue is 1, then the width and height of the image type data are stored in the cache queue, and each needs to occupy 4 cache spaces. If the number of bytes that can be stored in the cache space is also 4, then the width and height of the image type data are stored in the cache queue, and each needs only one cache space.
[0067] After obtaining the memory address "header" of the cache queue corresponding to one or more data of each type, the first target address is determined according to the first address and offset of the first cache space pointing to the cache queue for storing the first data of the same type, and the first target address of the cache queue for storing one or more data of the same type is determined according to the first address and the offset. The offset can be determined according to the number of cache spaces "data" occupied by the data written in the cache queue.
[0068] According to the obtained first target address storing one or more data of the same type, the one or more data of the same type are sequentially copied to the cache queue.
[0069] The cache queue structure in this application is as follows:
[0070]
[0071]
[0072] Shared memory queues are information maintained by multi-process communication, and are used to share queue information between multiple processes. You can quickly know which queues are currently in use and their specific information.
[0073] Queue name: Queues are classified by queue type, and multiple queues with different names will be generated according to different data. When dequeuing, you can directly use the queue name to perform queue operations.
[0074] In one example, for a data in VLImage, the first address points to the first cache space in the cache queue for storing the "width" in the image type data. When the cache queue writes data for the first time, the offset is 0. After obtaining the first target address for storing the "width" in the cache queue according to the first address and the offset, it is stored in the corresponding cache space. After it is stored in the cache space, the offset pointing to the cache queue for storing the next stored "height" can be determined according to the number of cache spaces it occupies. If the "width" occupies 2 cache spaces, the offset is 2, and the first cache space pointing to the cache queue for storing the "width" in the image type data plus 2 is the first target address pointing to the cache queue for storing the "height" in the image type data. The calculation method of the first target address for storing the frame number, trigger number, image data and pixel type in the cache queue for storing the image type data is similar to the calculation method of the first target address for storing the height in the image type data, and this application will not repeat it.
[0075] The serialized copy code is implemented as follows:
[0076]
[0077]
[0078] Through the above code, each member of the VLImage object (ie, width, height, frame number, trigger number, image data and pixel type) is copied to the specified first target address in a certain order.
[0079] The efficiency of data enqueueing through the above serialization copy operation is several times faster than the serialization efficiency of related technologies such as protobuf serialization and deserialization.
[0080] It should be noted that the members defined in different types of data can be the same or different, and the number of bytes occupied by each member can be freely set, and this application does not make specific limitations on this.
[0081] After the data is queued, the value of the queue tail "end" in the cache queue will be modified accordingly. Some code examples are as follows:
[0082]
[0083] The above code inserts the data into the cache queue and updates the value of the queue tail address "end" of the cache queue.
[0084] In some embodiments, after step 120, according to the memory address pointing to each cache queue, sequentially copying one or more data corresponding to the at least one type to the corresponding cache queue, the method may further include:
[0085] For each cache queue, one or more data of the same type stored in the cache queue are copied to a preset memory space.
[0086] It is understandable that after the data is copied to the corresponding cache queue, the data in the cache queue can be copied to the preset memory space in the following manner.
[0087] Specifically, obtain the memory address of the cache queue that stores one or more data of a certain type, that is, Figure 2 The address of the "header" in the cache queue is obtained; the first address of the cache queue is obtained; and one or more data of the type stored in the cache queue are sequentially copied to the preset memory space through a deserialization operation similar to the above-mentioned serialization copy operation.
[0088] It should be noted that, after the data in the cache queue is copied to the preset memory space, the queue head (ie, the first address, “front”) of the cache queue will be offset.
[0089] Some code examples are as follows:
[0090]
[0091] The above code is used to retrieve data from the cache queue and update the value of the first address of the cache queue.
[0092] In some embodiments, after step 120, according to the memory address pointing to each cache queue, sequentially copying one or more data corresponding to the at least one type to the corresponding cache queue, the method may further include:
[0093] For each cache queue:
[0094] Respectively obtain pointer addresses of one or more data of the same type stored in the cache queue;
[0095] One or more data of the same type stored in the cache queue are obtained according to the pointer address.
[0096] It is understandable that, for each cache queue, one or more data of the same type stored in the cache queue can be obtained by respectively acquiring pointer addresses of the one or more data of the same type stored in the cache queue.
[0097] One or more data of the same type stored in the cache queue are obtained by means of pointer address amplitude. Specifically, the pointer address is directly assigned to a formal parameter, such as a formal parameter "image" defined by image type data.
[0098] Some code examples are as follows:
[0099] std::uint8_t*p=reinterpret_cast<std::uint8_t*> (head+1);
[0100] p+=head->end;
[0101] return(this->*_umPushPtr[data.type()])(data,p);
[0102] According to the data processing method provided in the embodiment of the present application, the data stored in the cache queue can be operated without copying the data by assigning pointer addresses, thereby reducing one data copy and improving the efficiency of data dequeueing.
[0103] In some embodiments, after step 120, according to the memory address pointing to each cache queue, sequentially copying one or more data corresponding to the at least one type to the corresponding cache queue, the method may further include:
[0104] For each cache queue:
[0105] According to the first address and the number of bytes that can be stored in each cache space, obtain a second target address of the data of the target batch number in the cache queue, wherein each data corresponds to a batch number, and the second target address includes a first address and a second address, the first address points to a first cache space for storing the data of the target batch number, and the second address points to a last cache space for storing the data of the target batch number;
[0106] According to the second target address, data of the target batch number is obtained.
[0107] Optionally, for each cache queue, data of a specified target batch number may also be obtained from the cache queue, specifically:
[0108] Get the memory address where a certain type of cache queue is stored.
[0109] Get the first address of the cache queue.
[0110] Based on the obtained first address of the cache queue and the number of bytes that can be stored in each cache space in the cache queue, the second target address of the data of the target batch number pointed to in the cache queue is obtained, wherein after the data is entered into the queue, a corresponding batch number will be generated for each data stored in the cache queue, and the second target address includes a first address corresponding to the first cache space pointing to the data storing the target batch number and a second address pointing to the last cache space storing the data of the target batch number.
[0111] Through the dataEmpty flag in DataHead, determine whether the data of the target batch number has been dequeued by the specified batch. If the data does not exist, return that there is no data to be read. If the data is readable, proceed to the next step.
[0112] In an example, a cache queue can store 10 data of a certain type, and the number of bytes occupied by each member of the data of this type is 4. The number of bytes that can be stored in each cache space in the cache queue is 2. Then, a total of 20 cache spaces are required to store the 10 data of this type in the cache queue. After the data is stored in the cache queue, corresponding batch numbers 001 to 010 are generated for each data. Assuming that the addresses of the cache spaces in the cache queue are 0001 to 0019, two cache spaces are required to store one data, that is, one batch of data. Therefore, the first address of the first cache space for storing data with target batch number 003 is 0001+(3-1)*2=0005, and the second address of the last cache space for storing data with target batch number 003 is 0006.
[0113] By using a deserialization copy method similar to the above serialization copy, the data of the second target address in the cache queue is copied to obtain the data of the target batch number.
[0114] It should be noted that after the data in the cache queue is copied, the dataEmpty flag in the DataHead will be modified synchronously, indicating that the data has been dequeued.
[0115] Some code examples are as follows:
[0116]
[0117] In some embodiments, the cache queue is configured with a mutual exclusion lock mechanism.
[0118] In the specific implementation, the cache queue in this application is also configured with a mutex lock mechanism. Through mutex lock, when multiple processes read and write the same data ( Figure 2 When the data is stored in "data" in the READ_READ_LOG_LOG file, it can ensure that only one process can modify the data at any time, thus avoiding race conditions and data inconsistency problems.
[0119] In some scenarios, such as Figure 3 As shown, before data is queued, first create / open the cache queue; configure a mutex for the cache queue; obtain the cache queue memory address; determine whether the cache queue is full. If not, queue the data according to the above serialized copy method. After the data is queued, the tail address of the cache queue is offset.
[0120] like Figure 4 As shown, when data is dequeued, the cache queue is opened; a mutex is configured for the cache queue; the memory address of the cache queue is obtained; it is determined whether the cache queue is empty, and if not, one or more data stored in the cache queue are copied to a preset memory space, and the first address of the cache queue is modified.
[0121] According to the data processing method provided in the embodiment of the present application, through the configured mutual exclusion lock mechanism, it can be ensured that only one process can modify the data at any time, thereby avoiding competition conditions and data inconsistency problems.
[0122] The data processing method provided in the embodiment of the present application can be executed by a data processing device. In the embodiment of the present application, the data processing device provided in the embodiment of the present application is described by taking the data processing method executed by the data processing device as an example.
[0123] An embodiment of the present application also provides a data processing device.
[0124] like Figure 5 As shown, the data processing device includes: an acquisition module 510 and a storage module 520.
[0125] An acquisition module 510 is used to determine, according to a type of target data, at least one cache queue for storing the target data, wherein the target data includes one or more data corresponding to at least one type, and one or more data of the same type are stored in the same cache queue;
[0126] The storage module 520 is used to sequentially copy one or more data corresponding to the at least one type to the corresponding cache queue according to the memory address pointing to each cache queue.
[0127] According to the data processing device provided in the embodiment of the present application, the target data is directly copied to the corresponding cache queue through the memory address of the cache queue. Compared with the prior art of using a serialization protocol or library to serialize the data and then perform a queue operation, the present application implements data serialization and queueing through a copy operation, thereby improving the efficiency of data queueing.
[0128] In some embodiments, the storage module 520 may also be used to:
[0129] For each cache queue, each cache queue includes one or more cache spaces, and the number of data stored in each cache space is determined according to the number of bytes that can be stored in the cache space and the number of bytes occupied by each data:
[0130] Obtaining a first target address for storing one or more data corresponding to the same type in the cache queue, wherein the first target address is determined according to a first address and an offset, wherein the first address points to a first cache space in the cache queue for storing the first data of the same type, and the offset is determined according to the number of cache spaces occupied by the data written in the cache queue;
[0131] According to the first target address, the one or more data of the same type are sequentially copied to the cache queue.
[0132] In some embodiments, the device may further include: a first processing module;
[0133] The first processing module is used to copy one or more data of the same type stored in each cache queue to a preset memory space.
[0134] In some embodiments, the device may further include: a second processing module;
[0135] The second processing module is used for each cache queue:
[0136] Respectively obtain pointer addresses of one or more data of the same type stored in the cache queue;
[0137] One or more data of the same type stored in the cache queue are obtained according to the pointer address.
[0138] According to the data processing device provided in the embodiment of the present application, the data stored in the cache queue can be operated without copying the data by assigning pointer addresses, thereby reducing one data copy and improving data dequeue efficiency.
[0139] In some embodiments, the device may further include: a third processing module;
[0140] The third processing module is used for each cache queue:
[0141] According to the first address and the number of bytes that can be stored in each cache space, obtain a second target address of the data of the target batch number in the cache queue, wherein each data corresponds to a batch number, and the second target address includes a first address and a second address, the first address points to a first cache space for storing the data of the target batch number, and the second address points to a last cache space for storing the data of the target batch number;
[0142] According to the second target address, data of the target batch number is obtained.
[0143] In some embodiments, the cache queue is configured with a mutual exclusion lock mechanism.
[0144] According to the data processing device provided in the embodiment of the present application, a mutex lock mechanism is configured to ensure that only one process can modify data at any time, thereby avoiding race conditions and data inconsistency problems.
[0145] The data processing device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0146] The data processing device in the embodiment of the present application may be a device having an operating system. The operating system may be a Microsoft (Windows) operating system, an Android (Android) operating system, an IOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0147] The data processing device provided in the embodiment of the present application can realize Figures 1 to 4 To avoid repetition, the various processes implemented by the method embodiment are not described here.
[0148] In some embodiments, Figure 6 As shown, an embodiment of the present application also provides an electronic device 600, including a processor 601, a memory 602, and a computer program stored in the memory 602 and executable on the processor 601. When the program is executed by the processor 601, each process of the above-mentioned data processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0149] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0150] An embodiment of the present application also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned data processing method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0151] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0152] An embodiment of the present application also provides a computer program product, including a computer program, which implements the above-mentioned data processing method when executed by a processor.
[0153] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0154] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned data processing method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0155] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0156] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0157] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0158] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
[0159] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0160] Although the embodiments of the present application have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present application, and that the scope of the present application is defined by the claims and their equivalents.
Claims
1. A data processing method, characterized in that: include: Determine, according to the type of the target data, at least one cache queue for storing the target data, wherein the target data includes one or more data corresponding to at least one type, and the one or more data of the same type are stored in the same cache queue; According to the memory address pointing to each cache queue, one or more data corresponding to the at least one type are sequentially copied to the corresponding cache queue.
2. The data processing method according to claim 1, characterized in that: The step of sequentially copying one or more data corresponding to the at least one type to the corresponding cache queues according to the memory address pointing to each cache queue includes: For each cache queue, each cache queue includes one or more cache spaces, and the number of data stored in each cache space is determined according to the number of bytes that can be stored in the cache space and the number of bytes occupied by each data: Obtaining a first target address for storing one or more data corresponding to the same type in the cache queue, wherein the first target address is determined according to a first address and an offset, wherein the first address points to a first cache space in the cache queue for storing the first data of the same type, and the offset is determined according to the number of cache spaces occupied by the data written in the cache queue; According to the first target address, the one or more data of the same type are sequentially copied to the cache queue.
3. The data processing method according to claim 2, characterized in that: After sequentially copying the one or more data corresponding to the at least one type to the corresponding cache queues according to the memory address pointing to each cache queue, the method further includes: For each cache queue, one or more data of the same type stored in the cache queue are copied to a preset memory space.
4. The data processing method according to claim 2, characterized in that: After sequentially copying the one or more data corresponding to the at least one type to the corresponding cache queues according to the memory address pointing to each cache queue, the method further includes: For each cache queue: Respectively obtain pointer addresses of one or more data of the same type stored in the cache queue; One or more data of the same type stored in the cache queue are obtained according to the pointer address.
5. The data processing method according to claim 2, characterized in that: After sequentially copying the one or more data corresponding to the at least one type to the corresponding cache queues according to the memory address pointing to each cache queue, the method further includes: For each cache queue: According to the first address and the number of bytes that can be stored in each cache space, obtain a second target address of the data of the target batch number in the cache queue, wherein each data corresponds to a batch number, and the second target address includes a first address and a second address, the first address points to a first cache space for storing the data of the target batch number, and the second address points to a last cache space for storing the data of the target batch number; According to the second target address, data of the target batch number is obtained.
6. The data processing method according to any one of claims 1 to 5, characterized in that: The cache queue is configured with a mutual exclusion lock mechanism.
7. A data processing device, characterized in that: include: An acquisition module, configured to determine, according to a type of target data, at least one cache queue for storing the target data, wherein the target data includes one or more data corresponding to at least one type, and the one or more data of the same type are stored in the same cache queue; The storage module is used to sequentially copy one or more data corresponding to the at least one type to the corresponding cache queue according to the memory address pointing to each cache queue.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the data processing method according to any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the data processing method according to any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the data processing method according to any one of claims 1 to 6 is implemented.
