Data read-write

By extracting and persistently storing state data during application operation, the data loss problem caused by volatile memory failure is solved, the application can be restored after failure, and the persistent storage requirements of data are met.

WO2025202788A1PCT designated stage Publication Date: 2025-10-02CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PTE LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/IB2025/052265
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-03-29
Filing Date
2025-03-03
Publication Date
2025-10-02

AI Technical Summary

Technical Problem

In the existing technology, volatile memory causes data loss after a failure (such as power outage), and the application cannot be restored. Non-volatile storage media cannot support persistent storage of all data, resulting in the inability to recover after an application failure.

Method used

During the application's operation, the state data is extracted and persistently stored according to the staged state. After a failure, the application operation is restored by reloading the persistently stored state data.

Benefits of technology

It implements the restoration of the application's operating environment through persistently stored state data after a failure, ensuring that persistent storage of data is not affected by the failure and supporting application state recovery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure IB2025052265_02102025_PF_FP_ABST
    Figure IB2025052265_02102025_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present invention provide a data read-write method, an apparatus, an electronic device, and a storage medium. The data read-write method comprises: in response to a running recovery instruction, determining a target state node on the basis of a fault process of an application program to be recovered; acquiring, from at least one piece of prestored state data, target state data corresponding to the target state node, wherein any state data among the at least one piece of state data is extracted and stored when said application program runs to a corresponding state node before a fault occurs; and reloading the target state data to recover running of said application program.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] Data reading and writing technology field

[0002]

[0001] The present disclosure relates to the field of storage technology, and in particular to data reading and writing.

[0003]

[0002] The data involved in the running of the application can be written into the storage medium, so as to maintain the data generated by the running of the application and the data required for the running of the application in the storage medium.

[0004] In the related art, volatile memory is typically used to store application data. However, in the event of a failure (e.g., a power outage), the data stored in the volatile memory is lost, making it impossible for the application to resume normal operation. If all data related to the application's operation is stored in a non-volatile storage medium in order to meet the requirements of non-volatile data storage, not only is current technology unable to support this, but non-volatile storage media also cannot support the persistent storage of all data, resulting in insufficient data to resume application operation after a failure. Summary of the Invention

[0005]

[0004] The embodiments of the present disclosure provide a data reading and writing method, device, electronic device and storage medium.

[0006]

[0005] According to a first aspect of an embodiment of the present disclosure, a data reading and writing method is provided, the method comprising: in response to an instruction to resume operation, determining a target state node according to a faulty process of an application to be restored; obtaining target state data corresponding to the target state node from at least one pre-stored state data, wherein any state data of the at least one state data is extracted and stored when the application to be restored runs to a corresponding state node before the failure; and restoring the operation of the application to be restored by reloading the target state data.

[0007]

[0006] According to a second aspect of an embodiment of the present disclosure, a data reading and writing method is provided, the method comprising: during the operation of an application, if the stage of the operation of the application is any state node among a plurality of pre-set state nodes, extracting state data corresponding to the state node; storing the state data in a non-volatile storage area, and adding a persistent storage mark to the state data; if the application fails, in response to an instruction to resume operation, determining a target state node according to the faulty process of the application to be restored, the target state node belonging to a plurality of state nodes before the faulty process, and the application to be restored being the application that has failed; obtaining target state data corresponding to the target state node from the state data stored in the non-volatile storage area; and restoring the operation of the application to be restored by reloading the target state data.

[0007] According to a third aspect of an embodiment of the present disclosure, a data reading and writing device is provided, the device comprising: a determination module, for determining a target state node according to a faulty process of an application to be recovered in response to an instruction to resume operation; an acquisition module, for acquiring target state data corresponding to the target state node from at least one pre-stored state data, wherein any state data of the at least one state data is extracted and stored when the application to be recovered runs to the corresponding state node before the failure; and a recovery module, for recovering the operation of the application to be recovered by reloading the target state data.

[0008]

[0008] According to a fourth aspect of an embodiment of the present disclosure, an electronic device is provided, comprising a non-volatile memory, a processor, a register, and a computer program stored on the register and executable on the processor, wherein the computer program is executed by the processor to enable the electronic device to read and write data to the non-volatile memory, and to execute the method described in the first aspect or the second aspect.

[0009]

[0009] According to a fifth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and the program is executed by a processor to implement the method described in the first aspect or the second aspect.

[0010]

[0010] According to a sixth aspect of an embodiment of the present disclosure, a computer program product is provided, comprising instructions. When the instructions are executed on a computer, the computer executes the method described in the first aspect or the second aspect.

[0011] The technical solution provided by the embodiments of the present disclosure may include the following beneficial effects: Compared to the traditional method of storing only intermediate application data, the embodiments of the present disclosure support extracting and storing the state data corresponding to the application state node before a fault occurs. Furthermore, after a fault occurs, the application to be recovered is restored by reading the pre-stored state data. This shows that the occurrence of the fault does not affect the storage status of each state data. In other words, the storage of each state data in the embodiments of the present disclosure is persistent. Therefore, after a fault occurs, the persistently stored state data can be used to restore and reconstruct the operating environment of the application to be recovered according to the staged state of the application.

[0012]

[0012] It should be understood that the above general description and the detailed description below are only exemplary and explanatory and cannot limit the present disclosure.

[0013] To more clearly illustrate the technical solutions in the embodiments of the present disclosure, the following briefly introduces the drawings required for use in the embodiments of the present disclosure. It should be understood that a person of ordinary skill in the art can derive other drawings based on these drawings without inventive effort.

