CN116450044A - Data storage method and device, electronic equipment and storage medium - Google Patents

Data storage method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116450044A
CN116450044A CN202310430915.5A CN202310430915A CN116450044A CN 116450044 A CN116450044 A CN 116450044A CN 202310430915 A CN202310430915 A CN 202310430915A CN 116450044 A CN116450044 A CN 116450044A
Authority
CN
China
Prior art keywords
data
memory segment
memory
reserved
target memory
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.)
Pending
Application number
CN202310430915.5A
Other languages
Chinese (zh)
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.)
Suzhou Centec Communications Co Ltd
Original Assignee
Suzhou Centec Communications 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 Suzhou Centec Communications Co Ltd filed Critical Suzhou Centec Communications Co Ltd
Priority to CN202310430915.5A priority Critical patent/CN116450044A/en
Publication of CN116450044A publication Critical patent/CN116450044A/en
Pending legal-status Critical Current

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/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0647Migration mechanisms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1438Restarting or rejuvenating
    • 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/0614Improving the reliability of storage systems
    • G06F3/0619Improving the reliability of storage systems in relation to data integrity, e.g. data losses, bit errors
    • 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/0674Disk device
    • G06F3/0676Magnetic disk device
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The embodiment of the application provides a data storage method, a device, electronic equipment and a storage medium, and relates to the technical field of data storage, wherein the method comprises the following steps: in the running process of the electronic equipment, the memory space of the system chip is segmented to obtain a plurality of first memory segments, a first target memory segment to which data to be reserved belongs is determined, when a restarting operation occurs, the type of the restarting operation is judged, when the type of the restarting operation is hot restarting, the plurality of other first memory segments except the first target memory segment are refreshed, the data to be reserved is temporarily stored from the first target memory segment to at least one other first memory segment after the refreshing is completed, the first target memory segment is refreshed, and after the refreshing of the first target memory segment is completed, the data to be reserved is transferred from the at least one other first memory segment to the first target memory segment after the refreshing is completed. The method can reserve the data to be reserved of the system before restarting after hot restarting, and avoid data loss.

Description

