Memory data access method, device, computer equipment and storage medium

By responding to data processing requests in computer technology, using the relationship between data types and processes to directly access memory data, it solves the problem of low data access efficiency between different processes in traditional technology, and realizes the sharing and efficiency improvement of memory data.

CN111522673BActive Publication Date: 2024-10-29TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010338158.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-04-26
Publication Date
2024-10-29
Estimated Expiration
2040-04-26

AI Technical Summary

Technical Problem

Data access efficiency between different processes in traditional technology is low and requires serialization and deserialization, resulting in complex logical asynchronous processes, which increases development difficulty and CPU computing overhead.

Method used

By responding to the data processing request, the target data identifier and the data object to be operated are determined, and the association between the data type and the process is used to call the corresponding second process to find the target memory information from the object container and directly access the memory data required by the first process. , realize the sharing of memory data and avoid the traditional data transfer process.

Benefits of technology

It improves the efficiency of data access, simplifies the development method, changes from asynchronous programming to synchronous programming, reduces the CPU computing overhead of serialization and deserialization, reduces memory usage, and realizes memory data sharing among multiple processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111522673B_ABST
    Figure CN111522673B_ABST
Patent Text Reader

Abstract

The present application relates to a memory data access method, device, computer equipment and storage medium. The method includes: responding to a data processing request, determining a first process corresponding to the data processing request, a target data identifier of memory data required when running the first process, and a data object to be operated, determining a second process associated with the target data type according to the association between the data type and the process, and the target data type to which the target data identifier belongs, calling the second process, searching for target memory information corresponding to the target data identifier from an object container of the data object to be operated, and accessing the memory data required for the operation of the first process according to the target memory information. The method can improve the efficiency of memory data access.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a memory data access method, device, computer equipment and storage medium. Background Art

[0002] With the development of computer technology, a multi-process interactive data processing method has emerged. Take the gang gameplay in the game as an example. The gang gameplay is composed of many complex gameplays, including but not limited to: member management, tasks, wars, leagues, copies, planting, construction, etc. The larger the number of gang gameplays, the more data in the gang object, and the more complex the management of memory data. At the same time, other processes such as scene processes and combat processes need to use the data of the gang process during execution. In order to realize the data method between different processes, the data of each gang gameplay is usually managed in the gang object.

[0003] In traditional technology, for data access between different processes, the process that needs data generally sends a memory data acquisition request to the process that can provide data, and then processes the subsequent logic after receiving the data feedback from the process that provides the data. However, the processing method of requesting memory data and replying to memory data has low data acquisition efficiency. Summary of the invention

[0004] In view of this, it is necessary to provide a memory data access method, device, computer equipment and storage medium that can improve data acquisition efficiency in response to the above technical problems.

[0005] A method for accessing memory data, the method comprising:

[0006] In response to the data processing request, determine a first process corresponding to the data processing request, a target data identifier of memory data required when running the first process, and a data object to be operated;

[0007] Determine a second process associated with the target data type according to the association relationship between the data type and the process and the target data type to which the target data identifier belongs;

[0008] Calling the second process to search the target memory information corresponding to the target data identifier from the object container of the data object to be operated;

[0009] According to the target memory information, memory data required for the first process to run is accessed.

[0010] A memory data access device, the device comprising:

[0011] An operation response module, used to respond to a data processing request, determine a first process corresponding to the data processing request, a target data identifier of memory data required when running the first process, and a data object to be operated;

[0012] A second process determination module, configured to determine a second process associated with a target data type according to an association relationship between the data type and the process and a target data type to which the target data identifier belongs;

[0013] A memory information search module, used for calling the second process to search for target memory information corresponding to the target data identifier from the object container of the data object to be operated;

[0014] The memory data access module is used to access the memory data required for the first process to run according to the target memory information.

[0015] A computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0016] In response to the data processing request, determine a first process corresponding to the data processing request, a target data identifier of memory data required when running the first process, and a data object to be operated;

[0017] Determine a second process associated with the target data type according to the association relationship between the data type and the process and the target data type to which the target data identifier belongs;

[0018] Calling the second process to search the target memory information corresponding to the target data identifier from the object container of the data object to be operated;

[0019] According to the target memory information, memory data required for the first process to run is accessed.

[0020] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:

[0021] In response to the data processing request, determine a first process corresponding to the data processing request, a target data identifier of memory data required when running the first process, and a data object to be operated;

[0022] Determine a second process associated with the target data type according to the association relationship between the data type and the process and the target data type to which the target data identifier belongs;

[0023] Calling the second process to search the target memory information corresponding to the target data identifier from the object container of the data object to be operated;

[0024] According to the target memory information, memory data required for the first process to run is accessed.

