CN116400871A - Defragmentation method, defragmentation device, storage medium and electronic device - Google Patents

Defragmentation method, defragmentation device, storage medium and electronic device Download PDF

Info

Publication number
CN116400871A
CN116400871A CN202310680179.9A CN202310680179A CN116400871A CN 116400871 A CN116400871 A CN 116400871A CN 202310680179 A CN202310680179 A CN 202310680179A CN 116400871 A CN116400871 A CN 116400871A
Authority
CN
China
Prior art keywords
defragmentation
threshold
multimedia card
embedded multimedia
card 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.)
Granted
Application number
CN202310680179.9A
Other languages
Chinese (zh)
Other versions
CN116400871B (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.)
TCL Communication Technology Chengdu Ltd
Original Assignee
TCL Communication Technology Chengdu 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 TCL Communication Technology Chengdu Ltd filed Critical TCL Communication Technology Chengdu Ltd
Priority to CN202310680179.9A priority Critical patent/CN116400871B/en
Publication of CN116400871A publication Critical patent/CN116400871A/en
Application granted granted Critical
Publication of CN116400871B publication Critical patent/CN116400871B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/061Improving I/O performance
    • 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/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools
    • 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/0683Plurality of storage devices
    • 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

Abstract

The application discloses a defragmentation method, a defragmentation device, a storage medium and electronic equipment, and relates to the technical field of computers, wherein the defragmentation method comprises the following steps: acquiring a defragmentation threshold of an embedded multimedia card memory; adjusting the defragmentation threshold to obtain an adjusted defragmentation threshold, wherein the adjusted defragmentation threshold is smaller than the defragmentation threshold; if the data amount in the embedded multimedia card memory exceeds the adjusted finishing threshold value, detecting whether the equipment is in an idle state; before the data quantity in the embedded multimedia card memory exceeds the defragmentation threshold, triggering the embedded multimedia card memory to defragment if the device is detected to be in an idle state. When the method and the device can achieve defragmentation in the embedded multimedia card memory, the fact that the memory cannot respond to operation of upper-layer applications in time is effectively avoided, the fact that a user feels that equipment is blocked or the applications do not respond is avoided, and user experience is improved.

Description

Defragmentation method, defragmentation device, storage medium and electronic device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a defragmentation method, a defragmentation device, a storage medium, and an electronic device.
Background
The embedded multimedia card (EMMC, embedded Multi Media Card) memory manufacturer can trigger the related data sort action of the memory to sort according to the characteristics of the memory when the data amount of the written data reaches a certain sort threshold. The data sorting action is not controlled by upper software at present, and the defragmentation is that firmware of an EMMC memory manufacturer independently processes related logic, namely the EMMC memory is automatically and independently triggered to sort according to defragmentation threshold values, a large number of IO read-write operations are generated in the defragmentation process, at the moment, the memory cannot respond to the operation of upper application in time easily, and a user can feel that equipment is blocked or the application does not respond, so that the user experience is affected.
Disclosure of Invention
The embodiment of the application provides a scheme, when the defragmentation is carried out in the embedded multimedia card memory, the memory is effectively prevented from responding to the operation of the upper application in time, the user is prevented from feeling that the equipment is blocked or the application is unresponsive, and the user experience is improved.
The embodiment of the application provides the following technical scheme:
according to one embodiment of the present application, a defragmentation method comprises: acquiring a defragmentation threshold of an embedded multimedia card memory, wherein the defragmentation threshold is a threshold which is pre-designated in the embedded multimedia card memory and must trigger defragmentation; adjusting the defragmentation threshold to obtain an adjusted defragmentation threshold, wherein the adjusted defragmentation threshold is smaller than the defragmentation threshold; if the data amount in the embedded multimedia card memory exceeds the adjustment post-finishing threshold, detecting whether the equipment is in an idle state, wherein the idle state refers to various states which do not influence the use of the equipment by a user; before the data quantity in the embedded multimedia card memory exceeds the defragmentation threshold, triggering the embedded multimedia card memory to defragment if the device is detected to be in an idle state.
In some embodiments of the present application, the adjusting the defragmentation threshold to obtain an adjusted defragmentation threshold includes: acquiring a preset adjustment coefficient; and adjusting the size of the defragmentation threshold according to the preset adjustment coefficient to obtain the adjusted defragmentation threshold.
In some embodiments of the present application, the adjusting the defragmentation threshold to obtain an adjusted defragmentation threshold includes: acquiring equipment use information of the equipment; calculating according to the equipment use information to obtain a dynamic adjustment coefficient; and adjusting the size of the defragmentation threshold according to the dynamic adjustment coefficient to obtain the adjusted defragmentation threshold.
In some embodiments of the present application, before the amount of data in the embedded multimedia card memory exceeds the defragmentation threshold, if the device is detected to be in an idle state, before triggering defragmentation of the embedded multimedia card memory, the method further comprises: if the data volume written in the embedded multimedia card memory exceeds the adjustment post-finishing threshold value, detecting that the equipment does not enter an idle state after exceeding the detection duration, and generating state adjustment prompt information; and playing the state adjustment prompt information so that the equipment enters the idle state.
In some embodiments of the present application, the detection duration is determined as follows: obtaining a difference value between the defragmentation threshold and the adjustment post-defragmentation threshold; acquiring the data writing rate in the embedded multimedia card memory; acquiring average response time length aiming at notification messages in the equipment; and obtaining the detection duration according to the difference value, the data writing rate and the average response duration.
In some embodiments of the present application, the triggering the defragmentation of the embedded multimedia card memory if the device is detected to be in an idle state includes: if the equipment is detected to be in an idle state, determining persistence information of the idle state; and triggering the embedded multimedia card memory to carry out defragmentation according to the persistence information.
In some embodiments of the present application, the triggering the defragmentation of the embedded multimedia card memory according to the persistence information includes: triggering the embedded multimedia card memory to carry out defragmentation if the persistence information meets a preset persistence condition; and if the persistence information does not meet the preset persistence condition, triggering the embedded multimedia card memory to carry out defragmentation after playing the state persistence indication information.
According to one embodiment of the present application, a defragmenter, the apparatus comprises: the acquisition module is used for acquiring a defragmentation threshold value of the embedded multimedia card memory, wherein the defragmentation threshold value is a threshold value which is pre-designated in the embedded multimedia card memory and must trigger defragmentation; the adjustment module is used for adjusting the defragmentation threshold value to obtain an adjusted defragmentation threshold value, and the adjusted defragmentation threshold value is smaller than the defragmentation threshold value; the detection module is used for detecting whether the equipment is in an idle state or not if the data volume written in the embedded multimedia card memory exceeds the adjustment post-finishing threshold value, wherein the idle state refers to various states which do not influence the use of the equipment by a user; and the triggering module is used for triggering the embedded multimedia card memory to carry out defragmentation if the equipment is detected to be in an idle state before the written data volume in the embedded multimedia card memory exceeds the defragmentation threshold value.
In some embodiments of the present application, the adjustment module includes a first adjustment unit for: acquiring a preset adjustment coefficient; and adjusting the size of the defragmentation threshold according to the preset adjustment coefficient to obtain the adjusted defragmentation threshold.
In some embodiments of the present application, the adjustment module includes a second adjustment unit for: acquiring equipment use information of the equipment; calculating according to the equipment use information to obtain a dynamic adjustment coefficient; and adjusting the size of the defragmentation threshold according to the dynamic adjustment coefficient to obtain the adjusted defragmentation threshold.
In some embodiments of the present application, before the amount of data in the embedded multimedia card memory exceeds the defragmentation threshold, if the device is detected to be in an idle state, before triggering defragmentation of the embedded multimedia card memory, the apparatus further comprises a state adjustment module configured to: if the data volume written in the embedded multimedia card memory exceeds the adjustment post-finishing threshold value, detecting that the equipment does not enter an idle state after exceeding the detection duration, and generating state adjustment prompt information; and playing the state adjustment prompt information so that the equipment enters the idle state.
In some embodiments of the present application, the state adjustment module is configured to: obtaining a difference value between the defragmentation threshold and the adjustment post-defragmentation threshold; acquiring the data writing rate in the embedded multimedia card memory; acquiring average response time length aiming at notification messages in the equipment; and obtaining the detection duration according to the difference value, the data writing rate and the average response duration.
In some embodiments of the present application, the triggering module is configured to: if the equipment is detected to be in an idle state, determining persistence information of the idle state; and triggering the embedded multimedia card memory to carry out defragmentation according to the persistence information.
In some embodiments of the present application, the triggering module is configured to: triggering the embedded multimedia card memory to carry out defragmentation if the persistence information meets a preset persistence condition; and if the persistence information does not meet the preset persistence condition, triggering the embedded multimedia card memory to carry out defragmentation after playing the state persistence indication information.
According to another embodiment of the present application, a storage medium has stored thereon a computer program which, when executed by a processor of a computer, causes the computer to perform the method described in the embodiments of the present application.
According to another embodiment of the present application, an electronic device may include: a memory storing a computer program; and the processor reads the computer program stored in the memory to execute the method according to the embodiment of the application.
According to another embodiment of the present application, a computer program product or computer program includes computer instructions stored in a computer readable storage medium. The computer instructions are read from the computer-readable storage medium by a processor of a computer device, and executed by the processor, cause the computer device to perform the methods provided in the various alternative implementations described in the embodiments of the present application.
In the embodiment of the application, a defragmentation threshold of an embedded multimedia card memory is obtained, wherein the defragmentation threshold is a threshold which is pre-designated in the embedded multimedia card memory and must trigger defragmentation; adjusting the defragmentation threshold to obtain an adjusted defragmentation threshold, wherein the adjusted defragmentation threshold is smaller than the defragmentation threshold; if the data amount in the embedded multimedia card memory exceeds the adjustment post-finishing threshold, detecting whether the equipment is in an idle state, wherein the idle state refers to various states which do not influence the use of the equipment by a user; before the data quantity in the embedded multimedia card memory exceeds the defragmentation threshold, triggering the embedded multimedia card memory to defragment if the device is detected to be in an idle state.
The beneficial effects of this application are: in this way, according to the defragmentation threshold value which is pre-designated in the embedded multimedia card memory and must trigger defragmentation, the defragmentation threshold value is adjusted to obtain an adjusted defragmentation threshold value smaller than the defragmentation threshold value, after the data quantity exceeds the adjusted defragmentation threshold value, whether the device is in an idle state is detected, before the data quantity exceeds the defragmentation threshold value under the independent defragmentation logic of the memory and under the condition that the device is in the idle state, the defragmentation is actively triggered in advance in the memory, the defragmentation is passively triggered in the idle state actively, the memory can respond to the operation of upper application in time, the user is prevented from feeling that the device is stuck or the application is unresponsive, and the user experience is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly introduced below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 shows a flow chart of a defragmentation method according to an embodiment of the present application.
Fig. 2 shows a block diagram of a defragmenter according to an embodiment of the present application.
Fig. 3 shows a block diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The present disclosure is further described in detail below with reference to the drawings and examples. It should be understood that the examples provided herein are merely illustrative of the present disclosure and are not intended to limit the present disclosure. In addition, the embodiments provided below are some of the embodiments for implementing the present disclosure, and not all of the embodiments for implementing the present disclosure, and the technical solutions described in the embodiments of the present disclosure may be implemented in any combination without conflict.
It should be noted that, in the embodiments of the present disclosure, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a method 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 method or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other related elements (e.g., a step in a method or a unit in an apparatus, e.g., a unit may be a part of a circuit, a part of a processor, a part of a program or software, etc.) in a method or apparatus comprising the element.
For example, the defragmentation method provided by the embodiment of the present disclosure includes a series of steps, but the defragmentation method provided by the embodiment of the present disclosure is not limited to the described steps, and similarly, the defragmentation device provided by the embodiment of the present disclosure includes a series of units, but the device provided by the embodiment of the present disclosure is not limited to including the explicitly described units, and may also include units that are required to obtain relevant information or perform processing based on the information.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure belongs. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure.
Fig. 1 schematically shows a flow chart of a defragmentation method according to an embodiment of the present application. The execution subject of the defragmentation method can be any device with embedded multimedia card memory, such as televisions, computers, mobile phones, smart watches, home appliances, etc.
As shown in fig. 1, the defragmentation method may comprise steps S110 to S140.
Step S110, obtaining a defragmentation threshold of an embedded multimedia card memory, wherein the defragmentation threshold is a threshold which is pre-designated in the embedded multimedia card memory and must trigger defragmentation; step S120, adjusting the defragmentation threshold value to obtain an adjusted defragmentation threshold value, wherein the adjusted defragmentation threshold value is smaller than the defragmentation threshold value; step S130, if the data amount in the embedded multimedia card memory exceeds the adjustment post-finishing threshold, detecting whether the equipment is in an idle state, wherein the idle state refers to various states which do not influence the use of the equipment by a user; and step S140, triggering the embedded multimedia card memory to carry out defragmentation if the device is detected to be in an idle state before the data volume in the embedded multimedia card memory exceeds the defragmentation threshold.
The embedded multimedia card (EMMC, embedded Multi Media Card) memory may consist of one embedded storage solution, with an MMC (multimedia card) interface, a flash memory device, a host controller, etc. in the embedded multimedia card (EMMC, embedded Multi Media Card) memory.
Defragmentation threshold values set by manufacturers can be actively obtained from a main controller in the embedded multimedia card memory, and the embedded multimedia card memories with different sizes have different defragmentation threshold values. The detection of the amount of write data in the embedded multimedia card memory exceeding the defragmentation threshold will necessarily (necessarily) trigger the relevant defragmentation logic to defragment.
And actively acquiring the set defragmentation threshold value from the embedded multimedia card memory, and adjusting the defragmentation threshold value to obtain an adjusted defragmentation threshold value smaller than the defragmentation threshold value. Furthermore, the data volume of the written data in the embedded multimedia card memory can be obtained, if the data volume in the embedded multimedia card memory is detected to exceed the adjustment post-finishing threshold, whether the equipment is in an idle state is detected, and the idle state refers to various states which do not influence the use of the equipment by a user. The idle state is, for example, a state of charging, idle, or browsing articles.
Before the data quantity written in the embedded multimedia card memory exceeds the defragmentation threshold, if the device is detected to be in an idle state, the defragmentation of the embedded multimedia card memory is actively triggered, so that the defragmentation of the embedded multimedia card memory is carried out before the data quantity exceeds the defragmentation threshold and in the idle state, and adverse effects on user interaction are avoided.
In this way, based on steps S110 to S140, according to the defragmentation threshold value that has to trigger defragmentation and is pre-specified in the embedded multimedia card memory, the defragmentation threshold value is adjusted to obtain an adjusted defragmentation threshold value smaller than the defragmentation threshold value, after the data volume exceeds the adjusted defragmentation threshold value, whether the device is in an idle state is detected, before the data volume exceeds the defragmentation threshold value under the independent defragmentation logic of the memory and under the condition that the device is in the idle state, defragmentation is actively triggered in advance in the memory, the memory can respond to the operation of the upper application in time, the user is prevented from feeling that the device is stuck or the application is unresponsive, and the user experience is improved.
Further alternative embodiments of the steps performed in performing the in-memory defragmentation under the embodiment of fig. 1 are described below.
In one embodiment, the adjusting the defragmentation threshold to obtain an adjusted defragmentation threshold includes: acquiring a preset adjustment coefficient; and adjusting the size of the defragmentation threshold according to the preset adjustment coefficient to obtain the adjusted defragmentation threshold.
The preset adjustment coefficient is a coefficient preset for adjusting the defragmentation threshold. According to a preset adjustment mode, the size of the defragmentation threshold can be adjusted by using a preset adjustment coefficient, and the adjusted defragmentation threshold is obtained.
In one embodiment, the preset adjustment coefficient is a coefficient smaller than 1, and the size of the defragmentation threshold is adjusted according to the preset adjustment coefficient, specifically, the preset adjustment coefficient is multiplied by the defragmentation threshold, so that the obtained value is the adjusted defragmentation threshold.
For example, the defragmentation threshold in the EMMC memory with the preset adjustment coefficient of 5/6 and 64G size is 20G, so that the defragmentation threshold is 20G, a proper data size is selected to trigger defragmentation in advance, passive triggering after 20G is avoided, and the adjustment after-finishing threshold for active triggering which is selected by us can be obtained to be 16.66G.
It will be appreciated that alternatively, the size of the defragmentation threshold may be adjusted according to the preset adjustment factor according to other embodiments, for example, subtracting a preset adjustment factor from the defragmentation threshold to obtain an adjusted defragmentation threshold.
In one embodiment, the adjusting the defragmentation threshold to obtain an adjusted defragmentation threshold includes:
acquiring equipment use information of the equipment; calculating according to the equipment use information to obtain a dynamic adjustment coefficient; and adjusting the size of the defragmentation threshold according to the dynamic adjustment coefficient to obtain the adjusted defragmentation threshold.
The device usage information of the device may include usage information of a data writing unit such as a system and an application in the device that will write data into the embedded multimedia card memory, and the usage information may include a size of data to be loaded by the data writing unit, a data loading rate, and the like.
The method for obtaining the dynamic adjustment coefficient by calculating according to the equipment use information may be to calculate the size, the data loading rate and the like of the obtained data to be loaded of each data writing unit according to a preset calculation method, so as to obtain the dynamic adjustment coefficient.
In one mode, the dynamic adjustment coefficient is obtained by calculating according to the equipment use information, specifically: and obtaining weighted sum of the size of the prepared loading data of each data writing unit, the data loading rate and the like to obtain weighted data, and then mapping the weighted data into a value smaller than 1 to obtain a dynamic adjustment coefficient. It will be appreciated that alternative calculation methods may be employed to calculate the dynamic adjustment coefficients based on the device usage information.
After the dynamic adjustment coefficient is obtained, the size of the defragmentation threshold is adjusted according to the dynamic adjustment coefficient, and the adjusted defragmentation threshold is obtained: in one embodiment, the dynamic adjustment coefficient is a coefficient smaller than 1, and the size of the defragmentation threshold is adjusted according to the dynamic adjustment coefficient, specifically, the dynamic adjustment coefficient is multiplied by the defragmentation threshold, so that the obtained value is the adjusted defragmentation threshold. It will be appreciated that alternatively, the defragmentation threshold may be sized according to the dynamic adjustment coefficients according to other embodiments, for example by subtracting a dynamic adjustment coefficient from the defragmentation threshold to obtain an adjusted defragmentation threshold.
The dynamic adjustment coefficient is calculated based on the equipment use information to adjust the defragmentation threshold value, so that the problem that the difference value between the defragmentation threshold value and the adjustment post-defragmentation threshold value is small under the condition that a preset adjustment coefficient is preset, and the defragmentation threshold value is not timely enough in advance is avoided. The dynamic adjustment coefficient is suitable for the service condition of the equipment, the difference value between the defragmentation threshold and the adjustment post-defragmentation threshold is generally more reasonable, and the reliability of active triggering in advance is ensured.
In one embodiment, before the amount of data in the embedded multimedia card memory exceeds the defragmentation threshold, if the device is detected to be in an idle state, before triggering defragmentation of the embedded multimedia card memory, the method further comprises:
if the data volume written in the embedded multimedia card memory exceeds the adjustment post-finishing threshold value, detecting that the equipment does not enter an idle state after exceeding the detection duration, and generating state adjustment prompt information; and playing the state adjustment prompt information so that the equipment enters the idle state.
The state adjustment prompt information can be used for prompting the equipment to be adjusted to enter an idle state, and the mode of playing the state adjustment prompt information can be played through voice and/or through displaying the prompt information text through an interface. After the prompt message is adjusted in the play state, the user can operate the device to enter an idle state, and the device can be automatically adjusted to perform the idle state.
It can be appreciated that the steps in the foregoing embodiments of generating and playing state adjustment prompt information according to the detection duration may not be performed before the device is detected to be in the idle state and the embedded multimedia card memory is triggered to perform defragmentation before the data amount in the embedded multimedia card memory exceeds the defragmentation threshold.
In one embodiment, the detection duration is determined as follows: obtaining a difference value between the defragmentation threshold and the adjustment post-defragmentation threshold; acquiring the data writing rate in the embedded multimedia card memory; acquiring average response time length aiming at notification messages in the equipment; and obtaining the detection duration according to the difference value, the data writing rate and the average response duration.
And (3) differencing the defragmentation threshold value and the post-adjustment defragmentation threshold value to obtain a difference value between the defragmentation threshold value and the post-adjustment defragmentation threshold value. The data write rate at which data is currently written into the embedded multimedia card memory may be obtained from a host controller in the embedded multimedia card memory.
According to the equipment record information, the response time length of the user to the plurality of notification messages played in the equipment can be obtained, and the average value of the response time lengths of the plurality of notification messages is the average response time length. The average response time length can be obtained by calculating the average value of the rest response time lengths after the response time lengths of the plurality of notification messages can be eliminated from the abnormal long or abnormal short response time lengths.
And calculating according to the difference value, the data writing rate and the average response time length and a preset detection time length calculation mode, so that the detection time length can be obtained. The predetermined detection time length calculation mode may be: the difference value is removed from the data writing rate to obtain a first time length, the value obtained by subtracting the average response time length from the first time length is used as a second time length, and the detection time length is obtained by subtracting a preset interval value from the second time length. In this way it is ensured that after playing the status adjustment hint information, the user has enough time to operate the device to enter an idle state before the amount of data reaches the defragmentation threshold.
It will be appreciated that in other alternative embodiments, the detection duration may be a fixed duration that is predetermined.
In one embodiment, the triggering the defragmentation of the embedded multimedia card memory if the device is detected to be in an idle state includes: if the equipment is detected to be in an idle state, determining persistence information of the idle state; and triggering the embedded multimedia card memory to carry out defragmentation according to the persistence information.
According to the type of the idle state, the current time period of the device, and the like, the duration information of the idle state can be determined, for example, if the type of the idle state is charging, and the current time period of the device is a designated time period corresponding to noon or evening, the duration information of the idle state can be determined to be the duration of the first type, otherwise, if the type of the idle state is charging, the current time period of the device is a designated time period other than noon or evening, the duration information of the idle state can be determined to be the duration of the second type.
Triggering the embedded multimedia card memory to perform defragmentation according to the persistence information may include: triggering the embedded multimedia card memory to carry out defragmentation if the persistence information meets a preset persistence condition; and if the persistence information does not meet the preset persistence condition, triggering the embedded multimedia card memory to carry out defragmentation after playing the state persistence indication information.
For example, the persistence information is of a first type, and if the persistence information meets a predetermined persistence condition, the embedded multimedia card memory is triggered to be defragmented. And if the persistence information is the second type of persistence, the persistence information does not meet the preset persistence condition, and after the state persistence indication information is played, the embedded multimedia card memory is triggered to carry out defragmentation. The status duration indication information is used for indicating a user to enable the device to keep the current idle status, and after the defragmentation is completed, the complete defragmentation information can be further played so as to prompt completion of the defragmentation.
Alternatively, in other embodiments, if the device is detected to be in an idle state, the defragmentation of the embedded multimedia card memory may be directly triggered without detecting persistence information of the idle state.
In order to facilitate better implementation of the defragmentation method provided by the embodiment of the application, the embodiment of the application also provides a defragmentation device based on the defragmentation method. Where nouns have the same meaning as in the defragmentation method described above, reference may be made to the description of an embodiment of the method for specific implementation details. Fig. 2 shows a block diagram of a defragmenter according to an embodiment of the present application.
As shown in fig. 2, defragmenter 200 may comprise: the obtaining module 210 may be configured to obtain a defragmentation threshold of the embedded multimedia card memory, where the defragmentation threshold is a threshold that is pre-specified in the embedded multimedia card memory and must trigger defragmentation; the adjustment module 220 may be configured to perform adjustment processing on the defragmentation threshold to obtain an adjusted defragmentation threshold, where the adjusted defragmentation threshold is smaller than the defragmentation threshold; the detecting module 230 may be configured to detect whether the device is in an idle state if the amount of data written in the embedded multimedia card memory exceeds the adjustment post-finishing threshold, where the idle state refers to various states that do not affect the use of the device by the user; the triggering module 240 may be configured to trigger defragmentation of the embedded multimedia card memory if the device is detected to be in an idle state before the amount of data written in the embedded multimedia card memory exceeds the defragmentation threshold.
In some embodiments of the present application, the adjustment module includes a first adjustment unit for: acquiring a preset adjustment coefficient; and adjusting the size of the defragmentation threshold according to the preset adjustment coefficient to obtain the adjusted defragmentation threshold.
In some embodiments of the present application, the adjustment module includes a second adjustment unit for: acquiring equipment use information of the equipment; calculating according to the equipment use information to obtain a dynamic adjustment coefficient; and adjusting the size of the defragmentation threshold according to the dynamic adjustment coefficient to obtain the adjusted defragmentation threshold.
In some embodiments of the present application, before the amount of data in the embedded multimedia card memory exceeds the defragmentation threshold, if the device is detected to be in an idle state, before triggering defragmentation of the embedded multimedia card memory, the apparatus further comprises a state adjustment module configured to: if the data volume written in the embedded multimedia card memory exceeds the adjustment post-finishing threshold value, detecting that the equipment does not enter an idle state after exceeding the detection duration, and generating state adjustment prompt information; and playing the state adjustment prompt information so that the equipment enters the idle state.
In some embodiments of the present application, the state adjustment module is configured to: obtaining a difference value between the defragmentation threshold and the adjustment post-defragmentation threshold; acquiring the data writing rate in the embedded multimedia card memory; acquiring average response time length aiming at notification messages in the equipment; and obtaining the detection duration according to the difference value, the data writing rate and the average response duration.
In some embodiments of the present application, the triggering module is configured to: if the equipment is detected to be in an idle state, determining persistence information of the idle state; and triggering the embedded multimedia card memory to carry out defragmentation according to the persistence information.
In some embodiments of the present application, the triggering module is configured to: triggering the embedded multimedia card memory to carry out defragmentation if the persistence information meets a preset persistence condition; and if the persistence information does not meet the preset persistence condition, triggering the embedded multimedia card memory to carry out defragmentation after playing the state persistence indication information.
It should be noted that although in the above detailed description several modules or units of a device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functions of two or more modules or units described above may be embodied in one module or unit, in accordance with embodiments of the present application. Conversely, the features and functions of one module or unit described above may be further divided into a plurality of modules or units to be embodied.
In addition, the embodiment of the application further provides an electronic device, as shown in fig. 3, which shows a schematic structural diagram of the electronic device according to the embodiment of the application, specifically:
the electronic device may include one or more processing cores 'processors 301, one or more computer-readable storage media's memory 302, power supply 303, and input unit 304, among other components. Those skilled in the art will appreciate that the electronic device structure shown in fig. 3 is not limiting of the electronic device and may include more or fewer components than shown, or may combine certain components, or may be arranged in different components. Wherein:
the processor 301 is the control center of the electronic device, connects the various parts of the overall computer device using various interfaces and lines, and performs various functions of the computer device and processes data by running or executing software programs and/or modules stored in the memory 302, and invoking data stored in the memory 302, thereby performing overall monitoring of the electronic device. Optionally, processor 301 may include one or more processing cores; preferably, the processor 301 may integrate an application processor and a modem processor, wherein the application processor primarily handles operating systems, user pages, applications, etc., and the modem processor primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 301.
The memory 302 may be used to store software programs and modules, and the processor 301 executes various functional applications and data processing by executing the software programs and modules stored in the memory 302. The memory 302 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required for at least one function, and the like; the storage data area may store data created according to the use of the computer device, etc. In addition, memory 302 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 302 may also include a memory controller to provide the processor 301 with access to the memory 302.
The electronic device further comprises a power supply 303 for powering the various components, preferably the power supply 303 is logically connected to the processor 301 by a power management system, whereby the functions of managing charging, discharging, and power consumption are performed by the power management system. The power supply 303 may also include one or more of any components, such as a direct current or alternating current power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
The electronic device may further comprise an input unit 304, which input unit 304 may be used for receiving input digital or character information and for generating keyboard, mouse, joystick, optical or trackball signal inputs in connection with user settings and function control.
Although not shown, the electronic device may further include a display unit or the like, which is not described herein. In particular, in this embodiment, the processor 301 in the electronic device loads executable files corresponding to the processes of one or more computer programs into the memory 302 according to the following instructions, and the processor 301 executes the computer programs stored in the memory 302, so as to implement the functions in the foregoing embodiments of the present application, where the processor 301 may perform the following steps:
acquiring a defragmentation threshold of an embedded multimedia card memory, wherein the defragmentation threshold is a threshold which is pre-designated in the embedded multimedia card memory and must trigger defragmentation; adjusting the defragmentation threshold to obtain an adjusted defragmentation threshold, wherein the adjusted defragmentation threshold is smaller than the defragmentation threshold; if the data amount in the embedded multimedia card memory exceeds the adjustment post-finishing threshold, detecting whether the equipment is in an idle state, wherein the idle state refers to various states which do not influence the use of the equipment by a user; before the data quantity in the embedded multimedia card memory exceeds the defragmentation threshold, triggering the embedded multimedia card memory to defragment if the device is detected to be in an idle state.
In some embodiments of the present application, the adjusting the defragmentation threshold to obtain an adjusted defragmentation threshold includes: acquiring a preset adjustment coefficient; and adjusting the size of the defragmentation threshold according to the preset adjustment coefficient to obtain the adjusted defragmentation threshold.
In some embodiments of the present application, the adjusting the defragmentation threshold to obtain an adjusted defragmentation threshold includes: acquiring equipment use information of the equipment; calculating according to the equipment use information to obtain a dynamic adjustment coefficient; and adjusting the size of the defragmentation threshold according to the dynamic adjustment coefficient to obtain the adjusted defragmentation threshold.
In some embodiments of the present application, before the amount of data in the embedded multimedia card memory exceeds the defragmentation threshold, if the device is detected to be in an idle state, before triggering defragmentation of the embedded multimedia card memory, the method further includes: if the data volume written in the embedded multimedia card memory exceeds the adjustment post-finishing threshold value, detecting that the equipment does not enter an idle state after exceeding the detection duration, and generating state adjustment prompt information; and playing the state adjustment prompt information so that the equipment enters the idle state.
In some embodiments of the present application, further comprising: obtaining a difference value between the defragmentation threshold and the adjustment post-defragmentation threshold; acquiring the data writing rate in the embedded multimedia card memory; acquiring average response time length aiming at notification messages in the equipment; and obtaining the detection duration according to the difference value, the data writing rate and the average response duration.
In some embodiments of the present application, the triggering the defragmentation of the embedded multimedia card memory if the device is detected to be in an idle state includes: if the equipment is detected to be in an idle state, determining persistence information of the idle state; and triggering the embedded multimedia card memory to carry out defragmentation according to the persistence information.
In some embodiments of the present application, the triggering the defragmentation of the embedded multimedia card memory according to the persistence information includes: triggering the embedded multimedia card memory to carry out defragmentation if the persistence information meets a preset persistence condition; and if the persistence information does not meet the preset persistence condition, triggering the embedded multimedia card memory to carry out defragmentation after playing the state persistence indication information.
It will be appreciated by those of ordinary skill in the art that all or part of the steps of the various methods of the above embodiments may be performed by a computer program, or by computer program control related hardware, which may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, the present embodiments also provide a storage medium having stored therein a computer program that can be loaded by a processor to perform the steps of any of the methods provided by the embodiments of the present application.
Wherein the storage medium may include: read Only Memory (ROM), random access Memory (RAM, random Access Memory), magnetic or optical disk, and the like.
Since the computer program stored in the storage medium may perform any of the steps in the method provided in the embodiment of the present application, the beneficial effects that can be achieved by the method provided in the embodiment of the present application may be achieved, which are detailed in the previous embodiments and are not described herein.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains.
It will be understood that the present application is not limited to the embodiments that have been described above and shown in the drawings, but that various modifications and changes can be made without departing from the scope thereof.