[0014]

[0014] FIG1A is a schematic diagram of an exemplary hardware structure of an electronic device provided in an embodiment of the present disclosure;

[0015] FIG1B is a schematic diagram of an exemplary scenario of an application program running stage provided by an embodiment of the present disclosure;

[0015]

[0016] FIG2 is a schematic diagram of an exemplary method flow of a data reading and writing method provided by an embodiment of the present disclosure;

[0016]

[0017] FIG3 is a schematic diagram of an exemplary scenario of a persistent storage scenario provided by an embodiment of the present disclosure;

[0017]

[0018] FIG4 is a schematic diagram of an exemplary scenario of fault recovery provided by an embodiment of the present disclosure;

[0018]

[0019] FIG5 is a schematic diagram of an exemplary scenario of a data reading and writing scenario provided by an embodiment of the present disclosure;

[0019]

[0020] FIG6 is a flow chart of an exemplary method for resuming application execution according to an embodiment of the present disclosure;

[0020]

[0021] FIG7 is a schematic diagram showing an exemplary structure of a data reading and writing device provided by an embodiment of the present disclosure;

[0021]

[0022] FIG8 is a schematic diagram of an exemplary structure of an electronic device provided by an embodiment of the present disclosure.

[0022]

[0023] The technical solutions of the embodiments of the present disclosure are described below with reference to the accompanying drawings.

[0023]

[0024] The terms used in the following embodiments of the present disclosure are for the purpose of describing specific embodiments and are not intended to limit the technical solutions of the present disclosure. As used in the specification and appended claims of the present disclosure, the singular forms "a," "an," "the," "the," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.

[0024]

[0025] It should also be understood that although the terms first, second, etc. may be used in the following embodiments to describe a certain type of object, the objects should not be limited to these terms. These terms are used to distinguish specific implementation objects of this type of object.

[0025]

[0026] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present disclosure are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.

[0026]

[0027] During the execution of an application (APP), data related to the operation (such as environmental data and status data) and data generated during the operation (such as user operation data and results from different operation stages) can be written to the storage media of the electronic device. This facilitates user access and analysis of the data and facilitates recovery based on the stored data in the event of an application failure. As application execution performance improves, the storage media requirements of applications should meet the requirements of persistent storage, large capacity, and low latency during read and write operations.

[0028] However, in some typical implementations, applications read and write data based on the memory of electronic devices, such as dynamic random access memory (DRAM). Although the memory of electronic devices meets the requirements of low latency in the read and write process, it is a volatile storage medium. In the event of a failure (such as a power outage), the data stored in the memory will be lost, and the application will be unable to resume normal operation. If non-volatile storage media is used as memory to store application data, not only will not all data be saved, but the data writing process will require storage operations, which consumes computing resources such as time, computing power, and bandwidth, failing to meet the low latency requirement and also consuming computing resources.

[0027]

[0029] In light of this, embodiments of the present disclosure propose a data reading and writing method. During application execution, this method extracts application status data according to phased states and persistently stores each stage of the data. After a failure occurs, the application can be restored by reading and reloading the persistently stored status data. This method enables persistent storage of data needed to restore application operation, thus supporting recovery of the application's status in failure scenarios.

[0028]

[0030] The data reading and writing methods provided in the embodiments of the present disclosure can be applied to electronic devices. The electronic devices can be implemented as electronic devices such as mobile phones, car computers, tablet computers, game consoles, wearable devices, and personal computers (PCs). Optionally, the electronic devices involved in the embodiments of the present disclosure can support the installation and execution of applications. In some embodiments, the applications can be standalone applications that can be run directly on the operating system of the electronic device without relying on other applications, such as instant messaging apps, map apps, and travel apps. In other embodiments, the applications can be lightweight applications that rely on other applications to run, which can be referred to as "mini-programs," such as a map mini-program or travel mini-program running in an instant messaging app.

[0029]

[0031] FIG1A shows an exemplary hardware structure diagram of an electronic device for implementing a data reading and writing method. As shown in FIG1A , an electronic device 10 (or a computer device) may include a processor 101, a memory 102, a register 103, and a BUS bus.

[0030]

[0032] The processor 101 may be the nerve center and command center of the electronic device 10. Based on instruction opcodes and timing signals, the processor 101 may generate operational control signals to control the execution of applications, resume execution of applications to be resumed, detect whether the application's execution stage is a state node, extract and store state data, and verify the post-reload execution state. In some embodiments, the processor 101 may be a standalone device or may include one or more processors.

[0031]

[0033] It should be noted that the processor 101 may be embodied in whole or in part as software, hardware, firmware, or any other combination. Furthermore, the processor 101 may be a single independent processing module, or may be fully or partially integrated into any of the other components of the electronic device 10.

[0034] Memory 102 includes a cache area and a persistent storage area. The cache area can be used to store intermediate state data generated during application execution, such as result data generated by user operations. In some embodiments, the cache area can also store instructions or data used by processor 101 to control the application execution cycle. The persistent storage area can be used to store data and information required for application recovery after a failure, such as state data of multiple application state nodes, mappings between stored state data and corresponding state nodes, and first reference signatures corresponding to each state node. In some embodiments, memory 102 can be implemented as system memory of electronic device 10.

[0032]

[0035] For example, data stored in memory 102 can all be written in memory byte format. Furthermore, the data to be persistently stored can be labeled with a persistent storage function or data segment, etc., to identify the storage attributes of the data to be persistently stored. In this way, no storage operation is required during the data writing process, thereby meeting low-latency data storage requirements and saving computing resources.

[0033]

[0036] Register 103 can be used to store logs and instructions related to application execution. The logs may include execution logs for each stage of the application and data loading strategies. The execution logs may, for example, include the state node to which the application has run and the time at which the state node was reached. The data loading strategies may, for example, include the functions to be called and the calling rules for each function. The instructions may include a computer program that triggers the execution of a sub-state corresponding to a state node. In some embodiments, processor 101 may determine a target state node for restoring the application's execution state based on the logs stored in register 103, and trigger the execution of the sub-state matching the target state node by executing the corresponding instructions in register 103, thereby enabling electronic device 10 to restore the state of a failed application (i.e., the application to be restored).

[0034]

[0037] The processor 101, memory 102, and register 103 may be connected via a BUS bus, allowing the processor 101 to perform data and information read and write operations with the memory 102 and register 103, respectively. For example, the processor 101 may write the status data of each state node of an application to the memory 102 via the BUS bus. For another example, the processor 101 may write the application's running log to the register 103 via the BUS bus. For another example, during the state recovery process for the application to be recovered, the processor 101 may read data from the memory 102 and register 103 via the BUS bus.

[0035]

[0038] Those skilled in the art will appreciate that the structure shown in FIG1A is merely illustrative and does not limit the structure of the electronic device described above. For example, the electronic device 10 may include more or fewer components than those shown in FIG1A , such as a power supply, or have a configuration different from that shown in FIG1A .

[0036]

[0039] As shown in FIG1B , for an application running on electronic device 10, during the development phase of the corresponding application, the entire application execution cycle can be divided into multiple phased states based on the design characteristics of the corresponding application. Each phased state is distinguished by a state node, such as state node A, state node B, and state node C shown in FIG1B . Between each phased state, multiple sub-states (or micro-states) can be divided according to the various stages and / or modes of the application. For example, state node A and state node B can include multiple sub-states. After the application enters the environment of state node A, it can continue to load subsequent sub-states based on the operating environment of state node A until it reaches state node B. Furthermore, after loading the environment of state node B, it can continue to load subsequent sub-states based on the operating environment of state node B until it reaches state node C.

[0037]

[0040] For example, the running phase as a state node can be a point where there are fewer parameters and the program is approaching stability and convergence. For example, state node B can be a point where a set of functions in an application program have completed execution and returned calculation results, while intermediate results can be discarded. The running phase as a sub-state node can be a short period during program execution when there is a large amount of valid and active data and it changes frequently.

[0038]

[0041] In the above operating environment, the embodiment of the present disclosure provides a data reading and writing method as shown in FIG2. It should be noted that the data reading and writing method shown in FIG2 can be an implementation process for restoring the running state of the application to be restored after an application failure.

[0039]

[0042] Please refer to FIG2 , which provides a data reading and writing method according to an embodiment of the present disclosure. The data reading and writing method includes the following steps.

[0040]

[0043] In step S201, in response to an instruction to resume operation, a target state node is determined according to the faulty process of the application to be resumed.

[0041]

[0044] The instruction to resume operation may be input by a user after an application program fails. The application program to be resumed may be an application program that was interrupted after the failure. Accordingly, the faulty process may be a process of the application program that was interrupted.

[0042]

[0045] In some embodiments, the target state node belongs to multiple state nodes before the fault process.

[0043]

[0046] In step S202, target state data corresponding to the target state node is obtained from at least one pre-stored state data.

[0044]

[0047] Any state data of the at least one state data is extracted and stored when the application to be recovered runs to a corresponding state node before the application fails.

[0045]

[0048] Any state data may be all data supporting restoration of the running state, such as data and parameters of the program running in the state.

[0046]

[0049] It should be noted that the state data may include data supporting the restoration of the running state, but does not include intermediate process data generated by the running state. For example, if the state is to calculate 5+6, the state data is the expression "5+6", and intermediate process data such as carry 1 is not stored.

[0047]

[0050] In step S203, the operation of the application to be restored is restored by reloading the target state data.

[0048]

[0051] It should be noted that the location where the application to be restored resumes running may be the location of the target state node that has been successfully reloaded.

[0049]

[0052] As can be seen, using the embodiments of the present disclosure, before a failure, during application operation, the state data corresponding to each state node is extracted and stored according to the state node at each stage of the application's operation. As previously mentioned, state nodes are relatively stable and have data convergence at certain stages, making it easier to extract and store state data. Thus, compared to traditional methods that only store intermediate application data, the embodiments of the present disclosure support extracting application state data according to the stage of operation. Furthermore, after a failure, during the recovery of the application to be recovered, the embodiments of the present disclosure can obtain target state data from pre-stored state data using the determined target state node. This shows that the occurrence of a failure does not affect the storage status of each state data. In other words, the storage of each state data in the embodiments of the present disclosure is persistent. Therefore, after a failure, the embodiments of the present disclosure can use the persistently stored state data to restore and reconstruct the operating environment of the application to be recovered according to the staged state of the application.

[0050]

[0053] In some embodiments, before responding to the instruction to resume operation, during the application running stage, if the stage of the application running is any one of a plurality of preset state nodes, the electronic device can extract the state data corresponding to the state node, store the state data in a preset storage area, add a persistent storage mark to the state data, and store the mapping relationship between the physical address of the state data in the preset storage area and the state node.

[0051]

[0054] It should be noted that, in the embodiments of the present disclosure, the preset storage area may be a storage area in a non-volatile storage medium, such as the system memory of the electronic device. The electronic device may store the extracted status data in the preset storage area by writing the data into the non-volatile storage medium in a memory byte manner. In this way, the electronic device does not need to perform a storage operation, thereby reducing resource overhead.