[0025] The above-mentioned memory data access method, device, computer equipment and storage medium determine the first process corresponding to the operation, the target data identifier of the memory data required when running the first process, and the data object to be operated by responding to the terminal operation, and use the association between the data type to which the data identifier belongs and the process to determine the second process involved in the memory data required when the first process is running, and call the second process, and find the target memory information corresponding to the data object to be operated from the object container storing the memory information corresponding to the data identifier, and then call the target memory information to access the memory data required for the first process to run, and realize the sharing of memory data between different processes through memory information. Memory data sharing using memory information replaces the transmission of memory data between different processes, avoiding the complex operations of serialization and deserialization processing required for memory data transmission, thereby improving data access efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 An application environment diagram of a memory data access method in one embodiment;

[0027] Figure 2 A schematic diagram of a flow chart of a method for accessing memory data in one embodiment;

[0028] Figure 3 A schematic diagram of a flow chart of a memory data access method in another embodiment;

[0029] Figure 4 A schematic diagram of a flow chart of a method for accessing memory data in yet another embodiment;

[0030] Figure 5 A schematic diagram of a flow chart of a method for accessing memory data in another embodiment;

[0031] Figure 6 A schematic diagram of a flow chart of a method for accessing memory data in another embodiment;

[0032] Figure 7 A schematic diagram of a flow chart of a memory data access method in another embodiment;

[0033] Figure 8 A schematic diagram of a flow chart of a method for accessing memory data in yet another embodiment;

[0034] Fig. 9 A schematic diagram of a flow chart of a method for accessing memory data in another embodiment;

[0035] Fig.10 A schematic diagram of the association between an object container and a memory space in a memory data access method in an application example;

[0036] Fig.11 It is a timing diagram of the memory data access method in an application example;

[0037] Fig.12 is a structural block diagram of a memory data access device in one embodiment;

[0038] Fig.13 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0040] The memory data access method provided in this application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The server responds to the data processing request, determines the first process corresponding to the data processing request and the data object to be operated, determines the second process associated with the target data type according to the association relationship between the data type and the process, and the target data type of the memory data required when running the first process, calls the second process, searches the target memory information corresponding to the target data identifier from the object container of the data object to be operated, and accesses the memory data required for the first process to run according to the target memory information. Among them, the server 104 can be implemented by an independent server or a server cluster or distributed system composed of multiple servers, and can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network, content distribution network), and big data and artificial intelligence platforms. The terminal 102 can be a smart phone, a tablet computer, a laptop, a desktop computer, a smart speaker, a smart watch, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected by wired or wireless communication, and this application is not limited here.

[0041] In one embodiment, Figure 2 As shown, a memory data access method is provided, which is applied to Figure 1 The server in is taken as an example to illustrate, including the following steps 202 to 208.

[0042] Step 202, in response to the data processing request, determining a first process corresponding to the data processing request, a target data identifier of memory data required when running the first process, and a data object to be operated.

[0043] A data processing request is a data processing request that is triggered when a client operation is detected or the current data meets a preset condition, and the object to be operated is the data object involved in the data processing request. A data processing request can be a client call generated in response to a user operation and sent to the server, or it can be a server call for operation data or detection result generation after receiving the client's operation data or automatically detecting the current data conditions.

[0044] In the same server or the same server cluster, there are multiple data processing processes for processing different tasks, and different data processing requests are implemented by different processes. For example, the battle in the game is processed by the battle process, and the copy is processed by the copy process. It can be understood that the first process and the second process in the text are only used to distinguish different processes, and are not intended to limit the present application. In other embodiments, the first process and the second process can be interchangeable.

[0045] During the process running, it is necessary to obtain memory data as the supporting data for the process running. When the process processes different data processing requests, the memory data required is different. For example, if the memory data required by the replica process corresponding to a replica data processing request includes replica 1, then the memory data corresponding to replica 1 needs to be obtained, and replica 1 is the target data identifier of the memory data required when the process is running.

[0046] The object to be operated refers to the data object that participates in the data processing request. Taking the gang battle in the gang gameplay in the game as an example, the generation of the gang battle start request can be generated on the client by calling the user to actively trigger the operation, or it can be generated by the server when the client sends the user trigger information to the server. It can also be automatically generated by the system (server or client) by setting a scheduled task and detecting that the time information meets the timing conditions. When the server obtains the gang battle start request, it is necessary to determine the gang objects participating in the gang battle. In this scenario, the gang objects participating in the gang battle are the data objects to be operated. The battle process corresponding to the gang battle is the first process corresponding to the data processing request.

[0047] Step 204: Determine a second process associated with the target data type according to the association relationship between the data type and the process and the target data type to which the target data identifier belongs.

[0048] The association between the data type and the process may be a relationship pre-established based on the processing tasks of each process. The data identifier is used to distinguish different data in the same data type. For example, the replica data belongs to the data type, and replica 1, replica 2, ... replica M belong to different data identifiers in the replica data type.

[0049] Data type refers to the general term for data of the same type. Taking games as an example, different data types can correspond to different gameplays, such as member management, tasks, wars, leagues, dungeons, planting, buildings, etc., where each gameplay can include multiple data items, and each data item corresponds to a data identifier. For example, a task can include activity 1, activity 2...activity N (N is a natural number), and a dungeon can include dungeon 1, dungeon 2...dungeon M (M is a natural number), etc. Here, the N activities correspond to N different data identifiers.

[0050] There may be interdependencies between multiple processes. For example, the operation of process A depends on the data corresponding to process B. Before running, process A needs to obtain the corresponding data from process B. For example, the gang war process corresponding to the gang war (referred to as gang war) needs to obtain the object information of the members participating in the gang war. The member information is managed by the gang process, so the gang war process needs to obtain the gang object information from the gang process.

[0051] According to the pre-built association between data types and processes, and the target data type to which the target data identifier belongs, the process that the first process needs to rely on to obtain memory data can be determined. Specifically, there is a corresponding relationship between data types and processes. It should be noted that in the game scenario, the correspondence between gameplay and process does not mean a one-to-one correspondence. A process can be responsible for multiple data types, that is, multiple game play methods. For example, member management and buildings are managed by gang processes, and leagues, wars, copies, etc. related to combat are managed by combat processes. Each data type has a corresponding process. According to the data type to which the target data identifier belongs, and the corresponding relationship between the data type and the process, the second process corresponding to the data type to which the target data identifier belongs can be determined.

[0052] Step 206: call the second process to search the target memory information corresponding to the target data identifier from the object container of the data object to be operated.

[0053] During the running of a process, the dependency relationship of data between processes is called. After the dependent process is determined, it is also necessary to rely on the corresponding memory data in the process. Traditional technology generally uses data request to serialize the requested memory data and then obtain the requested data through deserialization. Among them, serialization in computer science data processing refers to the conversion of data structure or object state into byte stream for data storage or network transmission. Deserialization is the reverse process of serialization, which converts the byte stream into a data structure or object state, and is used to restore the stored or transmitted byte stream into a data structure or object.

[0054] In order to solve the problems of complex processing and logical asynchrony caused by direct transmission of memory data, a corresponding object container is configured for each data object. In the object container, each data identifier in each data type of the data object and the memory information of each data identifier in the memory space are stored. Different process pairs have management rights for different data. The memory data required by the first process corresponds to the second process, so it is necessary to call the second process to obtain the memory information of the memory data required by the first process.

[0055] In the same server or server cluster, multiple processes can communicate data. In an embodiment, the first process sends a data acquisition request to the second process to establish communication between the first process and the second process. After receiving the data acquisition request, the second process extracts the target data identifier and the data object to be operated carried in the data acquisition request by parsing, and then searches for the target memory information corresponding to the target data identifier from the object container of the data object to be operated according to its memory data management authority, and feeds back the target memory information to the first process. The first process calls the fedback target memory information, accesses the memory data corresponding to the running target memory information from the shared memory space, and the accessed data is the memory data required for the operation of the first process. Through the interaction between the first process and the second process, the processing content of each process is clarified, the interaction of memory information is realized, and the sharing of memory data is facilitated. Since only some data objects are involved in the data processing request, after determining the data object to be operated, it is also necessary to search for the target memory information corresponding to the target data identifier from the object container of the data object to be operated.

[0056] Step 208: Access memory data required for running the first process according to the target memory information.

[0057] Specifically, the target memory information may be fed back by the second process to the first process, and the first process accesses the memory data required for operation in the shared memory space storing the memory data according to the target memory information fed back by the second process. The content transmitted between processes is simplified from memory data to memory information, and the memory data is accessed through the shared memory.

[0058] The above-mentioned memory data access method determines the first process corresponding to the operation, the target data identifier of the memory data required when running the first process, and the data object to be operated by responding to the terminal operation, and uses the association between the data type to which the data identifier belongs and the process to determine the second process involved in the memory data required when the first process is running, and calls the second process, and searches for the target memory information corresponding to the data object to be operated from the object container storing the memory information corresponding to the data identifier, and then calls the target memory information to access the memory data required for the first process to run, and realizes the sharing of memory data between different processes through memory information. The memory data sharing of memory information replaces the transmission of memory data between different processes. Different gangs can directly obtain gang data without requesting data through asynchronous communication. The programming method of developers is changed from asynchronous programming to synchronous programming, which improves development efficiency and reduces the CPU computing overhead of asynchronous communication serialization and deserialization. The use of shared memory can also reduce memory usage. There is no need to allocate gang objects separately in multiple processes, and multiple processes can share the object container of gang objects.

[0059] In one embodiment, Figure 3 As shown, the target memory information includes target address offset data.

[0060] Calling the second process to search the target memory information corresponding to the target data identifier from the object container of the data object to be operated includes step 302.

[0061] Step 302: calling a second process to search for target address offset data corresponding to the target data identifier from the object container of the data object to be operated.

[0062] Accessing memory data required for running the first process according to the target memory information includes steps 304 to 308 .

[0063] Step 304, obtaining the first address of the memory block of the data object to be operated.

[0064] Step 306: Determine the target storage address of the memory data corresponding to the target data identifier according to the memory block head address and the target address offset data.

[0065] Step 308: access the target storage address to obtain the memory data required for the first process to run.