Claims (10)

1. A method of defragmentation comprising:
acquiring a defragmentation threshold of an embedded multimedia card memory, wherein the defragmentation threshold is a threshold which is pre-designated in the embedded multimedia card memory and must trigger defragmentation;
adjusting the defragmentation threshold to obtain an adjusted defragmentation threshold, wherein the adjusted defragmentation threshold is smaller than the defragmentation threshold;
if the data amount in the embedded multimedia card memory exceeds the adjustment post-finishing threshold, detecting whether the equipment is in an idle state, wherein the idle state refers to various states which do not influence the use of the equipment by a user;
before the data quantity in the embedded multimedia card memory exceeds the defragmentation threshold, triggering the embedded multimedia card memory to defragment if the device is detected to be in an idle state.
2. The method of claim 1, wherein said adjusting the defragmentation threshold to obtain an adjusted defragmentation threshold comprises:
acquiring a preset adjustment coefficient;
and adjusting the size of the defragmentation threshold according to the preset adjustment coefficient to obtain the adjusted defragmentation threshold.
3. The method of claim 1, wherein said adjusting the defragmentation threshold to obtain an adjusted defragmentation threshold comprises:
acquiring equipment use information of the equipment;
calculating according to the equipment use information to obtain a dynamic adjustment coefficient;
and adjusting the size of the defragmentation threshold according to the dynamic adjustment coefficient to obtain the adjusted defragmentation threshold.
4. The method of claim 1, wherein before the amount of data in the embedded multimedia card memory exceeds the defragmentation threshold, if the device is detected to be in an idle state, triggering defragmentation of the embedded multimedia card memory, the method further comprises:
if the data volume written in the embedded multimedia card memory exceeds the adjustment post-finishing threshold value, detecting that the equipment does not enter an idle state after exceeding the detection duration, and generating state adjustment prompt information;
and playing the state adjustment prompt information so that the equipment enters the idle state.
5. The method of claim 4, wherein the detection duration is determined as follows:
obtaining a difference value between the defragmentation threshold and the adjustment post-defragmentation threshold;
acquiring the data writing rate in the embedded multimedia card memory;
acquiring average response time length aiming at notification messages in the equipment;
and obtaining the detection duration according to the difference value, the data writing rate and the average response duration.
6. The method of claim 1, wherein triggering defragmentation of the embedded multimedia card memory if the device is detected in an idle state comprises:
if the equipment is detected to be in an idle state, determining persistence information of the idle state;
and triggering the embedded multimedia card memory to carry out defragmentation according to the persistence information.
7. The method of claim 6, wherein triggering defragmentation of the embedded multimedia card memory based on the persistence information comprises:
triggering the embedded multimedia card memory to carry out defragmentation if the persistence information meets a preset persistence condition;
and if the persistence information does not meet the preset persistence condition, triggering the embedded multimedia card memory to carry out defragmentation after playing the state persistence indication information.
8. A defragmenter, comprising:
the acquisition module is used for acquiring a defragmentation threshold value of the embedded multimedia card memory, wherein the defragmentation threshold value is a threshold value which is pre-designated in the embedded multimedia card memory and must trigger defragmentation;
the adjustment module is used for adjusting the defragmentation threshold value to obtain an adjusted defragmentation threshold value, and the adjusted defragmentation threshold value is smaller than the defragmentation threshold value;
the detection module is used for detecting whether the equipment is in an idle state or not if the data volume written in the embedded multimedia card memory exceeds the adjustment post-finishing threshold value, wherein the idle state refers to various states which do not influence the use of the equipment by a user;
and the triggering module is used for triggering the embedded multimedia card memory to carry out defragmentation if the equipment is detected to be in an idle state before the written data volume in the embedded multimedia card memory exceeds the defragmentation threshold value.
9. A storage medium having stored thereon a computer program which, when executed by a processor of a computer, causes the computer to perform the method of any of claims 1 to 7.
10. An electronic device, comprising: a memory storing a computer program; a processor reading a computer program stored in a memory to perform the method of any one of claims 1 to 7.
CN202310680179.9A 2023-06-09 2023-06-09 Defragmentation method, defragmentation device, storage medium and electronic device Active CN116400871B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310680179.9A CN116400871B (en) 2023-06-09 2023-06-09 Defragmentation method, defragmentation device, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310680179.9A CN116400871B (en) 2023-06-09 2023-06-09 Defragmentation method, defragmentation device, storage medium and electronic device

