Data updating method and device based on implicit transaction, operating system, virtual machine, equipment, terminal and medium
By automatically turning on implicit transactions in RTE to back up and record the application data, the repeated rewritten problem when updating persistent data is solved, and the performance and reliability of the application are improved.
Patent Information
- Application Number
- CN202411202388.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2024-12-06
AI Technical Summary
In the case where the transaction is not enabled when the prior art updates persistent data, the FLASH page is repeatedly rewritten, resulting in a degradation of the application's running performance.
Avoid repeated rewritten by automatically turning on implicit transactions in RTE, backing up the application data to be updated, and recording its persistent data address until the transaction is committed and ended when the implicit transaction shutdown condition is triggered.
Improves the operational performance and reliability of the application and reduces the risk of data corruption caused by power loss.
Smart Images

Figure CN119088421A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of computer application technology, and in particular, to a data update method, apparatus, operating system, virtual machine, equipment, terminal, medium and program based on implicit transactions. Background Art
[0002] WebAssembly (Wasm for short) is a method of using non-JavaScript (a lightweight, interpreted or just-in-time compiled programming language with function priority) code and making it run in the browser. These codes can be C, C++ or Rust (a modern system programming language that focuses on safety, speed and concurrency), etc. After they are loaded into the client browser, they can run at a speed close to native speed. In WebAssembly-based embedded operating systems, transactions are a logical method proposed for updating persistent data in non-volatile storage space and are an integral part. During the transaction process, all update operations will maintain consistency and integrity, that is, either the persistent data is updated or not updated. If the transaction cannot be completed, all update operations will be restored, that is, the persistent data will be restored to before the transaction started. This mechanism prevents power outages during transaction processing and prevents errors that may cause data corruption when all steps of the transaction are not completed normally.
[0003] In the prior art, if an application wants to ensure the consistency of updating persistent data, it needs to call the transaction start interface "systemBeginTransaction()" provided by the RTE (Runtime Environment) based on the WebAssembly embedded operating system to explicitly start the transaction, and explicitly call the transaction end interface after the update is completed, such as: committing the transaction through the systemCommitTransaction() interface, and terminating or canceling the transaction through the systemAbortTransaction() interface. If the transaction is committed, the content updated to the persistent data during the transaction will not be restored to the data before the transaction started; if the transaction is terminated or canceled, the content updated to the persistent data during the transaction will be restored to the data before the transaction started.
[0004] Normally, the application can call the above transaction management interface according to actual needs to ensure the consistency of updating persistent data. If the above transaction management interface is not called, RTE does not guarantee the consistency of updating persistent data. Every time RTE updates persistent data, it will back up the current old data, and then write the new data into the persistent data. After the transaction is committed, the backup data will be discarded to ensure that it will not be restored to the data before the update, that is, the recorded address is cleared. This process requires 4 times of erasing FLASH (Flash EEPROM Memory, flash memory) pages, that is, backing up the current data, recording the persistent data address, writing new data, and clearing the recorded persistent data address. In order to prevent the chip from losing power due to erasing FLASH pages, each update of persistent data will have a process of backing up the current data or writing the new data into the backup stack. In order to complete the persistent data update, there will be a process of submitting data writing, that is, writing the new data to the persistent data address and clearing the recorded address. Therefore, if the transaction is not opened, each update of persistent data will have a repeated process of erasing the recorded address, resulting in the more persistent data updated, the slower the overall performance of the application. Summary of the invention
[0005] The embodiments of the present invention provide a data update method, apparatus, operating system, virtual machine, equipment, terminal, medium and program based on implicit transactions, which can improve the application running performance and the reliability of the application running.
[0006] According to one aspect of the present invention, a data update method based on implicit transactions is provided, which is applied to RTE and includes:
[0007] When it is determined that the current application data to be updated is persistent data and it is determined that an implicit transaction is currently opened, backing up old application data corresponding to the current application data to be updated;
[0008] Recording the persistent data address of the current application data to be updated in the transaction address table of the implicit transaction, and writing the current application data to be updated into the persistent data address; wherein the persistent data address is a FLASH address;
[0009] When it is determined that the implicit transaction closing condition is triggered, the currently opened implicit transaction is committed and ended.
[0010] According to another aspect of the present invention, there is provided a data updating device based on implicit transactions, which is configured in RTE and includes:
[0011] An application data backup module, configured to back up old application data corresponding to the current application data to be updated when it is determined that the current application data to be updated is persistent data and an implicit transaction is currently enabled;
[0012] The to-be-updated application data writing module is used to record the persistent data address of the current to-be-updated application data in the transaction address table of the implicit transaction, and write the current to-be-updated application data into the persistent data address; wherein the persistent data address is a FLASH address;
[0013] The implicit transaction ending module is used to commit and end the currently opened implicit transaction when it is determined that the implicit transaction closing condition is triggered.
[0014] According to another aspect of the present invention, an operating system is provided, in which a runtime environment is executed, and the operating system executes the implicit transaction-based data update method provided by any embodiment of the present invention through the runtime environment.
[0015] According to another aspect of the present invention, a virtual machine is provided, wherein the virtual machine runs on an operating system, wherein a runtime environment is executed in the operating system, and the operating system executes the implicit transaction-based data update method provided by any embodiment of the present invention through the runtime environment.
[0016] According to another aspect of the present invention, an electronic device is provided, on which the above-mentioned operating system is installed, and the electronic device includes:
[0017] at least one processor; and
[0018] a memory communicatively connected to the at least one processor; wherein,
[0019] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the data update method based on implicit transactions described in any embodiment of the present invention.
[0020] According to another aspect of the present invention, a terminal is provided, comprising the electronic device provided by any embodiment of the present invention.
[0021] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the data update method based on implicit transactions described in any embodiment of the present invention when executed.
[0022] According to another aspect of the present invention, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the data updating method based on implicit transactions described in any embodiment of the present invention is implemented.
[0023] In the embodiment of the present invention, when RTE determines that the current application data to be updated is persistent data and that an implicit transaction is currently opened, the old application data corresponding to the current application data to be updated is backed up, the persistent data address of the current application data to be updated is further recorded in the transaction address table of the implicit transaction, and the current application data to be updated is written into the persistent data address, and when it is determined that the implicit transaction closing condition is triggered, the currently opened implicit transaction is committed and ended, so as to solve the problem of reduced application program running performance due to repeated erasing and writing of record addresses in the process of data update when the existing RTE does not open a transaction, and can improve the application program running performance and the reliability of application program running.
[0024] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0026] Figure 1 is a flow chart of a data updating method based on implicit transactions provided by an embodiment of the present invention;
[0027] Figure 2 is a flow chart of another data updating method based on implicit transactions provided by an embodiment of the present invention;
[0028] Figure 3 It is a flowchart of a data updating method based on implicit transactions provided by an embodiment of the present invention;
[0029] Figure 4 is a schematic diagram of a data updating device based on implicit transactions provided by an embodiment of the present invention;
[0030] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention;
[0031] Figure 6 is a structural diagram of a terminal provided according to an embodiment of the present invention. DETAILED DESCRIPTION
[0032] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0033] It should be noted that the terms "include", "have" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products or apparatus.
[0034] Figure 1 is a flowchart of a data update method based on implicit transactions provided by an embodiment of the present invention. This embodiment is applicable to the case where application data is updated according to an opened implicit transaction. The method can be executed by a data update device based on implicit transactions. The device can be implemented by software and / or hardware and can generally be integrated in an electronic device. The electronic device can be a restricted device. The restricted device can be integrated in a terminal device. The embodiment of the present invention does not limit the specific device type of the restricted device. Accordingly, Figure 1 As shown, the method includes the following operations:
[0035] S110: When it is determined that the current application data to be updated is persistent data and it is determined that an implicit transaction is currently enabled, back up old application data corresponding to the current application data to be updated.
[0036] In an optional embodiment of the present invention, the data update method based on implicit transactions may also include: when determining that the RTE starts processing a target instruction and determining that a transaction is not currently opened, opening the implicit transaction; wherein the target instruction indicates an update operation on the persistent data of the application.
[0037] The target instruction may be an instruction type that instructs to perform an update operation on the persistent data of the application.
[0038] Among them, the current application data to be updated can be the application data that the application currently needs to update in the WebAssembly operating system. Persistent data (non-volatile persistent resource, NVR) is data that can be stored and maintained for a long time during the execution of the application. This data is usually stored in non-volatile memory, will not be lost as the application runs or terminates, and can be read and modified during multiple runs of the application. An implicit transaction means that RTE automatically starts a transaction without calling the start transaction interface "SystemBeginTransaction". The old application data can be the application data used by the application corresponding to the current application data to be updated before the application data is updated.
[0039] In an embodiment of the present invention, an application program may call a system interface provided by an RTE to update application data. When an application program initiates a target instruction to update application data to the RTE, the RTE may first determine whether the current application data to be updated that needs to be updated is persistent data. If the current application data to be updated is not persistent data, it may be directly updated. If the current application data to be updated is persistent data, it may be further determined whether a transaction is currently open. If the RTE determines that a transaction is currently open, such as an explicit transaction or an implicit transaction, the subsequent processing flow may be continued through the currently opened explicit transaction or implicit transaction. If the RTE determines that a transaction is not currently open, that is, the RTE determines that neither an explicit transaction nor an implicit transaction is currently open, an implicit transaction may be automatically opened to continue the subsequent processing flow through the opened implicit transaction. Specifically, the RTE may check whether the application program calls SystemBeginTransaction() to explicitly open a transaction.
[0040] The application calls the transaction management interface provided by the RTE to start, commit, terminate or cancel transactions according to actual needs, which can be called explicit transaction management. However, in the case where an explicit transaction is not opened, in order to improve the update performance of persistent data, an embodiment of the present invention provides a data update method based on implicit transactions. Accordingly, if the RTE determines that the current application data to be updated is persistent data, and determines that an implicit transaction has been opened, the old application data corresponding to the current application data to be updated can be backed up to start the update process of the application data based on the opened implicit transaction. If the RTE determines that the current application data to be updated is persistent data, but the transaction is not currently opened, the RTE can open an implicit transaction in real time to update the application data.
[0041] Optionally, when backing up the old application data corresponding to the current application data to be updated, the data backup can be performed by erasing the FLASH page four times according to the steps of backing up the current application data, recording the persistent data address, writing the new data, and clearing the recorded persistent data address. Alternatively, an improved solution of the backup mechanism can be used, that is, writing the new data to the backup stack page, recording the persistent data address, writing the new data in the backup stack to the persistent data, and clearing the recorded persistent data address, and performing the data backup by erasing the FLASH page twice. As long as the effective backup of the old application data can be successfully completed, the embodiment of the present invention does not limit the specific backup method of the old application data.
[0042] In the embodiment of the present invention, optionally, only one implicit transaction can be opened to ensure the highest system operating performance and data update efficiency. An implicit transaction can involve the processing flow of one instruction, not the processing flow of multiple instructions, and an implicit transaction can process multiple application data update flows through one instruction.
[0043] S120: Record the persistent data address of the current application data to be updated in the transaction address table of the implicit transaction, and write the current application data to be updated into the persistent data address.
[0044] The persistent data address may be a memory address for storing persistent data. Optionally, the persistent data address may be a FLASH address. The transaction address table may be used to record address information involved in a transaction. Optionally, the form and content of the transaction address table may be based on the design of the application data backup mechanism, and may usually be recorded in one or more independent pages. The embodiment of the present invention does not limit the specific form and content of the transaction address table.
[0045] When RTE completes the data backup operation, it can record the persistent data address of the current application data to be updated in the transaction address table of the implicit transaction, thereby recording the persistent data address to a non-volatile storage space that is not on the same page as the backup data. At the same time, the current application data to be updated needs to be written to the persistent data address so that the current application data to be updated can be read and obtained according to the persistent data address recorded in the transaction address table.
[0046] It should be noted that after RTE writes the current application data to be updated to the persistent data address, it needs to keep the implicit transaction open and continue to execute the subsequent application data update process. In other words, if there is a situation of updating persistent data later, it is also considered to be within the scope of implicit transaction processing.
[0047] S130: When it is determined that the implicit transaction closing condition is triggered, commit and end the currently opened implicit transaction.
[0048] Among them, the implicit transaction closing condition can be a condition for closing an implicit transaction, and can be various types of conditional content, as long as it can meet the requirements for closing an implicit transaction. The embodiment of the present invention does not limit the specific conditional content of the implicit transaction closing condition.
[0049] Correspondingly, if RTE determines that the implicit transaction closing condition is triggered during the process of processing the application, such as when the application calls the transaction opening interface provided by RTE, calls the interface that needs to open a transaction independently, or exits the RTE operating environment, it can be determined that the implicit transaction closing condition is triggered. At this time, all the application data to be updated in the implicit transaction can be submitted at once and the currently opened implicit transaction can be ended.
[0050] It should be noted that, in general, explicit transactions and implicit transactions cannot be processed at the same time. If the RTE determines that the application data to be updated is persistent data and that an explicit transaction has been opened, the application data of the application program can be updated in the same manner as above.
[0051] In the embodiment of the present invention, an implicit transaction may include an explicit transaction, that is, the two may be combined, and the implicit transaction may be continuously processed as an explicit transaction, thereby expanding the management scope of the explicit transaction.
[0052] The above technical solution, when updating persistent data after a transaction is not started by calling the interface provided by RTE in the application, by starting an implicit transaction to allow RTE to run the application, the operation of updating persistent data not in the transaction can be completed in an implicit transaction, thereby avoiding multiple submissions to erase the FLASH page. At the same time, the automatic opening and closing of implicit transactions can effectively avoid the problem that the application cannot be re-run after the operating system loses power due to improper use of the explicit transaction interface by the application developer. It can be seen that the above technical solution can improve the operating performance of the application and the reliability of the application operation.
[0053] In the embodiment of the present invention, when RTE determines that the current application data to be updated is persistent data and that an implicit transaction is currently opened, the old application data corresponding to the current application data to be updated is backed up, and the persistent data address of the current application data to be updated is further recorded in the transaction address table of the implicit transaction, and the current application data to be updated is written into the persistent data address, and when it is determined that the implicit transaction closing condition is triggered, the currently opened implicit transaction is committed and ended, so as to solve the problem of reduced application running performance due to repeated erasing and writing of record addresses in the process of updating data when the transaction is not opened during the operation of the existing application, and improve the application running performance and the reliability of the application running.
[0054] Figure 2 is a flowchart of another data updating method based on implicit transactions provided by an embodiment of the present invention. Figure 3 is a flowchart of a data update method based on implicit transactions provided by an embodiment of the present invention. This embodiment is specific based on the above embodiment. In this embodiment, multiple specific optional implementation methods are provided for processing updated data multiple times without closing the implicit transaction and submitting and ending the currently opened implicit transaction. Figure 2 and Figure 3 As shown, the method of this embodiment may include:
[0055] S210: When it is determined that the current application data to be updated is persistent data and it is determined that an implicit transaction is currently enabled, back up old application data corresponding to the current application data to be updated.
[0056] S220: Record the persistent data address of the current application data to be updated in the transaction address table of the implicit transaction, and write the current application data to be updated into the persistent data address.
[0057] S230, determine whether there is a subsequent code program execution process, if so, return to execute S210, otherwise, execute S240.
[0058] That is, after completing the data update in an implicit transaction, the implicit transaction can remain open. When the persistent data needs to be updated again later, it is also considered to be within the processing scope of the implicit transaction.
[0059] S240: Determine the condition that triggers the closing of the implicit transaction, exit the RTE, and commit and end the currently opened implicit transaction.
[0060] If the application does not call the explicit transaction interface provided by RTE to open an explicit transaction, and if the transaction in the operating system is not opened when updating persistent data, RTE automatically opens an implicit transaction; otherwise, the persistent data update process continues under the current implicit transaction environment.
[0061] Specifically, Figure 3 As shown, the process of updating persistent data executed by RTE may include the following operations:
[0062] (1) The application runs the code program in the RTE operating environment and calls the system interface provided by the RTE to update the application data.
[0063] (2) RTE checks whether the updated application data is persistent data. If it is not persistent data, it is directly updated and the current application data to be updated can be written to the address where the data is located. At this time, the address where the data to be updated is written can be a memory address. If it is persistent data, continue to the next step.
[0064] (3) RTE checks whether a transaction is currently open, including explicit transactions or implicit transactions. If no transaction of any type is open, RTE can automatically open an implicit transaction. If it is determined that a transaction is open, including explicit transactions or implicit transactions, the next step of the process is continued.
[0065] (4) Back up the old data that is not currently updated (i.e., old application data) to the backup stack.
[0066] (5) Record the persistent data address in the transaction address table of the currently opened transaction (explicit transaction or implicit transaction).
[0067] (6) Write the current application data to be updated to the address where the persistent data is located. At this time, the address where the persistent data to be written to the current application data to be updated is located can be a FLASH address. Keep the currently opened transaction (explicit transaction or implicit transaction) open, continue to execute the subsequent application, and enter step (1).
[0068] (7) After the program code is executed, exit the RTE operating environment to end the currently opened explicit transaction or implicit transaction.
[0069] It should be noted that there is no possibility for the application to actively terminate or cancel the implicit transaction. When ending the currently opened implicit transaction, you can submit all application data to be updated and then close the implicit transaction.
[0070] In an optional embodiment of the present invention, the data update method based on implicit transactions may also include: when it is determined that an exception occurs during the running of the application and the RTE is exited, identifying the implicit transaction and committing all update operations that update the application data in the implicit transaction; clearing the transaction address table page of the implicit transaction and closing the implicit transaction.
[0071] It is understandable that an exception may occur during the operation of an application. After RTE opens an implicit transaction during the operation of an application, when an exception occurs during the operation of the application, resulting in the exit of the RTE operating environment, RTE needs to identify the implicit transaction and commit all persistent data update operations in the transaction, then clear the pages of the transaction address table at one time, and then close the implicit transaction.
[0072] In an optional embodiment of the present invention, the data update method based on implicit transactions may also include: when it is determined that the operating system loses power during the running of the application, waiting for the operating system to be powered on again; when it is determined that the implicit transaction exists, clearing the transaction address table page of the implicit transaction and closing the implicit transaction.
[0073] In the embodiment of the present invention, when the operating system loses power during the running of the application, the old application data corresponding to the persistent data and the address in the transaction address table have been recorded after the implicit transaction is started. After the operating system is powered on again, if it is determined that there is an implicit transaction, the transaction processing can be completed according to the following steps:
[0074] (1) Check whether there are transactions, including explicit transactions and implicit transactions.
[0075] (2) If it is determined that an explicit transaction exists, all old data that updates persistent data is restored to the application data storage address, the transaction address table of the explicit transaction is cleared, and the explicit transaction is closed.
[0076] (3) If it is determined that an implicit transaction exists, since the application data to be updated has been written to the persistent data address in advance, the transaction address table of the implicit transaction can be cleared and the implicit transaction can be closed. All contents that update persistent data in the implicit transaction are committed.
[0077] (4) If no transaction exists, no processing is performed.
[0078] In an optional embodiment of the present invention, submitting and ending the currently opened implicit transaction may include: when it is determined that the application code execution is completed and the RTE is exited, submitting all application data to be updated and closing the implicit transaction; and erasing all pages where the transaction address table of the implicit transaction is located at one time.
[0079] In an embodiment of the present invention, the conditions for triggering the closing of an implicit transaction may include the abnormal exit of the RTE due to the completion of the application program, the active calling of the explicit transaction interface provided by the RTE by the application program, and the calling of the interface provided by the RTE that requires independent transaction processing by the application program.
[0080] Optionally, if the application completes code execution and does not call the SystemCommitTransaction() interface to commit the transaction or an exception occurs during the operation to exit the RTE operating environment, there may be three situations: implicit transactions, explicit transactions, or no transactions. Specifically, if there is an explicit transaction, RTE can terminate or cancel all operations to update data in all explicit transactions, and restore the content of the persistent data of the current application data to be updated to the data before the explicit transaction was opened according to the transaction address table of the explicit transaction and the backed-up old application data. If there is an implicit transaction, all application data to be updated can be committed to avoid data loss caused by power failure, and then the implicit transaction can be closed. Finally, all pages where the transaction address table in the implicit transaction is recorded are erased at once. If there is no transaction, no processing is performed and exit is performed.
[0081] In an optional embodiment of the present invention, submitting and ending the currently opened implicit transaction may include: when it is determined that an explicit transaction opening interface is called during the running of the application, submitting all application data to be updated and closing the implicit transaction; and erasing all pages where the transaction address table of the implicit transaction is located at one time.
[0082] Optionally, when an implicit transaction is enabled during the running of the application, and the explicit transaction enable interface provided by the RTE is actively called, the RTE can process it as follows: Check whether there is a transaction currently enabled. If there is an explicit transaction, throw a transaction enable exception. If there is no explicit transaction, further check whether there is an implicit transaction. If there is an implicit transaction, all application data to be updated can be submitted, the implicit transaction can be closed, and finally the page where the transaction address table of the implicit transaction is located can be erased all at once. If there is no implicit transaction, the explicit transaction can be enabled normally.
[0083] In an optional embodiment of the present invention, submitting and ending the currently opened implicit transaction may include: when it is determined that the application calls an interface provided by the RTE that requires independent transaction processing, submitting all application data to be updated and closing the implicit transaction; and erasing all pages where the transaction address table of the implicit transaction is located at one time.
[0084] The independent transaction processing interface provided by RTE may be, for example, a non-atomic copy interface: u16arrayCopyNonAtomic(u8*dst,u8*src,u16 len) and a non-atomic fill interface: u16arrayFillNonAtomic(u8*dst,u16 bLen,u8 bValue), etc. The embodiment of the present invention does not limit the specific interface type and function of the independent transaction processing interface provided by RTE.
[0085] Optionally, during the application running process, after RTE opens an implicit transaction, when it calls the interface for independent transaction processing provided by RTE, since the interface for independent transaction processing is different from the transaction start interface for explicit transaction, although explicitly started transactions are allowed before executing the interface for independent transaction processing, implicit transactions need to complete transaction submission before executing this interface. Therefore, RTE needs to first check whether there is an implicit transaction at present. If there is an implicit transaction, all application data to be updated can be submitted first. After closing the implicit transaction, all pages where the transaction address table of the implicit transaction is located will be erased at once. If neither implicit transaction nor explicit transaction exists, the interface for opening explicit transaction is executed, and then the interface for independent transaction processing is executed. When the interface execution is completed and the interface is exited, the transaction is committed and the explicit transaction is closed. If there is an explicit transaction, the interface for independent transaction processing is directly executed, and the interface is exited after the interface execution is completed, without changing the current explicit transaction opening state.
[0086] It should be noted that in the above-mentioned multiple application scenarios of submitting and ending the currently opened implicit transaction, in the case of implicit transactions, since the application data to be updated has been written to the address where the persistent data is located, the process of submitting all the application data to be updated is essentially marking the transaction status, so that the data will not be restored after the subsequent power failure and restart. It should also be noted that in the above scheme, the operation of submitting all the application data to be updated, closing the implicit transaction, and erasing all the pages where the transaction address table of the implicit transaction is located at one time can also replace the submission of all data by erasing the address table.
[0087] The above technical solution, when RTE determines that the current application data to be updated is persistent data and that an implicit transaction has been opened, backs up the old application data corresponding to the current application data to be updated, further records the persistent data address of the current application data to be updated in the transaction address table of the implicit transaction, and writes the current application data to be updated into the persistent data address, and when it is determined that any condition that triggers the closing of the implicit transaction occurs, submits all the application data to be updated, closes the implicit transaction, and erases all the pages where the transaction address table of the implicit transaction is located at one time, which can solve the problem of reduced application running performance due to repeated erasing of the record address in the process of data update when the existing RTE does not open the transaction, and can improve the application running performance and the reliability of the application running.
[0088] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information are in compliance with the relevant laws and regulations and do not violate public order and good morals.
[0089] It should be noted that any arrangement and combination of the technical features in the above embodiments also falls within the protection scope of the present invention.
[0090] Figure 4 is a schematic diagram of a data updating device based on implicit transactions provided by an embodiment of the present invention, such as Figure 4 As shown, the device includes: an application data backup module 310, a to-be-updated application data writing module 320 and an implicit transaction ending module 330, wherein:
[0091] The application data backup module 310 is used to back up old application data corresponding to the current application data to be updated when it is determined that the current application data to be updated is persistent data and an implicit transaction is currently opened;
[0092] The to-be-updated application data writing module 320 is used to record the persistent data address of the current to-be-updated application data in the transaction address table of the implicit transaction, and write the current to-be-updated application data into the persistent data address;
[0093] The implicit transaction ending module 330 is used to commit and end the currently opened implicit transaction when it is determined that the implicit transaction closing condition is triggered.
[0094] In the embodiment of the present invention, when RTE determines that the current application data to be updated is persistent data and that an implicit transaction is currently opened, the old application data corresponding to the current application data to be updated is backed up, the persistent data address of the current application data to be updated is further recorded in the transaction address table of the implicit transaction, and the current application data to be updated is written into the persistent data address, and when it is determined that the implicit transaction closing condition is triggered, the currently opened implicit transaction is committed and ended, so as to solve the problem of reduced application program running performance due to repeated erasing and writing of record addresses in the process of data update when the existing RTE does not open a transaction, and can improve the application program running performance and the reliability of application program running.
[0095] Optionally, the data update device based on implicit transactions may also include an abnormal exit processing module, which is used to: when it is determined that an exception occurs during the running of the application program and exits the RTE, identify the implicit transaction and commit all update operations that update the application data in the implicit transaction; clear the transaction address table page of the implicit transaction and close the implicit transaction.
[0096] Optionally, the data update device based on implicit transactions may also include a system power failure processing module, which is used to: when it is determined that the operating system has lost power during the running of the application, wait for the operating system to be powered on again; when it is determined that the implicit transaction exists, clear the transaction address table page of the implicit transaction and close the implicit transaction.
[0097] Optionally, the data update device based on implicit transactions may further include an implicit transaction start module, which is used to: when it is determined that the RTE starts processing a target instruction and it is determined that the transaction is not currently started, start the implicit transaction; wherein the target instruction indicates an update operation on the persistent data of the application.
[0098] Optionally, the data update device based on implicit transactions may also include a loop execution module, which is used to: when it is determined that there is a subsequent code program execution process, return to execute the operation of backing up the old application data corresponding to the current application data to be updated when it is determined that the current application data to be updated is persistent data and when it is determined that the implicit transaction is currently opened, until exiting the RTE and committing and ending the currently opened implicit transaction.
[0099] Optionally, the implicit transaction ending module 330 is further used to: when it is determined that the application code execution is completed, submit all application data to be updated and close the implicit transaction; and erase all pages where the transaction address table of the implicit transaction is located at one time.
[0100] Optionally, the implicit transaction ending module 330 is further used to: when it is determined that the explicit transaction start interface is called during the running of the application, submit all application data to be updated and close the implicit transaction; and erase all pages where the transaction address table of the implicit transaction is located at one time.
[0101] Optionally, the implicit transaction ending module 330 is further used to: submit all application data to be updated and close the implicit transaction when it is determined that the application calls the independent transaction processing interface provided by the RTE; and erase all pages where the transaction address table of the implicit transaction is located at one time.
[0102] The above-mentioned data updating device based on implicit transactions can execute the data updating method based on implicit transactions provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method. For technical details not described in detail in this embodiment, please refer to the data updating method based on implicit transactions provided by any embodiment of the present invention.
[0103] Since the data update device based on implicit transactions introduced above is a device that can execute the data update method based on implicit transactions in the embodiment of the present invention, based on the data update method based on implicit transactions introduced in the embodiment of the present invention, the technical personnel in the field can understand the specific implementation of the data update device based on implicit transactions in this embodiment and its various variations, so how the data update device based on implicit transactions implements the data update method based on implicit transactions in the embodiment of the present invention is not introduced in detail here. As long as the technical personnel in the field implement the device used by the data update method based on implicit transactions in the embodiment of the present invention, it belongs to the scope of protection of this application.
[0104] An embodiment of the present invention further provides an operating system, in which a runtime environment is executed. The operating system executes the implicit transaction-based data update method provided by any embodiment of the present invention through the runtime environment.
[0105] An embodiment of the present invention further provides a virtual machine, which runs on an operating system. A runtime environment is executed in the operating system, and the operating system executes the implicit transaction-based data update method provided by any embodiment of the present invention through the runtime environment.
[0106] Figure 5 A schematic structural diagram of an electronic device 10 that can be used to implement an embodiment of the present invention is shown.
[0107] like Figure 5 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a non-volatile memory (NVM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the non-volatile memory (NVM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the NVM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0108] The I / O interface 15 in the electronic device 10 may include: ISO7816, ISO14443, eSPI (Enhanced Serial Peripheral Interface) and SPI (Serial Peripheral Interface), etc.
[0109] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 11 executes the various methods and processes described above, for example, executes a data update method based on implicit transactions as described in various embodiments of the present invention, which is executed by a runtime environment in an operating system, and the operating system is installed in an electronic device, and the method includes:
[0110] When it is determined that the current application data to be updated is persistent data and it is determined that an implicit transaction is currently opened, backing up old application data corresponding to the current application data to be updated;
[0111] Recording the persistent data address of the current application data to be updated in the transaction address table of the implicit transaction, and writing the current application data to be updated into the persistent data address;
[0112] When it is determined that the implicit transaction closing condition is triggered, the currently opened implicit transaction is committed and ended.
[0113] In some embodiments, a data update method based on implicit transactions as described in various embodiments of the present invention may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the NVM 12. When the processor 11 executes the computer program stored in the NVM 12 or the computer program loaded into the random access memory (RAM) 13 by the execution unit 18, one or more steps of the data update method based on implicit transactions as described in various embodiments of the present invention described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute a data update method based on implicit transactions as described in various embodiments of the present invention in any other appropriate manner (for example, by means of firmware).
[0114] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0115] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0116] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0117] Figure 6 is a structural diagram of a terminal provided according to an embodiment of the present invention. Figure 6 Said terminal comprises the electronic device 10 as described in any embodiment of the present invention.
[0118] The electronic device 10 may be a restricted device. Optionally, the restricted device may include but is not limited to an embedded security element, a smart card, a SE (Secure Element), an embedded device, and the like.
[0119] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0120] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A data update method based on implicit transactions, characterized in that: Applied to the runtime environment RTE, including: When it is determined that the current application data to be updated is persistent data and it is determined that an implicit transaction is currently opened, backing up old application data corresponding to the current application data to be updated; Recording the persistent data address of the current application data to be updated in the transaction address table of the implicit transaction, and writing the current application data to be updated into the persistent data address; wherein the persistent data address is a FLASH address; When it is determined that the implicit transaction closing condition is triggered, the currently opened implicit transaction is committed and ended.
2. The method according to claim 1, characterized in that After writing the current application data to be updated into the persistent data address, the method further includes: If it is determined that there is a subsequent code program execution process, return to execute the operation of backing up the old application data corresponding to the current application data to be updated when it is determined that the current application data to be updated is persistent data and the implicit transaction is currently opened, until exiting the RTE, committing and ending the currently opened implicit transaction.
3. The method according to claim 1, characterized in that The submitting and ending the currently opened implicit transaction includes: When it is determined that the execution of the application code is completed, all application data to be updated are submitted and the implicit transaction is closed; All pages where the transaction address table of the implicit transaction is located are erased at one time.
4. The method according to claim 1, characterized in that: The submitting and ending the currently opened implicit transaction includes: When it is determined that an explicit transaction opening interface is called during the running of the application program, all application data to be updated are submitted and the implicit transaction is closed; All pages where the transaction address table of the implicit transaction is located are erased at one time.
5. A data updating device based on implicit transactions, characterized in that: Configured in RTE, including: An application data backup module, configured to back up old application data corresponding to the current application data to be updated when it is determined that the current application data to be updated is persistent data and an implicit transaction is currently enabled; The to-be-updated application data writing module is used to record the persistent data address of the current to-be-updated application data in the transaction address table of the implicit transaction, and write the current to-be-updated application data into the persistent data address; wherein the persistent data address is a FLASH address; The implicit transaction ending module is used to commit and end the currently opened implicit transaction when it is determined that the implicit transaction closing condition is triggered.
6. An operating system, characterized in that: A runtime environment is executed in the operating system, and the operating system executes the implicit transaction-based data update method according to any one of claims 1 to 4 through the runtime environment.
7. A virtual machine, characterized in that: The virtual machine runs on an operating system, a runtime environment is executed in the operating system, and the operating system executes the implicit transaction-based data update method according to any one of claims 1 to 4 through the runtime environment.
8. An electronic device, characterized in that: The electronic device is installed with the operating system according to claim 6, and the electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the implicit transaction-based data update method according to any one of claims 1 to 4.
9. A terminal, characterized in that: Contains an electronic device as described in claim 8.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the implicit transaction-based data update method according to any one of claims 1 to 4 when executed.
Citation Information
Patent Citations
Method for quickly downloading eSIM card
CN112188477A
Transaction submission control method and device, electronic equipment and storage medium
CN118193088A
Flash data power failure protection method and device
WO2022126470A1
Cited By
Data updating method and device based on implicit transactions, operating system, virtual machine, equipment, terminal, medium and program
CN121501302A