[0066] The address offset data refers to the address offset of the storage address of the memory data relative to the first address of the memory block. In each process, the first address of the memory block of each data object is pre-stored. In the object container of the data object, only the address offset data corresponding to each data identifier needs to be stored. According to the first address of the memory block and the address offset data, the target storage address of the memory data corresponding to the target data identifier is determined, so that the memory data required for the operation of the first process is obtained by accessing the target storage address. By using the data processing method of storing the first address of the memory block of the data object and the offset address separately, the storage data in the object container can be simplified and the memory occupation of the object container can be saved.

[0067] In one embodiment, Figure 4 As shown, before calling the second process and searching the target memory information corresponding to the target data identifier from the object container of the data object to be operated, steps 402 to 404 are also included.

[0068] Step 402, start the second process, and determine the memory information of the memory data according to the storage location of the memory data corresponding to the second process in the memory space.

[0069] Step 404: write the memory information into the object container of the data object.

[0070] During each startup of a process, the data in the object container corresponding to the data object will be rewritten according to its management authority over the memory data, and the data in the object container will be released when the process ends. The specific processing process is to obtain the memory information of the memory data of each data object and write it to the object container corresponding to the data object. Specifically, the memory information of the memory data is determined according to the storage address of the memory data in the memory space. The memory information is used to represent the storage address information of the memory data, which can be an address offset relative to a certain address.

[0071] After the first process sends a data acquisition request to the second process, it is necessary to first detect the startup status of the second process, which includes started and not started. If the startup status of the second process is started, the target memory information corresponding to the target data identifier can be directly found from the object container of the data object to be operated through the second process. If the startup status of the second process is not started, the second process needs to be started first. Specifically, the server can send a process startup instruction to the second process, the second process starts, updates the memory information, and then finds the target memory information corresponding to the target data identifier from the object container of the data object to be operated.

[0072] In other embodiments, the memory information in the memory container can also be saved, and the update of the memory information in the memory space can be detected. When there is an update of the memory information, for example, a new gameplay is added, the storage address occupation in the memory space will be updated, and the updated memory information will be updated to the corresponding memory container.

[0073] By judging the startup status of the second process, the memory data is written when the process starts, which ensures that the latest memory data is obtained each time the process starts. By releasing the memory information corresponding to the process in the object container after the process ends, the memory usage is reduced. Compared with the method of saving memory information for updating, the method of recalculating when the process starts does not require update detection. When the process is not started, the corresponding memory information does not need to occupy memory, and the calculation and processing of memory information when the process starts takes very little time. In actual environment, it can be started in less than 1 second.

[0074] In one embodiment, Figure 5 As shown, writing memory information into the object container of the data object includes steps 502 to 504.

[0075] Step 502: Determine the data identifier corresponding to the memory data according to the memory information.

[0076] Step 504: write the memory information and the corresponding data identifier into the object container of the data object in the form of a data combination.

[0077] When updating the information in each object container, it is necessary to ensure that the data identifier and the data memory have a corresponding relationship to reduce data errors. In the memory space, each specific memory address is pre-configured with corresponding storage content. By calling the memory information, the corresponding data identifier can be determined, and then the data identifier and memory information are stored in pairs in the corresponding object container.

[0078] By writing memory information and data identification in the object container when the process starts, the memory information and data identification can be effectively updated for application scenarios such as the increase of memory information or the update of memory layout, avoiding errors and omissions in memory information. For example, in a certain period of time, a new activity N is opened, and a process writes the data corresponding to activity Z to the memory space, but the current object container does not contain the memory data of activity Z before, so there is no memory information corresponding to activity Z. By updating the information when the process starts, the information in the object container is improved. It should be noted that the reading and writing of memory data can ensure the reading and writing security of data through locking processing. To ensure the reading and writing security of data, generally speaking, only the corresponding process can write data, and the other processes can read memory data according to the memory information shared by the process.

[0079] In one embodiment, the memory information includes address offset data. Figure 6 As shown, starting the second process and determining the memory information of the memory data according to the storage location of the memory data corresponding to the second process in the memory space includes steps 602 to 606.

[0080] Step 602, start the second process, and obtain the storage location of the memory data corresponding to the second process in the memory space.

[0081] Step 604: Obtain the storage address corresponding to the memory data according to the storage location.

[0082] Step 606, obtaining the first address of the memory block of the data object corresponding to the memory data, and determining the address offset data of the memory data according to the first address of the memory block of the data object and the storage address of the memory data.

[0083] Updating the memory identification to the object container of the data object includes steps 608 to 610.

[0084] Step 608: Determine the data identifier corresponding to the memory data according to the address offset data.

[0085] Step 610: Write the address offset data and the corresponding data identifier into the object container of the data object in the form of a data combination.

[0086] Calling the second process to search the target memory information corresponding to the target data identifier from the object container of the data object to be operated includes step 612.

[0087] Step 612: Call the second process to search the target address offset data corresponding to the target data identifier from the object container of the data object to be operated.

[0088] Accessing memory data required for running the first process according to the target memory information includes step 614 .

[0089] Step 614: access the memory data required for the first process to run according to the target address offset data.

[0090] In one of the embodiments, the memory information is displayed in the form of a memory number, and after determining the address offset data of the memory data, it also includes marking the address offset data as the memory number of the memory data.