Publications (2)

Publication Number Publication Date
CN116400871A true CN116400871A (en) 2023-07-07
CN116400871B CN116400871B (en) 2023-09-19

Family

ID=87008058

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310680179.9A Active CN116400871B (en) 2023-06-09 2023-06-09 Defragmentation method, defragmentation device, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN116400871B (en)

Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040248612A1 (en) * 2003-06-03 2004-12-09 Lg Electronics Inc. Garbage collection system and method for a mobile communication terminal
US20130002565A1 (en) * 2011-06-28 2013-01-03 Microsoft Corporation Detecting portable device orientation and user posture via touch sensors
US8504934B1 (en) * 2012-08-30 2013-08-06 Google Inc. Displaying a graphical keyboard
CN103389948A (en) * 2012-05-10 2013-11-13 索尼公司 Device and method for managing memorizer and electronic device
US20150095292A1 (en) * 2013-10-02 2015-04-02 International Business Machines Corporation Data fragmentation tuning and candidacy persistence
CN110008141A (en) * 2019-03-28 2019-07-12 维沃移动通信有限公司 A kind of scrap cleaning method and electronic equipment
CN110377527A (en) * 2018-04-13 2019-10-25 华为技术有限公司 A kind of method and relevant device of memory management
CN111382129A (en) * 2020-03-09 2020-07-07 Oppo(重庆)智能科技有限公司 File defragmentation method, device, storage medium and related equipment
CN111444145A (en) * 2020-03-24 2020-07-24 维沃移动通信有限公司 Data cleaning method and electronic equipment
CN112445766A (en) * 2019-08-31 2021-03-05 华为技术有限公司 Terminal fragment sorting method and device and terminal
CN113268437A (en) * 2021-05-12 2021-08-17 上海龙旗科技股份有限公司 Method and equipment for actively triggering memory sorting
CN114356794A (en) * 2021-12-21 2022-04-15 深圳传音控股股份有限公司 Information prompting method, intelligent terminal and storage medium
CN114793278A (en) * 2022-04-25 2022-07-26 Oppo广东移动通信有限公司 Stuck detection method, device, equipment and storage medium
CN115687270A (en) * 2021-07-30 2023-02-03 北京小米移动软件有限公司 Data storage sorting method and device, electronic equipment and storage medium
CN115904220A (en) * 2021-08-10 2023-04-04 美光科技公司 Pre-shutdown media management operations for vehicle memory subsystems
US20230108949A1 (en) * 2021-09-28 2023-04-06 International Business Machines Corporation Defragmentation in deduplication storage systems

