CN114063930B - Nonvolatile memory medium data updating method and device - Google Patents

Nonvolatile memory medium data updating method and device Download PDF

Info

Publication number
CN114063930B
CN114063930B CN202111414248.9A CN202111414248A CN114063930B CN 114063930 B CN114063930 B CN 114063930B CN 202111414248 A CN202111414248 A CN 202111414248A CN 114063930 B CN114063930 B CN 114063930B
Authority
CN
China
Prior art keywords
data
serial number
initial value
numerical value
stored
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111414248.9A
Other languages
Chinese (zh)
Other versions
CN114063930A (en
Inventor
陈业夫
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
New H3C Big Data Technologies Co Ltd
Original Assignee
New H3C Big Data Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by New H3C Big Data Technologies Co Ltd filed Critical New H3C Big Data Technologies Co Ltd
Priority to CN202111414248.9A priority Critical patent/CN114063930B/en
Publication of CN114063930A publication Critical patent/CN114063930A/en
Application granted granted Critical
Publication of CN114063930B publication Critical patent/CN114063930B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/062Securing storage systems
    • G06F3/0622Securing storage systems in relation to access
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The invention discloses a nonvolatile memory medium data updating method, a device, electronic equipment and a storage medium, wherein the method comprises the following steps: performing atomic operation processing on the original data to obtain a first processed numerical value corresponding to the first serial number; and judging whether the second processed numerical value is larger than the first processed numerical value, if so, releasing the original data stored in the first data space, otherwise, ignoring the processing. According to the data updating method, the writing times and the data quantity of the NVM are reduced by writing the updated data into the new second data space, and the data spaces in which the original data are stored and the updated data are stored can be accurately identified by comparing the sizes of the serial numbers corresponding to the original data and the updated data; therefore, the data space storing the original data can be accurately released, and the utilization rate of the data space is effectively improved.

Description

Nonvolatile memory medium data updating method and device
Technical Field
The present invention relates to the field of network security technologies, and in particular, to a method and an apparatus for updating data in a nonvolatile memory medium.
Background
The NVM (Non Volatile Memory ) medium is a new storage medium technology that has been developed in recent years, and unlike the case of data loss after power-down of a normal memory, the data written therein can still be kept after power-down, i.e. the data before power-down can still be read after power-up again. In addition, the NVM is accessed in bytes and has a fast read/write speed, which is only slightly slower than normal memory. Because of these new characteristics of NVM, it has become increasingly popular in storage systems.
However, there are unique places to pay attention to the programming of NVM. One such point is that during the writing of the NVM, power loss may occur at any time. To ensure that software can continue to run after a power up again, it is often required that the write of the NVM be atomic. For example, one piece of data recording address information is: the ocean lake area of Beijing city is marked with the ground eight street 8. Suppose it is required to be modified as: the urban Gaoxin district and Letwo street No. 2. If the data is directly modified and a power down occurs at the time of modification, the data may be after powering up again: the urban high-new area is formed with the ground eight street 8, thereby causing a remarkable error. Therefore, for NVM media, the atomicity of data updates must be achieved, i.e., after power down and power up, either all old data or all new data in the NVM.
To achieve atomicity of data update, the following journaling scheme is a commonly employed data update scheme.
Assuming that an old data exists in a certain data space on the NVM, a new data needs to be written now, and the method for ensuring the atomicity of writing the new data by using the log scheme specifically comprises the following steps:
step a1: distributing a log space in the NVM nonvolatile memory;
step a2: writing new data into the log space;
step a3: writing a flag (atomic operation) to validate the log;
step a4: writing new data into the data space;
step a5: clearing log validity flags (atomic operations);
step a6: the log space is freed.
At system power up, it is checked that if there is a valid log space, its data is overlaid to the corresponding data space. According to the process, the power is turned off at any time in the updating process of the NVM data, and the atomicity of the data can be guaranteed by the log scheme. And powering down before the log takes effect, powering up again, taking effect of old data, and otherwise taking effect of new data.
How to solve the problems of more writing times and more writing data in the log scheme is a technical problem to be solved.
Disclosure of Invention
Accordingly, it is necessary to provide a method, an apparatus, an electronic device, and a storage medium for updating data in a nonvolatile memory medium, in order to solve the problems of a large number of writes and a large amount of written data existing in the conventional journal scheme.
In a first aspect, an embodiment of the present application provides a method for updating data of a nonvolatile memory medium, where the method includes:
responding to a data updating instruction for data updating, allocating a preset number of second data spaces for original data which are applied to a nonvolatile memory (NVM) and stored in first data spaces, wherein the second data spaces are used for writing updated data corresponding to the original data, the first data spaces are configured with first serial numbers, each second data space is configured with a corresponding second serial number, the initial value of the first serial number is a first initial value, and the length of the first serial number and the length of the second serial number are both configured as bytes with preset lengths;
writing the updated data into the second data space, wherein the initial value of the second serial number is a second initial value, and the first initial value is larger than the second initial value;
performing atomic operation processing on the updated data to obtain a second processed numerical value corresponding to the second serial number; performing atomic operation processing on the original data to obtain a first processed numerical value corresponding to the first serial number;
judging whether the second processed numerical value is larger than the first processed numerical value, releasing the original data stored in the first data space if the second processed numerical value is larger than the first processed numerical value, otherwise, ignoring the processing.
In one implementation, the performing atomic operation processing on the update data includes:
and configuring the value corresponding to the second serial number from the second initial value to the second processed value.
In one implementation, the performing atomic operation processing on the raw data includes:
and configuring the value corresponding to the first serial number from the first initial value to the first processed value.
In one implementation, the allocating, in response to the data update instruction for performing the data update, a preset number of second data spaces for the original data applied to the nonvolatile memory NVM and stored in the first data spaces includes:
and in response to the data updating instruction for data updating, allocating one second data space for the original data which is applied to the nonvolatile memory NVM and stored in the first data space.
In one implementation, the allocating, in response to the data update instruction for performing the data update, a preset number of second data spaces for the original data applied to the nonvolatile memory NVM and stored in the first data spaces includes:
and in response to the data updating instruction for data updating, two second data spaces are allocated for original data which is applied to the nonvolatile memory NVM and stored in the first data spaces.
In a second aspect, an embodiment of the present application provides a nonvolatile memory medium data updating apparatus, where the apparatus includes:
the allocation module is used for responding to a data updating instruction for updating data, allocating a preset number of second data spaces for original data which are applied to the nonvolatile memory NVM and stored in first data spaces, wherein the second data spaces are used for writing updated data corresponding to the original data, the first data spaces are configured with first serial numbers, each second data space is configured with a corresponding second serial number, the initial value of the first serial number is a first initial value, and the length of the first serial number and the length of the second serial number are configured as bytes with preset lengths;
the writing module is used for writing the updated data into the second data space distributed by the distribution module, the initial value of the second serial number is a second initial value, and the first initial value is larger than the second initial value;
the atomic operation module is used for performing atomic operation processing on the updated data to obtain a second processed numerical value corresponding to the second serial number; performing atomic operation processing on the original data to obtain a first processed numerical value corresponding to the first serial number;
and the processing module is used for judging whether the second processed numerical value obtained by the atomic operation module is larger than the first processed numerical value obtained by the atomic operation module, releasing the original data stored in the first data space if the second processed numerical value is judged to be larger than the first processed numerical value, otherwise, ignoring the processing.
In a third aspect, embodiments of the present application provide an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor running the computer program to implement the method steps as described above.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium having stored thereon a computer program for execution by a processor to perform the method steps described above.
The technical scheme provided by the embodiment of the application can comprise the following beneficial effects:
in the embodiment of the application, performing atomic operation processing on the updated data to obtain a second processed numerical value corresponding to the second serial number; performing atomic operation processing on the original data to obtain a first processed numerical value corresponding to the first serial number; and judging whether the second processed numerical value is larger than the first processed numerical value, if so, releasing the original data stored in the first data space, otherwise, ignoring the processing. According to the nonvolatile memory medium data updating method, the writing times and the data quantity of the NVM are reduced by writing the updating data into the new second data space, and the data spaces in which the original data are stored can be accurately identified by comparing the sizes of the serial numbers corresponding to the original data and the updating data; therefore, the data space storing the original data can be accurately released, and the utilization rate of the data space is effectively improved. It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention as claimed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
Fig. 1 is a flow chart of a method for updating data of a nonvolatile memory medium according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a method for updating data of a nonvolatile memory medium in a specific application scenario according to an embodiment of the present disclosure;
fig. 3 is a further schematic diagram of a method for updating data of a nonvolatile memory medium in a specific application scenario provided in the embodiment of the present application;
fig. 4 is a schematic structural diagram of a nonvolatile memory medium data updating device according to an embodiment of the present application;
fig. 5 shows a schematic diagram of an electronic device connection structure according to an embodiment of the present application.
Detailed Description
The following description and the drawings sufficiently illustrate specific embodiments of the invention to enable those skilled in the art to practice them.
It should be understood that the described embodiments are merely some, but not all, embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Alternative embodiments of the present disclosure are described in detail below with reference to the drawings.
Fig. 1 is a schematic flow chart of a method for updating data of a nonvolatile memory medium according to an embodiment of the present application; as shown in fig. 1, an embodiment of the present application provides a method for updating data of a nonvolatile memory medium, which specifically includes the following method steps:
s102: in response to a data update instruction for performing data update, a preset number of second data spaces are allocated for original data which is applied to the nonvolatile memory NVM and stored in the first data spaces, the second data spaces are used for writing updated data corresponding to the original data, the first data spaces are configured with first serial numbers, each second data space is configured with a corresponding second serial number, an initial value of the first serial number is a first initial value, and the length of the first serial number and the length of the second serial number are both configured as bytes with preset lengths.
In an actual application scenario, the preset length of the first sequence number byte may be adjusted according to requirements of different application scenarios, for example, the preset length of the first sequence number byte is set to 8 bytes, or the preset length of the first sequence number byte is set to 4 bytes.
Similarly, in the actual application scenario, the preset length of the second serial number byte may be adjusted according to the requirements of different application scenarios, for example, the preset length of the second serial number byte is set to 8 bytes, or the preset length of the second serial number byte is set to 4 bytes.
In one possible implementation, in response to a data update instruction for performing a data update, allocating a preset number of second data spaces for original data applied to the nonvolatile memory NVM and stored in the first data spaces includes the steps of:
in response to a data update instruction for performing a data update, a second data space is allocated for the original data applied to the non-volatile memory NVM and stored in the first data space.
In one possible implementation, in response to a data update instruction for performing a data update, allocating a preset number of second data spaces for original data applied to the nonvolatile memory NVM and stored in the first data spaces includes the steps of:
in response to a data update instruction for performing a data update, two second data spaces are allocated for original data applied to the nonvolatile memory NVM and stored in the first data spaces.
Comparing the implementation manner of allocating one second data space with the implementation manner of allocating two second data spaces, the latter data updating method is suitable for application scenarios with wider NVM capacity and higher performance requirements.
S104: and writing the updated data into a second data space, wherein the initial value of the second serial number is a second initial value, and the first initial value is larger than the second initial value.
S106: performing atomic operation processing on the updated data to obtain a second processed numerical value corresponding to the second serial number; and performing atomic operation processing on the original data to obtain a first processed numerical value corresponding to the first serial number.
In the embodiment of the present application, the following description is made for an atomic operation:
atomic operations refer to operations that are not interrupted by a thread scheduling mechanism; the atomic operation, once started, runs all the way to the end, without switching in the middle to another thread.
In one possible implementation, performing atomic operation processing on the update data includes the steps of:
and configuring the value corresponding to the second serial number from the second initial value to a second processed value.
In the embodiment of the present application, the second initial value and the second processed value are not particularly limited. For example, in a specific application scenario, the second initial value is 0 and the second processed value is 101.
In one possible implementation, performing atomic operation processing on the original data includes the following steps:
and configuring the value corresponding to the first serial number from the first initial value to be a first processed value.
In the embodiment of the present application, the first initial value and the first processed value are not particularly limited. For example, in a specific application scenario, the first initial value is 100, and the first processed value is 0.
S108: judging whether the second processed numerical value is larger than the first processed numerical value, if so, releasing the original data stored in the first data space, otherwise, ignoring the processing.
In an actual application scene, if the second processed numerical value is judged to be larger than the first processed numerical value, releasing the original data stored in the first data space; in this way, the utilization rate of the data space is effectively improved.
Fig. 2 is a schematic diagram of a method for updating data of a nonvolatile memory medium in a specific application scenario according to an embodiment of the present application.
The "new write+sequence number" mechanism employed by the data update method shown in fig. 2 can thus guarantee the atomicity of the NVM data update, as follows:
step b0: setting an 8-byte sequence number (seq) for the data in the NVM, wherein the sequence number and the data are in one-to-one correspondence; specifically, the different data are completely independent, and similarly, the serial numbers of the different data are also completely independent. If seq is 0, this indicates that the data space is free and unused, and then 1 is added to the seq each time the data is updated. Assuming the current seq of the data is 100, the data now needs to be updated;
step b1: allocating a new data space, whose seq is 0;
step b2: writing new data first, the seq of which is still 0;
step b3: setting the seq corresponding to the new data to be 101 (atomic operation);
step b4: setting the seq corresponding to the old data to 0 (atomic operation);
step b5: the old data space is freed.
If the data is powered down when the data is updated, the data with larger seq is valid data and the data with smaller seq is released (the seq is set to 0) when the data is powered up again; thus, the atomicity can be ensured when the power is turned off at any time in the data updating process.
Specifically, the first case: if power is down after step b1 or step b2, the new data space is considered to be idle and unused since seq of the space is 0 after the power is again up, so that the old data is validated.
Second case: if the power is turned off after the step b3 and then turned on, the seq corresponding to the new and old data is compared, so that the new data is effective;
third case: if powered down after b4 or b5, the old data space is considered to be idle and unused since the seq of the space is 0 after being powered up again, so that new data is validated.
In the practical application scene, the 8-byte seq can be accumulated all the time, and the overturn condition can not occur. Of course, if it can be guaranteed that no flip occurs, a smaller seq is also possible, such as 4 bytes, as long as it is guaranteed that its modification is an atomic operation.
The data updating method shown in fig. 2 has the following advantages compared with the existing log scheme:
advantage 1: only one data write and two seq writes are equivalent to reducing one data write, so that the data update method has faster write speed and longer NVM life.
Advantage 2: a separate log space area is not required to be managed, and only the original data space is required to be increased (and only one data space is required to be increased at minimum), so that the implementation process of software is simplified.
Fig. 3 is a schematic diagram of a method for updating data of a nonvolatile memory medium in a specific application scenario according to an embodiment of the present application.
In comparison with the data updating method shown in fig. 2, if the data space is larger, the data updating method shown in fig. 3 may be further adopted, which is specifically described as follows:
step c0: an 8-byte sequence number (seq) is set for data in NVM, while two such spaces (i.e., two data spaces and two seq spaces) are allocated for each data, where the data with the large seq is valid data. Assuming that the two seq of a certain data are 10 and 9, the valid data is the one corresponding to 10. The data now needs to be updated;
step c1: the data space with seq being 9 is invalid data, and new data is written into the data space;
step c2: modifying seq from 9 to 11 (atomic operation).
In the data updating method provided by the embodiment of the application, at any moment, the data with the large seq is effective data. The data update method as shown in fig. 3 has the following advantages over the data update method as shown in fig. 2:
advantage 1: only one data write and one seq write;
advantage 2: there is no need to allocate and free up data space.
Note that, since the data updating method shown in fig. 3 requires twice the data space, the data updating method shown in fig. 3 is suitable for an application scenario where the NVM capacity is relatively abundant and the performance requirement is relatively high.
In the embodiment of the application, atomic operation processing is performed on the updated data to obtain a second processed numerical value corresponding to the second serial number; performing atomic operation processing on the original data to obtain a first processed numerical value corresponding to the first serial number; and judging whether the second processed numerical value is larger than the first processed numerical value, if so, releasing the original data stored in the first data space, otherwise, ignoring the processing. According to the nonvolatile memory medium data updating method, the writing times and the data quantity of the NVM are reduced by writing the updating data into the new second data space, and the data spaces in which the original data are stored can be accurately identified by comparing the sizes of the serial numbers corresponding to the original data and the updating data; therefore, the data space storing the original data can be accurately released, and the utilization rate of the data space is effectively improved.
The following is an embodiment of a device for updating data of a nonvolatile memory medium according to the embodiment of the present application, which may be used to execute an embodiment of a method for updating data of a nonvolatile memory medium according to the embodiment of the present application. For details not disclosed in the embodiments of the apparatus for updating data of a nonvolatile memory medium in the embodiments of the present application, please refer to an embodiment of a method for updating data of a nonvolatile memory medium in the embodiments of the present application.
Referring to fig. 4, a schematic structural diagram of a nonvolatile memory medium data updating apparatus according to an exemplary embodiment of the invention is shown. The non-volatile memory medium data updating means may be implemented as whole or part of the terminal by software, hardware or a combination of both. The nonvolatile memory medium data updating apparatus includes an allocation module 402, a writing module 404, an atomic operation module 406, and a processing module 408.
Specifically, the allocating module 402 is configured to allocate, in response to a data update instruction for performing data update, a preset number of second data spaces for original data applied to the nonvolatile memory NVM and stored in the first data spaces, where the second data spaces are used for writing updated data corresponding to the original data, the first data spaces are configured with first serial numbers, each of the second data spaces are configured with corresponding second serial numbers, an initial value of the first serial numbers is a first initial value, and a length of the first serial numbers and a length of the second serial numbers are both configured as bytes with preset lengths;
a writing module 404, configured to write the update data into the second data space allocated by the allocation module 402, where the initial value of the second sequence number is a second initial value, and the first initial value is greater than the second initial value;
an atomic operation module 406, configured to perform atomic operation processing on the update data to obtain a second processed numerical value corresponding to the second serial number; performing atomic operation processing on the original data to obtain a first processed numerical value corresponding to the first serial number;
the processing module 408 is configured to determine whether the second processed value obtained by the atomic operation module 406 is greater than the first processed value obtained by the atomic operation module 406, and release the original data stored in the first data space if it is determined that the second processed value is greater than the first processed value, or ignore the processing if it is not.
Optionally, the atomic operation module 406 is specifically configured to:
and configuring the value corresponding to the second serial number from the second initial value to a second processed value.
Optionally, the atomic operation module 406 is specifically configured to:
and configuring the value corresponding to the first serial number from the first initial value to be a first processed value.
Optionally, the allocation module 402 is specifically configured to:
in response to a data update instruction for performing a data update, a second data space is allocated for the original data applied to the non-volatile memory NVM and stored in the first data space.
Optionally, the allocation module 402 is specifically configured to:
in response to a data update instruction for performing a data update, two second data spaces are allocated for original data applied to the nonvolatile memory NVM and stored in the first data spaces.
It should be noted that, when the nonvolatile memory medium data updating apparatus provided in the foregoing embodiment performs the nonvolatile memory medium data updating method, only the division of the foregoing functional units is used as an example, in practical application, the foregoing functional allocation may be completed by different functional units according to needs, that is, the internal structure of the device is divided into different functional units, so as to complete all or part of the functions described above. In addition, the nonvolatile memory medium data updating device and the nonvolatile memory medium data updating method provided in the foregoing embodiments belong to the same concept, and the implementation process is detailed in the nonvolatile memory medium data updating method embodiment, which is not described herein again.
In this embodiment of the present application, the atomic operation module is configured to perform atomic operation processing on the update data to obtain a second processed numerical value corresponding to the second serial number; performing atomic operation processing on the original data to obtain a first processed numerical value corresponding to the first serial number; and the processing module is used for judging whether the second processed numerical value obtained by the atomic operation module is larger than the first processed numerical value obtained by the atomic operation module, if so, releasing the original data stored in the first data space, otherwise, ignoring the processing. According to the nonvolatile memory medium data updating device, the writing times and the data quantity of the NVM are reduced by writing the updating data into the new second data space, and the data spaces in which the original data are stored can be accurately identified by comparing the sizes of the serial numbers corresponding to the original data and the updating data; therefore, the data space storing the original data can be accurately released, and the utilization rate of the data space is effectively improved.
As shown in fig. 5, the present embodiment provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor running the computer program to implement the method steps as described above.
The present embodiments provide a storage medium storing computer readable instructions, on which a computer program is stored, the program being executed by a processor to implement the method steps as described above.
Referring now to fig. 5, a schematic diagram of an electronic device suitable for use in implementing embodiments of the present application is shown. The terminal device in the embodiments of the present application may include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 5 is only an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present application.
As shown in fig. 5, the electronic device may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 501, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 502 or a program loaded from a storage means 508 into a Random Access Memory (RAM) 503. In the RAM503, various programs and data required for the operation of the electronic device are also stored. The processing device 501, the ROM502, and the RAM503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
In general, the following devices may be connected to the I/O interface 505: input devices 506 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 507 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 508 including, for example, magnetic tape, hard disk, etc.; and communication means 509. The communication means 509 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. While fig. 5 shows an electronic device having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 509, or from the storage means 508, or from the ROM 502. The above-described functions defined in the methods of the embodiments of the present application are performed when the computer program is executed by the processing device 501.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present application may be implemented by software, or may be implemented by hardware. Wherein the names of the units do not constitute a limitation of the units themselves in some cases.
The foregoing disclosure is only illustrative of the preferred embodiments of the present application and is not intended to limit the scope of the claims herein, as the equivalent of the claims herein shall be construed to fall within the scope of the claims herein.

Claims (8)

1. A method for updating data of a nonvolatile memory medium, the method comprising:
responding to a data updating instruction for data updating, allocating a preset number of second data spaces for original data which are applied to a nonvolatile memory (NVM) and stored in first data spaces, wherein the second data spaces are used for writing updated data corresponding to the original data, the first data spaces are configured with first serial numbers, each second data space is configured with a corresponding second serial number, the initial value of the first serial number is a first initial value, and the length of the first serial number and the length of the second serial number are both configured as bytes with preset lengths;
writing the updated data into the second data space, wherein the initial value of the second serial number is a second initial value, and the first initial value is larger than the second initial value;
performing atomic operation processing on the updated data to obtain a second processed numerical value corresponding to the second serial number; performing atomic operation processing on the original data to obtain a first processed numerical value corresponding to the first serial number;
wherein, the atomic operation processing on the update data includes: configuring a value corresponding to a second serial number from the second initial value to the second processed value;
the atomic operation processing on the original data comprises the following steps: configuring a value corresponding to a first serial number from the first initial value to the first processed value;
judging whether the second processed numerical value is larger than the first processed numerical value, releasing the original data stored in the first data space if the second processed numerical value is larger than the first processed numerical value, otherwise, ignoring the processing.
2. The method of claim 1, wherein allocating a predetermined amount of second data space for the original data applied to the non-volatile memory NVM and stored in the first data space in response to the data update instruction for performing the data update comprises:
and in response to the data updating instruction for data updating, allocating one second data space for the original data which is applied to the nonvolatile memory NVM and stored in the first data space.
3. The method of claim 1, wherein allocating a predetermined amount of second data space for the original data applied to the non-volatile memory NVM and stored in the first data space in response to the data update instruction for performing the data update comprises:
and in response to the data updating instruction for data updating, two second data spaces are allocated for original data which is applied to the nonvolatile memory NVM and stored in the first data spaces.
4. A non-volatile memory medium data updating apparatus, the apparatus comprising:
the allocation module is used for responding to a data updating instruction for updating data, allocating a preset number of second data spaces for original data which are applied to the nonvolatile memory NVM and stored in first data spaces, wherein the second data spaces are used for writing updated data corresponding to the original data, the first data spaces are configured with first serial numbers, each second data space is configured with a corresponding second serial number, the initial value of the first serial number is a first initial value, and the length of the first serial number and the length of the second serial number are configured as bytes with preset lengths;
the writing module is used for writing the updated data into the second data space distributed by the distribution module, the initial value of the second serial number is a second initial value, and the first initial value is larger than the second initial value;
the atomic operation module is used for performing atomic operation processing on the updated data to obtain a second processed numerical value corresponding to the second serial number; performing atomic operation processing on the original data to obtain a first processed numerical value corresponding to the first serial number;
and the processing module is used for judging whether the second processed numerical value obtained by the atomic operation module is larger than the first processed numerical value obtained by the atomic operation module, releasing the original data stored in the first data space if the second processed numerical value is judged to be larger than the first processed numerical value, otherwise, ignoring the processing.
5. The apparatus of claim 4, wherein the atomic operation module is specifically configured to:
and configuring the value corresponding to the second serial number from the second initial value to the second processed value.
6. The apparatus of claim 4, wherein the atomic operation module is specifically configured to:
and configuring the value corresponding to the first serial number from the first initial value to the first processed value.
7. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor runs the computer program to implement the data updating method of any of claims 1-3.
8. A computer-readable storage medium, on which a computer program is stored, characterized in that the program is executed by a processor to implement the data updating method according to any of claims 1-3.
CN202111414248.9A 2021-11-25 2021-11-25 Nonvolatile memory medium data updating method and device Active CN114063930B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111414248.9A CN114063930B (en) 2021-11-25 2021-11-25 Nonvolatile memory medium data updating method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111414248.9A CN114063930B (en) 2021-11-25 2021-11-25 Nonvolatile memory medium data updating method and device

Publications (2)

Publication Number Publication Date
CN114063930A CN114063930A (en) 2022-02-18
CN114063930B true CN114063930B (en) 2024-03-26

Family

ID=80276402

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111414248.9A Active CN114063930B (en) 2021-11-25 2021-11-25 Nonvolatile memory medium data updating method and device

Country Status (1)

Country Link
CN (1) CN114063930B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106873908A (en) * 2017-01-17 2017-06-20 北京联想核芯科技有限公司 Date storage method and device
CN112540725A (en) * 2020-11-26 2021-03-23 深圳腾视科技有限公司 Nonvolatile data storage method, embedded system and storage medium
CN113190176A (en) * 2021-05-11 2021-07-30 上海华东汽车信息技术有限公司 Data storage method and device, electronic equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112988067B (en) * 2016-02-18 2023-07-11 华为技术有限公司 Data updating technology
CN109117086B (en) * 2018-07-16 2021-09-21 北京百度网讯科技有限公司 Storage device data position processing method, device, equipment and storage medium
KR20200089939A (en) * 2019-01-18 2020-07-28 에스케이하이닉스 주식회사 Memory system and operating method thereof

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106873908A (en) * 2017-01-17 2017-06-20 北京联想核芯科技有限公司 Date storage method and device
CN112540725A (en) * 2020-11-26 2021-03-23 深圳腾视科技有限公司 Nonvolatile data storage method, embedded system and storage medium
CN113190176A (en) * 2021-05-11 2021-07-30 上海华东汽车信息技术有限公司 Data storage method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN114063930A (en) 2022-02-18

Similar Documents

Publication Publication Date Title
CN112035529B (en) Caching method, caching device, electronic equipment and computer readable storage medium
CN112256231B (en) Volume control method, device, terminal and storage medium
CN110389796A (en) Edit operation processing method, device and electronic equipment
US20150135181A1 (en) Information processing device and method for protecting data in a call stack
CN111400068B (en) Interface control method and device, readable medium and electronic equipment
CN110545313B (en) Message push control method and device and electronic equipment
CN114579055B (en) Disk storage method, device, equipment and medium
CN110069452B (en) Data storage method, device and computer readable storage medium
CN109918381B (en) Method and apparatus for storing data
CN110928574A (en) Microcontroller, interrupt processing chip, device and interrupt processing method
CN104184817A (en) Download optimizing method and device and terminal
CN116560878B (en) Memory sharing method and related device
CN111858393B (en) Memory page management method, memory page management device, medium and electronic equipment
CN114063930B (en) Nonvolatile memory medium data updating method and device
CN112363815A (en) Redis cluster processing method and device, electronic equipment and computer readable storage medium
CN111857518A (en) Method and device for canceling image editing operation, electronic equipment and medium
CN113391882B (en) Virtual machine memory management method and device, storage medium and electronic equipment
CN111290861A (en) Message processing method and device and electronic equipment
CN116541174A (en) Storage device capacity processing method, device, equipment and storage medium
CN113127430A (en) Mirror image information processing method and device, computer readable medium and electronic equipment
CN115756868A (en) Memory allocation method, device, equipment, storage medium and computer program product
CN112631609B (en) Compiling method, compiling device, compiling terminal and storage medium
CN113448585B (en) Compiling method and device of thread pool, electronic equipment and storage medium
CN111343468A (en) Message processing method and device and electronic equipment
CN110609728A (en) Page generation method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant