WO2016008070A1 - 数据写入的方法及装置 - Google Patents

数据写入的方法及装置 Download PDF

Info

Publication number
WO2016008070A1
WO2016008070A1 PCT/CN2014/082147 CN2014082147W WO2016008070A1 WO 2016008070 A1 WO2016008070 A1 WO 2016008070A1 CN 2014082147 W CN2014082147 W CN 2014082147W WO 2016008070 A1 WO2016008070 A1 WO 2016008070A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
written
target
page
data page
Prior art date
Application number
PCT/CN2014/082147
Other languages
English (en)
French (fr)
Inventor
王元钢
徐君
朱冠宇
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2014/082147 priority Critical patent/WO2016008070A1/zh
Priority to CN201480037216.3A priority patent/CN105518790B/zh
Publication of WO2016008070A1 publication Critical patent/WO2016008070A1/zh

Links

Classifications

    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11CSTATIC STORES
    • G11C11/00Digital stores characterised by the use of particular electric or magnetic storage elements; Storage elements therefor
    • G11C11/56Digital stores characterised by the use of particular electric or magnetic storage elements; Storage elements therefor using storage elements with more than two stable states represented by steps, e.g. of voltage, current, phase, frequency

Definitions

  • the present invention relates to the field of data storage, and in particular, to a method and an apparatus for writing data. Background technique
  • phase change memory combines the high-speed access characteristics of DRAM memory and the characteristics of flash memory to retain data after power is turned off, phase change memory is regarded by the industry as a replacement for DRAM flash memory and memory in the future.
  • the write latency is much larger than the read latency, because the delay in writing 0 and writing 1 is asymmetrical, that is, writing 0 (also called res et)
  • writing 0 also called res et
  • the delay is low, write 1 (also called set), the delay is large, and the delay between the two is more than ten times.
  • the read latency of read 0 and read 1 is basically the same.
  • the prior art provides a data writing method in which only changed data is written. Specifically: the idle data page is allocated according to the address sequence of the idle data page or the time sequence generated by the idle data page, and the address of the free data page is the write address, and the currently stored data on the write address is obtained (write The input address is the address to be written to the data to be written, and the data is compared with the data to be written to obtain a difference data bit, and the data bit of the difference is written.
  • the above-described step of reading out the stored data in the write address and comparing it with the data to be written before writing becomes a pre-write read.
  • the inventors have found that at least the following problems exist in the prior art: When the data to be written is completely different from the stored data, it is necessary to store all the data bits of the data to be written to The amount of data involved in the write operation in the write address is the same as the amount of data directly written without the pre-write read, that is, the number of write 1 operations is not reduced, and the write latency cannot be reduced.
  • the idle data page is allocated for writing the data to be written only according to the address sequence of the idle data page or the time sequence generated by the idle data page, because the method is obtained in this manner.
  • the idle data page may appear completely different or substantially different from the data to be written.
  • the differential write will cause a large number of write operations, and the write amount cannot be guaranteed to be reduced, and the write delay reduction effect is unstable. Summary of the invention
  • Embodiments of the present invention provide a data writing method and apparatus for solving the problem that the degradation effect of the write delay is unstable.
  • the present invention provides a data writing method, the method comprising: sampling a data to be written according to a preset sampling algorithm to obtain a target label, where the target label is used to represent the data to be written The numerical distribution of the data bits in the middle;
  • the sampling is performed to obtain a target label, including:
  • the target tag is determined according to the determined identification bits of each data region.
  • a second possible implementation manner of the first aspect is further provided.
  • Sampling the data to be written according to the preset sampling algorithm, and obtaining the target label including:
  • the feature value is determined as a target tag.
  • the first aspect is also provided A third possible implementation manner of the first aspect, in the third possible implementation manner of the first aspect, the data bit that is different from the target idle data page in the data to be written is written Corresponding locations in the target free data page, including:
  • the data in the data to be written in the data to be written is written into the data bit to be written of the target free data page.
  • a fourth possible implementation of the first aspect is also provided, in the first aspect
  • the method further includes:
  • the idle data page is divided into a preset idle data page group, and the free data page label is determined as a group label corresponding to the preset idle data page group.
  • a fifth possible implementation of the first aspect is also provided, a fifth possible aspect of the first aspect.
  • the method further includes:
  • the new idle data page is sampled according to the preset sampling algorithm, and a new idle data page label corresponding to the new idle data page is obtained;
  • the new free data page is added to the preset idle data page packet corresponding to the group tag with the highest similarity.
  • the present invention provides an apparatus for data writing, the apparatus comprising: a sampling unit, configured to sample the data to be written according to the preset sampling algorithm, to obtain a target label, where the target label is used to indicate a numerical distribution of data bits in the data to be written;
  • a searching unit configured to search, from the preset group label set, a target group label with the highest similarity with the target label obtained by the sampling unit, where the preset group label set is composed of at least one group label, and each group label Corresponding to at least two free data pages having similar data characteristics;
  • a selecting unit configured to select a target idle data page from at least one free data page corresponding to the target group label searched by the searching unit;
  • a writing unit configured to write a data bit in the data to be written that is different from the target free data page selected by the selecting unit, into a corresponding position in the target free data page.
  • the sampling unit includes:
  • a dividing subunit configured to divide the data to be written into a preset number of data regions
  • a flag determining subunit configured to separately analyze a distribution feature of data in each data region divided by the dividing subunit, according to The distribution feature determines an identification bit of each data region
  • a first target label determining subunit configured to determine the target label according to the identifier bit of each data area determined by the identifier bit determining subunit.
  • the sampling unit also includes:
  • a conversion subunit configured to convert the data to be written into a binary image according to the data content in the data to be written
  • An image analysis subunit configured to perform image analysis on the binary image obtained by the conversion subunit to obtain a feature value, where the feature value is used to represent a graphic feature of the binary image;
  • a second target tag determining subunit configured to determine the feature value obtained by the image analyzing subunit as a target tag.
  • the writing unit includes:
  • a determining subunit configured to determine whether each data bit in the data to be written is the same as data in a data bit at the same position in the target free data page
  • a data bit determining subunit to be written configured to determine, when the determining unit obtains that the current data bit in the data to be written is different from the data in the same position in the target free data page, The same data bit is the data bit to be written;
  • a write subunit configured to write data of the to-be-written data bit determined by the to-be-written data bit determining subunit in the data to be written to the target idle data page to be written In the data bit.
  • the sampling unit is further configured to: sample the idle data page according to the preset sampling algorithm, to obtain an idle data page label corresponding to each idle data page, where the idle data page is a data page in the system that is idle;
  • the device also includes:
  • a grouping unit configured to divide the free data page having the same free data page label into a preset idle data page group, and determine the free data page label as the group label corresponding to the preset idle data page group.
  • the sampling unit is further configured to: when a new idle data page is generated, sample the new idle data page according to the preset sampling algorithm, to obtain a new idle data page corresponding to the new idle data page.
  • the searching unit is further configured to: search, from the preset group of label sets, a group label with the highest similarity to the new idle data page label obtained by the sampling unit;
  • the device also includes:
  • the present invention provides an apparatus for writing data, the apparatus comprising: a processor, configured to sample a data to be written according to a preset sampling algorithm, to obtain a target label, where the target label is used to represent Describe the numerical distribution of the data bits in the written data;
  • a memory configured to store the preset group label set
  • a target group label with the highest similarity with the target label where the preset group label set is composed of at least one group label, and each group label corresponds to a similar data feature. At least two free data pages;
  • the memory is further configured to store the idle data page
  • the processor is further configured to: select a target idle data page from at least one free data page corresponding to the target group label;
  • a data bit in the data to be written that is different from the target free data page is written to a corresponding position in the target free data page.
  • the processor is further configured to:
  • the target tag is determined according to the determined identification bits of each data region.
  • a second possible implementation manner of the third aspect is further provided.
  • the processor is also used to:
  • the feature value is determined as a target tag.
  • a third possible implementation manner of the third aspect is further provided.
  • the processor is also used to:
  • the data in the data to be written in the data to be written is written into the data bit to be written of the target free data page.
  • a fourth possible implementation of the third aspect is also provided, in the third aspect
  • the processor is further configured to:
  • the free data page having the same free data page label is divided into a preset idle data page group, and the free data page label is determined as the group label corresponding to the preset idle data page group.
  • a fifth possible implementation of the third aspect is also provided, and a fifth possible aspect of the third aspect
  • the processor is further configured to:
  • the new idle data page is sampled according to the preset sampling algorithm, and a new idle data page label corresponding to the new idle data page is obtained;
  • the new free data page is added to the preset idle data page packet corresponding to the group tag with the highest similarity.
  • the method and device for writing data provided by the present invention can sample the write data before the storage address is allocated for the data to be written, obtain a target label indicating the data feature of the data to be written, and then select the target label from the preset group. Find the target group with the highest similarity to the target tag in the tag set And selecting a target free data page from the plurality of free data pages corresponding to the target group label, and then writing a data bit in the data to be written that is different from the target free data page into the target idle data page. position.
  • the free data page is allocated for writing the data to be written only according to the address sequence of the idle data page or the time sequence generated by the idle data page, since the free data page obtained in this way may appear and be written.
  • Incoming data is completely different or basically different (more than 90% difference).
  • differential writing will cause a large number of write operations, so the prior art cannot guarantee to reduce the amount of writing.
  • the prior art when a blank data page is allocated, the degree of similarity between the blank data page and the data to be written is not considered, and there is a case where the allocated blank data page is identical or similar to the content of the data to be written.
  • the prior art directly allocates idle data pages for data to be written, so that the data features of the allocated free data pages are significantly different from the structural features of the data to be written, resulting in the number of write operations being similar to the number of write operations of ordinary write operations. Or the same, the effect of reducing the write delay is unstable.
  • the allocated blank data page can be determined according to the degree of similarity between the data to be written and the blank data page, because the target tag and the group tag are matched, and obtained and to be written, before the free data page is allocated for the data to be written. Entering a set of free data pages closest to the data, and selecting a free data page from the set of free data pages for differential storage, so the blank data page allocated for the data to be written in the present invention has the data to be written
  • the blank data page with the highest similarity, in the case of differential storage can reduce the number of write operations and achieve the effect of stably reducing the number of write operations.
  • FIG. 1 is a flowchart of a method for writing a first data in an embodiment of the present invention
  • FIG. 1 is a flowchart of a method for writing a second data in an embodiment of the present invention
  • FIG. 3 is a flowchart of a method for writing a third data in an embodiment of the present invention.
  • FIG. 4 is a flowchart of a method for writing a fourth data in an embodiment of the present invention.
  • FIG. 5 is a flowchart of a method for writing a fifth data according to an embodiment of the present invention
  • FIG. 6 is a flowchart of a sixth data writing method according to an embodiment of the present invention
  • FIG. 7 is a schematic diagram of data flow of a usage scenario in an embodiment of the present invention.
  • FIG. 8 is a schematic structural diagram of an apparatus for writing first data according to an embodiment of the present invention.
  • FIG. 9 is a schematic structural diagram of an apparatus for writing a second data according to an embodiment of the present invention.
  • FIG. 10 is a schematic structural diagram of an apparatus for writing a third data according to an embodiment of the present invention.
  • FIG. 11 is a schematic structural diagram of an apparatus for writing a fourth data according to an embodiment of the present invention.
  • FIG. 12 is a schematic structural diagram of an apparatus for writing a fifth data according to an embodiment of the present invention.
  • FIG. 13 is a schematic structural diagram of an apparatus for writing a sixth data according to an embodiment of the present invention.
  • FIG. 14 is a schematic structural diagram of an apparatus for writing a seventh data according to an embodiment of the present invention.
  • An embodiment of the present invention provides a data writing method, where the method is applied to an electronic device having data storage and processing capabilities, such as a server, a personal computer, a mobile terminal, etc., as shown in FIG.
  • the method includes:
  • Step 101 Sampling the data to be written according to a preset sampling algorithm to obtain a target label, where the target label is used to indicate a numerical distribution of data bits in the data to be written.
  • the data to be written is divided into a plurality of data areas according to fixed data units, and the identification bits of each area are determined according to the distribution characteristics of the data in each data area, and the target labels are generated according to the respective identification bits.
  • a 64 Byte (byte) of data to be written is divided into a data area every 8b to form 64 data areas, and the distribution characteristics in each data area are respectively analyzed to obtain 64 flag bits.
  • the flag bits are arranged in order to form the target tag of 64b it.
  • the number of the target is different from the size of the data to be written, and the target tag may be 256 bi t or 512 bi t or the like.
  • the above sampling algorithm is used for sampling idle data pages and new idle data pages in addition to sampling for data to be written. Since the write is usually performed in units of data pages, regardless of the total amount of data of the data to be written (such as a movie), the data to be written is written when the write operation is performed. The write operation is completed in the data page where the system is idle, and the amount of data written each time is the size of a data page (such as a data segment after the movie is split). Therefore, the data size of the data to be written (ie, data written each time) is a data page size, and the data to be written can be processed as one data page during reading and processing. A free data page is an empty physical page for storing data.
  • the data page is a Non-Viola te Memory (NVM) page.
  • NVM Non-Viola te Memory
  • Step 102 Search for a target group label with the highest similarity with the target label from the preset group label set, where the preset group label set is composed of at least one group label, and each group label corresponds to at least two idle data pages having similar data characteristics. .
  • the target group label and the target label are identical.
  • the target group label and the target label are not identical. However, the target group label is the same content as the target label in the preset group label set, and more than any one of the preset group label sets except the target group label is the same as the target label.
  • Step 103 Select a target idle data page from at least one free data page corresponding to the target group label.
  • the target free data page is randomly selected or sequentially selected from at least one free data page corresponding to the target group label. If at least one free data page is stored in a linked list form, the pointer associated with the target free data page is updated after the target free data page is selected.
  • Step 104 Write a data bit that is different from the target idle data page in the data to be written, and write the data bit in the target idle data page.
  • data to be written is written to the target free data page, only the difference data bits are written.
  • the data to be written and the target free data page differ only in the content of the 10th data bit.
  • the content of the 10th data bit in the data to be written is 1, and the 10th data bit in the target free data page. If the content is 0, only the 10th data bit of the target free data page is written.
  • the method for writing data according to the present invention can sample the write data before the storage address is allocated for the data to be written, obtain the target label indicating the data feature of the data to be written, and then set the label from the preset group label. Searching for the target group label with the highest similarity with the target label, selecting a target free data page from the plurality of free data pages corresponding to the target group label, and then distinguishing the to-be-written data from the target free data page. The data bits are written to corresponding locations in the target free data page.
  • the free data page is allocated for writing the data to be written only according to the address sequence of the idle data page or the time sequence generated by the idle data page, since the free data page obtained in this way may appear and be written.
  • Incoming data is completely different or basically different (more than 90% difference).
  • differential writing will cause a large number of write operations, so the prior art cannot guarantee to reduce the amount of writing.
  • the prior art when a blank data page is allocated, the degree of similarity between the blank data page and the data to be written is not considered, and there is a case where the allocated blank data page is identical or similar to the content of the data to be written.
  • the prior art directly allocates idle data pages for data to be written, so that the data features of the allocated free data pages are significantly different from the structural features of the data to be written, resulting in the number of write operations being similar to the number of write operations of ordinary write operations. Or the same, the effect of reducing the write delay is unstable.
  • the allocated blank data page can be determined according to the degree of similarity between the data to be written and the blank data page, because the target tag and the group tag are matched, and obtained and to be written, before the free data page is allocated for the data to be written. Entering a set of free data pages closest to the data, and selecting a free data page from the set of free data pages for differential storage, so the blank data page allocated for the data to be written in the present invention has the data to be written
  • the blank data page with the highest similarity, in the case of differential storage can reduce the number of write operations and achieve the effect of stably reducing the number of write operations.
  • the embodiment of the present invention further provides a method for writing data.
  • step 101 sampling a data to be written according to a preset sampling algorithm to obtain a target label.
  • Step 201 Divide the data to be written into a preset number of data areas.
  • Step 202 separately analyze the distribution characteristics of the data in each data area, and determine the identification bits of each data area according to the distribution characteristics.
  • the flag is 0 or 1.
  • the determination rules for the identification bits include any of the following:
  • the data area contains a total of 8 data bits, where "1" appears 5 times and "0" appears 3 times, then the data area has a flag of 1.
  • the identification bit is 1. If the number of occurrences of "1" in the first half is less than the number of occurrences of "1" in the second half, the flag is 0.
  • the data area contains a total of 8 data bits, the first half corresponds to the first to fourth data bits, and the second half corresponds to the fifth to eighth data bits.
  • the data content of the data area is "1101 0100".
  • the number of occurrences of "1" in the first half (3 times) and the number of occurrences of "1" in the second half (1 time), therefore, the flag of the data area is determined to be 1.
  • the identification bit is 1. If the number of "1"s in the first half occurs more than the number of occurrences of "1" in the second half, the flag is 0.
  • the data area contains a total of 8 data bits, the first half corresponds to the first to fourth data bits, and the second half corresponds to the fifth to eighth data bits.
  • the data content of the data area is "1101 0100".
  • the number of occurrences of "0" in the first half (1 time) is less than the number of occurrences of "0" in the second half (3 times), so it is determined that the flag bit of the data area is 0.
  • Step 203 Determine a target label according to the determined identifier bit of each data area.
  • the identification bits in each data area are sequentially arranged to obtain a target label.
  • the data to be written is divided into 8 data areas, and the identification bits of each data area are "1", “0", “0", T, "0", T, ⁇ , "0", then the target tag of the data to be written is "10010110".
  • the method for writing data according to the embodiment of the present invention can divide the data to be written, analyze the divided data regions to obtain the identifier bits of each data region, and determine the data to be written according to the obtained identifier bits.
  • the target tag by refining the analysis object (data area), can improve the accuracy of the target tag, so that the target tag more accurately represents the data feature of the data to be written.
  • step 101 sampling a data to be written according to a preset sampling algorithm to obtain a target label. , including:
  • Step 301 Convert the data to be written into a binary image according to the data content in the data to be written.
  • the data content in the data to be written is "0" or "1". In the binary image, 0 means white and 1 means black.
  • Step 302 Perform image analysis on the binary image to obtain feature values, and the feature values are used to represent graphical features of the binary image.
  • Step 303 Determine the feature value as a target tag.
  • the data writing method provided by the embodiment of the present invention can convert the data to be written into a binary image. Since the prior art has a relatively mature technical solution in the field of image analysis, in the present case, the conversion is obtained. The binary image is analyzed, and the target label accurately representing the characteristics of the data to be written can be obtained, and the accuracy of the target label is improved.
  • the embodiment of the present invention further provides a data writing method.
  • the data to be written and the target free data page are Data bits that differ, are written to corresponding locations in the target free data page, including:
  • Step 401 Determine whether data in each of the data bits in the data to be written is the same as the data in the same position in the target free data page.
  • Step 402 If the current data bit in the data to be written is different from the data content in the data bit at the same position in the target free data page, determine that the same data bit is the data bit to be written.
  • Step 403 Write data in the data to be written located in the data to be written to the data bit to be written of the target free data page.
  • the method for writing data can compare the write data to the target idle data page with the granularity of the data bit, determine the data bit to be written, accurately locate the data bit to be written, and improve data writing. s efficiency.
  • the embodiment of the present invention further provides a method for writing data.
  • step 101 the data to be written according to a preset sampling algorithm is sampled.
  • the method further includes:
  • Step 501 Sample an idle data page according to a preset sampling algorithm, and obtain an idle data page label corresponding to each idle data page, where the idle data page is a data page in an idle state in the system.
  • the processor finishes processing a certain piece of code or deletes a certain data
  • the piece of code or the storage space occupied by the data is released.
  • the data page in the storage space becomes an idle data page, and the idle number is used, that is, the released data.
  • the page is idle.
  • Step 502 The idle data page having the same free data page label is divided into a preset idle data page group, and the idle data page label is determined as a group label corresponding to the preset idle data page group.
  • the free data page having the similar free data page label is divided into a preset idle data page group, and the idle data page label is determined as the group label corresponding to the preset idle data page group.
  • the similarity is the degree of similarity between the preset free ratios between the idle data page labels, the preset ratio being, for example, 90%.
  • the method for writing data according to an embodiment of the present invention can group idle data pages according to idle data page labels, and each packet has the same idle data page label (group label), thereby implementing The data pages in the idle state of the system are managed, and when the free data pages are allocated for the write data, the packets to be used can be directly determined according to the group labels, thereby improving the data writing efficiency.
  • the embodiment of the present invention further provides a data writing method.
  • the free data page having the same free data page label is divided into one.
  • the method further includes:
  • Step 601 When a new idle data page is generated, the new idle data page is sampled according to a preset sampling algorithm, and a new free data page label corresponding to the new idle data page is obtained.
  • Step 602 Find a group label with the highest similarity from the new idle data page label from the preset group label set.
  • Step 603 Add a new idle data page to the preset idle data page group corresponding to the group tag with the highest similarity.
  • the new free data page is the newly generated free data page. Since all free data pages in the system are grouped before a new free data page is generated, when a data page is idle, the data page is added to the existing packet based on the existing free data page packet.
  • the method for writing data according to an embodiment of the present invention can add a new free data page to an existing preset idle data page packet according to a new free data page label, and update a free data page in a preset idle data page group in real time. , improve data writing efficiency.
  • step one uses the following process:
  • Step 101 Sampling the data to be written X according to a preset sampling algorithm to obtain a target label.
  • Step 102 Search for a target group label with the highest similarity to the target label from the preset group label set.
  • a set of and a set of tags with three group tags is set, and the group tags are group tag A, group tag B, and group tag respectively.
  • H group tag C is the group tag with the highest similarity to the target tag, Then the target group label is the group label c.
  • Step 103 Select a target idle data page from at least one free data page corresponding to the target group label.
  • the group label A corresponds to the idle data page group a, and the free data page group a includes two free data pages, which are the idle data page a l and the idle data page a2, respectively.
  • the group label B corresponds to the idle data page group b, and the free data page group b includes three free data pages, which are the idle data page bl, the idle data page b2, and the idle data page b3.
  • the group label C corresponds to the idle data page group c, and the free data page group c includes three free data pages, which are the idle data page cl, the idle data page c2, and the idle data page c3, respectively.
  • a free data page is randomly or sequentially selected from the idle data packet c as the target free data page, such as the free data page c2, and the free data page c2 is the target free data page.
  • the second step compares the data to be written X with the target idle data page c2, determines the data bits having the difference, and performs a write operation on the data bits having the difference.
  • the embodiment of the present invention further provides a device for writing data.
  • the device is used to implement the foregoing method, and the device includes:
  • a sampling unit 81 configured to sample the data to be written according to a preset sampling algorithm, to obtain a target label, where the target label is used to represent a numerical distribution of data bits in the data to be written
  • a searching unit 82 is configured to Searching, in the preset group label set, a target group label having the highest similarity with the target label obtained by the sampling unit 81, where the preset group label set is composed of at least one group label, and each group label has similar data characteristics. At least two free data pages;
  • the selecting unit 83 is configured to select a target idle data page from at least one free data page corresponding to the target group label searched by the searching unit 82;
  • the writing unit 84 is configured to write a data bit of the to-be-written data that is different from the target free data page selected by the selecting unit 83, into a corresponding position in the target free data page.
  • the device for writing data provided by the present invention can sample the write data before the storage address is allocated for the data to be written, and obtain a target label indicating the data feature of the data to be written. And searching for the target group label with the highest similarity to the target label from the preset group label set, selecting the target idle data page from the plurality of idle data pages corresponding to the target group label, and then Data bits that differ in the target free data page are written to corresponding locations in the target free data page.
  • the free data page is allocated for writing the data to be written only according to the address sequence of the idle data page or the time sequence generated by the idle data page, since the free data page obtained in this way may appear and be written. Incoming data is completely different or basically different (more than 90% difference).
  • the allocated blank data page can be determined according to the degree of similarity between the data to be written and the blank data page, because the target tag and the group tag are matched, and obtained and to be written, before the free data page is allocated for the data to be written. Entering a set of free data pages closest to the data, and selecting a free data page from the set of free data pages for differential storage, so the blank data page allocated for the data to be written in the present invention has the data to be written
  • the blank data page with the highest similarity, in the case of differential storage can reduce the number of write operations and achieve the effect of stably reducing the number of write operations.
  • the embodiment of the present invention further provides a device for writing data.
  • the sampling unit 81 includes:
  • the dividing sub-unit 81 1 is configured to divide the data to be written into a preset number of data areas; and the identifier determining unit 812 is configured to separately analyze data in each data area divided by the dividing sub-unit 81 1 a distribution feature, the identifier bit of each data region is determined according to the distribution feature; the first target label determining sub-unit 81 3 is configured to determine, according to the identifier bit, the identifier bit of each data region determined by the sub-unit 812 The target tag.
  • the embodiment of the present invention further provides a device for writing data.
  • the sampling unit 81 further includes:
  • the conversion subunit 814 is configured to convert the data to be written into a binary image according to the data content in the data to be written;
  • the image analysis sub-unit 815 is configured to perform image analysis on the binary image obtained by the conversion sub-unit 814 to obtain a feature value, where the feature value is used to represent a graphic feature of the binary image;
  • the second target tag determining sub-unit 816 is configured to determine the feature value obtained by the image analyzing sub-unit 815 as a target tag.
  • the embodiment of the present invention further provides a device for writing data.
  • the writing unit 84 includes:
  • a determining subunit 841 configured to determine whether each data bit in the data to be written is the same as data in a data bit at the same position in the target free data page;
  • a data bit determining subunit 842 to be used when the determining unit obtains that the current data bit in the data to be written is different from the data in the data bit at the same position in the target free data page, The same data bit is the data bit to be written;
  • a write subunit 843 configured to write data of the to-be-written data bit determined by the to-be-written data bit determining subunit 842 in the to-be-written data to the target idle data page Write to the data bit.
  • the embodiment of the present invention further provides a device for writing data, as a specific description of the device shown in FIG. 9 and FIG. 10, as shown in FIG.
  • the sampling unit 81 is further configured to: sample the idle data page according to the preset sampling algorithm, to obtain an idle data page label corresponding to each idle data page, where the free data page is a data page in an idle state in the system. ;
  • the device also includes:
  • the grouping unit 85 is configured to divide the free data page having the same free data page label into a preset idle data page group, and determine the free data page label as the group label corresponding to the preset idle data page group.
  • the embodiment of the present invention further provides a device for writing data, as a specific description of the device shown in FIG. 12, as shown in FIG.
  • the sampling unit 81 is further configured to: when the new idle data page is generated, sample the new idle data page according to the preset sampling algorithm, to obtain a new idle data page label corresponding to the new idle data page;
  • the searching unit 82 is further configured to: search, from the preset group of label sets, a group label with the highest similarity to the new idle data page label obtained by the sampling unit 81;
  • the device also includes:
  • the adding unit 86 is configured to add the new idle data page to the preset idle data page group corresponding to the group tag with the highest similarity found by the searching unit 82.
  • the embodiment of the present invention further provides a device for writing data, and the device is used to implement the foregoing method.
  • the device includes:
  • the processor 1401 is configured to sample the data to be written according to the preset sampling algorithm, to obtain a target label, where the target label is used to indicate a numerical distribution of data bits in the data to be written; and the storage 1402 is configured to store a set of preset group labels;
  • a target group label with the highest similarity with the target label where the preset group label set is composed of at least one group label, and each group label has similar data characteristics. At least two free data pages;
  • the memory is further configured to store the idle data page
  • the processor is further configured to: select a target idle data page from at least one free data page corresponding to the target group label;
  • a data bit in the data to be written that is different from the target free data page is written to a corresponding position in the target free data page.
  • the device for writing data can sample the data to be written before the storage address is allocated for the data to be written, obtain a target label indicating the data feature of the data to be written, and then set the label from the preset group label. Searching for the target group label with the highest similarity with the target label, selecting a target free data page from the plurality of free data pages corresponding to the target group label, and then distinguishing the to-be-written data from the target free data page. The data bits are written to corresponding locations in the target free data page.
  • the free data page is allocated for writing the data to be written only in the order of the address of the idle data page or the time sequence generated by the idle data page, because the space obtained in this way is empty.
  • the free data page may appear completely different or substantially different from the data to be written (more than 90%).
  • differential writing will cause a large number of write operations, so the prior art cannot guarantee to reduce the write amount.
  • the prior art when a blank data page is allocated, the degree of similarity between the blank data page and the data to be written is not considered, and there is a case where the allocated blank data page is identical or similar to the content of the data to be written.
  • the prior art directly allocates idle data pages for data to be written, so that the data features of the allocated free data pages are significantly different from the structural features of the data to be written, resulting in the number of write operations being similar to the number of write operations of ordinary write operations. Or the same, the effect of reducing the write delay is unstable.
  • the allocated blank data page can be determined according to the degree of similarity between the data to be written and the blank data page, because the target tag and the group tag are matched, and obtained and to be written, before the free data page is allocated for the data to be written. Entering a set of free data pages closest to the data, and selecting a free data page from the set of free data pages for differential storage, so the blank data page allocated for the data to be written in the present invention has the data to be written
  • the blank data page with the highest similarity, in the case of differential storage can reduce the number of write operations and achieve the effect of stably reducing the number of write operations.
  • processor 1401 is further configured to:
  • the target tag is determined according to the determined identification bits of each data region.
  • processor 1401 is further configured to:
  • the feature value is determined as a target tag.
  • processor 1401 is further configured to:
  • the data in the data to be written in the data to be written is written into the data bit to be written of the target free data page.
  • processor 1401 is further configured to:
  • the free data page having the same free data page label is divided into a preset idle data page group, and the free data page label is determined as the group label corresponding to the preset idle data page group.
  • processor 1401 is further configured to:
  • the new idle data page is sampled according to the preset sampling algorithm, and a new idle data page label corresponding to the new idle data page is obtained;
  • the new free data page is added to the preset idle data page packet corresponding to the group tag with the highest similarity.
  • MRAM magnetic random access memory

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明公开了一种数据写入的方法及装置,涉及数据存储领域,用于解决写时延的降低效果不稳定的问题。所述方法包括:根据预设抽样算法对待写入数据进行抽样,得到目标标签,所述目标标签用于表示所述待写入数据中数据位的数值分布情况;从预设组标签集合中查找与所述目标标签相似度最高的目标组标签,所述预设组标签集合由至少一个组标签组成,每个组标签对应具有相似数据特征的至少两个空闲数据页;从所述目标组标签对应的至少一个空闲数据页中选择目标空闲数据页;将所述待写入数据中与所述目标空闲数据页存在差异的数据位,写入所述目标空闲数据页中的对应位置。本发明主要应用于数据读写操作过程中。

Description

数据写入的方法及装置 技术领域
本发明涉及数据存储领域, 尤其涉及一种数据写入的方法及装置。 背景技术
随着緩存技术的发展, 在动态随机存取存储器(Dynami c Random Acces s Memory , 简称 DRAM )之后, 业界开发出了用于替换 DRAM的新的存储器相变内 存(Pha se-Change Memory , 简称 PCM )。 由于相变内存结合了 DRAM内存的高 速存取特性, 以及闪存在关闭电源之后保留数据的特性, 因此相变内存被业 界视为未来替代 DRAM的闪存和内存。 但是, 在相变内存的读写操作中, 写时 延远大于读时延, 其原因在于: 在写 0和写 1时的时延具有不对称性, 即写 0 (也称 res et ) 的时延艮低, 写 1 (也称 set ) 时延^艮大, 两者的时延相差十 几倍以上。 而读 0和读 1的读时延基本相同。
为了提高数据写入的速度, 现有技术提供了一种数据写入方法, 在该发 那个发中仅将发生变化的数据进行写入。 具体的: 按照空闲数据页的地址顺 序或者空闲数据页产生的时间顺序为待写入数据分配空闲数据页, 空闲数据 页的地址为写入地址, 获取写入地址上当前已存储的数据 (写入地址为待写 入数据即将存入的地址), 将该数据与待写入数据进行比较, 得到差异的数据 位, 对该差异的数据位进行写操作。 上述在写入之前将写入地址中已存储的 数据进行读出并与待写入数据进行比较的步骤成为写前读。
在实现上述数据写入的过程中, 发明人发现现有技术中至少存在如下问 题: 当待写入数据与已存储的数据差别完全不同时, 需要将待写入数据的各 个数据位全部存储到该写入地址中写操作涉及的数据量, 与不进行写前读直 接进行写入的数据量相同, 即不会减少写 1 操作的数量, 进而无法降低写时 延。 可见, 现有技术中仅按照空闲数据页的地址顺序或者空闲数据页产生的 时间顺序将空闲数据页分配用于写入待写入数据, 由于按照此种方式获得的 空闲数据页可能出现与待写入数据完全不同或基本不同, 此时进行差异写入 将造成大量的写操作, 无法保证降低写入量, 写时延的降低效果不稳定。 发明内容
本发明的实施例提供一种数据写入的方法及装置, 用于解决写时延的降 低效果不稳定的问题。
第一方面, 本发明提供了一种数据写入的方法, 所述方法包括: 根据预设抽样算法对待写入数据进行抽样, 得到目标标签, 所述目标标 签用于表示所述待写入数据中数据位的数值分布情况;
从预设组标签集合中查找与所述目标标签相似度最高的目标组标签, 所 述预设组标签集合由至少一个组标签组成, 每个组标签对应具有相似数据特 征的至少两个空闲数据页;
从所述目标组标签对应的至少一个空闲数据页中选择目标空闲数据页; 将所述待写入数据中与所述目标空闲数据页存在差异的数据位, 写入所 述目标空闲数据页中的对应位置。
结合第一方面, 在所述第一方面的第一种可能的实现方式中, 所述根据 预设抽样算法对待写入数据进行抽样, 得到目标标签, 包括:
将所述待写入数据划分为预设数量的数据区域;
分别分析每个数据区域中数据的分布特征, 根据所述分布特征确定每个 数据区域的标识位;
根据确定出的每个数据区域的标识位确定所述目标标签。
结合第一方面, 在所述第一方面的实现方式中, 还提供了所述第一方面 的第二种可能的实现方式, 在所述第一方面的第二种可能的实现方式中, 所 述根据预设抽样算法对待写入数据进行抽样, 得到目标标签, 包括:
根据待写入数据中的数据内容,将待写入数据转换为二值图像; 对所述二值图像进行图像分析得到特征值,所述特征值用于表示所述二 值图像的图形特征;
将所述特征值确定为目标标签。
结合第一方面, 在所述第一方面的实现方式中, 还提供了所述第一方面 的第三种可能的实现方式, 在所述第一方面的第三种可能的实现方式中, 所 述将所述待写入数据中与所述目标空闲数据页存在差异的数据位, 写入所述 目标空闲数据页中的对应位置, 包括:
分别判断所述待写入数据中每个数据位与所述目标空闲数据页中相同位 置的数据位中的数据是否相同;
如果所述待写入数据中当前数据位与所述目标空闲数据页中相同位置的 数据位中的数据内容不同, 则确定所述相同数据位为待写入数据位;
将所述待写入数据中位于所述待写入数据位的数据写入到所述目标空闲 数据页的待写入数据位中。
结合第一方面, 在所述第一方面的第一种可能或第二种可能的实现方式 中, 还提供了所述第一方面的第四种可能的实现方式, 在所述第一方面的第 四种可能的实现方式中, 在所述根据预设抽样算法对待写入数据进行抽样, 得到目标标签之前, 所述方法还包括:
根据所述预设抽样算法对空闲数据页进行抽样, 得到每个空闲数据页对 应的空闲数据页标签, 所述空闲数据页为系统中处于闲置状态的数据页; 将具有相同空闲数据页标签的空闲数据页划分为一个预设空闲数据页分 组, 将所述空闲数据页标签确定为所述预设空闲数据页分组对应的组标签。
结合第一方面, 在所述第一方面的第四种可能的实现方式中, 还提供了 所述第一方面的第五种可能的实现方式, 在所述第一方面的第五种可能的实 现方式中, 在所述将具有相同空闲数据页标签的空闲数据页划分为一个预设 空闲数据页分组, 将所述空闲数据页标签确定为所述预设空闲数据页分组的 组标签之后, 所述方法还包括:
当产生新空闲数据页时, 根据所述预设抽样算法对所述新空闲数据页进 行抽样, 得到所述新空闲数据页对应的新空闲数据页标签;
从所述预设组标签集合中的查找与所述新空闲数据页标签相似度最高的 组标签;
将所述新空闲数据页添加到所述相似度最高的组标签对应的预设空闲数 据页分组中。
第二方面, 本发明提供了一种数据写入的装置, 所述装置包括: 抽样单元, 用于根据预设抽样算法对待写入数据进行抽样, 得到目标标 签, 所述目标标签用于表示所述待写入数据中数据位的数值分布情况;
查找单元, 用于从预设组标签集合中查找与所述抽样单元得到的所述目 标标签相似度最高的目标组标签, 所述预设组标签集合由至少一个组标签组 成, 每个组标签对应具有相似数据特征的至少两个空闲数据页;
选择单元, 用于从所述查找单元查找到的所述目标组标签对应的至少一 个空闲数据页中选择目标空闲数据页;
写入单元, 用于将所述待写入数据中与所述选择单元选择的所述目标空 闲数据页存在差异的数据位, 写入所述目标空闲数据页中的对应位置。
结合第二方面, 在所述第二方面的第一种可能的实现方式中, 所述抽样 单元包括:
划分子单元, 用于将所述待写入数据划分为预设数量的数据区域; 标识位确定子单元, 用于分别分析所述划分子单元划分的每个数据区域 中数据的分布特征, 根据所述分布特征确定每个数据区域的标识位;
第一目标标签确定子单元, 用于根据所述标识位确定子单元确定出的每 个数据区域的标识位确定所述目标标签。
结合第二方面, 在所述第二方面的实现方式中, 还提供了所述第二方面 的第二种可能的实现方式, 在所述第二方面的第二种可能的实现方式中, 所 述抽样单元还包括:
转换子单元, 用于根据待写入数据中的数据内容,将待写入数据转换为二 值图像;
图像分析子单元, 用于对转换子单元得到的所述二值图像进行图像分析 得到特征值,所述特征值用于表示所述二值图像的图形特征;
第二目标标签确定子单元, 用于将所述图像分析子单元得到的所述特征 值确定为目标标签。
结合第二方面, 在所述第二方面的实现方式中, 还提供了所述第二方面 的第三种可能的实现方式, 在所述第二方面的第三种可能的实现方式中, 所 述写入单元, 包括:
判断子单元, 用于判断所述待写入数据中每个数据位与所述目标空闲数 据页中相同位置的数据位中的数据是否相同;
待写入数据位确定子单元, 用于当所述判断单元得到所述待写入数据中 当前数据位与所述目标空闲数据页中相同位置的数据位中的数据不同时, 则 确定所述相同数据位为待写入数据位;
写入子单元, 用于将所述待写入数据中位于所述待写入数据位确定子单 元确定的所述待写入数据位的数据写入到所述目标空闲数据页的待写入数据 位中。
结合第二方面, 在所述第二方面的第一种可能或第二种可能的实现方式 中, 还提供了所述第二方面的第四种可能的实现方式, 在所述第二方面的第 四种可能的实现方式中, 所述抽样单元还用于, 根据所述预设抽样算法对空 闲数据页进行抽样, 得到每个空闲数据页对应的空闲数据页标签, 所述空闲 数据页为系统中处于闲置状态的数据页;
所述装置还包括:
分组单元, 用于将具有相同空闲数据页标签的空闲数据页划分为一个预 设空闲数据页分组, 将所述空闲数据页标签确定为所述预设空闲数据页分组 对应的组标签。
结合第二方面, 在所述第二方面的第四种可能的实现方式中, 还提供了 所述第二方面的第五种可能的实现方式, 在所述第二方面的第五种可能的实 现方式中, 所述抽样单元还用于, 当产生新空闲数据页时, 根据所述预设抽 样算法对所述新空闲数据页进行抽样, 得到所述新空闲数据页对应的新空闲 数据页标签;
所述查找单元还用于, 从所述预设组标签集合中的查找与所述抽样单元 得到的所述新空闲数据页标签相似度最高的组标签;
所述装置还包括:
添加单元, 用于将所述新空闲数据页添加到所述查找单元查找到的所述 相似度最高的组标签对应的预设空闲数据页分组中。 第三方面, 本发明提供了一种数据写入的装置, 所述装置包括: 处理器, 用于根据预设抽样算法对待写入数据进行抽样, 得到目标标签, 所述目标标签用于表示所述待写入数据中数据位的数值分布情况;
存储器, 用于存储所述预设组标签集合;
从所述存储器存储的预设组标签集合中查找与所述目标标签相似度最高 的目标组标签, 所述预设组标签集合由至少一个组标签组成, 每个组标签对 应具有相似数据特征的至少两个空闲数据页;
所述存储器还用于存储所述空闲数据页;
所述处理器还用于, 从所述目标组标签对应的至少一个空闲数据页中选 择目标空闲数据页;
将所述待写入数据中与所述目标空闲数据页存在差异的数据位, 写入所 述目标空闲数据页中的对应位置。
结合第三方面, 在所述第三方面的第一种可能的实现方式中, 所述处理 器还用于:
将所述待写入数据划分为预设数量的数据区域;
分别分析每个数据区域中数据的分布特征, 根据所述分布特征确定每个 数据区域的标识位;
根据确定出的每个数据区域的标识位确定所述目标标签。
结合第三方面, 在所述第三方面的实现方式中, 还提供了所述第三方面 的第二种可能的实现方式, 在所述第三方面的第二种可能的实现方式中, 所 述处理器还用于:
根据待写入数据中的数据内容,将待写入数据转换为二值图像;
对所述二值图像进行图像分析得到特征值,所述特征值用于表示所述二 值图像的图形特征;
将所述特征值确定为目标标签。
结合第三方面, 在所述第三方面的实现方式中, 还提供了所述第三方面 的第三种可能的实现方式, 在所述第三方面的第三种可能的实现方式中, 所 述处理器还用于:
分别判断所述待写入数据中每个数据位与所述目标空闲数据页中相同位 置的数据位中的数据是否相同;
如果所述待写入数据中当前数据位与所述目标空闲数据页中相同位置的 数据位中的数据不同, 则确定所述相同数据位为待写入数据位;
将所述待写入数据中位于所述待写入数据位的数据写入到所述目标空闲 数据页的待写入数据位中。
结合第三方面, 在所述第三方面的第一种可能或第二种可能的实现方式 中, 还提供了所述第三方面的第四种可能的实现方式, 在所述第三方面的第 四种可能的实现方式中, 所述处理器还用于:
根据所述预设抽样算法对存储器中存储的空闲数据页进行抽样, 得到每 个空闲数据页对应的空闲数据页标签, 所述空闲数据页为系统中处于闲置状 态的数据页;
将具有相同空闲数据页标签的空闲数据页划分为一个预设空闲数据页分 组, 将所述空闲数据页标签确定为所述预设空闲数据页分组对应的组标签。
结合第三方面, 在所述第三方面的第四种可能的实现方式中, 还提供了 所述第三方面的第五种可能的实现方式, 在所述第三方面的第五种可能的实 现方式中, 所述处理器还用于:
当产生新空闲数据页时, 根据所述预设抽样算法对所述新空闲数据页进 行抽样, 得到所述新空闲数据页对应的新空闲数据页标签;
从所述存储器存储的所述预设组标签集合中的查找与所述新空闲数据页 标签相似度最高的组标签;
将所述新空闲数据页添加到所述相似度最高的组标签对应的预设空闲数 据页分组中。
本发明提供的数据写入的方法及装置, 能够在为对待写入数据分配存储 地址之前, 先对待写入数据进行抽样, 获得表示待写入数据的数据特征的目 标标签, 再从预设组标签集合中查找与所述目标标签相似度最高的目标组标 签, 从目标组标签对应的多个空闲数据页中选择目标空闲数据页, 再将待写 入数据中与所述目标空闲数据页存在差异的数据位写入所述目标空闲数据页 中的对应位置。 现有技术中, 仅按照空闲数据页的地址顺序或者空闲数据页 产生的时间顺序将空闲数据页分配用于写入待写入数据, 由于按照此种方式 获得的空闲数据页可能出现与待写入数据完全不同或基本不同 ( 90%以上不 同), 此时进行差异写入将造成大量的写操作, 因此现有技术无法保证降低写 入量。 现有技术中在分配空白数据页时, 并未考虑空白数据页与待写入数据 的相似程度, 存在为分配的空白数据页与待写入数据的内容部分或全部相同 或相似的情况。 现有技术直接为待写入数据分配空闲数据页, 使分配的空闲 数据页的数据特征与待写入数据的结构特征存在较大差异, 导致写操作数量 与普通写入操作的写操作数量近似或相同, 使得写时延的降低效果不稳定。 本发明中, 能够根据待写入数据与空白数据页的相似程度确定分配的空白数 据页, 由于在为待写入数据分配空闲数据页之前, 将目标标签和组标签进行 匹配, 得到与待写入数据最接近的一组空闲数据页, 再从该组空闲数据页中 选择一张空闲数据页进行差异存储, 因此本发明中为待写入数据分配的空白 数据页为与待写入数据具有最高相似度的空白数据页, 进而在进行差异存储 时, 能够减少写操作的数量, 达到稳定减少写操作数量的效果。 附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案, 下面将对实 施例或现有技术描述中所需要使用的附图作简单地介绍, 显而易见地, 下面 描述中的附图仅仅是本发明的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳动的前提下, 还可以根据这些附图获得其他的附图。
图 1为本发明实施例中第一个数据写入的方法的流程图;
图 1为本发明实施例中第二个数据写入的方法的流程图;
图 3为本发明实施例中第三个数据写入的方法的流程图;
图 4为本发明实施例中第四个数据写入的方法的流程图;
图 5为本发明实施例中第五个数据写入的方法的流程图; 图 6为本发明实施例中第六个数据写入的方法的流程图;
图 7为本发明实施例中一个使用场景的数据流示意图;
图 8为本发明实施例中第一个数据写入的装置的结构示意图;
图 9为本发明实施例中第二个数据写入的装置的结构示意图;
图 1 0为本发明实施例中第三个数据写入的装置的结构示意图;
图 1 1为本发明实施例中第四个数据写入的装置的结构示意图;
图 12为本发明实施例中第五个数据写入的装置的结构示意图;
图 1 3为本发明实施例中第六个数据写入的装置的结构示意图;
图 14为本发明实施例中第七个数据写入的装置的结构示意图。
具体实施方式
下面将结合本发明实施例中的附图, 对本发明实施例中的技术方案进行 清楚、 完整地描述, 显然, 所描述的实施例仅仅是本发明一部分实施例, 而 不是全部的实施例。 基于本发明中的实施例, 本领域普通技术人员在没有作 出创造性劳动前提下所获得的所有其他实施例, 都属于本发明保护的范围。
本发明实施例提供了一种数据写入的方法, 所述方法运用于具有数据存 储及处理能力的电子设备中, 所述电子设备如服务器、 个人电脑、 移动终端 等, 如图 1所示, 所述方法包括:
步骤 101、 根据预设抽样算法对待写入数据进行抽样, 得到目标标签, 目 标标签用于表示待写入数据中数据位的数值分布情况。
预设抽样算法包括两种, 分别为:
一、 将待写入数据转换为图形, 根据图形识别算法获取该图形的特征值, 将该特征值作为目标标签。
二、 将待写入数据按照固定数据单元划分为多个数据区域, 根据每个数 据区域中数据的分布特征确定每个区域的标识位, 根据各标识位生成目标标 签。 例如, 将一个 64Byte (字节)的待写入数据按照每 8b划分为一个数据区 域, 形成 64个数据区域, 分别对每个数据区域中的分布特征进行分析, 得到 64个标识位, 该 64个标识位顺序排列组成 64b i t的目标标签。根据数据区域 的数量和待写入数据的大小的不同, 目标标签还可以是 256bi t或 512bi t等。 需要说明的是, 上述抽样算法除了用于对待写入数据进行抽样, 还用于 对空闲数据页和新空闲数据页进行抽样。 由于在进行写操作时, 通常以数据 页为单位进行写入, 因此无论待写入的数据 (如一部电影) 的总数据量为如 何, 在进行写入操作时, 将待写入数据写入到系统空闲的数据页中完成写入 操作, 每次写入的数据量为一个数据页 (如将电影拆分后的数据片段) 的大 小。 因此, 所述待写入数据 (即每次写入的数据) 的数据大小为一个数据页 大小, 在进行读取和处理时可将待写入数据作为一个数据页进行处理。 空闲 数据页为闲置的用于存储数据的物理页面。 同时, 空闲数据页、 新空闲数据 页的数据格式相同, 命名的区别仅用于区分不同阶段的数据页, 方便描述。 可选的, 该数据页为非易失固态存储(Non-Viola te Memory , 简称 NVM ) 页 面。
步骤 102、 从预设组标签集合中查找与目标标签相似度最高的目标组标 签, 预设组标签集合由至少一个组标签组成, 每个组标签对应具有相似数据 特征的至少两个空闲数据页。
目标组标签与目标标签存在下述两种关系:
1、 目标组标签和目标标签完全相同。
2、 目标组标签和目标标签不完全相同。 但是, 目标组标签为预设组标签 集合中与目标标签相同的内容, 多于预设组标签集合中除目标组标签以外任 意一个组标签与目标标签相同的内容。
步骤 103、从目标组标签对应的至少一个空闲数据页中选择目标空闲数据 页。
从目标组标签对应的至少一个空闲数据页中 , 随机选取或顺序选取目标 空闲数据页。 如果至少一个空闲数据页之间采用链表形式存储, 则在选取目 标空闲数据页后, 更新所述目标空闲数据页相关的指针。
步骤 104、将待写入数据中与目标空闲数据页存在差异的数据位, 写入目 标空闲数据页中的对应位置。 在向目标空闲数据页中写入待写入数据的数据时, 仅对差异的数据位进 行写入。例如:待写入数据和目标空闲数据页仅第 10个数据位中的内容不同, 具体的,待写入数据中第 10个数据位的内容为 1 , 目标空闲数据页中第 10个 数据位的内容为 0 , 则仅向目标空闲数据页的第 10个数据位执行写操作。
本发明提供的数据写入的方法, 能够在为对待写入数据分配存储地址之 前, 先对待写入数据进行抽样, 获得表示待写入数据的数据特征的目标标签, 再从预设组标签集合中查找与所述目标标签相似度最高的目标组标签, 从目 标组标签对应的多个空闲数据页中选择目标空闲数据页, 再将待写入数据中 与所述目标空闲数据页存在差异的数据位写入所述目标空闲数据页中的对应 位置。 现有技术中, 仅按照空闲数据页的地址顺序或者空闲数据页产生的时 间顺序将空闲数据页分配用于写入待写入数据, 由于按照此种方式获得的空 闲数据页可能出现与待写入数据完全不同或基本不同 (90%以上不同), 此时 进行差异写入将造成大量的写操作, 因此现有技术无法保证降低写入量。 现 有技术中在分配空白数据页时, 并未考虑空白数据页与待写入数据的相似程 度, 存在为分配的空白数据页与待写入数据的内容部分或全部相同或相似的 情况。 现有技术直接为待写入数据分配空闲数据页, 使分配的空闲数据页的 数据特征与待写入数据的结构特征存在较大差异, 导致写操作数量与普通写 入操作的写操作数量近似或相同, 使得写时延的降低效果不稳定。 本发明中, 能够根据待写入数据与空白数据页的相似程度确定分配的空白数据页, 由于 在为待写入数据分配空闲数据页之前, 将目标标签和组标签进行匹配, 得到 与待写入数据最接近的一组空闲数据页, 再从该组空闲数据页中选择一张空 闲数据页进行差异存储, 因此本发明中为待写入数据分配的空白数据页为与 待写入数据具有最高相似度的空白数据页, 进而在进行差异存储时, 能够减 少写操作的数量, 达到稳定减少写操作数量的效果。
本发明实施例还提供了一种数据写入的方法, 作为对图 1 所示方法的具 体说明, 如图 2所示, 步骤 101、 根据预设抽样算法对待写入数据进行抽样, 得到目标标签, 可通过下述方式进行实施: 步骤 201、 将待写入数据划分为预设数量的数据区域。
步骤 202、分别分析每个数据区域中数据的分布特征, 根据分布特征确定 每个数据区域的标识位。
标识位为 0或 1。 标识位的确定规则包括下述任意一种:
1、 根据数据区域中数据内容("0" 或 "1" ) 的出现次数的多少, 确定标 识位。
例如: 数据区域共包含 8个数据位, 其中 "1" 出现 5次, "0" 出现 3次, 则该数据区域的标识位为 1。
2、 根据数据区域中前半段数据内容("0" 或 "1" ) 的出现次数与后半段 数据内容("0" 或 "1" ) 的出现次数的差, 确定标识位。
1 )如果前半段中 "1" 出现的次数多于后半段中 "1" 出现的次数, 则标 识位为 1。 如果前半段中 "1" 出现的次数少于后半段中 "1" 出现的次数, 则 标识位为 0。
例如: 数据区域共包含 8个数据位, 前半段对应第一个到第四个数据位, 后半段对应第五个到第八个数据位, 该数据区域的数据内容为 "1101 0100" 在前半段中 "1" 出现的次数(3次)多与后半段中 "1" 出现的次数(1次), 因此确定该数据区域的标志位为 1。
2)如果前半段中 "1" 出现的次数少于后半段中 "1" 出现的次数, 则标 识位为 1。 如果前半段中 "1" 出现的次数多于后半段中 "1" 出现的次数, 则 标识位为 0。
例如: 数据区域共包含 8个数据位, 前半段对应第一个到第四个数据位, 后半段对应第五个到第八个数据位, 该数据区域的数据内容为 "1101 0100" 在前半段中 "0" 出现的次数(1次)少于后半段中 "0" 出现的次数(3次), 因此确定该数据区域的标志位为 0。
步骤 203、 根据确定出的每个数据区域的标识位确定目标标签。
将每个数据区域中的标识位顺序排列, 得到目标标签。 例如: 待写入数 据被划分为 8 个数据区域, 每个数据区域的标识位分别为 "1"、 "0"、 "0"、 T、 "0"、 T、 Τ、 "0" , 则该待写入数据的目标标签为 "10010110"。 本发明实施例提供的数据写入的方法, 能够对待写入数据进行划分, 分 别对划分出的数据区域进行分析得到表示每个数据区域的标识位, 再根据得 到的标识位确定待写入数据的目标标签, 通过细化分析对象(数据区域) 能 够提高目标标签的精确度, 使得目标标签更为准确的表示待写入数据的数据 特征。
本发明实施例还提供了一种数据写入的方法, 作为对图 1 所示方法的具 体说明, 如图 3所示, 步骤 101、 根据预设抽样算法对待写入数据进行抽样, 得到目标标签, 包括:
步骤 301、根据待写入数据中的数据内容,将待写入数据转换为二值图像。 待写入数据中的数据内容为 "0" 或 "1 " , 在二值图像中 0表示白色, 1 表示黑色。
步骤 302、 对二值图像进行图像分析得到特征值,特征值用于表示二值图 像的图形特征。
图像分析可采用现有技术中的图像分析方法, 可根据使用需要自行选择。 步骤 303、 将该特征值确定为目标标签。
本发明实施例提供的数据写入的方法, 能够将待写入数据转换为二值图 像, 由于现有技术中在图像分析领域已有较为成熟的技术方案, 因此在本案 中通过对转换后得到的二值图像进行分析, 能够得到准确体现待写入数据排 列特征的目标标签, 提高目标标签的精确度。
本发明实施例还提供了一种数据写入的方法, 作为对图 1 所示方法的具 体说明, 如图 4所示, 步骤 104、 将所述待写入数据中与所述目标空闲数据页 存在差异的数据位, 写入所述目标空闲数据页中的对应位置, 包括:
步骤 401、分别判断待写入数据中每个数据位与目标空闲数据页中相同位 置的数据位中的数据是否相同。
在进行比较时, 可按位进行比较, 也可按数据页中的行或列或预设个数 的位作为每次读取的数据单元。 如果系统在 CPU与存储器之间还设置有高速 緩存 ( Cache ), 则根据 Cache的处理能力确定数据单元的大小。
步骤 402、如果待写入数据中当前数据位与目标空闲数据页中相同位置的 数据位中的数据内容不同, 则确定相同数据位为待写入数据位。
如果待写入数据中当前数据位与目标空闲数据页中相同位置的数据位中 的数据内容相同, 则无需对当前数据位进行写入。
步骤 403、将待写入数据中位于待写入数据位的数据写入到目标空闲数据 页的待写入数据位中。
本发明实施例提供的数据写入的方法, 能够以数据位的粒度对待写入数 据和目标空闲数据页进行比较, 确定待写入数据位, 准确定位需要写入的数 据位, 提高数据写入的效率。
本发明实施例还提供了一种数据写入的方法, 作为对图 1 所示方法的进 一步说明, 如图 5所示, 在步骤 1 01、 所述根据预设抽样算法对待写入数据进 行抽样, 得到目标标签之前, 所述方法还包括:
步骤 501、根据预设抽样算法对空闲数据页进行抽样, 得到每个空闲数据 页对应的空闲数据页标签, 空闲数据页为系统中处于闲置状态的数据页。
当处理器结束处理某段代码或者删除某数据时, 会释放该段代码或该数 据占用的存储空间, 释放后存储空间中的数据页将成为空闲数据页, 空闲数 用, 即被释放的数据页处于闲置状态。
步骤 502、将具有相同空闲数据页标签的空闲数据页划分为一个预设空闲 数据页分组, 将空闲数据页标签确定为预设空闲数据页分组对应的组标签。
可选的, 将具有相似空闲数据页标签的空闲数据页划分为一个预设空闲 数据页分组, 将空闲数据页标签确定为预设空闲数据页分组对应的组标签。
所述相似为各空闲数据页标签之间的存在预设比例以上的相似度, 所述 预设比例如 90%。
本发明实施例提供的数据写入的方法, 能够将空闲数据页根据空闲数据 页标签进行分组, 每个分组具有相同空闲数据页标签(组标签), 进而实现对 系统中处于闲置状态的数据页进行管理, 为对待写入数据分配空闲数据页时, 能够直接根据组标签确定所要使用的分组, 进而提高数据写入效率。
本发明实施例还提供了一种数据写入的方法, 作为对图 5 所示方法的进 一步说明, 如图 6所述, 在步骤 502、 将具有相同空闲数据页标签的空闲数据 页划分为一个预设空闲数据页分组, 将所述空闲数据页标签确定为所述预设 空闲数据页分组的组标签之后, 所述方法还包括:
步骤 601、 当产生新空闲数据页时,根据预设抽样算法对新空闲数据页进 行抽样, 得到新空闲数据页对应的新空闲数据页标签。
步骤 602、从预设组标签集合中的查找与新空闲数据页标签相似度最高的 组标签。
步骤 603、将新空闲数据页添加到相似度最高的组标签对应的预设空闲数 据页分组中。
新空闲数据页为新产生的空闲数据页。 由于在产生新空闲数据页之前, 系统中的全部空闲数据页均已分组, 因此当某数据页被闲置后, 根据现有的 空闲数据页分组将该数据页添加到现有分组中。
本发明实施例提供的数据写入的方法, 能够根据新空闲数据页标签将新 空闲数据页添加到已有的预设空闲数据页分组中, 实时更新预设空闲数据页 分组中的空闲数据页, 提高数据写入效率。
下面通过一个实施例对上述方法进行具体说明, 当需要对待写入数据进 行写入时, 分为两步: 一、 为待写入数据分配相似度最高的空闲数据页。 二、 在分配的空闲数据页写入待写入数据。 在如图 7 所示的数据流示意图中, 步 骤一采用下述流程:
步骤 101、 根据预设抽样算法对待写入数据 X进行抽样, 得到目标标签。 步骤 102、从预设组标签集合中查找与所述目标标签相似度最高的目标组 标签。
图 7 中, 举出了具有三个组标签的与涉足标签集合, 组标签分别为组标 签 A、组标签 B和组标签(。 H没组标签 C为与目标标签相似度最高的组标签, 则目标组标签为组标签 c。
步骤 103、从所述目标组标签对应的至少一个空闲数据页中选择目标空闲 数据页。
组标签 A对应空闲数据页分组 a ,空闲数据页分组 a包括 2个空闲数据页, 分别为空闲数据页 a l和空闲数据页 a2。
组标签 B对应空闲数据页分组 b ,空闲数据页分组 b包括 3个空闲数据页, 分别为空闲数据页 bl、 空闲数据页 b2和空闲数据页 b3。
组标签 C对应空闲数据页分组 c ,空闲数据页分组 c包括 3个空闲数据页, 分别为空闲数据页 cl、 空闲数据页 c2和空闲数据页 c 3。
如果目标组标签为组标签 C ,则从空闲数据分组 c中随机或顺序选取一个 空闲数据页作为目标空闲数据页, 如空闲数据页 c2 , 空闲数据页 c2为目标空 闲数据页。
在步骤一确定目标空闲数据页后, 步骤二将待写入数据 X与目标空闲数 据页 c2进行比较,确定存在差异的数据位,对存在差异的数据位进行写操作。
本发明实施例还提供了一种数据写入的装置, 如图 8 所示, 所述装置用 于实现上述方法, 所述装置包括:
抽样单元 81 , 用于根据预设抽样算法对待写入数据进行抽样, 得到目标 标签, 所述目标标签用于表示所述待写入数据中数据位的数值分布情况; 查找单元 82 ,用于从预设组标签集合中查找与所述抽样单元 81得到的所 述目标标签相似度最高的目标组标签, 所述预设组标签集合由至少一个组标 签组成, 每个组标签对应具有相似数据特征的至少两个空闲数据页;
选择单元 83 ,用于从所述查找单元 82查找到的所述目标组标签对应的至 少一个空闲数据页中选择目标空闲数据页;
写入单元 84 ,用于将所述待写入数据中与所述选择单元 83选择的所述目 标空闲数据页存在差异的数据位, 写入所述目标空闲数据页中的对应位置。
本发明提供的数据写入的装置, 能够在为对待写入数据分配存储地址之 前, 先对待写入数据进行抽样, 获得表示待写入数据的数据特征的目标标签, 再从预设组标签集合中查找与所述目标标签相似度最高的目标组标签, 从目 标组标签对应的多个空闲数据页中选择目标空闲数据页, 再将待写入数据中 与所述目标空闲数据页存在差异的数据位写入所述目标空闲数据页中的对应 位置。 现有技术中, 仅按照空闲数据页的地址顺序或者空闲数据页产生的时 间顺序将空闲数据页分配用于写入待写入数据, 由于按照此种方式获得的空 闲数据页可能出现与待写入数据完全不同或基本不同 (90%以上不同), 此时 进行差异写入将造成大量的写操作, 因此现有技术无法保证降低写入量。 现 有技术中在分配空白数据页时, 并未考虑空白数据页与待写入数据的相似程 度, 存在为分配的空白数据页与待写入数据的内容部分或全部相同或相似的 情况。 现有技术直接为待写入数据分配空闲数据页, 使分配的空闲数据页的 数据特征与待写入数据的结构特征存在较大差异, 导致写操作数量与普通写 入操作的写操作数量近似或相同, 使得写时延的降低效果不稳定。 本发明中, 能够根据待写入数据与空白数据页的相似程度确定分配的空白数据页, 由于 在为待写入数据分配空闲数据页之前, 将目标标签和组标签进行匹配, 得到 与待写入数据最接近的一组空闲数据页, 再从该组空闲数据页中选择一张空 闲数据页进行差异存储, 因此本发明中为待写入数据分配的空白数据页为与 待写入数据具有最高相似度的空白数据页, 进而在进行差异存储时, 能够减 少写操作的数量, 达到稳定减少写操作数量的效果。
本发明实施例还提供了一种数据写入的装置, 作为对图 8 所示装置的具 体说明, 如图 9所示, 所述抽样单元 81包括:
划分子单元 81 1 , 用于将所述待写入数据划分为预设数量的数据区域; 标识位确定子单元 812 ,用于分别分析所述划分子单元 81 1划分的每个数 据区域中数据的分布特征, 根据所述分布特征确定每个数据区域的标识位; 第一目标标签确定子单元 81 3 ,用于根据所述标识位确定子单元 812确定 出的每个数据区域的标识位确定所述目标标签。
本发明实施例还提供了一种数据写入的装置, 作为对图 8 所示装置的具 体说明, 如图 10所示, 所述抽样单元 81还包括: 转换子单元 814 , 用于根据待写入数据中的数据内容,将待写入数据转换 为二值图像;
图像分析子单元 815 ,用于对转换子单元 814得到的所述二值图像进行图 像分析得到特征值,所述特征值用于表示所述二值图像的图形特征;
第二目标标签确定子单元 816 ,用于将所述图像分析子单元 815得到的所 述特征值确定为目标标签。
本发明实施例还提供了一种数据写入的装置, 作为对图 8 所示装置的具 体说明, 如图 1 1所示, 所述写入单元 84 , 包括:
判断子单元 841 ,用于判断所述待写入数据中每个数据位与所述目标空闲 数据页中相同位置的数据位中的数据是否相同;
待写入数据位确定子单元 842 ,用于当所述判断单元得到所述待写入数据 中当前数据位与所述目标空闲数据页中相同位置的数据位中的数据不同时, 则确定所述相同数据位为待写入数据位;
写入子单元 843 ,用于将所述待写入数据中位于所述待写入数据位确定子 单元 842 确定的所述待写入数据位的数据写入到所述目标空闲数据页的待写 入数据位中。
本发明实施例还提供了一种数据写入的装置, 作为对图 9和图 1 0所示装 置的具体说明, 如图 12所示,
所述抽样单元 81还用于,根据所述预设抽样算法对空闲数据页进行抽样, 得到每个空闲数据页对应的空闲数据页标签, 所述空闲数据页为系统中处于 闲置状态的数据页;
所述装置还包括:
分组单元 85 , 用于将具有相同空闲数据页标签的空闲数据页划分为一个 预设空闲数据页分组, 将所述空闲数据页标签确定为所述预设空闲数据页分 组对应的组标签。
本发明实施例还提供了一种数据写入的装置, 作为对图 12所示装置的具 体说明, 如图 1 3所示, 所述抽样单元 81还用于, 当产生新空闲数据页时, 根据所述预设抽样算 法对所述新空闲数据页进行抽样, 得到所述新空闲数据页对应的新空闲数据 页标签;
所述查找单元 82还用于, 从所述预设组标签集合中的查找与所述抽样单 元 81得到的所述新空闲数据页标签相似度最高的组标签;
所述装置还包括:
添加单元 86 ,用于将所述新空闲数据页添加到所述查找单元 82查找到的 所述相似度最高的组标签对应的预设空闲数据页分组中。
本发明实施例还提供了一种数据写入的装置, 所述装置用于实施上述方 法, 如图 14所示, 所述装置包括:
处理器 1401 , 用于根据预设抽样算法对待写入数据进行抽样, 得到目标 标签, 所述目标标签用于表示所述待写入数据中数据位的数值分布情况; 存储器 1402 , 用于存储所述预设组标签集合;
从所述存储器 1402存储的预设组标签集合中查找与所述目标标签相似度 最高的目标组标签, 所述预设组标签集合由至少一个组标签组成, 每个组标 签对应具有相似数据特征的至少两个空闲数据页;
所述存储器还用于存储所述空闲数据页;
所述处理器还用于, 从所述目标组标签对应的至少一个空闲数据页中选 择目标空闲数据页;
将所述待写入数据中与所述目标空闲数据页存在差异的数据位, 写入所 述目标空闲数据页中的对应位置。
本发明提供的数据写入的装置, 能够在为对待写入数据分配存储地址之 前, 先对待写入数据进行抽样, 获得表示待写入数据的数据特征的目标标签, 再从预设组标签集合中查找与所述目标标签相似度最高的目标组标签, 从目 标组标签对应的多个空闲数据页中选择目标空闲数据页, 再将待写入数据中 与所述目标空闲数据页存在差异的数据位写入所述目标空闲数据页中的对应 位置。 现有技术中, 仅按照空闲数据页的地址顺序或者空闲数据页产生的时 间顺序将空闲数据页分配用于写入待写入数据, 由于按照此种方式获得的空 闲数据页可能出现与待写入数据完全不同或基本不同 (90%以上不同), 此时 进行差异写入将造成大量的写操作, 因此现有技术无法保证降低写入量。 现 有技术中在分配空白数据页时, 并未考虑空白数据页与待写入数据的相似程 度, 存在为分配的空白数据页与待写入数据的内容部分或全部相同或相似的 情况。 现有技术直接为待写入数据分配空闲数据页, 使分配的空闲数据页的 数据特征与待写入数据的结构特征存在较大差异, 导致写操作数量与普通写 入操作的写操作数量近似或相同, 使得写时延的降低效果不稳定。 本发明中, 能够根据待写入数据与空白数据页的相似程度确定分配的空白数据页, 由于 在为待写入数据分配空闲数据页之前, 将目标标签和组标签进行匹配, 得到 与待写入数据最接近的一组空闲数据页, 再从该组空闲数据页中选择一张空 闲数据页进行差异存储, 因此本发明中为待写入数据分配的空白数据页为与 待写入数据具有最高相似度的空白数据页, 进而在进行差异存储时, 能够减 少写操作的数量, 达到稳定减少写操作数量的效果。
进一步的, 所述处理器 1401还用于:
将所述待写入数据划分为预设数量的数据区域;
分别分析每个数据区域中数据的分布特征, 根据所述分布特征确定每个 数据区域的标识位;
根据确定出的每个数据区域的标识位确定所述目标标签。
进一步的, 所述处理器 1401还用于:
根据待写入数据中的数据内容,将待写入数据转换为二值图像;
对所述二值图像进行图像分析得到特征值,所述特征值用于表示所述二 值图像的图形特征;
将所述特征值确定为目标标签。
进一步的, 所述处理器 1401还用于:
分别判断所述待写入数据中每个数据位与所述目标空闲数据页中相同位 置的数据位中的数据是否相同;
如果所述待写入数据中当前数据位与所述目标空闲数据页中相同位置的 数据位中的数据不同, 则确定所述相同数据位为待写入数据位;
将所述待写入数据中位于所述待写入数据位的数据写入到所述目标空闲 数据页的待写入数据位中。
进一步的, 所述处理器 1401还用于:
根据所述预设抽样算法对存储器 1402中存储的空闲数据页进行抽样, 得 到每个空闲数据页对应的空闲数据页标签, 所述空闲数据页为系统中处于闲 置状态的数据页;
将具有相同空闲数据页标签的空闲数据页划分为一个预设空闲数据页分 组, 将所述空闲数据页标签确定为所述预设空闲数据页分组对应的组标签。
进一步的, 所述处理器 1401还用于:
当产生新空闲数据页时, 根据所述预设抽样算法对所述新空闲数据页进 行抽样, 得到所述新空闲数据页对应的新空闲数据页标签;
从所述存储器 1402存储的所述预设组标签集合中的查找与所述新空闲数 据页标签相似度最高的组标签;
将所述新空闲数据页添加到所述相似度最高的组标签对应的预设空闲数 据页分组中。
需要说明的是, 本发明除了可以运用到相变内存中以外, 还可运用到其 他具有读、 写速度存在差异的介质中, 如磁性随机存储器(Magnet i c Random Acces s Memory , 简称 MRAM )等。
所属领域的技术人员可以清楚地了解到, 为描述的方便和简洁, 仅以上 述各功能模块的划分进行举例说明, 实际应用中, 可以根据需要而将上述功 能分配由不同的功能模块完成, 即将装置的内部结构划分成不同的功能模块, 以完成以上描述的全部或者部分功能。 上述描述的系统, 装置和单元的具体 工作过程, 可以参考前述方法实施例中的对应过程, 在此不再赘述。
以上所述, 仅为本发明的具体实施方式, 但本发明的保护范围并不局限 于此, 任何熟悉本技术领域的技术人员在本发明揭露的技术范围内, 可轻易 想到变化或替换, 都应涵盖在本发明的保护范围之内。 因此, 本发明的保护 范围应所述以权利要求的保护范围为准。

Claims

权利 要求 书
1、 一种数据写入的方法, 其特征在于, 所述方法包括:
根据预设抽样算法对待写入数据进行抽样, 得到目标标签, 所述目标标签 用于表示所述待写入数据中数据位的数值分布情况;
从预设组标签集合中查找与所述目标标签相似度最高的目标组标签, 所述 预设组标签集合由至少一个组标签组成, 每个组标签对应具有相似数据特征的 至少两个空闲数据页;
从所述目标组标签对应的至少一个空闲数据页中选择目标空闲数据页; 将所述待写入数据中与所述目标空闲数据页存在差异的数据位, 写入所述 目标空闲数据页中的对应位置。
2、 根据权利要求 1所述的数据写入的方法, 其特征在于, 所述根据预设抽 样算法对待写入数据进行抽样, 得到目标标签, 包括:
将所述待写入数据划分为预设数量的数据区域;
分别分析每个数据区域中数据的分布特征, 根据所述分布特征确定每个数 据区域的标识位;
根据确定出的每个数据区域的标识位确定所述目标标签。
3、 根据权利要求 1所述的数据写入的方法, 其特征在于, 所述根据预设抽 样算法对待写入数据进行抽样, 得到目标标签, 包括:
根据待写入数据中的数据内容,将待写入数据转换为二值图像;
对所述二值图像进行图像分析得到特征值,所述特征值用于表示所述二值 图像的图形特征;
将所述特征值确定为目标标签。
4、 根据权利要求 1所述的数据写入的方法, 其特征在于, 所述将所述待写 入数据中与所述目标空闲数据页存在差异的数据位, 写入所述目标空闲数据页 中的对应位置, 包括:
分别判断所述待写入数据中每个数据位与所述目标空闲数据页中相同位置 的数据位中的数据是否相同; 如果所述待写入数据中当前数据位与所述目标空闲数据页中相同位置的数 据位中的数据内容不同, 则确定所述相同数据位为待写入数据位;
将所述待写入数据中位于所述待写入数据位的数据写入到所述目标空闲数 据页的待写入数据位中。
5、 根据权利要求 2或 3所述的数据写入的方法, 其特征在于, 在所述根据 预设抽样算法对待写入数据进行抽样, 得到目标标签之前, 所述方法还包括: 根据所述预设抽样算法对空闲数据页进行抽样, 得到每个空闲数据页对应 的空闲数据页标签, 所述空闲数据页为系统中处于闲置状态的数据页;
将具有相同空闲数据页标签的空闲数据页划分为一个预设空闲数据页分 组, 将所述空闲数据页标签确定为所述预设空闲数据页分组对应的组标签。
6、 根据权利要求 5所述的数据写入的方法, 其特征在于, 在所述将具有相 同空闲数据页标签的空闲数据页划分为一个预设空闲数据页分组, 将所述空闲 数据页标签确定为所述预设空闲数据页分组的组标签之后, 所述方法还包括: 当产生新空闲数据页时, 根据所述预设抽样算法对所述新空闲数据页进行 抽样, 得到所述新空闲数据页对应的新空闲数据页标签;
从所述预设组标签集合中的查找与所述新空闲数据页标签相似度最高的组 标签;
将所述新空闲数据页添加到所述相似度最高的组标签对应的预设空闲数据 页分组中。
7、 一种数据写入的装置, 其特征在于, 所述装置包括:
抽样单元, 用于根据预设抽样算法对待写入数据进行抽样, 得到目标标签, 所述目标标签用于表示所述待写入数据中数据位的数值分布情况;
查找单元, 用于从预设组标签集合中查找与所述抽样单元得到的所述目标 标签相似度最高的目标组标签, 所述预设组标签集合由至少一个组标签组成, 每个组标签对应具有相似数据特征的至少两个空闲数据页;
选择单元, 用于从所述查找单元查找到的所述目标组标签对应的至少一个 空闲数据页中选择目标空闲数据页; 写入单元, 用于将所述待写入数据中与所述选择单元选择的所述目标空闲 数据页存在差异的数据位, 写入所述目标空闲数据页中的对应位置。
8、 根据权利要求 7所述的数据写入的装置, 其特征在于, 所述抽样单元包 括:
划分子单元, 用于将所述待写入数据划分为预设数量的数据区域; 标识位确定子单元, 用于分别分析所述划分子单元划分的每个数据区域中 数据的分布特征, 根据所述分布特征确定每个数据区域的标识位;
第一目标标签确定子单元, 用于根据所述标识位确定子单元确定出的每个 数据区域的标识位确定所述目标标签。
9、 根据权利要求 7所述的数据写入的方法, 其特征在于, 所述抽样单元还 包括:
转换子单元, 用于根据待写入数据中的数据内容,将待写入数据转换为二值 图像;
图像分析子单元, 用于对转换子单元得到的所述二值图像进行图像分析得 到特征值,所述特征值用于表示所述二值图像的图形特征;
第二目标标签确定子单元, 用于将所述图像分析子单元得到的所述特征值 确定为目标标签。
10、 根据权利要求 7所述的数据写入的装置, 其特征在于, 所述写入单元, 包括:
判断子单元, 用于判断所述待写入数据中每个数据位与所述目标空闲数据 页中相同位置的数据位中的数据是否相同;
待写入数据位确定子单元, 用于当所述判断单元得到所述待写入数据中当 前数据位与所述目标空闲数据页中相同位置的数据位中的数据不同时, 则确定 所述相同数据位为待写入数据位;
写入子单元, 用于将所述待写入数据中位于所述待写入数据位确定子单元 确定的所述待写入数据位的数据写入到所述目标空闲数据页的待写入数据位 中。
11、 根据权利要求 8或 9所述的数据写入的装置, 其特征在于, 所述抽样单元还用于, 根据所述预设抽样算法对空闲数据页进行抽样, 得 到每个空闲数据页对应的空闲数据页标签, 所述空闲数据页为系统中处于闲置 状态的数据页;
所述装置还包括:
分组单元, 用于将具有相同空闲数据页标签的空闲数据页划分为一个预设 空闲数据页分组, 将所述空闲数据页标签确定为所述预设空闲数据页分组对应 的组标签。
12、 根据权利要求 11所述的数据写入的装置, 其特征在于,
所述抽样单元还用于, 当产生新空闲数据页时, 根据所述预设抽样算法对 所述新空闲数据页进行抽样, 得到所述新空闲数据页对应的新空闲数据页标签; 所述查找单元还用于, 从所述预设组标签集合中的查找与所述抽样单元得 到的所述新空闲数据页标签相似度最高的组标签;
所述装置还包括:
添加单元, 用于将所述新空闲数据页添加到所述查找单元查找到的所述相 似度最高的组标签对应的预设空闲数据页分组中。
13、 一种数据写入的装置, 其特征在于, 所述装置包括:
处理器, 用于根据预设抽样算法对待写入数据进行抽样, 得到目标标签, 所述目标标签用于表示所述待写入数据中数据位的数值分布情况;
存储器, 用于存储所述预设组标签集合;
从所述存储器存储的预设组标签集合中查找与所述目标标签相似度最高的 目标组标签, 所述预设组标签集合由至少一个组标签组成, 每个组标签对应具 有相似数据特征的至少两个空闲数据页;
所述存储器还用于存储所述空闲数据页;
所述处理器还用于, 从所述目标组标签对应的至少一个空闲数据页中选择 目标空闲数据页;
将所述待写入数据中与所述目标空闲数据页存在差异的数据位, 写入所述 目标空闲数据页中的对应位置。
14、 根据权利要求 1 3所述的数据写入的装置, 其特征在于, 所述处理器还 用于:
将所述待写入数据划分为预设数量的数据区域;
分别分析每个数据区域中数据的分布特征, 根据所述分布特征确定每个数 据区域的标识位;
根据确定出的每个数据区域的标识位确定所述目标标签。
15、 根据权利要求 1 3所述的数据写入的方法, 其特征在于, 所述处理器还 用于:
根据待写入数据中的数据内容,将待写入数据转换为二值图像;
对所述二值图像进行图像分析得到特征值,所述特征值用于表示所述二值 图像的图形特征;
将所述特征值确定为目标标签。
16、 根据权利要求 1 3所述的数据写入的装置, 其特征在于, 所述处理器还 用于:
分别判断所述待写入数据中每个数据位与所述目标空闲数据页中相同位置 的数据位中的数据是否相同;
如果所述待写入数据中当前数据位与所述目标空闲数据页中相同位置的数 据位中的数据不同, 则确定所述相同数据位为待写入数据位;
将所述待写入数据中位于所述待写入数据位的数据写入到所述目标空闲数 据页的待写入数据位中。
17、 根据权利要求 14或 1 5所述的数据写入的装置, 其特征在于, 所述处 理器还用于:
根据所述预设抽样算法对存储器中存储的空闲数据页进行抽样, 得到每个 空闲数据页对应的空闲数据页标签, 所述空闲数据页为系统中处于闲置状态的 数据页;
将具有相同空闲数据页标签的空闲数据页划分为一个预设空闲数据页分 组, 将所述空闲数据页标签确定为所述预设空闲数据页分组对应的组标签。
18、 根据权利要求 17所述的数据写入的装置, 其特征在于, 所述处理器还 用于:
当产生新空闲数据页时, 根据所述预设抽样算法对所述新空闲数据页进行 抽样, 得到所述新空闲数据页对应的新空闲数据页标签;
从所述存储器存储的所述预设组标签集合中的查找与所述新空闲数据页标 签相似度最高的组标签;
将所述新空闲数据页添加到所述相似度最高的组标签对应的预设空闲数据 页分组中。
PCT/CN2014/082147 2014-07-14 2014-07-14 数据写入的方法及装置 WO2016008070A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2014/082147 WO2016008070A1 (zh) 2014-07-14 2014-07-14 数据写入的方法及装置
CN201480037216.3A CN105518790B (zh) 2014-07-14 2014-07-14 数据写入的方法及装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2014/082147 WO2016008070A1 (zh) 2014-07-14 2014-07-14 数据写入的方法及装置

Publications (1)

Publication Number Publication Date
WO2016008070A1 true WO2016008070A1 (zh) 2016-01-21

Family

ID=55077782

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/082147 WO2016008070A1 (zh) 2014-07-14 2014-07-14 数据写入的方法及装置

Country Status (2)

Country Link
CN (1) CN105518790B (zh)
WO (1) WO2016008070A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI650564B (zh) * 2017-04-11 2019-02-11 飛宏科技股份有限公司 通用序列匯流排c型轉接器之測試裝置與方法
CN114519125A (zh) * 2020-11-19 2022-05-20 北京达佳互联信息技术有限公司 数据写入方法、装置及服务器

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101467148A (zh) * 2006-04-11 2009-06-24 数据域公司 利用了数据段的相似度的高效数据存储
CN101882141A (zh) * 2009-05-08 2010-11-10 北京众志和达信息技术有限公司 一种实现重复数据数据删除的方法和系统
CN101976226A (zh) * 2010-10-20 2011-02-16 青岛海信宽带多媒体技术有限公司 一种数据存储方法
WO2014056330A1 (zh) * 2012-10-10 2014-04-17 华为技术有限公司 数据写入方法及装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101467148A (zh) * 2006-04-11 2009-06-24 数据域公司 利用了数据段的相似度的高效数据存储
CN101882141A (zh) * 2009-05-08 2010-11-10 北京众志和达信息技术有限公司 一种实现重复数据数据删除的方法和系统
CN101976226A (zh) * 2010-10-20 2011-02-16 青岛海信宽带多媒体技术有限公司 一种数据存储方法
WO2014056330A1 (zh) * 2012-10-10 2014-04-17 华为技术有限公司 数据写入方法及装置

Also Published As

Publication number Publication date
CN105518790B (zh) 2019-05-28
CN105518790A (zh) 2016-04-20

Similar Documents

Publication Publication Date Title
US9965385B2 (en) Memory allocation accelerator
US9361408B2 (en) Memory system including key-value store
US7461233B2 (en) Method for identifying data characteristics for flash memory
CN109753231B (zh) 键值存储设备及操作其的方法
TWI406130B (zh) 資料處理系統、控制器及其搜尋特定記憶體區的方法
US11200466B2 (en) Machine learning classifiers
CN106599091B (zh) 基于键值存储的rdf图结构存储和索引方法
US11829376B2 (en) Technologies for refining stochastic similarity search candidates
KR101400506B1 (ko) 비휘발성 메모리 제어기 및 그 제어 방법
WO2018063479A1 (en) Storage device with fine grained search capability
CN108268596B (zh) 搜索存储在存储器中的数据的方法和系统
CN107562853B (zh) 一种面向海量互联网文本数据的流式聚类及展现的方法
CN103793468A (zh) 数据存储方法和装置以及数据读取方法和装置
WO2022007596A1 (zh) 图像检索系统、方法和装置
WO2016008070A1 (zh) 数据写入的方法及装置
US9880930B2 (en) Method for operating controller and method for operating device including the same
CN111541617B (zh) 一种用于高速大规模并发数据流的数据流表处理方法及装置
US7788445B2 (en) Intelligent allocation of programmable comparison operations for reducing the number of associative memory entries required
CN110737678A (zh) 一种数据查找方法、装置、设备和存储介质
US10073809B2 (en) Technologies for scalable remotely accessible memory segments
KR101075439B1 (ko) 멀티 코어 프로세서를 기반으로 하는 문자열 매칭 장치 및 그것의 문자열 매칭 방법
AU2021339989B2 (en) Tri-color bitmap array for garbage collection
US9916086B2 (en) Content-addressable memory device
KR101269790B1 (ko) 데이터 플로우 병렬 처리 장치 및 방법
CN110334251B (zh) 一种有效解决rehash冲突的元素序列生成方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14897649

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14897649

Country of ref document: EP

Kind code of ref document: A1