Patent Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040248612A1 (en) * 2003-06-03 2004-12-09 Lg Electronics Inc. Garbage collection system and method for a mobile communication terminal
US20130002565A1 (en) * 2011-06-28 2013-01-03 Microsoft Corporation Detecting portable device orientation and user posture via touch sensors
CN103389948A (en) * 2012-05-10 2013-11-13 索尼公司 Device and method for managing memorizer and electronic device
US8504934B1 (en) * 2012-08-30 2013-08-06 Google Inc. Displaying a graphical keyboard
US20150095292A1 (en) * 2013-10-02 2015-04-02 International Business Machines Corporation Data fragmentation tuning and candidacy persistence
CN110377527A (en) * 2018-04-13 2019-10-25 华为技术有限公司 A kind of method and relevant device of memory management
CN110008141A (en) * 2019-03-28 2019-07-12 维沃移动通信有限公司 A kind of scrap cleaning method and electronic equipment
CN112445766A (en) * 2019-08-31 2021-03-05 华为技术有限公司 Terminal fragment sorting method and device and terminal
CN111382129A (en) * 2020-03-09 2020-07-07 Oppo(重庆)智能科技有限公司 File defragmentation method, device, storage medium and related equipment
CN111444145A (en) * 2020-03-24 2020-07-24 维沃移动通信有限公司 Data cleaning method and electronic equipment
CN113268437A (en) * 2021-05-12 2021-08-17 上海龙旗科技股份有限公司 Method and equipment for actively triggering memory sorting
CN115687270A (en) * 2021-07-30 2023-02-03 北京小米移动软件有限公司 Data storage sorting method and device, electronic equipment and storage medium
CN115904220A (en) * 2021-08-10 2023-04-04 美光科技公司 Pre-shutdown media management operations for vehicle memory subsystems
US20230108949A1 (en) * 2021-09-28 2023-04-06 International Business Machines Corporation Defragmentation in deduplication storage systems
CN114356794A (en) * 2021-12-21 2022-04-15 深圳传音控股股份有限公司 Information prompting method, intelligent terminal and storage medium
CN114793278A (en) * 2022-04-25 2022-07-26 Oppo广东移动通信有限公司 Stuck detection method, device, equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
钱佳兴: ""闪存存储系统的碎片管理优化研究"", 《中国优秀硕士学位论文全文数据库(信息科技辑)》, no. 2022, pages 28 - 53 *

