Data updating method and device based on implicit transactions, operating system, virtual machine, equipment, terminal, medium and program
By using an implicit transaction mechanism to back up data and record addresses when updating persistent data, the performance degradation caused by repeated erasure and rewriting is resolved, thereby improving the performance and reliability of the application.
Patent Information
- Application Number
- CN202411200476.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2026-02-10
AI Technical Summary
In existing technologies, when applications update persistent data, the lack of transactions leads to repeated erasure of the FLASH page, resulting in performance degradation and reliability issues.
An implicit transaction mechanism is adopted. When it is determined that the data to be updated is persistent data and implicit transactions have been enabled, the data is backed up and the address table is recorded. The updated data is committed when the implicit transaction is closed, thus avoiding repeated writes.
It improves the performance and reliability of applications and reduces performance degradation caused by repeated erasure and rewriting.
Smart Images

Figure CN121501302A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of computer application, and particularly relate to a data updating method and device based on implicit transaction, an operating system, a virtual machine, equipment, a terminal, a medium and a program. BACKGROUND
[0002] WebAssembly (Wasm for short) is a method of using non-JavaScript code and running it in a browser, which can be C, C++ or Rust, etc. After loading into the client browser, it can run at near-native speed. In a WebAssembly-based embedded operating system, a transaction is a logical method proposed for updating persistent data in non-volatile storage space, and is an indivisible part. In the transaction process, all update operations will maintain consistency and integrity, that is, either all persistent data is updated or none is updated. If the transaction cannot be completed, all update operations will be restored, that is, the persistent data is restored to the state before the transaction starts. This mechanism can prevent power failure events during transaction processing and prevent errors that may cause data corruption when all steps of the transaction are not completed normally.
[0003] In the prior art, to ensure the consistency of updating persistent data, an application needs to call the start transaction interface "systemBeginTransaction()" provided by the RTE (Runtime Environment) of the WebAssembly embedded operating system to explicitly start a transaction, and after the update is completed, explicitly call the end transaction interface, such as the systemCommitTransaction() interface to commit the transaction, or the systemAbortTransaction() interface to terminate or cancel the transaction. If the transaction is committed, the contents of the persistent data updated during the transaction will not be restored to the data between the start and end of the transaction; if the transaction is terminated or canceled, the contents of the persistent data updated during the transaction will be restored to the data between the start and end of the transaction.
[0004] Generally, the application program can call the transaction management interface according to actual needs to ensure the consistency of the updated persistent data. If the transaction management interface is not called, the RTE does not guarantee the consistency of the updated persistent data. The RTE backs up the current old data each time the persistent data is updated, then writes new data into the persistent data, and discards the backup data after the transaction is committed to ensure that the backup data is not restored to the data before the update, that is, the address of the record is cleared. In this process, 4 times of erasing and writing FLASH (Flash EEPROM Memory, flash) pages are involved, that is, backing up the current data, recording the address of the persistent data, writing new data, and clearing the recorded address of the persistent data. In order to prevent the chip from losing power and causing data loss due to erasing and writing FLASH pages, each time the persistent data is updated, the process of backing up the current data or writing new data into the backup stack is required, and the process of committing data writing is required to complete the persistent data update, that is, writing new data into the persistent data address and clearing the recorded address. Therefore, without starting the transaction, each time the persistent data is updated, the process of repeatedly erasing and writing the recorded address is required, which causes the more the persistent data is updated, the slower the overall performance of the application program is. SUMMARY
[0005] Embodiments of the present application provide a data update method and device based on implicit transactions, an operating system, a virtual machine, a device, a terminal, a medium and a program, which can improve the running performance of an application program and the reliability of the running of the application program.
[0006] According to an aspect of the present application, a data update method based on implicit transactions is provided, which is applied to an RTE, and includes the following steps.
[0007] In a case where it is determined that the current application data to be updated is persistent data and it is determined that an implicit transaction has been started, old application data corresponding to the current application data to be updated is backed up.
[0008] The address of the persistent data of the current application data to be updated is recorded in a transaction address table of the implicit transaction, and the current application data to be updated is written into the address of the persistent data.
[0009] In a case where it is determined that an implicit transaction closing condition is triggered, the current implicit transaction that has been started is committed and ended.
[0010] According to another aspect of the present application, a data update device based on implicit transactions is provided, which is configured in an RTE, and includes the following steps.
[0011] An application data backup module is configured to, in a case where it is determined that the current application data to be updated is persistent data and it is determined that an implicit transaction has been started, back up old application data corresponding to the current application data to be updated.
[0012] a to-be-updated application data writing module, configured to record a persistent data address of the current to-be-updated application data in a transaction address table of the implicit transaction, and write the current to-be-updated application data into the persistent data address;
[0013] an implicit transaction ending module, configured to commit and end the current started implicit transaction in a case where it is determined that an implicit transaction closing condition is triggered.
[0014] According to another aspect of the present application, there is provided an operating system in which a runtime environment is executed, and the operating system executes the implicit transaction-based data updating method provided by any of the embodiments of the present application through the runtime environment.
[0015] According to another aspect of the present application, there is provided a virtual machine running on an operating system in which a runtime environment is executed, and the operating system executes the implicit transaction-based data updating method provided by any of the embodiments of the present application through the runtime environment.
[0016] According to another aspect of the present application, there is provided an electronic device on which the above-mentioned operating system is installed, and the electronic device comprises:
[0017] at least one processor; and
[0018] a memory in communication connection with 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 to enable the at least one processor to execute the implicit transaction-based data updating method provided by any of the embodiments of the present application.
[0020] According to another aspect of the present application, there is provided a terminal comprising the electronic device provided by any of the embodiments of the present application.
[0021] According to another aspect of the present application, there is provided a computer readable storage medium storing computer instructions for enabling a processor to implement the implicit transaction-based data updating method provided by any of the embodiments of the present application when executed by the processor.
[0022] According to another aspect of the present application, there is also provided a computer program product comprising a computer program for implementing the implicit transaction-based data updating method provided by any of the embodiments of the present application when executed by a processor.
[0023] The embodiment of the application backs up the old application data corresponding to the current application data to be updated in the case of determining that the current application data to be updated is persistent data and determining that the current implicit transaction is started, 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, in the case of determining that the implicit transaction closing condition is triggered, submits and ends the current started implicit transaction, solves the problem of application program running performance reduction due to repeated erasing and writing of recording addresses in the process of updating data without starting transaction in the existing RTE, and can improve the application program running performance and the reliability of the application program running.
[0024] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the application, nor to limit the scope of the application. Other features of the application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the embodiments of the application, the drawings needed in the embodiment description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0026] Figure 1 is a flowchart of a data updating method based on an implicit transaction provided by the embodiment of the application;
[0027] Figure 2 is a flowchart of another data updating method based on an implicit transaction provided by the embodiment of the application;
[0028] Figure 3 is a flowchart of a data updating method based on an implicit transaction provided by the embodiment of the application;
[0029] Figure 4 is a schematic diagram of a data updating device based on an implicit transaction provided by the embodiment of the application;
[0030] Figure 5 is a structural schematic diagram of an electronic device provided by the embodiment of the application;
[0031] Figure 6 is a structural diagram of a terminal provided by the embodiment of the application. DETAILED DESCRIPTION
[0032] In the following, the technical solutions in the embodiments of the present application will be described clearly and completely with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part but not all of the embodiments of the present application. Based on the embodiments in the present application, all the other embodiments obtained by a person of ordinary skill in the art without creative work shall fall into the protection scope of the present application.
[0033] It should be noted that the terms "comprising" and "having" and any variations thereof are intended to cover a non-exclusive inclusion, for example, a process, method, system, product or device that includes a list of steps or units need not be limited to those clearly listed, but can include other steps or units that are not clearly listed or inherent to such processes, methods, products or devices.
[0034] Figure 1 is a flowchart of a data updating method based on an implicit transaction provided by an embodiment of the present application. The embodiment can be applicable to the case of updating application data according to an opened implicit transaction. The method can be executed by a data updating device based on an implicit transaction. The device can be realized by software and / or hardware, and can be generally integrated in an electronic device. The electronic device can be a restricted device, which can be integrated in a terminal device. The embodiment of the present application does not limit the specific type of the restricted device. Correspondingly, as shown in Figure 1 the method includes the following operations.
[0035] S110, in the case of determining that the current application data to be updated is persistent data and determining that an implicit transaction is currently opened, backing up old application data corresponding to the current application data to be updated.
[0036] In an optional embodiment of the present application, the data updating method based on an implicit transaction can further include: in the process of determining that the RTE starts processing a target instruction, and determining that no transaction is currently opened, opening the implicit transaction; wherein the target instruction indicates an update operation on persistent data of an application program.
[0037] The target instruction can be an instruction type indicating an update operation on persistent data of an application program.
[0038] The current application data to be updated can be application data that the application currently needs to update in the operating system of WebAssembly. The non-volatile persistent resource (NVR) is data that can be stored and maintained for a long time during the execution of the application. Such data is usually stored in non-volatile memory and will not be lost with the running or termination of the application, and can be read and modified in multiple runs of the application. The implicit transaction refers to that the RTE automatically starts a transaction without calling the start transaction interface SystemBeginTransaction. The old application data can be application data used by the application corresponding to the current application data to be updated before updating the application data.
[0039] In the embodiments of the present application, the application can call the system interface provided by the RTE to update the application data. When the application initiates the target instruction of updating the application data to the RTE, the RTE can 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 can be directly updated. If the current application data to be updated is persistent data, it can be further determined whether a transaction has been started. If the RTE determines that a transaction has been started, such as an explicit transaction or an implicit transaction has been started, the subsequent processing flow can be continued through the explicit transaction or the implicit transaction that has been started. If the RTE determines that no transaction has been started, that is, the RTE determines that neither an explicit transaction nor an implicit transaction has been started, an implicit transaction can be automatically started to continue the subsequent processing flow through the started implicit transaction. Specifically, the RTE can check whether the application calls SystemBeginTransaction() to explicitly start a transaction.
[0040] The application calls the transaction management interface provided by the RTE to start a transaction, submit a transaction, terminate a transaction, or cancel a transaction according to actual needs, which can be called explicit transaction management. However, in the case where no explicit transaction is started, in order to improve the update performance of persistent data, the embodiments of the present application provide a data update method based on an implicit transaction. Accordingly, if the RTE determines that the current application data to be updated is persistent data and determines that an implicit transaction has been started, 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 started implicit transaction. If the RTE determines that the current application data to be updated is persistent data, but no transaction has been started, the RTE can start an implicit transaction in real time to perform the update process of the application data.
[0041] Optionally, when the old application data corresponding to the current application data to be updated is backed up, the data backup can be performed according to the steps of backing up the current application data, recording the persistent data address, writing new data, and clearing the recorded persistent data address, and the data backup can be performed according to the way of erasing the FLASH page four times. Alternatively, the improved backup mechanism can also be used, that is, the new data is written into the backup stack page, the persistent data address is recorded, the new data in the backup stack is written into the persistent data, and the recorded persistent data address is cleared, and the data backup can be performed according to the way of erasing the FLASH page twice. As long as the effective backup of the old application data can be successfully completed, the specific backup method of the old application data is not limited in the embodiment of the application.
[0042] In the embodiment of the application, optionally, only one implicit transaction can be started to ensure the highest running performance and data updating efficiency of the system. The implicit transaction can involve the processing flow of one instruction and not involve the processing flow of multiple instructions, and the implicit transaction can process the updating flow of application data multiple times 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 can be a memory address for storing persistent data. Optionally, the persistent data address can be a FLASH address. The transaction address table can be used to record the address information involved in the transaction. Optionally, the form and content of the transaction address table can be designed according to the application data backup mechanism, and in general, the form and content are recorded in one or more independent pages, and the specific form and content of the transaction address table are not limited in the embodiment of the application.
[0045] When the RTE completes the data backup operation, the persistent data address of the current application data to be updated can be recorded in the transaction address table of the implicit transaction, so that the persistent data address is recorded in the non-volatile storage space which is not in the same page as the backup data. At the same time, the current application data to be updated needs to be written into the persistent data address, so as to read and obtain the current application data to be updated according to the persistent data address recorded in the transaction address table.
[0046] It should be noted that after the RTE writes the current application data to be updated into the persistent data address, the start state of the implicit transaction needs to be kept unchanged, and the data updating flow of the subsequent application program needs to be continued. That is, if the subsequent application program also encounters the updating of the persistent data, it is also considered to be within the processing range of the implicit transaction.
[0047] S130, in the case where it is determined that the implicit transaction closing condition is triggered, the current started implicit transaction is committed and ended.
[0048] The implicit transaction closing condition can be any condition for closing the implicit transaction, and can be of various types, as long as it meets the requirement of closing the implicit transaction. This embodiment of the invention does not limit the specific content of the implicit transaction closing condition.
[0049] Correspondingly, if RTE determines that the implicit transaction closure condition has been triggered during the processing of the application, such as when the application calls the transaction start interface provided by RTE, calls its own interface that needs to start a transaction independently, or exits the RTE runtime environment, it can be determined that the implicit transaction closure condition has been triggered. At this time, all application data to be updated in the implicit transaction can be committed at once, and the currently started implicit transaction can be closed.
[0050] It should be noted that, generally, explicit transactions and implicit transactions cannot be processed simultaneously. If the RTE determines that the application data to be updated is persistent data and that an explicit transaction is already enabled, then the same method described above can be used to update the application data.
[0051] In this embodiment of the invention, implicit transactions may include explicit transactions, that is, the two can be merged and the implicit transaction can be processed as an explicit transaction, thereby expanding the management scope of explicit transactions.
[0052] The above technical solution, when updating persistent data in the application without initiating a transaction through the interface provided by RTE, allows RTE to run the application by enabling implicit transactions. This ensures that operations that update persistent data outside of a transaction are completed within an implicit transaction, thus avoiding multiple commits and writes to the Flash page. Furthermore, the automatic initiation and termination of implicit transactions effectively prevents the application from failing to restart after a power outage due to improper use of explicit transaction interfaces by the application developer. Therefore, the above technical solution can improve the application's performance and reliability.
[0053] This invention, through Real-Time Execution (RTE), determines that the application data to be updated is persistent data and that implicit transactions are currently enabled. It then 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 to the persistent data address. When the implicit transaction closure condition is triggered, the currently enabled implicit transaction is committed and terminated. This solves the problem of reduced application performance caused by repeated erasing and rewriting of record addresses during data updates when transactions are not enabled in existing applications. It improves application performance and reliability.
[0054] Figure 2 This is a flowchart of another data update method based on implicit transactions provided in an embodiment of the present invention. Figure 3 This is a flowchart illustrating a data update method based on implicit transactions provided by an embodiment of the present invention. This embodiment is a specific modification of the above embodiment, and provides several specific optional implementation methods for processing updated data multiple times and committing and ending the currently enabled implicit transaction without closing the implicit transaction. Correspondingly, as... Figure 2 and Figure 3 As shown, the method in this embodiment may include:
[0055] S210. If it is determined that the application data to be updated is persistent data and that implicit transactions have been enabled, the old application data corresponding to the application data to be updated is backed up.
[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 if there is a subsequent code execution flow. If yes, return to execute S210; otherwise, execute S240.
[0058] In other words, once data updates are completed within an implicit transaction, the implicit transaction can remain open indefinitely. Subsequent updates to persistent data are also considered to fall within the scope of the implicit transaction.
[0059] S240. Determine the implicit transaction closing condition, exit RTE, and commit and end the currently started 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 is not started in the operating system when updating persistent data, RTE will automatically start an implicit transaction; otherwise, the process of updating persistent data will continue to be executed in the current implicit transaction environment.
[0061] Specifically, such as Figure 3 As shown, the process of RTE performing persistent data updates may include the following operations:
[0062] (1) The application runs code in the RTE runtime environment and calls the system interface provided by RTE to update application data.
[0063] (2) RTE checks whether the application data to be updated is persistent data. If it is not persistent data, it updates directly by writing the current application data to be updated to the address where the data is located. At this time, the address where the current application data to be updated is written can be a memory address. If it is persistent data, it continues to the next step.
[0064] (3) RTE checks whether a transaction is currently active, including explicit or implicit transactions. If no transaction of any type is active, RTE can automatically start an implicit transaction. If it is determined that a transaction is active, including explicit or implicit transactions, then proceed to the next step of the process.
[0065] (4) Back up the old data that has not been 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 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 current application data to be updated is written to the persistent data can be a FLASH address. Keep the currently opened transaction (explicit or implicit transaction) in the open state and continue to execute the subsequent application, proceeding to step (1).
[0068] (7) After the program code is executed, exit the RTE runtime environment and end the currently started explicit or implicit transaction.
[0069] It's important to note that implicit transactions cannot be actively terminated or canceled by the application. When ending a currently open implicit transaction, you can commit 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 further include: when it is determined that the running program encounters an exception and exits the RTE during the operation of the application, identifying the implicit transaction and submitting all update operations for updating 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 exceptions may occur during application runtime. When RTE enables implicit transactions during application runtime, if an exception occurs during application runtime and causes it to exit the RTE runtime environment, RTE needs to identify the implicit transaction, commit all update operations of persistent data in the transaction, clear the pages of the transaction address table all at once, and then close the implicit transaction.
[0072] In an optional embodiment of the present invention, the data update method based on implicit transactions may further include: if it is determined that the operating system loses power during the operation of the application, waiting for the operating system to be powered on again; if 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 this embodiment of the invention, when the operating system loses power during application operation, the implicit transaction has already recorded the old application data corresponding to the persistent data and the address in the transaction address table. After the operating system restarts, if it is determined that the implicit transaction exists, the transaction processing can be completed according to the following steps:
[0074] (1) Check if there are any transactions, including explicit transactions and implicit transactions.
[0075] (2) If it is determined that an explicit transaction exists, restore all old data that updates persistent data to the application data storage address, clear the transaction address table of the explicit transaction, and close the explicit transaction.
[0076] (3) If an implicit transaction is confirmed to exist, since the application data to be updated has already been written to the persistent data address in advance, the transaction address table of the implicit transaction can be cleared and the implicit transaction closed. All content that updates persistent data within the implicit transaction is committed.
[0077] (4) If no transaction exists, no action is taken.
[0078] In an optional embodiment of the present invention, the step of submitting and ending the currently enabled implicit transaction may include: when it is determined that the application code has finished executing and exited RTE, submitting all application data to be updated and closing the implicit transaction; and erasing all pages containing the transaction address table of the implicit transaction at once.
[0079] In this embodiment of the invention, the conditions for triggering implicit transaction closure can include various situations such as the application exiting the RTE abnormally upon completion of execution, the application actively calling the explicit transaction interface provided by the RTE, and the application calling the interface provided by the RTE that requires independent transaction processing. Optionally, if the application completes code execution without calling the SystemCommitTransaction() interface to commit the transaction or exits the RTE runtime environment abnormally during execution, there may be three situations: implicit transaction, explicit transaction, or no transaction. Specifically, if an explicit transaction exists, the RTE can terminate or cancel all data update operations in all explicit transactions, and restore the content of the persistent data of the application data to be updated to the data before the explicit transaction was started, based on the transaction address table of the explicit transaction and the backed-up old application data. If an implicit transaction exists, all application data to be updated can be committed to avoid data loss due to power failure, then the implicit transaction can be closed, and finally the page containing the transaction address table of the implicit transaction can be completely erased at once. If there is no transaction, no processing is performed and the application exits.
[0080] In an optional embodiment of the present invention, the step of submitting and ending the currently enabled implicit transaction may include: when it is determined that the application calls the explicit transaction start interface during the application's operation, submitting all application data to be updated and closing the implicit transaction; and erasing all pages containing the transaction address table of the implicit transaction at once.
[0081] Optionally, if an application starts an implicit transaction during runtime and then actively calls the explicit transaction start interface provided by RTE, RTE can handle it as follows: Check if a transaction is currently running. If an explicit transaction exists, throw a transaction start exception. If no explicit transaction exists, further check if an implicit transaction exists. If an implicit transaction exists, commit all application data to be updated, close the implicit transaction, and finally erase all pages containing the transaction address table of the implicit transaction. If no implicit transaction exists, start an explicit transaction normally.
[0082] In an optional embodiment of the present invention, the step of submitting and ending the currently enabled implicit transaction may include: when it is determined that the application calls the interface provided by RTE that requires independent transaction processing, submitting all application data to be updated and closing the implicit transaction; and erasing all pages containing the transaction address table of the implicit transaction at once.
[0083] The independent transaction processing interfaces provided by RTE can be, for example, non-atomic copy interfaces: u16arrayCopyNonAtomic(u8*dst, u8*src, u16 len) and non-atomic fill interfaces: u16arrayFillNonAtomic(u8*dst, u16 bLen, u8 bValue), etc. This embodiment of the invention does not limit the specific interface type and function of the independent transaction processing interfaces provided by RTE.
[0084] Optionally, during application runtime, if RTE starts an implicit transaction and then calls the independent transaction processing interface provided by RTE, the interface for independent transaction processing differs from the interface for starting an explicit transaction. Therefore, while an explicitly started transaction is allowed before executing the independent transaction processing interface, implicit transactions require completion and commit before this interface is executed. Thus, RTE first checks if an implicit transaction exists. If an implicit transaction exists, it commits all application data to be updated, closes the implicit transaction, and erases all pages containing the transaction address table of the implicit transaction. If neither an implicit nor an explicit transaction exists, it starts an explicit transaction, then executes the interface for independent transaction processing. Upon completion and exiting the interface, it commits the transaction and closes the explicit transaction. If an explicit transaction exists, it directly executes the interface for independent transaction processing, exits the interface after completion, and does not change the current explicit transaction start state.
[0085] It's important to note that in the various application scenarios described above where an implicit transaction is committed and terminated, when an implicit transaction exists, since the application data to be updated has already been written to the address of persistent data, the process of committing all application data to be updated essentially marks the transaction state, ensuring that the data will not be recovered after a power outage and restart. It should also be noted that the operation described above—committing all application data to be updated, closing the implicit transaction, and erasing the page containing the implicit transaction's address table—can also be achieved by erasing the address table instead of committing all data.
[0086] The above technical solution, through RTE, determines that the application data to be updated is persistent data and that implicit transactions are currently enabled. It backs up the old application data corresponding to the application data to be updated, further records the persistent data address of the application data to be updated in the transaction address table of the implicit transaction, and writes the application data to be updated to the persistent data address. When any condition for triggering the implicit transaction to close is determined, all application data to be updated is committed, the implicit transaction is closed, and the page containing the transaction address table of the implicit transaction is completely erased at once. This can solve the problem of reduced application performance caused by repeated erasure and writing of record addresses during data updates when RTE does not enable transactions, and can improve application performance and reliability.
[0087] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information in this technical solution comply with relevant laws and regulations and do not violate public order and good morals.
[0088] It should be noted that any arrangement or combination of the technical features in the above embodiments also falls within the protection scope of this invention.
[0089] Figure 4 This is a schematic diagram of a data update device based on implicit transactions provided in an embodiment of the present invention, as shown below. Figure 4 As shown, the device includes: an application data backup module 310, an application data to be updated writing module 320, and an implicit transaction termination module 330, wherein:
[0090] The application data backup module 310 is used to back 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 that implicit transactions have been enabled.
[0091] The application data to be updated writing module 320 is used to 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.
[0092] The implicit transaction termination module 330 is used to commit and terminate the currently started implicit transaction when it is determined that the implicit transaction closure condition has been triggered.
[0093] This invention, through the Real-Time Execution (RTE), determines that the application data to be updated is persistent data and that implicit transactions are currently enabled. It then backs up the old application data corresponding to the application data to be updated, records the persistent data address of the application data to be updated in the transaction address table of the implicit transaction, and writes the application data to be updated to the persistent data address. When the implicit transaction closure condition is triggered, the currently enabled implicit transaction is committed and terminated. This solves the problem of reduced application performance caused by repeated erasing and rewriting of record addresses during data updates when transactions are not enabled in existing RTEs, thereby improving application performance and reliability.
[0094] Optionally, the data update device based on implicit transactions may further include an exception exit handling module, used to: identify the implicit transaction and submit all update operations for updating application data in the implicit transaction when it is determined that the running program encounters an exception and exits the RTE during the application's operation; clear the transaction address table page of the implicit transaction and close the implicit transaction.
[0095] Optionally, the data update device based on implicit transactions may further include a system power failure handling module, used to: wait for the operating system to power up again when it is determined that the operating system has lost power during the application's operation; and clear the transaction address table page of the implicit transaction and close the implicit transaction when it is determined that the implicit transaction exists.
[0096] Optionally, the data update apparatus based on implicit transactions may further include an implicit transaction initiation module, used to: initiate the implicit transaction when it is determined that the RTE has started processing a target instruction and that no transaction is currently initiated; wherein the target instruction instructs an update operation on the persistent data of the application.
[0097] Optionally, the data update device based on implicit transactions may further include a loop execution module, used to: if it is determined that there is a subsequent code program execution flow, return to execute the operation of backing up the old application data corresponding to the current application data to be updated, if it is determined that the current application data to be updated is persistent data and if it is determined that implicit transactions have been started, until exiting RTE, submitting and ending the currently started implicit transaction.
[0098] Optionally, the implicit transaction termination module 330 is further configured to: commit all application data to be updated and close the implicit transaction when it is determined that the application code has been executed; and erase all pages containing the transaction address table of the implicit transaction at once.
[0099] Optionally, the implicit transaction termination module 330 is further configured to: commit all application data to be updated and close the implicit transaction when it is determined that the explicit transaction start interface is called during the application's operation; and erase all pages containing the transaction address table of the implicit transaction at once.
[0100] Optionally, the implicit transaction termination module 330 is further configured to: commit all application data to be updated and close the implicit transaction when it is determined that the application has called the interface for independent transaction processing provided by the RTE; and erase all pages containing the transaction address table of the implicit transaction at once.
[0101] The aforementioned data update apparatus based on implicit transactions can execute the data update method based on implicit transactions provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the method. Technical details not described in detail in this embodiment can be found in the data update method based on implicit transactions provided in any embodiment of the present invention.
[0102] Since the implicit transaction-based data update device described above is an apparatus capable of executing the implicit transaction-based data update method in the embodiments of the present invention, those skilled in the art can understand the specific implementation and various variations of the implicit transaction-based data update device in this embodiment based on the implicit transaction-based data update method described in the embodiments of the present invention. Therefore, how the implicit transaction-based data update device implements the implicit transaction-based data update method in the embodiments of the present invention will not be described in detail here. Any apparatus used by those skilled in the art to implement the implicit transaction-based data update method in the embodiments of the present invention falls within the scope of protection of this application.
[0103] This invention also provides an operating system that executes a runtime environment, through which the operating system executes the implicit transaction-based data update method provided in any embodiment of this invention.
[0104] This invention also provides a virtual machine that runs on an operating system. The operating system has a runtime environment, and the operating system executes the implicit transaction-based data update method provided in any embodiment of this invention through the runtime environment.
[0105] Figure 5 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown.
[0106] like Figure 5As shown, the electronic device 10 includes at least one processor 11 and a memory, such as non-volatile memory (NVM) 12, random access memory (RAM) 13, etc., communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the NVM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, NVM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0107] 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.
[0108] Processor 11 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, central processing unit (CPU), graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, for example, performing a data update method based on implicit transactions as described in various embodiments of the present invention, executed by a runtime environment in an operating system installed in an electronic device, the method comprising:
[0109] If it is determined that the application data to be updated is persistent data and that implicit transactions have been enabled, the old application data corresponding to the application data to be updated is backed up.
[0110] 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;
[0111] If the implicit transaction closure condition is determined to be triggered, the currently opened implicit transaction is committed and terminated.
[0112] In some embodiments, the implicit transaction-based data update method described in the various embodiments of the present invention can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 10 via NVM 12. When processor 11 executes the computer program stored in NVM 12 or the computer program loaded into random access memory (RAM) 13 by execution storage unit 18, it can perform one or more steps of the implicit transaction-based data update method described above in the various embodiments of the present invention. Alternatively, in other embodiments, processor 11 can be configured by any other suitable means (e.g., by means of firmware) to execute the implicit transaction-based data update method described in the various embodiments of the present invention.
[0113] Various embodiments 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-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0114] Computer programs used to implement 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, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0115] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0116] Figure 6 This is a structural diagram of a terminal provided according to an embodiment of the present invention. Figure 6 The terminal includes the electronic device 10 as described in any embodiment of the present invention.
[0117] The electronic device 10 can be a restricted device. Optionally, the restricted device can include, but is not limited to, an embedded secure element, a smart card, an SE (Secure Element), and an embedded device.
[0118] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and no limitation is imposed herein.
[0119] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A data update method based on implicit transactions, characterized in that, Applied to the runtime environment RTE, including: If it is determined that the application data to be updated is persistent data and that implicit transactions have been enabled, the old application data corresponding to the application data to be updated is backed up. 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; If the implicit transaction closure condition is determined to be triggered, the currently opened implicit transaction is committed and terminated.
2. The method according to claim 1, characterized in that, The method further includes: If it is determined that the application program encounters an exception and exits the RTE during the application's operation, the implicit transaction is identified and all update operations that update application data in the implicit transaction are committed. Clear the transaction address table page of the implicit transaction and close the implicit transaction.
3. The method according to claim 1, characterized in that, The method further includes: If it is determined that the operating system lost power during the application's operation, wait for the operating system to be powered on again; If the existence of the implicit transaction is confirmed, the transaction address table page of the implicit transaction is cleared, and the implicit transaction is closed.
4. The method according to claim 1, further comprising: If it is determined that the RTE has started processing a target instruction and that no transaction is currently in operation, then the implicit transaction is started. The target instruction instructs an update operation on the persistent data of the application.
5. The method according to claim 1, characterized in that, After writing the current application data to be updated to the persistent data address, the process further includes: If it is determined that there is a subsequent code execution flow, return to the operation of backing up the old application data corresponding to the current application data to be updated, if it is determined that the current application data to be updated is persistent data and that an implicit transaction has been started, until exit RTE, commit and end the currently started implicit transaction.
6. The method according to claim 1 or 5, characterized in that, The submission and termination of the currently initiated implicit transaction includes: Once the application code execution is complete, commit all application data to be updated and close the implicit transaction; The entire page containing the transaction address table of the implicit transaction is erased at once.
7. The method according to claim 1 or 5, characterized in that, The submission and termination of the currently initiated implicit transaction includes: If it is determined that the explicit transaction start interface is called during application runtime, commit all application data to be updated and close the implicit transaction; The entire page containing the transaction address table of the implicit transaction is erased at once.
8. The method according to claim 1 or 5, characterized in that, The submission and termination of the currently initiated implicit transaction includes: If it is determined that the application is calling the independent transaction processing interface provided by RTE, commit all application data to be updated and close the implicit transaction; The entire page containing the transaction address table of the implicit transaction is erased at once.
9. A data update device based on implicit transactions, characterized in that, Configuration in RTE includes: The application data backup module is used to back 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 that implicit transactions have been enabled. The application data to be updated writing module is used to 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. The implicit transaction termination module is used to commit and terminate the currently started implicit transaction when the implicit transaction closure condition is determined to be triggered.
10. An operating system, characterized in that, The operating system executes a runtime environment, and the operating system executes the implicit transaction-based data update method of any one of claims 1-8 through the runtime environment.
11. A virtual machine, characterized in that, The virtual machine runs on an operating system, which executes a runtime environment. The operating system executes the data update method based on implicit transactions according to any one of claims 1-8 through the runtime environment.
12. An electronic device, characterized in that, The electronic device is equipped with the operating system of claim 10, 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 that can be executed by the at least one processor to enable the at least one processor to perform the implicit transaction-based data update method of any one of claims 1-8.
13. The electronic device according to claim 12, characterized in that, The electronic device includes a restricted device.
14. The electronic device according to claim 13, characterized in that, The restricted devices are smart cards, security elements (SEs), and embedded devices.
15. A terminal, characterized in that, It includes the electronic device as described in any one of claims 12-14.
16. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the implicit transaction-based data update method of any one of claims 1-8.
17. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the implicit transaction-based data update method according to any one of claims 1-8.
Citation Information
Patent Citations
Performing mode switching in an unbounded transactional memory (UTM) system
CN102741826A
Method for quickly downloading eSIM card
CN112188477A
Transaction recording method and system
CN116225627A
Transaction submission control method and device, electronic equipment and storage medium
CN118193088A
Data updating method and device based on implicit transaction, operating system, virtual machine, equipment, terminal and medium
CN119088421A