[0052]

[0055] Although non-volatile storage media offer the characteristic of persistent data storage, they also typically store temporary data that is discarded after operations such as a reboot. To clearly indicate the persistent storage properties of state data and ensure its validity even after a failure, electronic devices write extracted state data to non-volatile storage media and then tag the data with a persistent identifier (PID) to identify the data's persistent storage properties. A persistent identifier is an identifier used to identify data objects and provide a persistent, time-invariant access path. The purpose of this identifier is to ensure that the PID can consistently and accurately locate the storage address of these data objects regardless of their location. This ensures the persistence and discoverability of state data, facilitating access to this data during failure recovery.

[0053]

[0056] Exemplarily, the types of PID may include Digital Object Identifier (DOI), Handle System and Archival Resource Key (ARK).

[0054]

[0057] Furthermore, the electronic device may also set a metadata area in the non-volatile storage medium. The metadata area persistently maintains at least one mapping relationship. Any mapping relationship represents a mapping between a state node and storage information corresponding to the corresponding state node. The storage information includes a physical address of the state data corresponding to the corresponding state node. In some embodiments, the physical address includes a starting address (offset, 0) and a continuous length (length, L) of the state data in the non-volatile storage medium.

[0055]

[0058] For example, as shown in FIG3 , in the persistent storage scenario provided by the embodiments of the present disclosure, a non-volatile storage medium can be divided into a data area and a persistent metadata area. The data area can store volatile data segments (i.e., the aforementioned temporary data) and persistent data segments. Each time an electronic device writes state data to the data area, it can add a persistent storage flag (e.g., the shading in FIG3 ) to the state data. Each persistent data segment can be treated as an object, and its physical address can be associated and stored. For example, FIG3 shows persistent data segment T1 (O1, L1), persistent data segment T2 (O2, L2), persistent data segment Ti (Oi, Li), and persistent data segment Tn (On, Ln2). The persistent metadata area can be used to persistently store the mapping relationship between the physical address of each persistent data segment in the data area and the state node of the corresponding persistent data segment. Illustratively, each persistent data segment can be used as an object, and the object identifier of each persistent data segment can be used as the identifier of a state node. Accordingly, referring to the mapping table shown in FIG3 , a mapping relationship between each state node and the corresponding state data storage information can be established by corresponding the object identifier and the physical address of the corresponding persistent data segment.

[0056]

[0059] In view of this, in some embodiments of the present disclosure, obtaining the target state data corresponding to the target state node from at least one pre-stored state data can be implemented as follows: determining the storage information corresponding to the target state node from the mapping relationship in the preset storage area, the storage information includes the physical address of the target state data, the mapping relationship includes at least one mapping relationship, any mapping relationship represents the mapping of the state node and the storage information corresponding to the corresponding state node, and reading the target state data from the storage area indicated by the physical address.

[0057]

[0060] Taking the identifier Obj2 corresponding to the target state node as an example, the electronic device can determine the storage information T2 (O2, L2) corresponding to the target state node from the mapping table shown in Figure 3 based on Obj2, and then read the persistent data segment T2 (02, L2) from the data area based on the starting physical address 02 and data length L2 indicated by T2 (O2, L2), thereby obtaining the target state data.

[0061] It can be seen that, by adopting this implementation, a corresponding relationship between status nodes and stored information is established by setting a mapping table, which provides a reference basis for locating status data of the electronic device, thereby facilitating accurate locating of these status data during the fault recovery phase.

[0058]

[0062] It should be noted that in actual implementation scenarios, the target state node may not be a specific state node, but rather a state node that restores the application to be restored to a normal operating state. In some embodiments, to reduce computational complexity, after determining the faulty process, the electronic device may first determine the state node with the smallest time interval with the faulty process as the target state node, and restore the application's operating state based on the state data of the target state node.

[0059]

[0063] For any determined target state data, the electronic device can reload the target state data to obtain a reloaded state, and then detect whether the credibility of the reloaded state reaches a preset level, where the credibility represents the degree of matching between the reloaded state and the running state corresponding to the target state node; if the credibility of the reloaded state reaches the preset level, it is determined that the application to be restored resumes operation from the reloaded state; if the credibility of the reloaded state does not reach the preset level, the previous state node of the target state node is determined as a new target state node, and the operation of obtaining the target state data corresponding to the target state node from the multiple stored state data is performed again.

[0060]

[0064] The credibility of the reloaded state is used to indicate the accuracy with which the reloaded state restores the operating state of the target node before the failure. In some embodiments, the electronic device may generate a signature based on at least one piece of status information of the corresponding operating state and verify the credibility of the reloaded state based on the signature. See the following description of the corresponding embodiments for details.

[0061]

[0065] The following description uses the first target state node as an example. As described in the preceding embodiments, the electronic device's register stores an application's execution log, which records the state node reached by the application and the time at which it reached that state node. Based on this, referring to the scenario diagram shown in FIG4 , in some embodiments, the electronic device can read the execution log of the application to be restored and determine the state node with the shortest time interval between the execution log and the failed process as the target state node. This target state node is the first target state node determined.

[0062]

[0066] Furthermore, the electronic device can determine the storage information corresponding to the target state node based on the mapping relationship in the persistent metadata area in FIG. 3 , and then read the target state data from the data area in FIG. 3 based on the storage information. As can be seen from the above description of state data, the target state data can be a variable (e.g., an algorithmic expression). After reading the target state data, the electronic device can reload the state of the target state node by assigning a value to the variable indicated by the target state data.