[0091] The memory number refers to the address offset of the storage address of the memory data relative to a fixed address. The fixed address can be the first address of the memory block corresponding to each data object. For each memory data of the data object, the memory number of the memory data is obtained by calculating the address offset of the storage address of each memory data relative to the first address of the memory block.

[0092] The storage address of the memory data can be determined by calling the first address of the memory block corresponding to the data object and the storage position corresponding to each data identifier in the memory layout.

[0093] In one embodiment, Figure 7 As shown, before starting the second process and determining the memory information of the memory data according to the storage location of the memory data corresponding to the second process in the memory space, it also includes steps 702 to 708.

[0094] Step 702: Acquire data attribute information and data storage arrangement of the data object.

[0095] Step 704: Determine the memory size required for each data object based on the data attribute information.

[0096] Step 706: divide corresponding memory blocks for each data object according to the memory size required by each data object, and determine the first address of each memory block.

[0097] Step 708: store each data item of the data object to a corresponding storage location in the memory block according to the first address of the memory block and the data storage arrangement mode.

[0098] The storage of each data in the memory space is determined according to the data attribute information of the data object and the data storage arrangement. The memory space required for each data object is determined by the data attribute information of each data object, such as the data types contained in the data object, the number of data identifiers in the same data type, and the memory size of the data corresponding to the data identifier. For each data type, a memory size is reserved. For example, in the data attribute information of the data object, the number of data identifiers of the task data type is limited to 1000, and the tasks configured in the actual program cannot exceed 1000. In an embodiment, the allocated memory space for different data objects can be the same.

[0099] According to the memory size required by each data object, the corresponding memory block is divided for each data object, and the first address of each memory block is determined. The first address of the memory block and the data storage arrangement method are called to store the data of the data object to the corresponding storage position in the memory block. The first address information of the memory block corresponding to each data object is stored in each process, so that the memory number of each memory data of the data object can be calculated according to the first address information when the process is started.

[0100] In one embodiment, the data attribute information includes the data types contained in the data object, the number of data identifiers in the same data type, and the memory size of the data corresponding to the data identifier. The data storage arrangement includes the data type sorting method and the arrangement method of each data identifier in the same data type. Figure 8As shown, according to the first address of the memory block and the data storage arrangement mode, storing each data of the data object to the corresponding storage position in the memory block includes steps 802 to 806.

[0101] Step 802, determining the memory size required for each data type according to the data type sorting method, the number of data identifiers in the same data type, and the memory size of the data corresponding to the data identifiers.

[0102] Step 804, determining the memory head address of each data type according to the head address of the memory block and the memory size required for each data type.

[0103] Step 806, determining the storage address of the data corresponding to each data identifier according to the memory head address of each data type and the arrangement of each data identifier in the data type.

[0104] In the game, the entire memory is divided into different memory blocks according to the gameplay type, gameplay data size, and data quantity. Assume that the memory first address of a data object is start, and the data types of the data object include activities, tasks, and replicas, which are arranged in order in the memory. Specifically, it includes n task data, the task data is identified as task 1, task 2, ... task n (tasks 1 to n are arranged in order), and the size of each task data is N bytes; m activities, the activity data is identified as activity 1, activity 2, ... activity m, and the size of each activity data is M bytes; s replicas, the replica data is identified as replica 1, replica 2, ... replica s, and the size of each replica data is S bytes. For example, the storage address of activity 2 is start+n*N+M, and the memory number of activity 2 is calculated by calling the offset between the storage address and the memory first address. The memory number of activity 2 is start+n*N+M-start=n*N+M. Similarly, the storage address of the data corresponding to each data identifier can be calculated.

[0105] In one embodiment, Fig. 9 As shown, a memory data access method is provided, which specifically includes the following steps 902 to 934.

[0106] Step 902: Acquire data attribute information and data storage arrangement of the data object.

[0107] Step 904: Determine the memory size required for each data object based on the data attribute information.

[0108] Step 906: divide each data object into corresponding memory blocks according to the memory size required by each data object, and determine the first address of each memory block.

[0109] Step 908, determining the memory size required for each data type according to the data type sorting method, the number of data identifiers in the same data type, and the memory size of the data corresponding to the data identifiers.

[0110] Step 910, determining the memory head address of each data type according to the head address of the memory block and the memory size required for each data type.

[0111] Step 912, determining the storage address of the data corresponding to each data identifier according to the memory head address of each data type and the arrangement of each data identifier in the data type.

[0112] Step 914, start the second process, and obtain the storage location of the memory data corresponding to the second process in the memory block.

[0113] Step 916, calculating the storage address corresponding to the memory data according to the storage location.

[0114] Step 918, obtaining the first address of the memory block of the data object corresponding to the memory data, and determining the address offset data of the memory data according to the first address of the memory block of the data object and the storage address of the memory data.

[0115] Step 920, marking the address offset data as the memory number of the memory data.

[0116] Step 922, determining the data identifier corresponding to the memory data according to the memory number.