Data storage method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of data storage, and in particular, to a data storage method, apparatus, electronic device, and storage medium.
Background
At present, in the process of restarting the electronic device, the data in the system chip is required to be initialized after restarting, namely, the whole memory space of the system chip is required to be refreshed, so that the stability of the memory is ensured. Refreshing the entire memory space of the system chip can result in data loss prior to restarting.
Disclosure of Invention
The invention aims to provide a data storage method, a data storage device, electronic equipment and a storage medium, which can avoid data loss during restarting.
In order to achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:
in a first aspect, an embodiment of the present application provides a data storage method, applied to a processor of an electronic device, where the electronic device further includes a system chip, and the system chip includes the processor, and the method includes:
in the running process of the electronic equipment, segmenting the memory space of the system chip to obtain a plurality of first memory segments;
determining a first memory segment to which data to be reserved belongs as a first target memory segment, wherein the data to be reserved is data meeting preset conditions;
when the restarting operation occurs, judging the type of the restarting operation;
when the type of the restarting operation is hot restarting, refreshing a plurality of other first memory segments except the first target memory segment;
temporarily storing the data to be reserved from the first target memory segment to at least one other first memory segment after the refreshing is completed, and refreshing the first target memory segment;
and after the refreshing of the first target memory segment is completed, migrating the data to be reserved from at least one other first memory segment to the refreshed first target memory segment.
In an optional embodiment, the step of temporarily storing the data to be retained from the first target memory segment to at least one other first memory segment after the refresh is completed includes:
respectively determining the storage spaces of other first memory segments after refreshing;
determining the data quantity of the data to be reserved;
determining the arrangement sequence of other first memory segments;
sequentially inquiring according to the arrangement sequence, and determining a target memory segment with a memory space larger than or equal to the data volume from other first memory segments;
and temporarily storing the data to be reserved into the target memory segment.
In an alternative embodiment, the method further comprises:
when the data volume is larger than the storage space of each other first memory segment, acquiring a preset number of target memory segments from a plurality of other first memory segments;
determining the sum of the storage spaces of the preset number of target memory segments;
comparing the data amount with the sum of the storage spaces;
and when the data volume is smaller than or equal to the sum of the storage spaces, temporarily storing the data to be reserved into each target memory segment.
In an alternative embodiment, the step of migrating the data to be retained from at least one other first memory segment to the first target memory segment after the refresh is completed after the first target memory segment is refreshed includes:
and after the first target memory segment is refreshed, migrating the data to be reserved from each target memory segment to the first target memory segment.
In an alternative embodiment, the electronic device further includes a dynamic random access memory, where the dynamic random access memory is communicatively connected to the processor, and the step of determining the type of the restart operation when the restart operation occurs includes:
when a restarting operation occurs, judging whether data can be acquired from the dynamic random access memory or not;
if the data can be obtained from the dynamic random access memory, judging the type of the restarting operation to be hot restarting;
and if the data cannot be acquired from the dynamic random access memory, judging the type of the restarting operation to be cold restarting.
In an alternative embodiment, the step of determining the type of the restart operation when the restart operation occurs includes:
when a restarting operation occurs, acquiring a lock state of the system chip;
and determining the type of the restarting operation based on the lock state of the system chip, wherein different lock states correspond to different restarting operation types.
In an alternative embodiment, the step of determining the arrangement sequence of the other first memory segments includes:
determining the time when refreshing of each other first memory segment is completed;
and ordering the other first memory segments based on the time sequence to obtain the arrangement sequence of the other first memory segments.
In a second aspect, embodiments of the present application provide a data storage device, the device including:
the segmentation module is used for segmenting the memory space of the system chip in the running process of the electronic equipment to obtain a plurality of first memory segments;
the determining module is used for determining a first memory segment to which data to be reserved belongs as a first target memory segment, wherein the data to be reserved is data meeting preset conditions;
the judging module is used for judging the type of the restarting operation when the restarting operation occurs;
the refreshing module is used for refreshing a plurality of other first memory segments except the first target memory segment when the type of the restarting operation is hot restarting;
the temporary storage module is used for temporarily storing the data to be reserved from the first target memory segment to at least one other first memory segment after the refreshing is completed, and refreshing the first target memory segment;
and the migration module is used for migrating the data to be reserved from at least one other first memory segment to the refreshed first target memory segment after the first target memory segment is refreshed.
In a third aspect, an embodiment of the present application provides an electronic device, including a memory storing a computer program and a processor implementing the steps of the data storage method when the processor executes the computer program.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the data storage method.
The application has the following beneficial effects:
according to the method, in the running process of the electronic equipment, the memory space of the system chip is segmented to obtain a plurality of first memory segments, the first memory segments to which data to be reserved belong are determined to be used as the first target memory segments, the type of restarting operation is judged when restarting operation occurs, when restarting operation is hot restarting, the plurality of other first memory segments except the first target memory segments are refreshed, the data to be reserved are temporarily stored from the first target memory segments to at least one other first memory segment after refreshing is completed, refreshing is carried out on the first target memory segments, and after refreshing of the first target memory segments is completed, the data to be reserved is transferred from the at least one other first memory segment to the first target memory segment after refreshing is completed. The method can reserve the data to be reserved of the system before restarting after hot restarting, avoid data loss, and realize the storage of the data to be reserved under the condition of not introducing extra storage media.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered limiting the scope, and that other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic block diagram of an electronic device according to an embodiment of the present application;
FIG. 2 is a schematic flow chart of a data storage method according to an embodiment of the present disclosure;
FIG. 3 is a second flow chart of a data storage method according to the embodiment of the present application;
FIG. 4 is a third flow chart of a data storage method according to the embodiment of the present application;
FIG. 5 is a flowchart illustrating a data storage method according to an embodiment of the present disclosure;
FIG. 6 is a fifth flow chart of a data storage method according to an embodiment of the present disclosure;
fig. 7 is a block diagram of a data storage device according to an embodiment of the present application.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments. The components of the embodiments of the present application, which are generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present application, as provided in the accompanying drawings, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
In the description of the present application, it should be noted that, if the terms "upper," "lower," "inner," "outer," and the like indicate an azimuth or a positional relationship based on the azimuth or the positional relationship shown in the drawings, or the azimuth or the positional relationship in which the inventive product is conventionally put in use, it is merely for convenience of describing the present application and simplifying the description, and it is not indicated or implied that the apparatus or element referred to must have a specific azimuth, be configured and operated in a specific azimuth, and thus should not be construed as limiting the present application.
Furthermore, the terms "first," "second," and the like, if any, are used merely for distinguishing between descriptions and not for indicating or implying a relative importance.
In the description of the present application, it should also be noted that, unless explicitly specified and limited otherwise, the terms "disposed," "mounted," "connected," and "connected" are to be construed broadly, and may be, for example, fixedly connected, detachably connected, or integrally connected; can be mechanically or electrically connected; can be directly connected or indirectly connected through an intermediate medium, and can be communication between two elements. The specific meaning of the terms in this application will be understood by those of ordinary skill in the art in a specific context.
The inventor has found through a great deal of researches that at present, in the process of restarting the electronic equipment, the data in the system chip is required to be initialized after restarting, namely, the whole memory space of the system chip is required to be refreshed, so that the stability of the memory is ensured. Refreshing the entire memory space of the system chip can result in data loss prior to restarting.
Through researches, in order to avoid data loss caused by restarting the electronic device, important data in the system chip can be saved to the local disk, and when the system chip is restarted, the local disk is utilized for data recovery.
However, the inventors have studied and found that the above approach requires the additional introduction of other storage media to achieve the preservation of the data to be preserved.
In view of the above-mentioned problems, the present embodiment provides a data storage method, apparatus, electronic device, and storage medium, and the following details of the scheme provided in the present embodiment are described.
The embodiment provides an electronic device capable of storing data. In one possible implementation, the electronic device may be a user terminal, for example, the electronic device may be, but is not limited to, a server, a smart phone, a personal computer (PersonalComputer, PC), a tablet, a personal digital assistant (Personal Digital Assistant, PDA), a mobile internet device (Mobile Internet Device, MID), or the like.
Referring to fig. 1, fig. 1 is a schematic structural diagram of an electronic device 100 according to an embodiment of the disclosure. The electronic device 100 may also include more or fewer components than shown in fig. 1, or have a different configuration than shown in fig. 1. The components shown in fig. 1 may be implemented in hardware, software, or a combination thereof.
The electronic device 100 includes a data storage 110, a memory 120, and a processor 130.
The memory 120 and the processor 130 are electrically connected directly or indirectly to each other to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines. The data storage 110 includes at least one software function module that may be stored in the memory 120 in the form of software or firmware (firmware) or cured in an Operating System (OS) of the electronic device 100. The processor 130 is configured to execute executable modules stored in the memory 120, such as software functional modules and computer programs included in the data storage device 110.
The Memory 120 may be, but is not limited to, a random access Memory (RandomAccess Memory, RAM), a Read Only Memory (ROM), a programmable Read Only Memory (Programmable Read-Only Memory, PROM), an erasable Read Only Memory (Erasable ProgrammableRead-Only Memory, EPROM), an electrically erasable Read Only Memory (Electric Erasable ProgrammableRead-Only Memory, EEPROM), etc. The memory 120 is configured to store a program, and the processor 130 executes the program after receiving an execution instruction.
Referring to fig. 2, fig. 2 is a flowchart of a data storage method applied to the electronic device 100 of fig. 1, and the method includes various steps described in detail below.
The data storage method provided by the embodiment is applied to a processor of an electronic device, and the electronic device further comprises a system chip, wherein the system chip comprises the processor.
Step 201: and in the running process of the electronic equipment, segmenting the memory space of the system chip to obtain a plurality of first memory segments.
Step 202: and determining a first memory segment to which the data to be reserved belongs as a first target memory segment.
The data to be reserved are data meeting preset conditions.
Step 203: when a restart operation occurs, the type of the restart operation is determined.
Step 204: and refreshing a plurality of other first memory segments except the first target memory segment when the type of the restarting operation is hot restarting.
Step 205: temporarily storing the data to be reserved from the first target memory segment to at least one other first memory segment after the refreshing is completed, and refreshing the first target memory segment.
Step 206: after the refreshing of the first target memory segment is completed, the data to be retained is migrated from at least one other first memory segment to the refreshed first target memory segment.
In the continuous operation process of the electronic equipment, in order to avoid that when the restarting operation occurs, the system chip of the electronic equipment directly refreshes data to cause data loss, the electronic equipment segments the memory space of the system chip to obtain a plurality of first memory segments. And determining the data meeting the preset conditions as the data to be reserved, and determining a first target memory segment to which the data to be reserved belongs.
It should be specifically noted that, when the memory space of the system chip is segmented, it is required to ensure that the storage space of the segmented first target memory segment can meet the requirement of storing the data to be reserved, that is, the storage space of the first target memory segment is greater than or equal to the data amount of the data to be reserved.
For example, the data to be reserved may be important data of the user, where the data to be reserved may be data configured by the user, or may be data of an important result calculated in the operation process of the electronic device, or other valuable data.
For the determination mode of the data to be reserved, based on the preset field, in the continuous operation of the electronic device, searching the data consistent with the preset field from all the data operated by the system chip as the data to be reserved. Or based on the requirement of the user, determining the data consistent with the requirement of the user from all the data operated by the system chip as the data to be reserved. The method for determining the data to be reserved is not particularly limited in the embodiment of the present application.
When the electronic equipment is restarted, the type of the restarting operation is judged, the type of the restarting operation can be divided into cold restarting and hot restarting, and the cold restarting indicates that the electronic equipment is powered on to restart after power is turned off. The hot restart indicates that the device is not powered down to restart.
When the restart operation is judged to be hot restart, the data to be reserved is temporarily stored to other first memory segments by refreshing the other first memory segments except the first target memory segment, after the refreshing of the other first memory segments is finished, and after the refreshing of the first target memory segment is finished, the data to be reserved is migrated to the original position, namely the data to be reserved is migrated to the first target memory segment, so that the important data can be reserved under the condition that other storage media are not added, and when the hot restart operation is carried out, the data loss is avoided.
It should be noted that, the refreshing of at least one other first memory segment and the first target memory segment actually performs the initialization processing on the data in at least one other memory segment and the first target memory segment, that is, the data emptying is completed.
In another example, during operation of the electronic device, the memory space of the system chip is segmented to obtain a plurality of first memory segments, when a restart operation occurs and when the restart operation is judged to be a hot restart, whether the plurality of first memory segments contain data to be reserved or not is judged, if yes, a first target memory segment to which the data to be reserved belongs is determined, refreshing is performed on a plurality of other first memory segments except the first target memory segment, the data to be reserved is temporarily stored from the first target memory segment to at least one other first memory segment after the refresh is completed, the first target memory segment is refreshed, and after the refresh of the first target memory segment is completed, the data to be reserved is migrated from at least one other first memory segment to the first target memory segment after the refresh is completed. And when judging that the first memory sections do not contain the data to be reserved, refreshing all the data in the system chip according to the existing mode.
Various implementations are provided for temporarily storing the data to be retained from the first target memory segment to at least one other first memory segment after the refresh is completed, and in one implementation, as shown in fig. 3, the method includes the following steps:
step 205-1: and respectively determining the storage spaces of the other first memory sections after the refreshing is finished.
Step 205-2: and determining the data quantity of the data to be reserved.
Step 205-3: and determining the arrangement sequence of other first memory segments.
Step 205-4: and sequentially inquiring according to the arrangement sequence, and determining a target memory segment with the storage space larger than or equal to the data volume from other first memory segments.
Step 205-5: and temporarily storing the data to be reserved into the target memory segment.
For example, when the memory space of the system chip is segmented into a plurality of first memory segments, the numbers are the first memory segment, the second memory segment, and the third memory segment, respectively, and the second memory segment is determined to be the first target memory segment. The other first memory segments except the first target memory segment are a first memory segment and a third memory segment, the storage spaces of the first memory segment and the third memory segment are respectively determined, and the data quantity of the data to be reserved is determined. And determining that the arrangement sequence of the first memory segment and the third memory segment is the first memory segment and the third memory segment, comparing the data volume of the data to be reserved with the storage space of the first memory segment, and temporarily storing the data to be reserved into the first memory segment when the storage space of the first memory segment is larger than or equal to the data volume of the data to be reserved. When the storage space of the first memory segment is smaller than the data amount of the data to be reserved, comparing the data amount of the data to be reserved with the storage space of the third memory segment, and when the storage space of the third memory segment is larger than or equal to the data amount of the data to be reserved, temporarily storing the data to be reserved into the third memory segment.
The implementation manner of determining the arrangement sequence of the other first memory segments may be: determining the time when refreshing of each other first memory segment is completed; and ordering the other first memory segments based on the time sequence to obtain the arrangement sequence of the other first memory segments.
When the data to be reserved is temporarily stored in the first memory segment, after the first target memory segment is refreshed, the data to be reserved is migrated from the first memory segment to the first target memory segment. When the data to be reserved is temporarily stored in the third memory segment, after the first target memory segment is refreshed, the data to be reserved is migrated from the third memory segment to the first target memory segment.
In another example, when the storage space of the first memory segment is smaller than the data amount of the data to be reserved, the target data may be determined from the data to be reserved based on the selection operation of the user, and the target data may be stored in the first memory segment. It should be noted that, the data size of the target data is smaller than the data size of the data to be reserved.
In another implementation of temporarily storing the data to be retained from the first target memory segment to at least one other first memory segment after the completion of the refresh, as shown in fig. 4, the method includes the following steps:
step 205-6: and when the data volume is larger than the storage space of each other first memory segment, acquiring a preset number of target memory segments from the plurality of other first memory segments.
Step 205-7: and determining the sum of the storage spaces of the preset number of target memory segments.
Step 205-8: the amount of data is compared to the sum of the storage spaces.
Step 205-9: and when the data volume is smaller than or equal to the sum of the storage spaces, temporarily storing the data to be reserved into each target memory segment.
For example, when the memory space of the system chip is segmented into a plurality of first memory segments, the numbers are the first memory segment, the second memory, the third memory segment and the fourth memory segment, respectively, and the third memory segment is determined to be the first target memory segment. The other first memory segments except the first target memory segment are a first memory segment, a second memory segment and a fourth memory segment, the storage spaces of the first memory segment, the second memory segment and the fourth memory segment are respectively determined, and the data quantity of the data to be reserved is determined. And when the data quantity of the data to be reserved is larger than the storage space of the first memory section, the storage space of the second memory section and the storage space of the fourth memory section, and the preset quantity is set to be 2, the first memory section and the second memory section are obtained as target memory sections, the storage spaces of the first memory section and the second memory section are added to obtain a storage space sum, and when the data quantity of the data to be reserved is smaller than the storage space sum, the data to be reserved is temporarily stored in the first memory section and the second memory section.
When the data to be reserved are temporarily stored in the first memory segment and the second memory segment, after the first target memory segment is refreshed, the data to be reserved are migrated from the first memory segment and the second memory segment to the first target memory segment.
In another example, when the sum of the storage spaces indicates that the sum of the storage spaces is the storage space of the first memory segment and the second memory segment, when the data amount of the data to be reserved is greater than the sum of the storage spaces, the first memory segment, the second memory segment and the fourth memory segment are obtained as the destination memory segment, the sum of the storage spaces of the first memory segment, the second memory segment and the fourth memory segment is calculated, and when the data amount of the data to be reserved is less than the sum of the storage spaces, the data to be reserved is temporarily stored in the first memory segment, the second memory segment and the fourth memory segment.
When the restart operation occurs, there are various implementation manners for judging the restart operation, and in one implementation manner, as shown in fig. 5, the method includes the following steps:
step 203-1: when a restart operation occurs, it is determined whether data can be acquired from the dynamic random access memory.
Step 203-2: if the data can be obtained from the dynamic random access memory, the type of the restart operation is determined to be a hot restart.
Step 203-3: if the data cannot be acquired from the dynamic random access memory, the type of the restarting operation is determined to be cold restarting.
The electronic device further includes a dynamic random access memory communicatively coupled to the processor. Because the dynamic random access memory is not powered down during the hot restart, the data stored on the dynamic random access memory cannot be lost, and after the hot restart of the system, the dynamic random access memory can use the data before the restart. When cold restarting, the data stored on the dynamic memory is lost after the dynamic memory is powered down, so the type of restarting operation can be judged based on the state of the data acquired by the dynamic random memory.
In another implementation of determining the restart operation, as shown in fig. 6, the method includes the following steps:
step 203-4: when a restart operation occurs, the lock state of the system chip is acquired.
Step 203-5: the type of restart operation is determined based on the lock state of the system chip.
Wherein, different lock states correspond to different restart operation types.
When the type of the restart operation is judged based on the lock state of the system chip, the system chip may be set in advance, when the type of the restart operation is hot restart, the lock state is set to 1, when the type of the restart operation is cold restart, the lock state is set to 0, and when the restart operation occurs, the system chip triggers a change of the lock state based on the type of the restart operation, so that the type of the restart operation may be judged based on the lock state of the system chip.
Referring to fig. 7, an embodiment of the present application further provides a data storage device 110 applied to the electronic apparatus 100 shown in fig. 1, where the data storage device 110 includes:
a segmentation module 111, configured to segment a memory space of the system chip during the operation of the electronic device, to obtain a plurality of first memory segments;
the determining module 112 is configured to determine a first memory segment to which data to be reserved belongs as a first target memory segment, where the data to be reserved is data that meets a preset condition;
a judging module 113, configured to judge a type of a restart operation when the restart operation occurs;
a refresh module 114, configured to refresh a plurality of other first memory segments except the first target memory segment when the type of the restart operation is a hot restart;
a temporary storage module 115, configured to temporarily store the data to be retained from the first target memory segment to at least one other first memory segment after the refresh is completed, and refresh the first target memory segment;
and a migration module 116, configured to migrate, after the refreshing of the first target memory segment is completed, the data to be retained from at least one other first memory segment to the first target memory segment after the refreshing is completed.
The present application also provides an electronic device 100, the electronic device 100 comprising a processor 130 and a memory 120. Memory 120 stores computer-executable instructions that, when executed by processor 130, implement the data storage method.
The embodiments of the present application also provide a computer readable storage medium storing a computer program, which when executed by the processor 130, implements the data storage method.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners as well. The apparatus embodiments described above are merely illustrative, for example, flow diagrams and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. 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.
In addition, the functional modules in the embodiments of the present application may be integrated together to form a single part, or each module may exist alone, or two or more modules may be integrated to form a single part. The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing is merely various embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the present application, and the changes and substitutions are intended to be covered in the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A data storage method, characterized by being applied to a processor of an electronic device, the electronic device further comprising a system chip, the system chip containing the processor, the method comprising:
in the running process of the electronic equipment, segmenting the memory space of the system chip to obtain a plurality of first memory segments;
determining a first memory segment to which data to be reserved belongs as a first target memory segment, wherein the data to be reserved is data meeting preset conditions;
when the restarting operation occurs, judging the type of the restarting operation;
when the type of the restarting operation is hot restarting, refreshing a plurality of other first memory segments except the first target memory segment;
temporarily storing the data to be reserved from the first target memory segment to at least one other first memory segment after the refreshing is completed, and refreshing the first target memory segment;
and after the refreshing of the first target memory segment is completed, migrating the data to be reserved from at least one other first memory segment to the refreshed first target memory segment.
2. The method of claim 1, wherein the step of temporarily storing the data to be retained from the first target memory segment into at least one other of the first memory segments after the refresh is completed comprises:
respectively determining the storage spaces of other first memory segments after refreshing;
determining the data quantity of the data to be reserved;
determining the arrangement sequence of other first memory segments;
sequentially inquiring according to the arrangement sequence, and determining a target memory segment with a memory space larger than or equal to the data volume from other first memory segments;
and temporarily storing the data to be reserved into the target memory segment.
3. The method according to claim 2, wherein the method further comprises:
when the data volume is larger than the storage space of each other first memory segment, acquiring a preset number of target memory segments from a plurality of other first memory segments;
determining the sum of the storage spaces of the preset number of target memory segments;
comparing the data amount with the sum of the storage spaces;
and when the data volume is smaller than or equal to the sum of the storage spaces, temporarily storing the data to be reserved into each target memory segment.
4. The method of claim 3, wherein the step of migrating the data to be retained from at least one other of the first memory segments to the refreshed first target memory segment after the first target memory segment is refreshed comprises:
and after the first target memory segment is refreshed, migrating the data to be reserved from each target memory segment to the first target memory segment.
5. The method of claim 1, wherein the electronic device further comprises a dynamic random access memory communicatively coupled to the processor, the step of determining the type of restart operation when the restart operation occurs comprising:
when a restarting operation occurs, judging whether data can be acquired from the dynamic random access memory or not;
if the data can be obtained from the dynamic random access memory, judging the type of the restarting operation to be hot restarting;
and if the data cannot be acquired from the dynamic random access memory, judging the type of the restarting operation to be cold restarting.
6. The method of claim 1, wherein the step of determining the type of the restart operation when the restart operation occurs comprises:
when a restarting operation occurs, acquiring a lock state of the system chip;
and determining the type of the restarting operation based on the lock state of the system chip, wherein different lock states correspond to different restarting operation types.
7. The method of claim 2, wherein the step of determining the order of the other first memory segments comprises:
determining the time when refreshing of each other first memory segment is completed;
and ordering the other first memory segments based on the time sequence to obtain the arrangement sequence of the other first memory segments.
8. A data storage device, the device comprising:
the segmentation module is used for segmenting the memory space of the system chip in the running process of the electronic equipment to obtain a plurality of first memory segments;
the determining module is used for determining a first memory segment to which data to be reserved belongs as a first target memory segment, wherein the data to be reserved is data meeting preset conditions;
the judging module is used for judging the type of the restarting operation when the restarting operation occurs;
the refreshing module is used for refreshing a plurality of other first memory segments except the first target memory segment when the type of the restarting operation is hot restarting;
the temporary storage module is used for temporarily storing the data to be reserved from the first target memory segment to at least one other first memory segment after the refreshing is completed, and refreshing the first target memory segment;
and the migration module is used for migrating the data to be reserved from at least one other first memory segment to the refreshed first target memory segment after the first target memory segment is refreshed.
9. An electronic device comprising a memory storing a computer program and a processor implementing the steps of the method of any one of claims 1-7 when the computer program is executed by the processor.
10. A storage medium having stored thereon a computer program, which when executed by a processor performs the steps of the method according to any of claims 1-7.
CN202310430915.5A 2023-04-21 2023-04-21 Data storage method and device, electronic equipment and storage medium Pending CN116450044A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310430915.5A CN116450044A (en) 2023-04-21 2023-04-21 Data storage method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310430915.5A CN116450044A (en) 2023-04-21 2023-04-21 Data storage method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116450044A true CN116450044A (en) 2023-07-18

