A protocol-based process big data memory sharing method and system

By allocating two shared memory areas in process A and process B and introducing an operation queue and a judgment module, the system instability and data loss caused by large data exchange between processes are solved, and fast and accurate data sharing and memory space stability are achieved.

CN114528124BActive Publication Date: 2024-09-03FUJIAN TQ ONLINE INTERACTIVE INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210144850.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-17
Publication Date
2024-09-03
Estimated Expiration
2042-02-17

AI Technical Summary

Technical Problem

Existing inter-process communication methods are prone to system instability when exchanging large amounts of data, especially shared memory methods, which may cause system crashes when the data exceeds 2GB. Furthermore, asynchronous message processing cannot guarantee data integrity, and synchronous messages may cause the sending process to freeze.

Method used

A protocol-based process big data memory sharing method is adopted. Two shared memory areas are opened in process A and process B, which are used for reading and writing instructions and data respectively. An operation queue and a judgment module are introduced to realize the segmented and task-based processing of data between processes. The shared memory area mapping technology and synchronization mechanism are used to ensure data synchronization and accuracy.

Benefits of technology

It enables fast and accurate sharing of big data between processes, reduces operational error rates, saves time, ensures the stability of memory space and data consistency, and avoids system crashes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114528124B
    Figure CN114528124B
Patent Text Reader

Abstract

The present invention provides a process big data memory sharing method based on a protocol, and the method comprises the following steps: step S1, making process A communicate with process B, opening two shared memory areas in process A and process B for reading and writing instructions and data; step S2, process B receives an instruction thread operation and waits for process A to send an instruction; step S3, process A sends an instruction thread operation instruction to enter an operation queue; step S4, process B receives the operation type of the instruction sent by process A, and judges the type of the instruction; step S5, process B performs an operation on the instruction sent by process A, and judges whether the instruction is an interrupt instruction operation, and if yes, returns to step S2, otherwise, performs the instruction operation; step S6, after the operation of process B is completed, sends a completion instruction to the operation process A; the present invention can realize the classification of instruction types according to the big data between processes that users need to interact, and completes the processing of data occupying memory space in segments and tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a protocol-based process big data memory sharing method and system. Background Art