Also Published As

Publication number Publication date
CN116400871B (en) 2023-09-19

Similar Documents

Publication Publication Date Title
EP2488929B1 (en) Memory object relocation for power savings
US8255715B2 (en) Storage system and power control method thereof with mode selection defined by timeout period and power supply
KR20130021625A (en) Operating method and portable device supporting the same
CN107544755A (en) The control method and device of a kind of reading and writing data
CN108701026A (en) Method and apparatus for the managing process under memory constraints
CN114647550A (en) Process control method, device, storage medium and electronic equipment
TWI514278B (en) Method for generating a reduced snapshot image for booting, computing apparatus readable recording medium, and computing apparatus
US11860718B2 (en) Register reading method and apparatus, device, and medium
CN114968839A (en) Hard disk garbage recycling method, device and equipment and computer readable storage medium
CN103870319A (en) Method and device for information processing and electronic device
CN116400871B (en) Defragmentation method, defragmentation device, storage medium and electronic device
CN111367471B (en) Speed limiting method, device, equipment and medium for write-in cache
KR20130073697A (en) An electronics apparatus configured to execute memory cleaning and method thereof
CN115840542B (en) Method and system for processing request of hard disk, storage medium and electronic equipment
CN107526675B (en) Method and device for recording application information, storage medium and electronic equipment
KR20170055206A (en) Method of controlling memory cell access based on safe address mapping
CN111381953B (en) Process management method and device, storage medium and electronic equipment
CN111090627B (en) Log storage method and device based on pooling, computer equipment and storage medium
CN104461754B (en) A kind of method and apparatus for monitoring eMMC
CN104572332B (en) The method and apparatus of processing system collapse
CN112346556A (en) Method, device, computer equipment and medium for improving low power consumption efficiency of chip
CN110069330A (en) A kind of data destruction method based on system load, device and equipment
CN115794446B (en) Message processing method and device, electronic equipment and storage medium
CN113064639B (en) Method, system and medium for reducing server boot time
CN116991636B (en) Data incremental backup method, system and storage medium based on distributed storage

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