[0067] It should be noted that, before responding to the instruction to resume operation, during the application execution, in order to facilitate verification of the credibility of the reloaded state during the failure phase, for any state node, after extracting the state data of the state node, the electronic device may further extract at least one state information corresponding to the state data, and then generate and store a first reference signature corresponding to the state node based on the at least one state information. Furthermore, when the application executes to the kth substate corresponding to the state node, a substate reference signature is generated based on the state information of the kth substate; the substate reference signature corresponding to the kth substate is used to overwrite the substate reference signature corresponding to the k-1th substate, thereby forming the second reference signature corresponding to the state node.

[0063]

[0068] Illustratively, the at least one state information may include at least one of the following: a preset multi-tenant isolation key, state configuration information with a preset value, etc. After extracting the at least one state information, the electronic device may serially concatenate the above information into a string, and then use a multi-hash algorithm to calculate a signature with a collision probability lower than a preset value (e.g., 10-50). This signature may be the first reference signature corresponding to the state node. Furthermore, the electronic device may write the first reference signature into the data area illustrated in FIG. 3 for persistent storage.

[0064]

[0069] Furthermore, when executing a substate between any two state nodes, the electronic device can extract state information for any substate, such as a program execution depth identifier (e.g., program execution location), and generate a signature corresponding to the substate as a second reference signature. Exemplarily, when storing the second reference signature, the electronic device can overwrite the signature corresponding to the previous substate with the signature corresponding to the current substate, writing the signature as the latest second reference signature into the volatile data segment of the data area.

[0065]

[0070] In traditional designs, a power-failure protection circuit maintains charge and, in the event of a fault, reads the stored data and writes it to a non-volatile storage medium. When storing large amounts of data, the power-failure protection circuit cannot provide sufficient charge, increasing system complexity and reducing its stability. Therefore, this implementation eliminates the need for traditional power-failure protection circuits for signature storage, thereby reducing system complexity while ensuring data write stability.

[0066]

[0071] Based on this, referring again to the scenario diagram shown in Figure 4, after reloading the target state data to obtain the reloaded state, the electronic device detects whether the credibility of the reloaded state reaches a preset level, which can be implemented as follows: obtaining a first signature to be verified and a first reference signature of the reloaded state; if the first signature to be verified matches the first reference signature, loading the sub-state corresponding to the application to be recovered based on the reloaded state; when the sub-state to be verified corresponding to the faulty process is loaded, detecting whether the second signature to be verified corresponding to the sub-state to be verified matches the second reference signature, the second reference signature being a pre-cached sub-state reference signature; if the second signature to be verified matches the second reference signature, determining that the credibility of the reloaded state reaches the preset level.

[0072] Illustratively, after obtaining the reloading state, the electronic device may extract at least one state information of the reloading state, calculate the first signature to be verified based on the at least one state information, and then read the first reference signature corresponding to the target state node from a plurality of pre-stored reference signatures.

[0067]

[0073] For example, if the first signature to be verified matches the first reference signature, it can indicate that the reload state of the target state node is ready. After the electronic device reads the instructions and logs in the register to advance the target state node, the programs of each sub-state resume running one by one until the instruction of the faulty process is executed.

[0068]

[0074] It should be noted that since the first signature to be verified is calculated based on at least one state information of the reloaded state, that is, the information used to calculate the first signature to be verified and the first reference signature has the same attributes, if the reloaded state accurately restores the operating state of the target node before the failure, then the first signature to be verified and the first reference signature should be equal. Based on this, in this embodiment, the first signature to be verified matches the first reference signature, for example, by being equal to the first reference signature. The implementation principle and comparison criteria for whether the second signature to be verified matches the second reference signature are the same as those for the first signature to be verified and the first reference signature, and will not be further described here.

[0069]

[0075] Furthermore, if the first signature to be verified does not match the first reference signature, or the second signature to be verified does not match the second reference signature, it indicates that recovery based on the target state node (i.e., the first target state node) has failed. The electronic device can again search for the previous state node of the first target state node based on the log, and use the previous state node as the new target state node, and repeat the operations of reading state data, reloading and verifying based on the read state data in the above embodiment.

[0070]

[0076] It can be seen that by adopting this implementation method, the previous state node closest to the faulty process is first used as the recovery point to rebuild the application's operating environment. This not only makes it easier to overcome the losses caused by various faults, but also reduces the amount of calculation.

[0071]

[0077] The above describes the technical solution from the perspective of various implementations of the technical solution. To facilitate understanding, the following describes the technical solution from the perspective of the complete life cycle.

[0072]

[0078] It should be noted that the following embodiments are merely illustrations of the present technical solution from different perspectives. The same or similar parts as those in the above embodiments can be used for reference and will not be repeated in this solution.

[0073]

[0079] In some embodiments, the implementation of this technical solution may include two phases: the first phase: the phase of normal application operation, that is, the data storage phase; the second phase: the fault recovery phase, that is, the data reading phase. The following describes these two phases. Phase 1: Phase of normal application operation

[0074]

[0080] As shown in Figure 5, the data read and write scenario diagram shows that the application is divided into multiple state nodes, which can appear in the order in which the application is run. Between each two state nodes, there can be multiple microstates (i.e., the aforementioned substates).

[0075]