[0117] Step 924, write the memory number and the corresponding data identifier into the object container of the data object in the form of a data combination.

[0118] Step 926, in response to the data processing request, determining the first process corresponding to the data processing request, the target data identifier of the memory data required when running the first process, and the data object to be operated.

[0119] Step 928: Determine a second process associated with the target data type based on the association relationship between the data type and the process and the target data type to which the target data identifier belongs.

[0120] Step 930: Call the second process to search the target memory number corresponding to the target data identifier from the object container of the data object to be operated.

[0121] Step 932, obtain the first address of the memory block of the data object to be operated, and determine the target storage address of the memory data corresponding to the target data identifier according to the first address of the memory block and the target memory number.

[0122] Step 934, access the target storage address to obtain the memory data required for the first process to run.

[0123] The present application also provides an application scenario. Specifically, any application scenario involving complex memory data management can use the above method to access and manage memory. Large professional processing software such as photo shop, video editing software Adobe after effects, and integrated development software such as visual studio can use this method to optimize memory management. In the game scenario, MMO is the largest and is very suitable for using this method. Other applications such as large turn-based online games and shooting online games can also be used.

[0124] Taking the application of this method in a massively multiplayer online role-playing game as an example, the above-mentioned memory data access method is applied in this application scenario. Specifically, the application of the memory data access method in this application scenario is as follows:

[0125] Massive Multiplayer Online Role-Playing Game (MMORPG) is a type of online game, which is classified by the number of people in the electronic game. In all MMORPGs, players can play one or more virtual characters and control the activities and behaviors of the characters in the virtual world of the game.

[0126] In today's MMORPG game context, gang gameplay is a popular system consisting of many complex gameplays, including but not limited to: member management, tasks, wars, leagues, dungeons, planting, construction, etc. The larger the number of gang gameplays, the more data in the gang object, and the more complex the management of memory data; at the same time, other processes: such as scene processes, battle processes, etc., all need to use the data of the gang process, so data communication between various processes in the server is also an important development content.

[0127] In the prior art, the data objects of each gameplay of a gang are usually centralized in the gang object for management. This management method is simple to develop and is relatively simple and practical when the data type is small. However, as the number of gameplays increases, the disadvantages are also obvious: a single gang object takes up a lot of memory. When allocating memory for the gang object, it is necessary to allocate all the gameplay data objects together. In the actual game, gangs in different periods only need to open different gameplays, and do not need all the gameplay data, and the memory usage is not large. Therefore, this solution has the disadvantage of not being able to use memory reasonably.

[0128] Another solution in the prior art is to use pointers (pointers occupy 4 bytes of memory in 32-bit operating systems and 8 bytes of memory in 64-bit systems), and then the pointers point to another additional allocated heap space for storing actual gameplay data. This solution can reduce the memory usage of gang objects and solve the need to allocate different gameplay data to gangs in different periods. However, the use of pointers requires high memory management capabilities of developers. At the same time, as the number of gameplay increases and the logic becomes more and more complex, the storage address of the data is gradually randomly allocated. The use of pointers is prone to the risk of process downtime due to negligence of developers.

[0129] In addition, the asynchronous logic caused by the inter-process communication in the above two processing methods is difficult to develop and has the problem of code logic fragmentation. For example, if the battle process needs to start a gang battle, it needs to first request the gang data from the gang process, and then process the subsequent battle logic after receiving the gang data replied by the gang process. Such an asynchronous process is not very friendly to developers. Developers need to save the logical context before initiating the request in order to process the subsequent logic after receiving the gang process reply. Requesting and replying data at the same time requires serialization and deserialization of data, which consumes more CPU computing resources. Especially in MMORPG games, there are a large number of frequent data communications that need to be serialized and deserialized, and the computing resources consumption is particularly large.

[0130] In the application scenario of massively multiplayer online role-playing games, this method calls the memory access and management scheme of object containers and memory numbers, which can simultaneously solve the problem of large gang object memory usage and memory management problems caused by pointer operations in the prior art. Calling shared memory ensures that gang data can be shared between multiple processes, solving the problem of asynchronous logic fragmentation.

[0131] Specifically, an object container CONTAINER is allocated in the gang object. The object container stores the memory number SHM_ID of all the gameplay data of the gang object. The memory number is represented by a 64-bit integer. Different gameplay data can be located through different memory numbers. Fig.10 As shown, the object container only stores the identifiers and memory numbers of various gameplay data. The calculation process of the memory number is as follows:

[0132] First, register a data type for each type of gameplay data. The type is defined by the developer and does not conflict with other types. For example, register type 1 for task gameplay data and type 2 for activity gameplay data. Each task or activity has a different identifier, such as activity 1 or activity 2.

[0133] The entire memory is divided into different memory blocks according to the gameplay type, number of data identifiers, and size of gameplay data. Assume that the memory first address is start, and there are n task data, each of which is N bytes in size; m activities, each of which is M bytes in size; s copies, each of which is S bytes in size, and are arranged in order in the memory space. The memory number of activity 2 is calculated by the offset from the memory first address: start+n*N+M-start=n*N+M.