Family

ID=87121751

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310430915.5A Pending CN116450044A (en) 2023-04-21 2023-04-21 Data storage method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116450044A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116701041A (en) * 2023-07-27 2023-09-05 飞腾信息技术有限公司 Memory data retention method, retention device and related equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116701041A (en) * 2023-07-27 2023-09-05 飞腾信息技术有限公司 Memory data retention method, retention device and related equipment
CN116701041B (en) * 2023-07-27 2023-11-10 飞腾信息技术有限公司 Memory data retention method, retention device and related equipment

Similar Documents

Publication Publication Date Title
CN116450044A (en) Data storage method and device, electronic equipment and storage medium
US10873900B2 (en) Method for wireless fidelity connection and related products
US11086638B2 (en) Method and apparatus for loading application
CN109871382A (en) A kind of implementation method and device of tables of data access java standard library
CN105022819A (en) File storage method and apparatus
CN109582470B (en) Data processing method and data processing device
CN106648685B (en) Intelligent terminal system application processing method and device and intelligent terminal
CN103150359B (en) Micro-blog information display packing and device
CA3139243A1 (en) Information collection method, device, computer equipment and storage medium
CN104750872A (en) Method and device for searching service object
CN112487083A (en) Data verification method and equipment
CN109408682B (en) Regular expression matching method, system and equipment
CN110688378A (en) Migration method and system for database storage process
CN112749173A (en) Method and device for updating object
CN103763760A (en) Network selection method and 4G multi-mode terminal
CN106502648A (en) Application shows the method and terminal of language-specific
CN109617708B (en) Compression method, device and system for embedded point log
CN109408124A (en) Store equipment and preparation method thereof, operating system double mode bootstrap technique and device
CN108089904A (en) A kind of displayed page extended method and equipment
CN115687023A (en) Internet big data processing method and system
CN105701162B (en) Management method for user data partition of intelligent terminal and intelligent terminal
CN111768224A (en) Open screen information display method, device, equipment and storage medium
CN104657043A (en) Multimedia data backup method, user terminal and synchronous device
CN114492297A (en) Commodity information specification parameter extraction method and device and computer equipment
CN115221360A (en) Tree structure configuration method and system

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