[0081] During this phase, the electronic device can detect whether the application is currently running at a pre-set state node. If so, the electronic device extracts the state data from the state node and writes it to the electronic device's system memory as memory bytes. It also adds a persistent storage flag to the state data and assigns an object identifier. Furthermore, the object identifier and the physical address indicated by the persistent storage flag are stored in a pre-set persistent metadata area. In other embodiments, the electronic device can also establish an association between the object identifier and the state node in a register.

[0076]

[0082] The implementation process of storing data in the system memory, adding a persistent storage mark, and establishing an object identifier and a physical address storage indicated by the persistent storage mark is described with reference to the embodiment corresponding to FIG. 3 above, and will not be described in detail here.

[0077]

[0083] In other embodiments, the electronic device extracts state data, such as state configuration information, subject data, multi-tenant private keys, and operational depth information, and performs a hash operation to generate a first reference signature corresponding to the state node. The electronic device then writes the first reference signature to system memory for persistent storage.

[0078]

[0084] Furthermore, for each microstate loaded into the state node, the electronic device can extract the state configuration information, main body data, multi-tenant private key, and running depth information of the corresponding microstate, perform a hash operation to generate a second reference signature, and then write the second reference signature into the volatile field area of ​​the system memory, storing it by overwriting the previously generated second reference signature.

[0079]

[0085] In addition, during the above operation process, the electronic device writes the operation log of the application into the register to record information such as the status configuration data of each status node.

[0080]

[0086] If the application is interrupted due to a fault, in response to a user input instruction to resume operation, the electronic device can resume the operation of the application according to the recovery method shown in FIG. 6 .

[0081]

[0087] 6, an exemplary method for resuming application execution provided by an embodiment of the present disclosure may include steps S601-S611.

[0082]

[0088] S601, read the log from the register and determine the target state node.

[0083]

[0089] The electronic device may determine the nearest state node corresponding to the faulty process and the object identifier corresponding to the state node from the state configuration data in the register.

[0090] S602: Read the storage information corresponding to the object identifier from the mapping relationship table in the persistent metadata area.

[0084]

[0091] The persistent metadata area is the storage area in the first-stage system memory.

[0085]

[0092] S603, read the status data according to the physical address indicated by the storage information.

[0086]

[0093] S604: Reload the state data, and calculate a first signature to be verified according to the reloaded state.

[0087]

[0094] The process of reloading the state data is the process of assigning values ​​to the variables of the state node, which will not be expanded here.

[0088]

[0095] Exemplarily, the electronic device may extract state configuration information, main body data, multi-tenant private key, and running depth information from the reloaded state, and perform a hash operation to obtain the first signature to be verified.

[0089]

[0096] S605: Read the first reference signature of the state node from the persistent storage area.

[0090]

[0097] Otherwise, execute step S61 L S606, determines whether the first signature to be verified is the same as the first reference signature, if the same, execute step S607; otherwise, execute step S61 L

[0091]

[0098] If the first signature to be verified is identical to the first reference signature, it is considered that the state node is successfully restored.

[0092]

[0099] S607: Load the microstate according to the instructions in the register and the state recorded in the log.

[0093]

[0100] S608: If the state recorded in the log is loaded, calculate the second signature to be verified based on the last reloaded microstate.

[0094]

[0101] Otherwise, execute step S61 L S609, determines whether the second signature to be verified is the same as the second reference signature, if the same, execute step S610; otherwise, execute step S61 L

[0095]

[0102] S610, switching the recovery state to the running state.

[0096]

[0103] The second signature to be verified is identical to the second reference signature, indicating that the application state has been correctly restored to the state before the failure. The restored state can be switched to the running state of the application, and the application can continue to run based on the microstate.

[0097]

[0104] S611: Report an error on the stored status data and indicate that recovery has failed.

[0098]

[0105] In other embodiments, the electronic device may search for a previous state node of the state node based on the log, and perform recovery again according to steps S602 to S611.

[0099]

[0106] As can be seen, the embodiments of the present disclosure provide a data reading and writing method that extracts application running status data according to phased states during application execution and persistently stores each piece of running status data. After a failure occurs, the application can be restored by reading and reloading the persistently stored running status data. This allows data used to restore application execution to be persistently stored, thus supporting recovery of the application's running status in failure scenarios.

[0100]

[0107] It should be understood that the components illustrated in FIG. 1A can be implemented as hardware or a combination of hardware and computer software. Whether the processing steps of any relevant component are performed by hardware or by computer software driving the hardware depends on the specific application and design constraints of the technical solution. Professionals may also implement the functions described in the above embodiments using different methods for specific applications, but such implementations should not be considered beyond the scope of this disclosure.

[0101]

[0108] For example, if the above implementation steps can implement corresponding functions through a software module, corresponding to the above data reading and writing method, the embodiment of the present disclosure may also provide a data reading and writing device.

[0102]

[0109] As shown in FIG7 , a data reading and writing device is provided, which may include a determination module 71, an acquisition module 72, and a recovery module 73. The data reading and writing device may be used to perform some or all of the operations of the electronic device in FIG2 to FIG6 .

[0103]

[0110] For example: a determination module 71 is used to determine a target state node according to the fault process of the application to be restored in response to an instruction to resume operation; an acquisition module 72 is used to obtain target state data corresponding to the target state node from at least one pre-stored state data, and any state data in the at least one state data is extracted and stored when the application to be restored runs to the corresponding state node before the failure; a recovery module 73 is used to restore the operation of the application to be restored by reloading the target state data.

[0104]

[0111] Thus, the data reading and writing device provided in the embodiments of the present disclosure can extract the state data corresponding to the application state node and store it persistently. After a failure occurs, the persistently stored state data can be used to restore and rebuild the operating environment of the application to be restored according to the staged state of the application.

[0105]

[0112] Optionally, the determination module 71 is further configured to determine storage information corresponding to the target state node from a mapping relationship in the preset storage area, where the storage information includes a physical address storing the target state data, and the mapping relationship includes at least one mapping relationship, any mapping relationship representing a mapping between a state node and storage information corresponding to the corresponding state node; and the acquisition module 72 is further configured to read the target state data from the storage area indicated by the physical address.

[0106]

[0113] Optionally, the recovery module 73 is further configured to read the operation log of the application to be recovered; and determine the state node with the shortest time interval with the faulty process recorded in the operation log as the target state node.

[0107]

[0114] Optionally, the recovery module 73 is further used to reload the target state data to obtain a reloaded state; detect whether the credibility of the reloaded state reaches a preset level, the credibility representing the degree of matching between the reloaded state and the running state corresponding to the target state node; if the credibility of the reloaded state reaches the preset level, determine that the application to be restored resumes operation from the reloaded state; and if the credibility of the reloaded state does not reach the preset level, determine the previous state node of the target state node as a new target state node, and call the acquisition module 72 again to obtain the target state data corresponding to the target state node from the multiple stored state data.

[0108]

[0115] Optionally, the acquisition module 72 is further used to obtain a first signature to be verified and a first reference signature of the reloaded state; the recovery module 73 is further used to load the sub-state corresponding to the application to be recovered based on the reloaded state if the first signature to be verified matches the first reference signature; when the sub-state to be verified corresponding to the faulty process is loaded, detect whether the second signature to be verified corresponding to the sub-state to be verified matches the second reference signature, and the second reference signature is a pre-cached sub-state reference signature; the determination module 71 is further used to determine that the credibility of the reloaded state reaches the preset level if the second signature to be verified matches the second reference signature.

[0109]

[0116] Optionally, the acquisition module 72 is further used to extract at least one state information of the reloaded state; the recovery module 73 is further used to calculate the first signature to be verified based on the at least one state information; and read the first reference signature corresponding to the target state node from a plurality of pre-stored reference signatures, where the first reference signature is generated and stored based on the at least one preset state information of the target state node before the failure of the application to be recovered.

[0110]

[0117] Optionally, the data reading and writing device further includes: an extraction module and a storage module, the extraction module being used to extract, during the running of the application, the state data corresponding to any of a plurality of preset state nodes if the running stage of the application is the application before the failure of the application to be recovered; the storage module being used to store the state data in a preset storage area, and to add a persistent storage mark to the state data; and to store a mapping relationship between the physical address of the state data in the preset storage area and the state node.

[0111]

[0118] Optionally, the extraction module is further configured to extract at least one state information corresponding to the state data; and the storage module is further configured to generate and store a first reference signature corresponding to the state node according to the at least one state information.

[0112]

[0119] Optionally, the data reading and writing device further includes: a generation module for generating a substate reference signature based on the state information of the kth substate when running to the kth substate corresponding to the state node; and a storage module for using the substate reference signature corresponding to the kth substate to overwrite the substate reference signature corresponding to the k-1th substate as the second reference signature corresponding to the state node.

[0113]

[0120] It is understood that the division of the modules in FIG. 7 is merely a division of logical functions. In actual implementation, the functions of the modules can be integrated into the hardware of the electronic device. The electronic device may be as shown in FIG. 1A . In other embodiments, the memory 102 and register 102 in FIG. 1A may be further integrated into a single memory.

[0114]

[0121] Referring to FIG. 8 , FIG. 8 provides an electronic device. The programmable chip includes a processor 511, a transceiver 512, and a memory 513. These components are connected and communicate with each other via a communication bus 514. Specifically, the transceiver 512 can be used to receive a restore instruction. The memory 513 is used to store the persistent data segments stored by the memory 102 in FIG. 1A , as well as program instructions in the register 102. When the program instructions are invoked, the processor 511 executes some or all of the operations of the electronic device described in FIG. 2 through FIG. 6 .

[0115]

[0122] For the specific implementation process, please refer to the description of the electronic device in Figures 2 to 6, which will not be repeated here.

[0116]

[0123] The present disclosure also provides a computer-readable storage medium that stores data reading and writing instructions. When the computer-readable storage medium is executed on a computer, the computer executes some or all of the steps in the method described in the aforementioned embodiment.

[0117]

[0124] The present disclosure also provides a computer program product including instructions for reading and writing data. When the computer program product is executed on a computer, the computer executes some or all of the steps in the method described in the aforementioned embodiment.

[0118]

[0125] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0119]

[0126] In the several embodiments provided in this disclosure, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of units described is merely a logical functional division. In actual implementation, other divisions may be used. For example, multiple units or components may be combined or integrated into another system, or some features may be omitted or not implemented. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interface, or the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0120]

[0127] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected according to actual needs to achieve the objectives of this embodiment.

[0121]

[0128] In addition, the functional units in the various embodiments of the present disclosure may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0122]

[0129] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure, or the portion that contributes to the relevant art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes instructions for causing a computer device (such as a personal computer, smartphone, or network device) to execute all or part of the steps of the methods described in various embodiments of the present disclosure. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0123]

[0130] Although optional embodiments of the present disclosure have been described, those skilled in the art may make additional changes and modifications to these embodiments once they are aware of the basic inventive concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present disclosure.

[0124]