[0002] There are many ways to communicate between processes. Commonly used methods include shared memory, named pipes and anonymous pipes, and sending messages. In addition, data communication between processes can be indirectly achieved through sockets, configuration files, and registry. Each of the above methods has its own advantages and disadvantages. When it comes to the problem of fast exchange of large amounts of data between processes, the use of configuration files and registry methods can be ruled out. In addition, since the use of pipes and sockets requires the support of a network card, they can also be ignored. In this way, the only two communication methods available are shared memory and sending messages. It is also not appropriate to use the method of sending messages to achieve frequent and fast data exchange when the amount of exchanged data is large (because there are two methods of sending messages: synchronous messaging and asynchronous messaging. Synchronous messaging means that the receiving process will return the result to the sending process only after processing the received message. The sending process can proceed to the next step based on the communication result returned between processes. However, the disadvantage is that it is easy to cause the sending process to get stuck and cannot be further processed before the message is returned. Asynchronous message processing means that the sending process sends the message and does not wait for the result to be returned, and then proceeds to the next message processing, but the execution result of the message cannot be obtained, and the correctness of the result cannot be guaranteed. When data transmission is too frequent, it may lead to data loss.

[0003] Compared with the above inter-process communication methods, shared memory has obvious advantages. Shared memory is implemented by directly operating memory-mapped files, and memory-mapped files are the lowest-level mechanism for single-machine data sharing. The previous data exchange methods are all implemented through memory-mapped files at the low level. Therefore, using shared memory can achieve higher performance with less overhead, and is the best solution for fast exchange of large amounts of data. Moreover, if the memory data that needs to be shared between processes is too large, such as more than 2G, it is easy to cause system instability. Usually, the operating system has a memory size limit for applications. For example, the maximum memory that a process in a 32-bit system can handle is 4G. 64-bit operating systems will have more, and usually a process with more than 3G memory is also prone to instability and system crashes. The disadvantage is the problem of shared memory, which can be solved by a good system process. Summary of the invention

[0004] To overcome the above problems, the purpose of the present invention is to provide a method that can classify instruction types according to the big data between processes that users need to interact with, and perform data segmentation and task processing on the part of the data of a certain instruction that particularly occupies memory space.

[0005] The present invention is implemented by the following scheme: a protocol-based process big data memory sharing method, the method comprising the following steps:

[0006] Step S1, making process A communicate with process B, opening two shared memory areas in process A and process B for reading and writing instructions and data;

[0007] Step S2, process B receives the instruction thread operation and waits for process A to send the instruction;

[0008] Step S3, process A sends the instruction thread operation instruction to enter the operation queue;

[0009] Step S4: Process B receives the operation type of the instruction sent by process A and determines the type of the instruction;

[0010] Step S5, process B executes an operation for the instruction sent by process A, and determines whether the instruction is an interrupt instruction operation. If yes, it returns to step S2, otherwise, it executes the instruction operation;

[0011] Step S6: After the operation of process B is completed, a completion instruction is sent to the operating process A, so that the big data between processes that the user needs to interact with can be divided into instruction types, and the data occupying the memory space can be processed in segments and tasks.

[0012] Furthermore, the step S1 is further specified as follows: realizing the communication between process A and process B through a shared memory area, opening up two shared memory areas in process A and process B, in one shared memory area process A can only write data and process B can only read data, and in the other shared memory area process A can only read data and process B can only write data.

[0013] Furthermore, the step S3 is further specified as follows: the operation queue is a specific number of instructions for operating the instruction thread sent by process A.

[0014] The present invention also provides a process big data memory sharing system based on a protocol, comprising a communication module, a receiving module, a sending module, a judging module, an executing module and a completing module, wherein the communication module, even if process A and process B communicate, opens two shared memory areas in process A and process B for reading and writing instructions and data; the receiving module, namely, process B receives an instruction thread operation and waits for process A to send an instruction; the sending module, namely, process A sends an instruction thread operation instruction to enter an operation queue; the judging module, namely, process B receives the operation type of the instruction sent by process A and judges the type of the instruction; the executing module, namely, process B performs an operation on the instruction sent by process A and judges whether the instruction is an interrupt instruction operation, if yes, returns to step S2, otherwise, executes the instruction operation; the completing module, namely, after the operation of process B is completed, sends a completion instruction to the operating process A, thereby realizing the classification of instruction types according to the big data between processes that users need to interact with, and completing the processing of data occupying memory space in segments and tasks.

[0015] Furthermore, the communication module is further specified as follows: realizing the communication between process A and process B through a shared memory area, opening up two shared memory areas in process A and process B, in one shared memory area process A can only write data and process B can only read data, and in the other shared memory area process A can only read data and process B can only write data.

[0016] Furthermore, the sending module is further specified as follows: the operation queue is a specific number of instructions for operating the instruction thread sent by process A.

[0017] The beneficial effects of the present invention are as follows: the present invention can classify instruction types according to the big data between processes that users need to interact with, and perform data segmentation and task processing on the part of the data of a certain instruction that particularly occupies memory space; due to the use of shared memory area mapping technology and the addition of the synchronous system of shared memory area mapping technology, the two processes can share content quickly and accurately, reducing the same operations of users, saving time, and the error rate problem caused by two operations; it ensures that a piece of data is modified once, and the two places where it is used maintain the current unified synchronization information. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 It is a schematic flow chart of the method of the present invention.

[0019] Figure 2 It is a system principle block diagram of the present invention. DETAILED DESCRIPTION

[0020] The present invention will be further described below in conjunction with the accompanying drawings.

[0021] See also Figure 1As shown, a protocol-based process big data memory sharing method of the present invention comprises the following steps:

[0022] Step S1, making process A communicate with process B, opening two shared memory areas in process A and process B for reading and writing instructions and data;

[0023] Step S2, process B receives the instruction thread operation and waits for process A to send the instruction;

[0024] Step S3, process A sends the instruction thread operation instruction to enter the operation queue;

[0025] Step S4: Process B receives the operation type of the instruction sent by process A and determines the type of the instruction;

[0026] Step S5, process B executes an operation for the instruction sent by process A, and determines whether the instruction is an interrupt instruction operation. If yes, it returns to step S2, otherwise, it executes the instruction operation;

[0027] Step S6: After the operation of process B is completed, a completion instruction is sent to the operating process A, so that the big data between processes that the user needs to interact with can be divided into instruction types, and the data occupying the memory space can be processed in segments and tasks.

[0028] The present invention will be further described below by a specific embodiment:

[0029] The present invention mainly comprises the following six steps:

[0030] 1. Process A and process B split two shared memory areas 1 and 2, which are used to read and write instructions and data respectively;

[0031] 2. Process B receives the instruction thread operation and waits for process A to send the instruction;

[0032] 3. Process A sends the instruction thread operation instruction to enter the operation queue;

[0033] If you select an object in process A and perform COPY+C, it means that you are going to copy the object and merge the current operations to be copied into one instruction and enter the operation queue. At this time, there is only one file in the operation queue. If you select multiple objects at the same time, there will be multiple instructions to be copied in the operation queue. The detailed copy instructions are as shown in step 14 of "V. Specific application scenario examples". Process B receives the operation type of the instruction sent by process A and determines the type of instruction;

[0034] In addition to copying, the command can also synchronize the size, direction, and rotation angle of the selected objects.

[0035] For example, define the program instruction structure:

[0036]

[0037]

[0038] If process A wants to copy an object (the corresponding file path is C:\\1.obj), the command sent is as follows:

[0039]

[0040] If you want to synchronize the position of the selected object (the corresponding file path is C:\\1.obj), send the following command:

[0041]

[0042] 5. Process B performs further operations on the instructions of process A, usually on data, or it may interrupt the current operation (in order to allow the operation to be interrupted at any time, a data instruction header is added to the data, and each instruction has it);

[0043] 6. If it is an interrupt instruction operation, continue to wait for the next instruction operation in step 2;

[0044] 7. After the operation of process B is completed, a completion instruction is sent to the operation process A;

[0045] 8. Process A receives the completion instruction sent by process B, indicating that one round of operation has been performed.

[0046] In actual applications, process A and process B refer to two game editors on the same computer. Users can open multiple editors of the same type (to edit two different game maps at the same time), because some of the same parts in the game can be synchronized through editor commands, saving users time in repeated operations. For example, multiple room settings used in a complex game, such as the first map, need to be slowly laid out, taking several days. In the new map, the same setting only needs to be operated with a command and synchronized to another map editor.

[0047] The following example illustrates how the present invention optimizes the operation of two game map editors:

[0048] Example: Open the map editor process A, set up shared memory zones 1 and 2, and write instructions to shared memory zone 1 (shared memory zone 1 process A is write-only, shared memory zone 2 process A is read-only).

[0049] Open the map editor as process B, read the instructions in shared memory zone 1, parse the instructions on the data header, and feed back to process A in shared memory zone 2, indicating that you agree with process A that I am ready to receive actual instructions and you can start sending actual instructions to be operated. (Process B sets shared memory zone 1 to read-only, and process B sets shared memory zone 2 to write-only).

[0050] 1. Then select 100 objects in process A. Assume that each object has 15 associated objects (the total number of objects to be operated is 100*15=1500 objects). Then press CTRL+C to copy. At this time, write the instruction to memory area 1 and write the overall situation of the task to the task queue (including what the current operation is (such as copy, delete), how many files there are in total).

[0051] 2. Press CTRL+V in process B. Process B indicates that it is ready to receive data and reads the data written by process A in memory area 1. After parsing the data header, it knows that the total task is to copy 1,500 objects. Then it feeds back the instruction of preparing to receive data to process A (by writing the instruction to memory area 2).

[0052] 3. After process A receives the instruction that process B can start, it starts to split the task, and calculates the number of subtasks, the number of subtasks, the task completion status, the file name, offset, data length, and the data that actually needs to be operated, and writes them into memory area 1.

[0053] 4. After receiving the task, process B starts to split the instruction header, analyze the current task, and operate the data according to the instruction. In this example, the instruction is to copy the file, which means the data is saved as a file available to process B.

[0054] 5. Repeat 3 and 4 until the total task is completed

[0055] 6. After the total task is completed, process B gives feedback to process A to indicate that the task has been completed

[0056] 7. After process A receives the completion instruction from process B, it removes the completed subtask from the task queue and starts the next task. If there is a next step operation, it starts from instruction 1.

[0057] 8. The task queue of process A has been cleared and this operation is completed.

[0058] In summary, the present invention provides a new protocol-based inter-process big data sharing method and system, which can classify the big data between processes that users need to interact with according to the instruction type, and perform data segmentation and task processing on the part of the data of a certain instruction that particularly occupies memory space. This can achieve, for example, the need to copy the objects in the currently selected map from a game map editor for overall copying. (Because each object is 3D and has many associated objects, textures, sound effects, and special effects, a very large memory will be required. If a large number of objects are copied at one time, it may directly cause a large amount of memory to be required between the two processes. First, it will cause the two processes to get stuck, and second, it will cause excessive memory usage, which may cause the program to crash).

[0059] See also Figure 2 As shown, the present invention also provides a protocol-based process big data memory sharing system, including a communication module, a receiving module, a sending module, a judgment module, an execution module and a completion module, wherein the communication module, even if process A and process B communicate, opens two shared memory areas in process A and process B for reading and writing instructions and data; the receiving module, that is, process B receives the instruction thread operation and waits for process A to send the instruction; the sending module, that is, process A sends the instruction thread operation instruction to enter the operation queue; the judgment module, that is, process B receives the operation type of the instruction sent by process A, and judges the type of the instruction; the execution module, that is, process B performs an operation on the instruction sent by process A, and judges whether the instruction is an interrupt instruction operation, if yes, returns to step S2, otherwise, executes the instruction operation; the completion module, that is, after the operation of process B is completed, sends the completion instruction to the operating process A, so that it can be realized that the big data between processes that users need to interact with can be divided into instruction types, and the data occupying the memory space can be processed in segments and tasks.

[0060] The communication module is further specified as follows: the communication between process A and process B is realized through a shared memory area, two shared memory areas are opened in process A and process B, in one shared memory area, process A can only write data and process B can only read data, and in the other shared memory area, process A can only read data and process B can only write data.

[0061] The sending module is further specifically: the operation queue is based on the instruction thread sent by process A to operate the specific instruction quantity.

[0062] The above description is only a preferred embodiment of the present invention. All equivalent changes and modifications made according to the scope of the patent application of the present invention should fall within the scope of the present invention.

Claims

1. A protocol-based process big data memory sharing method, characterized in that: The method comprises the following steps: Step S1, enabling process A and process B to communicate, opening two shared memory areas in process A and process B for reading and writing instructions and data; the step S1 is further specifically as follows: realizing communication between process A and process B through the shared memory area, opening two shared memory areas in process A and process B, in one shared memory area process A can only write data, process B can only read data, and in the other shared memory area process A can only read data, process B can only write data; Step S2, the receiving instruction thread of process B waits for process A to send an instruction; Step S3, the sending instruction thread of process A, the operation instruction enters the operation queue; Step S4: Process B receives the operation type of the instruction sent by process A and determines the type of the instruction; Step S5, process B executes an operation for the instruction sent by process A, and determines whether the instruction is an interrupt instruction operation. If yes, it returns to step S2, otherwise, it executes the instruction operation; Step S6: After the operation of process B is completed, a completion instruction is sent to the operation process A, so that the instruction type can be divided according to the big data between processes that the user needs to interact with, and the data occupying the memory space can be processed in segments and tasks; Among them, in step S3, process A writes instructions to shared memory area 1, and writes the overall situation of the task into the operation queue, starts to split the task, and writes the total number of subtasks, the current subtask, the task completion status, the file name of the current task, the offset, the data length, and the data that actually needs to be operated into shared memory area 1. After receiving the task, process B starts to split the instruction header, analyze the current task, and operate the data according to the instructions.

2. A protocol-based process big data memory sharing method according to claim 1, characterized in that: The step S3 is further specifically as follows: entering the operation queue is to enter the operation queue according to the specific number of instructions of the instruction thread operation sent by process A.

3. A protocol-based process big data memory sharing system, characterized by: It includes a communication module, a receiving module, a sending module, a judging module, an executing module and a completing module. The communication module enables process A and process B to communicate, and opens two shared memory areas in process A and process B for reading and writing instructions and data. The communication module is further specifically as follows: realizing communication between process A and process B through a shared memory area, opening two shared memory areas in process A and process B, in one shared memory area, process A can only write data, process B can only read data, and in another shared memory area, process A can only read data, process B can only write data; The receiving module, i.e., the receiving instruction thread of process B, operates to wait for process A to send instructions; the sending module, i.e., the sending instruction thread of process A, operates instructions into the operation queue; the judging module, i.e., the operation type of the instruction sent by process A received by process B, and judges the type of the instruction; the executing module, i.e., process B performs operations on the instruction sent by process A, and judges whether the instruction is an interrupt instruction operation, if yes, returns to step S2, if not, executes the instruction operation; the completing module, i.e., after the operation of process B is completed, sends a completion instruction to the operating process A, so as to realize the classification of instruction types according to the big data between processes that the user needs to interact, and complete the processing of the data occupying the memory space by segmentation and task; Among them, process A in the sending module writes instructions to shared memory area 1, and writes the overall situation of the task into the operation queue, starts to split the task, and writes the total number of subtasks, the current subtask, the task completion status, the file name of the current task, the offset, the data length, and the data that actually needs to be operated into shared memory area 1. After receiving the task, process B starts to split the instruction header, analyze the current task, and operate the data according to the instructions.

4. The protocol-based process big data memory sharing system according to claim 3, characterized in that: The sending module is further specifically configured to enter the operation queue by sending a specific number of instructions of the instruction thread of process A into the operation queue.