[0134] After calculating the memory number, save the data identifier and the memory number in the object container. In the future development process, you only need to use the data identifier to get the memory number from the object container, and you can get the actual gameplay data through the memory number. The memory number replaces the use of pointers to improve the fault tolerance of the code.

[0135] In addition, this method allocates the entire gang object mentioned above in shared memory, and through shared memory, it is accessed by different processes instead of being exclusive to a certain process. Therefore, different processes, such as combat processes and gang processes, can directly call memory numbers to obtain gang data without requesting memory data through asynchronous communication. The developer's programming method is changed from asynchronous programming to synchronous programming, which improves development efficiency; at the same time, it reduces the CPU computing overhead of asynchronous communication serialization and deserialization; the use of shared memory can also reduce memory usage, and there is no need to allocate gang objects in multiple processes. Multiple processes can share gang objects. When the gang process is started, the memory numbers of the corresponding memory data of the gang process are calculated and written into the corresponding object container. When the combat process needs to obtain the memory number, such as Fig.11 As shown, the gang process sends the memory number found in the object container to the combat process. After the combat process obtains the number, it can directly access the shared memory.

[0136] It should be understood that although Figure 2-9 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-9 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0137] In one embodiment, Fig.12As shown, a memory data access device 1200 is provided. The device can adopt a software module or a hardware module, or a combination of the two to become a part of a computer device. The device specifically includes: an operation response module 1202, a second process determination module 1204, a memory information search module 1206 and a memory data access module 1208, wherein:

[0138] The operation response module 1202 is used to respond to the data processing request, determine the first process corresponding to the data processing request, the target data identifier of the memory data required when running the first process, and the data object to be operated.

[0139] The second process determination module 1204 is used to determine the second process associated with the target data type according to the association relationship between the data type and the process and the target data type to which the target data identifier belongs.

[0140] The memory information search module 1206 is used to call the second process to search for the target memory information corresponding to the target data identifier from the object container of the data object to be operated.

[0141] The memory data access module 1208 is used to access the memory data required for the first process to run according to the target memory information.

[0142] In one of the embodiments, the memory information search module is also used for the first process to send a data acquisition request to the second process; the second process extracts the target data identifier and the data object to be operated carried in the data acquisition request, and searches for the target memory information corresponding to the target data identifier from the object container of the data object to be operated; and feeds back the target memory information to the first process.

[0143] In one embodiment, the memory data access module is also used to obtain the first address of the memory block of the data object to be operated; determine the target storage address of the memory data corresponding to the target data identifier based on the first address of the memory block and the target address offset data; access the target storage address to obtain the memory data required for the operation of the first process.

[0144] In one embodiment, the memory data access device further includes a memory information writing module for determining a data identifier corresponding to the memory data according to the memory information; and writing the memory information and the corresponding data identifier into an object container of the data object in the form of a data combination.

[0145] In one embodiment, the memory information includes address offset data; a memory information writing module is used to obtain the storage position of memory data corresponding to the second process in the memory block when the second process is started; obtain the storage address corresponding to the memory data according to the storage position; obtain the memory block first address of the data object corresponding to the memory data, and determine the address offset data of the memory data according to the memory block first address of the data object and the storage address of the memory data.

[0146] In one embodiment, the memory data access device also includes a data storage module, which is used to obtain data attribute information and data storage arrangement of the data object; determine the memory size required for each data object based on the data attribute information; divide the corresponding memory blocks for each data object based on the memory size required for each data object, and determine the first address of each memory block; store each data of the data object in the corresponding storage position in the memory block based on the first address of the memory block and the data storage arrangement.

[0147] In one embodiment, data attribute information includes data types contained in the data object, the number of data identifiers in the same data type, and the memory size of the data corresponding to the data identifier; the data storage arrangement method includes the data type sorting method and the arrangement method of the data identifiers in the same data type; the data storage module is also used to determine the memory size required for each data type according to the data type sorting method, the number of data identifiers in the same data type, and the memory size of the data corresponding to the data identifier; determine the memory starting address of each data type according to the starting address of the memory block and the memory size required for each data type; determine the storage address of the data corresponding to each data identifier according to the memory starting address of each data type and the arrangement method of the data identifiers in the data type.

[0148] For the specific definition of the memory data access device, please refer to the definition of the memory data access method above, which will not be repeated here. Each module in the above-mentioned memory data access device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0149] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.13As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store memory data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a memory data access method is implemented.

[0150] Those skilled in the art will understand that Fig.13 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0151] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0152] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0153] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0154] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0155] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A method for accessing memory data, It is characterized in that The method comprises: In response to a data processing request, determining a first process corresponding to the data processing request, a target data identifier of memory data required when running the first process, and a data object to be operated; Determine a second process associated with the target data type according to an association relationship between the data type and the process and the target data type to which the target data identifier belongs; Calling the second process to search the target memory information corresponding to the target data identifier from the object container of the data object to be operated; Accessing memory data required for running the first process according to the target memory information; Before calling the second process and searching the target memory information corresponding to the target data identifier from the object container of the data object to be operated, the method further includes: Obtain data attribute information and data storage arrangement of data objects; Determine the memory size required for each data object according to the data attribute information; According to the memory size required by each data object, a corresponding memory block is divided for each data object, and a first address of each memory block is determined; According to the first address of the memory block and the data storage arrangement mode, storing each data of the data object to a corresponding storage position in the memory block; Starting the second process, and determining memory information of the memory data according to a storage location of the memory data corresponding to the second process in the memory space; The memory information is written into the object container of the data object.