[0131] The specific embodiments described above further illustrate the objectives, technical solutions, and beneficial effects of the present disclosure. It should be understood that the above description is merely a specific embodiment of the present disclosure and is not intended to limit the scope of protection of the present disclosure. Any modifications, equivalent replacements, improvements, etc. made based on the technical solutions of the present disclosure shall be included in the scope of protection of the present disclosure.

Claims

Claims 1. A data reading and writing method, comprising: In response to an instruction to resume operation, determining a target state node according to a faulty process of the application to be resumed; Obtain target state data corresponding to the target state node from at least one pre-stored state data, wherein any state data in the at least one state data is extracted and stored when the application to be recovered runs to the corresponding state node before the failure of the application to be recovered; and restore the operation of the application to be recovered by reloading the target state data.

2. The method according to claim 1, wherein: The obtaining of the target state data corresponding to the target state node from at least one pre-stored state data includes: determining storage information corresponding to the target state node from a mapping relationship in a preset storage area, the storage information including a physical address storing the target state data, the mapping relationship including at least one mapping relationship, any mapping relationship representing a mapping between a state node and the storage information corresponding to the corresponding state node; and reading the target state data from the storage area indicated by the physical address.

3. The method according to claim 1, wherein: Determining the target state node according to the faulty process of the application to be restored includes: reading the operation log of the application to be restored; and determining the state node with the shortest time interval with the faulty process recorded in the operation log as the target state node.

4. The method according to claim 1, wherein: The method of restoring the operation of the application to be restored by reloading the target state data includes: reloading the target state data to obtain a reloaded state; detecting whether the credibility of the reloaded state reaches a preset level, the credibility representing the degree of matching between the reloaded state and the running state corresponding to the target state node; if the credibility of the reloaded state reaches the preset level, determining that the application to be restored resumes operation from the reloaded state; if the credibility of the reloaded state does not reach the preset level, determining the previous state node of the target state node as a new target state node, and performing the operation of obtaining the target state data corresponding to the target state node from the multiple stored state data again.

5. The method according to claim 4, wherein: The detecting whether the credibility of the reloading state reaches a preset level includes: obtaining a first signature to be verified and a first reference signature of the reloading state; If the first signature to be verified matches the first reference signature, the sub-state corresponding to the application to be restored is loaded based on the reloaded state; when the sub-state to be verified corresponding to the faulty process is loaded, it is detected whether the second signature to be verified corresponding to the sub-state to be verified matches the second reference signature, and the second reference signature is a pre-cached sub-state reference signature; if the second signature to be verified matches the second reference signature, it is determined that the credibility of the reloaded state reaches the preset level.

6. The method according to claim 5, wherein: The method of obtaining the first signature to be verified and the first reference signature of the reloaded state includes: extracting at least one state information of the reloaded state; calculating the first signature to be verified based on the at least one state information; reading the first reference signature corresponding to the target state node from a plurality of pre-stored reference signatures, wherein the first reference signature is generated and stored based on the at least one preset state information of the target state node before the failure of the application to be recovered.

7. The method according to any one of claims 1 to 6, wherein: Before responding to the instruction to resume operation, the method further includes: during the application operation process, if the application operation stage is any one of a plurality of preset state nodes, extracting state data corresponding to the state node, and the application is the application before the failure of the application to be restored; storing the state data in a preset storage area, and adding a persistent storage mark to the state data; and storing a mapping relationship between the physical address of the state data in the preset storage area and the state node.

8. The method according to claim 7, further comprising: extracting at least one state information corresponding to the state data; A first reference signature corresponding to the state node is generated and stored according to the at least one state information.

9. The method according to claim 8, further comprising: When the state node reaches the kth substate corresponding to the state node, a substate reference signature is generated according to the state information of the kth substate; The sub-state reference signature corresponding to the k-th sub-state is used to overwrite the sub-state reference signature corresponding to the k-1-th sub-state as the second reference signature corresponding to the state node.

10. A data reading and writing method, comprising: During the application program operation, if the application program operation stage is one of the preset multiple state nodes For any state node, extract the state data corresponding to the state node; storing the state data in a non-volatile storage area and adding a persistent storage mark to the state data; if the application fails, responding to an instruction to resume operation, determining a target state node based on the failed process of the application to be restored, where the target state node belongs to a plurality of state nodes preceding the failed process, and the application to be restored is the application that failed; Obtaining target state data corresponding to the target state node from the state data stored in the non-volatile storage area; and resuming the operation of the application to be resumed by reloading the target state data.

11. A data reading and writing device, comprising: a determination module, configured to determine, in response to an instruction to resume operation, a target state node according to a faulty process of an application program to be resumed; an acquisition module, configured to acquire target state data corresponding to the target state node from at least one pre-stored state data, wherein any state data in the at least one state data is extracted and stored when the application to be recovered runs to the corresponding state node before the application fails; A recovery module is used to recover the operation of the application to be recovered by reloading the target state data.

12. An electronic device comprising a nonvolatile memory, a processor, a register, and a computer program stored in the register and executable on the processor, wherein: The computer program is executed by the processor to enable the electronic device to read and write data to the non-volatile memory, and to perform the method according to any one of claims 1 to 10.

13. A computer-readable storage medium having a computer program stored thereon, wherein: The program is executed by a processor to implement the method according to any one of claims 1 to 10.

14. A computer program product comprising instructions, wherein: When the instructions are executed on a computer, the computer is caused to perform the method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Data recovery method and device

    CN113515317A

  • Application dump and recovery method and device based on check points and storage medium

    CN116610493A

  • Persistent memory device for backup process checkpoint states

    US20050132250A1

  • Checkpoint restart system and method

    US20060156157A1