2. The method according to claim 1, It is characterized in that The target memory information includes target address offset data; The accessing the memory data required for the running of the first process according to the target memory information includes: Get the first address of the memory block of the data object to be operated; Determine the target storage address of the memory data corresponding to the target data identifier according to the memory block first address and the target address offset data; Access the target storage address to obtain memory data required for running the first process.

3. The method according to claim 1, It is characterized in that The step of writing the memory information into the object container of the data object comprises: Determine, according to the memory information, a data identifier corresponding to the memory data; The memory information and the corresponding data identifier are written into the object container of the data object in the form of a data combination.

4. The method according to claim 1, It is characterized in that The memory information includes address offset data; The starting the second process and determining the memory information of the memory data according to the storage location of the memory data corresponding to the second process in the memory space comprises: Starting the second process, and obtaining a storage location of memory data corresponding to the second process in the memory space; According to the storage location, obtaining a storage address corresponding to the memory data; The memory block first address of the data object corresponding to the memory data is obtained, and the address offset data of the memory data is determined according to the memory block first address of the data object and the storage address of the memory data.

5. The method according to claim 1, It is characterized in that The data attribute information includes the data types contained in the data object, the number of data identifiers in the same data type, and the memory size of the data corresponding to the data identifier; the data storage arrangement method includes the data type sorting method and the arrangement method of the data identifiers in the same data type; According to the first address of the memory block and the data storage arrangement mode, storing each data of the data object to a corresponding storage position in the memory block includes: Determine the memory size required for each data type according to the data type sorting method, the number of data identifiers in the same data type, and the memory size of the data corresponding to the data identifiers; Determine the memory starting address of each data type according to the starting address of the memory block and the memory size required for each data type; The storage address of the data corresponding to each data identifier is determined according to the memory head address of each data type and the arrangement of each data identifier in the data type.

6. A memory data access device, It is characterized in that The device comprises: An operation response module, used to respond to a data processing request, determine a first process corresponding to the data processing request, a target data identifier of memory data required when running the first process, and a data object to be operated; A data storage module, used to obtain data attribute information and data storage arrangement of data objects; determine the memory size required for each data object according to the data attribute information; divide corresponding memory blocks for each data object according to the memory size required for each data object, and determine the first address of each memory block; store each data of the data object to the corresponding storage position in the memory block according to the first address of the memory block and the data storage arrangement; A memory information writing module is used to start a second process, determine the memory information of the memory data according to the storage location of the memory data corresponding to the second process in the memory space, and write the memory information into the object container of the data object; A second process determination module, configured to determine a second process associated with the target data type according to an association relationship between the data type and the process and a target data type to which the target data identifier belongs; A memory information search module, used for calling the second process to search for target memory information corresponding to the target data identifier from the object container of the data object to be operated; A memory data access module is used to access the memory data required for the operation of the first process according to the target memory information.

7. The device according to claim 6, It is characterized in that The target memory information includes target address offset data; the memory data access module is further used to obtain the first address of the memory block of the data object to be operated; and determine the target storage address of the memory data corresponding to the target data identifier according to the first address of the memory block and the target address offset data; Access the target storage address to obtain memory data required for running the first process.

8. The device according to claim 6, It is characterized in that The memory data access device further comprises a memory information writing module, which is used to determine the data identifier corresponding to the memory data according to the memory information; The memory information and the corresponding data identifier are written into the object container of the data object in the form of a data combination.

9. The device according to claim 6, It is characterized in that The memory information includes address offset data; the memory information writing module is used to obtain the storage location of the memory data corresponding to the second process in the memory space when the second process is started; and obtain the storage address corresponding to the memory data according to the storage location; The memory block first address of the data object corresponding to the memory data is obtained, and the address offset data of the memory data is determined according to the memory block first address of the data object and the storage address of the memory data.

10. The device according to claim 6, It is characterized in that The data attribute information includes the data types contained in the data object, the number of data identifiers in the same data type, and the memory size of the data corresponding to the data identifier; the data storage arrangement method includes the data type sorting method and the arrangement method of the data identifiers in the same data type; The data storage module is further used to determine the memory size required for each data type based on the data type sorting method, the number of data identifiers in the same data type, and the memory size of the data corresponding to the data identifier; determine the memory starting address of each data type based on the starting address of the memory block and the memory size required for each data type; determine the storage address of the data corresponding to each data identifier based on the memory starting address of each data type and the arrangement method of each data identifier in the data type.

11. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.

12. A computer-readable storage medium storing a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Method and device for sharing data between processes, and terminal

    CN105868028A