CN106951301A - Pre-reading method of files and device - Google Patents

Pre-reading method of files and device Download PDF

Info

Publication number
CN106951301A
CN106951301A CN201710288340.2A CN201710288340A CN106951301A CN 106951301 A CN106951301 A CN 106951301A CN 201710288340 A CN201710288340 A CN 201710288340A CN 106951301 A CN106951301 A CN 106951301A
Authority
CN
China
Prior art keywords
read
file
disk
disk cluster
cluster
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
CN201710288340.2A
Other languages
Chinese (zh)
Other versions
CN106951301B (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201710288340.2A priority Critical patent/CN106951301B/en
Publication of CN106951301A publication Critical patent/CN106951301A/en
Application granted granted Critical
Publication of CN106951301B publication Critical patent/CN106951301B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0862Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches with prefetch
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application is related to technical field of information processing, more particularly to a kind of pre-reading method of files and device, to solve to improve the problem of file pre-reads efficiency the need in the prior art existing;The method that the embodiment of the present application is provided includes determining disk cluster respectively shared by file to be pre-read;By the disk cluster shared by respectively file to be pre-read sequentially, it is defined as the reading order of respectively file to be pre-read;According to the reading order after determination, the file respectively to be pre-read is read.So, in file processes are pre-read, logical offset in the embodiment of the present application not according still further to file sequentially reads file, but read by disk cluster order, so that the reading of file to be pre-read is the characteristics of storage according to file in disk and the priority of magnetic head addressing is read in order, so magnetic head without addressing back and forth, so as to improve the efficiency that file is pre-read.

Description

Pre-reading method of files and device
Technical field
The application is related to technical field of information processing, more particularly to pre-reading method of files and device.
Background technology
Time-consuming longer when large software (such as large-scale network game and business software) starts, this causes period of reservation of number long, Poor user experience.So, prior art reduces the stand-by period by software Acceleration of starting technology.
It is the file after startup starts from disk needed for reading startup in initial software start-up course.And from disk Read file time-consuming longer, so, the method for existing software Acceleration of starting pre-reads to improve toggle speed typically by file.
Called file, which is pre-read, to be referred to required file from disk reads caching.So, the process of software Acceleration of starting Generally:File needed for software is started first is from disk reads file system cache;Software start start after, then from File is read in caching, without reading file from disk, so as to improve toggle speed.
Inventor's research is found, in existing file pre-head method:According to the order of the logical offset of file to be pre-read, successively Read respectively file to be pre-read.And because disk is constantly read and write, the out of order storage in disk of most of file.As shown in figure 1, being Distribution situation of 5 files to be pre-read in disk.Numbering 1,2,3,4,5 is the logical offset according to file to be pre-read in Fig. 1 The sequencing being addressed.From the distribution of file to be pre-read in Fig. 1, it is necessary to magnetic when logically skew is addressed Head is addressed back and forth.For example, first addressing 1 after, it is necessary to 1 the right side address 2, the file 3 of next reading but 2 the left side. Finished so on up to will need to be pre-read file and read.This causes single to address duration increase so that the pre- reading rate of file It is limited.So, how to improve the efficiency that file pre-reads and still need to solve.
The content of the invention
The embodiment of the present application provides a kind of pre-reading method of files, and pre-reading efficiency solving file in the prior art needs to carry High the problem of.
A kind of pre-reading method of files that the embodiment of the present application is provided, including:
It is determined that each disk cluster shared by file to be pre-read;
By the disk cluster shared by respectively file to be pre-read sequentially, it is defined as the reading order of respectively file to be pre-read;The magnetic Disk cluster order is used for the sequencing for characterizing the disk cluster that the mechanical movement rule based on disk and magnetic head is addressed to;
According to the reading order after determination, the file respectively to be pre-read is read.
The pre- read apparatus of a kind of file that the embodiment of the present application is provided, including:
Disk cluster determining module, for determining the disk cluster shared by respectively file to be pre-read;
Reading order determining module, for the disk cluster shared by respectively file to be pre-read sequentially, to be defined as respectively waiting to pre-read The reading order of file;The disk cluster order is used to characterize the disk that the mechanical movement rule based on disk and magnetic head is addressed to The sequencing of cluster;
Read module, for according to the reading order after determination, reading the file respectively to be pre-read.
Another embodiment of the application additionally provides a kind of computing device, and it includes memory and processor, wherein, it is described to deposit Reservoir is instructed for storage program, and the processor is used to call the programmed instruction stored in the memory, according to acquisition Program execution files pre-head method.
Another embodiment of the application additionally provides a kind of computer-readable storage medium, the computer-readable recording medium storage There are computer executable instructions, the computer executable instructions are used to make the computer perform pre-reading method of files.
In the embodiment of the present application:When file is pre-read, it is determined that the respectively disk cluster shared by file to be pre-read;It respectively will wait to pre-read Disk cluster shared by file sequentially, is defined as the reading order of respectively file to be pre-read;According to the reading order after determination, read The file respectively to be pre-read.So, in file processes are pre-read, in the embodiment of the present application not according still further to file logical offset according to Sequence reads file, but is read by disk cluster order so that the reading of file to be pre-read is deposited according to file in disk What feature and the priority of magnetic head addressing were read in order, so magnetic head without addressing back and forth, so as to improve the efficiency that file is pre-read.
Brief description of the drawings
Fig. 1 is the logical offset of file to be pre-read and the distribution schematic diagram in disk;
Fig. 2 is the pre-reading method of files schematic flow sheet that the embodiment of the present application one is provided;
Disk and the schematic diagram of the magnetic head characteristics of motion that Fig. 3 provides for the embodiment of the present application;
The schematic diagram for being used to illustrate leak that Fig. 4 provides for the embodiment of the present application;
Fig. 5 is the schematic flow sheet that the software that the embodiment of the present application two is provided starts pre-reading method of files in scene;
Fig. 6 for the pre- read apparatus of file that the embodiment of the present application is provided structural representation;
The structural representation for the computing device that Fig. 7 provides for the embodiment of the present application.
Embodiment
For ease of understand, first to the invention relates to some nouns explain, including:
1st, disk cluster:At least one sector of disk constitutes a disk cluster, can be in units of disk cluster during data storage Stored.
2nd, disk cluster is numbered, and each disk cluster has a corresponding numbering in disk.
3rd, disk cluster is sequentially:Priority for characterizing the disk cluster that the mechanical movement rule based on disk and magnetic head is addressed to Sequentially.
4th, it is distributed dispersion:For characterizing file position distribution dispersion degree in disk.
5th, each overall distribution dispersion of file to be pre-read:Respectively file to be pre-read is considered as an entirety, for characterizing this Position distribution dispersion degree of the individual entirety in disk.
6th, magnetic track:Using disk center as the center of circle, the card of disk is divided into multiple donuts, each annulus is one Individual magnetic track, data storage is in magnetic track.
According to the achievement in research of inventor, in the embodiment of the present application when file is pre-read, it is determined that respectively shared by file to be pre-read Disk cluster;By the disk cluster shared by respectively file to be pre-read sequentially, it is defined as the reading order of respectively file to be pre-read;According to It is determined that after reading order, read the file respectively to be pre-read.So, in file processes are pre-read, in the embodiment of the present application not File is sequentially read according still further to the logical offset of file, but is read by disk cluster order so that the reading of file to be pre-read is What the priority of the characteristics of being deposited according to file in disk and magnetic head addressing was read in order, so magnetic head without addressing back and forth, So as to improve the efficiency that file is pre-read.
For ease of further understanding, the embodiment of the present application is described in further detail with reference to Figure of description.Need It is noted that the pre-reading method of files that the embodiment of the present application is provided is applicable not only to the applied field of large software Acceleration of starting Scape, application scenarios the embodiment of the present application that any required file is pre-read is applicable.For example, it is desired to during segment processing mass data, Before treatment, it is necessary to which when pre-reading rear one piece of data, the method for the embodiment of the present application is also suitable during one piece of data.
As shown in Fig. 2 the schematic flow sheet of the pre-reading method of files provided for the embodiment of the present application, comprises the following steps:
Step 201:It is determined that each disk cluster shared by file to be pre-read.
Step 202:By the disk cluster shared by respectively file to be pre-read sequentially, the reading for being defined as respectively file to be pre-read is suitable Sequence;The priority that the disk cluster order is used to characterize the disk cluster that the mechanical movement rule based on disk and magnetic head is addressed to is suitable Sequence.
Under normal circumstances, magnetic head is coordinated to move radially to read data as shown in figure 3, disk unidirectionally runs at high speed.Therefore This, magnetic head addressing is addressed according to the mechanical movement rule of disk and magnetic head.The disk cluster that can be addressed to also has certain Sequencing.For example, continuing by taking the file ordering in Fig. 1 as an example, it is assumed that each file is existing on same magnetic track in Fig. 1 A kind of mechanical movement rule of technology is that magnetic head is navigated on the magnetic track, as disc rotation magnetic head first reaches file 4, then according to Secondary process file 3,5,1 and 2.So mechanical movement rule as first reaches file 4, then sequentially pass through file 3,5,1 and 2.Need It is noted that the disk of different manufacturers different model is because hardware configuration is different and control magnetic head and disc unit in the prior art The addressing rules that tool is rotated are different, and the mechanical movement rule of disk also can not Unify legislation.So, during specific implementation, Ke Yigen Determined according to the concrete condition of specific disk, this can be applicable as long as can determine the sequencing for the disk cluster being addressed to Apply for embodiment, the application is not construed as limiting to this.
During specific implementation, because disk cluster numbering size can represent disk cluster sequentially, so can be by respectively text to be pre-read The order of disk cluster numbering from small to large shared by part, is defined as the reading order of respectively file to be pre-read.So, redefine Reading order is easy to operate, easily realizes.
Step 203:According to the reading order after determination, the file respectively to be pre-read is read.
For example, continuing the example that the file to be pre-read shown in Fig. 1 is distributed in disk.Because file to be pre-read is in magnetic The disk cluster order of distribution in disk is 4,3,5,1,2.So, after sequence the priority reading order of file to be pre-read be 4,3,5, 1、2.File to be pre-read is read relative to the order according to 1,2,3,4,5, magnetic head without addressing back and forth, so the embodiment of the present application The magnetic head addressing time can be reduced, file is improved and pre-reads efficiency.
For ease of further understanding the pre-reading method of files of the embodiment of the present application offer, this method is done furtherly below It is bright.
Wherein, in one embodiment, inventor also found through research, and the bottleneck that file is pre-read is hardware performance and treated Pre-read the dispersion being distributed in disk of file.In the case where hardware performance is close, the distribution dispersion of file is higher The time pre-read shared by this document is longer.In view of this, in order to further reduce the magnetic head addressing time, step 201 (is determined The each disk cluster shared by file to be pre-read) before, the further comprising the steps of A1- steps A2 of methods described:
Step A1:Disk is scanned, the disk cluster distribution of the file respectively to be pre-read is obtained.
Step A2:It is distributed according to the disk cluster of the file respectively to be pre-read, according to the disk cluster of the file respectively to be pre-read Distribution, recombinates the file respectively to be pre-read respectively after the data storage location for pre-reading file is recombinated, wherein, after restructuring Respectively the overall distribution dispersion of file to be pre-read is less than before restructuring, and the overall distribution dispersion is used to characterize respectively file to be pre-read Position distribution dispersion degree in disk.
Dispersion degree is dispersion, as the term suggests the difference degree between the specified parameter of expression observational variable.The application In embodiment, specified parameter is storage location of the file in disk.And the difference degree between storage location, it can use Whether the storage location of file continuously represents.If storage location continuously if represent dispersion degree it is minimum;If storage location Discontinuously, then the fewer expression dispersion degree of leak quantity between storage location is lower.Wherein, leak represents the fragment position of file Put discontinuous in disk.For example, at least one disk cluster is spaced between the fragment 1 and fragment 2 of file to be pre-read, and this is at least One disk cluster is used for the data for storing other files, then has leak between fragment 1 and fragment 2.
It should be noted that the disk cluster after step A2 restructuring respectively shared by file to be pre-read can change, institute Also need to perform step 201 after step A2, when file is pre-read to redefine the disk cluster shared by respectively file to be pre-read.
From step A1- step A2, the data storage location that file is pre-read by treating is recombinated so that respectively treat pre- Read overall distribution dispersion of the file in disk to decrease, magnetic head addressing time when pre-reading file so as to reduce, Further improve the efficiency that file is pre-read.
Wherein, in one embodiment, it for foregoing overall distribution dispersion, can be determined, wrapped according to following methods Include step B1- steps B3:
Step B1:Determine the disk cluster sum shared by the file respectively to be pre-read.
Step B2:In the disk cluster shared by respectively file to be pre-read, if based on two adjacent disks of disk cluster order Position of the cluster in disk is non-conterminous, then is designated as 1 leak.
Wherein, step B1 and step B2 execution sequence are unrestricted.
Step B3:Total leak number is calculated with the ratio of disk cluster sum as the overall distribution dispersion.
As shown in figure 4, being separated by 1 disk cluster between file 1 and file 2 is then designated as having 1 leakage between file 1 and file 2 Hole.It is separated by multiple disk clusters between file 4 and file 5,1 leak is designated as between file 4 and file 5.Each file institute to be pre-read The disk cluster sum of occupancy is 10, and leak number is 3, then overall distribution dispersion is 0.3.It is of course also possible to which user's percentage comes Overall distribution dispersion is represented, the embodiment of the present application is not construed as limiting to this.
Further, during specific implementation, for the ease of easily determining in leak, the embodiment of the present application, step B2 can have Body includes step B21:
Step B21:By the disk cluster numbering of respectively file to be pre-read, size order sorts by number.
Wherein it is possible to be arranged according to descending order is numbered, it can also be arranged according to ascending order is numbered.
Step B22:For two disk clusters numbering of arbitrary neighborhood in the ranking, if adjacent two disk clusters numbering Discontinuously, then it is designated as 1 leak.
Namely, it is generally the case that the disk cluster numbering of adjacent discs cluster is continuous in disk, if disk cluster numbering does not connect It is continuous that to represent position of two disk clusters in disk non-conterminous.So, numbered by disk cluster, in that context it may be convenient to pass through statistical number The mode of amount and ratio calculated, to determine the overall distribution dispersion of file to be pre-read, computational methods are easy easily to be realized.
Certainly, it is necessary to which explanation, the definition of the overall distribution dispersion in the embodiment of the present application, any determination is whole The method of body dispersion is applied to the embodiment of the present application, and this is not construed as limiting.For example, being provided really according to the embodiment of the present application The method of fixed entirety dispersion, as long as in file to be pre-read disk cluster shared in disk, adjacent two disk cluster in sequence Non-conterminous in the position of disk is that can be identified as 1 leak.The method for so determining leak number based on this principle is also fitted For the embodiment of the present application.
After overall distribution dispersion has been understood, further, for ease of realize treat pre-read the restructuring of file so as to In reducing the overall distribution dispersion of file to be pre-read, step A2 may particularly include:According to the disk of the file respectively to be pre-read Cluster is distributed, and defragmentation is carried out to the file respectively to be pre-read.That is by way of defragmentation, it can make to wait to pre-read File distribution is concentrated, and reduces the overall distribution dispersion of file to be pre-read.It should be noted that the method for defragmentation can root Realized according to prior art, suitable for the embodiment of the present application.
Further, magnetic head addressing number of times can also influence file to pre-read in efficiency, the embodiment of the present application in order that obtaining file Pre-reading can be close to physics limit, and step A2, which may particularly include, is moved to respectively file to be pre-read in advance from corresponding disk cluster In the Coutinuous store space of determination, wherein the memory capacity in the Coutinuous store space is more than or equal to the file respectively to be pre-read Total amount of data.
During specific implementation, respectively the reading order of file to be pre-read is unrestricted when reading Coutinuous store space.
By the way that file to be pre-read is centrally stored in Coutinuous store space so that the overall dispersion of file to be pre-read is several It is 0.In addition, being stored in Coutinuous store space, magnetic head is addressed 1 time, relative to multiple addressing of the prior art, is sought Location number of times is substantially reduced.So, the magnetic head addressing spent time is almost determined by hardware performance, namely the speed that file is pre-read Degree can be almost close to physics limit.
Certainly, the data storage location of file to be pre-read is recombinated, needs to expend process resource and time.The application is real Apply in order to save process resource and time in example, it is described to be distributed according to the disk cluster of the file respectively to be pre-read, recombinate described each Before the data storage location of file to be pre-read, the further comprising the steps of C1- steps C2 of methods described:
Step C1:Be distributed according to the disk cluster of respectively file to be pre-read, determine the overall distribution of the file respectively to be pre-read from Divergence.
Step C2:If the overall distribution dispersion is more than default dispersion, perform according to the file respectively to be pre-read Disk cluster distribution, recombinate the data storage location of the file respectively to be pre-read.
Certainly, if overall distribution dispersion is less than or equal to default dispersion, it can not recombinate.Wherein, preset discrete Degree can determine that the embodiment of the present application is not construed as limiting to this according to the actual requirements.
For example, during specific implementation, before recombinating for the first time, without judging whether overall distribution dispersion is more than default dispersion It can be recombinated.By taking large software as an example, due to the long-term read-write operation of disk, before not recombinating, the file to be pre-read of the software Overall distribution dispersion it is generally higher.So, the magnitude relationship without judging overall distribution dispersion and default dispersion.And After recombinating first time, respectively storage location of the file to be pre-read in disk may be changed due to other reasonses again.Should Reason is, for example, software upgrading, the overall defragmentation of user's progress etc., then the storage location of file to be pre-read is likely to occur change Change.So, it is possible to need to recombinate again.So, in the embodiment of the present application, preset if the overall distribution dispersion is more than Recombinated during dispersion, equivalent to realizing restructuring of having ready conditions.Can effectively limit the number of times of restructuring, save process resource and Restructuring is time-consuming.
The disk cluster of Shi Douhui determinations respectively shared by file to be pre-read is pre-read due in the embodiment of the present application, starting file, Then the disk cluster order of file to be pre-read is successively read the file respectively to be pre-read.So, in the embodiment of the present application, no matter respectively Position of the file to be pre-read in disk is due to that restructuring or other reasonses change, and can all redefine respectively text to be pre-read Disk cluster shared by part.Completely errorless reading it can need to be pre-read file when file is pre-read.
Below, the pre-reading method of files that the embodiment of the present application is provided is understood for ease of global, by embodiment two with large-scale Exemplified by software Acceleration of starting, it is explained.
Embodiment two
As shown in figure 5, being this method schematic flow sheet, comprise the following steps:
Step 501:Disk is scanned, respectively the disk cluster distribution of file to be pre-read.
Step 502:The total amount of data of the file respectively to be pre-read is determined, and determines that one piece of memory capacity is more than in disk Or equal to the Coutinuous store space of the total quantity.
Wherein, the total amount of data of the file respectively to be pre-read can be determined before step 501, that is to say, that specific to perform Opportunity can determine that the embodiment of the present application is not construed as limiting to this by opportunity demand.
Step 503:Respectively file to be pre-read is moved in the Coutinuous store space from corresponding disk cluster.
Step 504:It is determined that each disk cluster shared by file to be pre-read.
Step 505:Disk cluster shared by respectively file to be pre-read is numbered to ascending order, is defined as respectively waiting to pre-read The reading order of file.
Step 506:According to the reading order after determination, read the file respectively to be pre-read and refer in file system cache.
Step 507:After software startup starts, the file respectively to be pre-read is read from file system cache.
It should be noted that because the speed that file is read from file system cache is quite fast, so the application is implemented In example, although the reading order of file to be pre-read and in the prior art difference, but do not interfere with software start-up course, from text Part system cache reads the speed of file.
Step 508:After software upgrading, disk is scanned, the disk cluster distribution of the file respectively to be pre-read is obtained.
Step 509:Be distributed according to the disk cluster of respectively file to be pre-read, determine the overall distribution of the file respectively to be pre-read from Divergence.
Step 510:Judge whether the overall distribution dispersion is more than default dispersion, if so, step 502 is then performed, If it is not, then performing step 504.
If it should be noted that when the overall distribution dispersion is less than or equal to default dispersion, without performing file Pre-read, then can also end operation.
As can be seen here, in the embodiment of the present application, by the way that file to be pre-read is recombinated into Coutinuous store space, it will wait to pre-read The overall distribution dispersion of file is reduced to 0, and is read from Coutinuous store space when file is pre-read, it is only necessary to 1 addressing.Phase For prior art, magnetic head addressing number of times and magnetic head addressing duration are all substantially reduced.So, large software can be greatly speeded up and opened The dynamic efficiency accelerated.
, such as, can be with when training deep learning model in batches based on mass data in addition, in another application scenarios When training the data of present lot, the data of next batch are pre-read in advance, to reduce overall time consumption for training.
Embodiment three
Based on same application design, a kind of device corresponding with pre-reading method of files is additionally provided in the embodiment of the present application, Because the principle that the device solves problem is similar to the method for the embodiment of the present application, therefore the implementation of the device may refer to method Implementation, repeat part repeat no more.
As shown in fig. 6, be the structural representation of the pre- read apparatus of file that the embodiment of the present application is provided, including:
Disk cluster determining module 601, for determining the disk cluster shared by respectively file to be pre-read;
Reading order determining module 602, for the disk cluster shared by respectively file to be pre-read sequentially, to be defined as respectively treating pre- Read the reading order of file;The disk cluster order is used to characterize the magnetic that the mechanical movement rule based on disk and magnetic head is addressed to The sequencing of disk cluster;
Read module 603, for according to the reading order after determination, reading the file respectively to be pre-read.
Wherein, in one embodiment, the reading order determining module, specifically for by shared by respectively file to be pre-read Disk cluster numbers ascending order, is defined as the reading order of respectively file to be pre-read.
Wherein, in one embodiment, described device also includes:
Disk cluster is distributed determining module, for determining the magnetic shared by respectively file to be pre-read in the disk cluster determining module Before disk cluster, disk is scanned, the disk cluster distribution of the file respectively to be pre-read is obtained;
Recombination module, for being distributed according to the disk cluster of the file respectively to be pre-read, recombinates the file respectively to be pre-read Data storage location recombinated after file respectively to be pre-read, wherein, the overall distribution of the file respectively to be pre-read after restructuring is discrete Degree is less than before restructuring, and the overall distribution dispersion is used to characterize the respectively discrete journey of position distribution of the file to be pre-read in disk Degree.
Wherein, in one embodiment, the recombination module, specifically for from corresponding disk cluster by respectively text to be pre-read Part is moved in predetermined Coutinuous store space, wherein the memory capacity in the Coutinuous store space is more than or equal to described The each total amount of data of file to be pre-read.
Wherein, in one embodiment, the recombination module, specifically for the disk cluster according to the file respectively to be pre-read Distribution, defragmentation is carried out to the file respectively to be pre-read.
Wherein, in one embodiment, described device also includes:
First overall distribution dispersion determining module, in magnetic of the recombination module according to the file respectively to be pre-read Disk cluster is distributed, before the data storage location for recombinating the file respectively to be pre-read, and is distributed according to the disk cluster of respectively file to be pre-read, Determine the overall distribution dispersion of the file respectively to be pre-read;
The recombination module, if being more than default dispersion specifically for the overall distribution dispersion, is performed according to institute The disk cluster distribution of respectively file to be pre-read is stated, the data storage location of the file respectively to be pre-read is recombinated.
Wherein, in one embodiment, described device also includes:
Second overall distribution dispersion determining module, for determining the overall distribution dispersion according to following methods:
Determine the disk cluster sum shared by the file respectively to be pre-read;And,
In the disk cluster shared by respectively file to be pre-read, if based on two adjacent disk clusters of disk cluster order in disk In position it is non-conterminous, then be designated as 1 leak;
Total leak number is calculated with the ratio of disk cluster sum as the overall distribution dispersion.
Wherein, in one embodiment, the second overall distribution dispersion determining module, specifically for:
By the disk cluster numbering of respectively file to be pre-read, size order sorts by number;
For two disk clusters numbering of arbitrary neighborhood in the ranking, if adjacent two disk clusters numbering is discontinuous, Then it is designated as 1 leak.
The pre- read apparatus of file that the embodiment of the present application is provided, when file is pre-read, it is determined that respectively shared by file to be pre-read Disk cluster;By the disk cluster shared by respectively file to be pre-read sequentially, it is defined as the reading order of respectively file to be pre-read;According to determination Reading order afterwards, reads the file respectively to be pre-read.So, in file processes are pre-read, no longer pressed in the embodiment of the present application Sequentially read file according to the logical offset of file, but read by disk cluster order so that the reading of file to be pre-read be according to What the priority of the characteristics of file is deposited in disk and magnetic head addressing was read in order, so magnetic head without addressing back and forth, so that Improve the efficiency that file is pre-read.
The embodiment of the present application additionally provides a kind of computing device, and the computing device is specifically as follows desktop computer, portable Formula computer, smart mobile phone, panel computer, personal digital assistant (Personal Digital Assistant, PDA) etc..Such as Shown in Fig. 7, the computing device can include central processing unit (Center Processing Unit, CPU) 701, memory 702nd, input equipment 703, output equipment 704 etc., input equipment can include keyboard, mouse, touch-screen etc., and output equipment can be with Including display device, such as liquid crystal display (Liquid Crystal Display, LCD), cathode-ray tube (Cathode Ray Tube, CRT) etc..
Memory can include read-only storage (ROM) and random access memory (RAM), and provide storage to processor The programmed instruction and data stored in device.In the embodiment of the present application, memory can be used for the journey of storage file pre-head method Sequence.
Processor is by calling the programmed instruction of memory storage, and processor is used to perform according to the programmed instruction of acquisition: It is determined that each disk cluster shared by file to be pre-read;By the disk cluster shared by respectively file to be pre-read sequentially, it is defined as respectively treating pre- Read the reading order of file;The disk cluster order is used to characterize the magnetic that the mechanical movement rule based on disk and magnetic head is addressed to The sequencing of disk cluster;According to the reading order after determination, the file respectively to be pre-read is read.
In addition, the embodiment of the present application provides a kind of computer-readable storage medium, for saving as used by above-mentioned computing device Computer program instructions, it, which is included, is used to perform the program of above-mentioned pre-reading method of files.
The computer-readable storage medium can be any usable medium or data storage device that computer can be accessed, bag Include but be not limited to magnetic storage (such as floppy disk, hard disk, tape, magneto-optic disk (MO)), optical memory (such as CD, DVD, BD, HVD etc.) and semiconductor memory it is (such as ROM, EPROM, EEPROM, nonvolatile memory (NAND FLASH), solid State hard disk (SSD)) etc..
Finally it should be noted that:Above example is only to the technical scheme for illustrating the application, rather than its limitations;Although The application is described in detail with reference to the foregoing embodiments, it will be understood by those within the art that:It still may be used To be modified to the technical scheme described in foregoing embodiments, or to which part technical characteristic progress equivalent; And these modification or replace, do not make appropriate technical solution essence depart from each embodiment technical scheme of the application spirit and Scope.

Claims (14)

1. a kind of pre-reading method of files, it is characterised in that methods described includes:
It is determined that each disk cluster shared by file to be pre-read;
By the disk cluster shared by respectively file to be pre-read sequentially, it is defined as the reading order of respectively file to be pre-read;The disk cluster Order is used for the sequencing for characterizing the disk cluster that the mechanical movement rule based on disk and magnetic head is addressed to;
According to the reading order after determination, the file respectively to be pre-read is read.
2. according to the method described in claim 1, it is characterised in that described that disk cluster shared by respectively file to be pre-read is suitable Sequence, is defined as the reading order of respectively file to be pre-read, specifically includes:
Disk cluster shared by respectively file to be pre-read is numbered to ascending order, the reading for being defined as respectively file to be pre-read is suitable Sequence.
3. according to the method described in claim 1, it is characterised in that the disk cluster of the determination respectively shared by file to be pre-read it Before, methods described also includes:
Disk is scanned, the disk cluster distribution of the file respectively to be pre-read is obtained;
It is distributed according to the disk cluster of the file respectively to be pre-read, the data storage location for recombinating the file respectively to be pre-read obtains weight File respectively to be pre-read after group, wherein, the overall distribution dispersion of the file respectively to be pre-read after restructuring is less than before restructuring, described whole Body distribution dispersion is used to characterize respectively position distribution dispersion degree of the file to be pre-read in disk.
4. method according to claim 3, it is characterised in that the disk cluster according to the file respectively to be pre-read point Cloth, recombinates the data storage location of the file respectively to be pre-read, specifically includes:
Respectively file to be pre-read is moved in predetermined Coutinuous store space from corresponding disk cluster, wherein described continuous The memory capacity of memory space is more than or equal to the total amount of data of the file respectively to be pre-read.
5. method according to claim 3, it is characterised in that the disk cluster according to the file respectively to be pre-read point Cloth, recombinates the data storage location of the file respectively to be pre-read, specifically includes:
It is distributed according to the disk cluster of the file respectively to be pre-read, defragmentation is carried out to the file respectively to be pre-read.
6. according to any described method in claim 3-5, it is characterised in that the magnetic according to the file respectively to be pre-read Disk cluster is distributed, and before the data storage location for recombinating the file respectively to be pre-read, methods described also includes:
It is distributed according to the disk cluster of respectively file to be pre-read, determines the overall distribution dispersion of the file respectively to be pre-read;
If the overall distribution dispersion is more than default dispersion, perform according to the disk cluster of the file respectively to be pre-read point Cloth, recombinates the data storage location of the file respectively to be pre-read.
7. method according to claim 3, it is characterised in that methods described also includes:
The overall distribution dispersion is determined according to following methods:
Determine the disk cluster sum shared by the file respectively to be pre-read;And,
In the disk cluster shared by respectively file to be pre-read, if based on two adjacent disk clusters of disk cluster order in disk Position is non-conterminous, then is designated as 1 leak;
Total leak number is calculated with the ratio of disk cluster sum as the overall distribution dispersion.
8. a kind of pre- read apparatus of file, it is characterised in that described device includes:
Disk cluster determining module, for determining the disk cluster shared by respectively file to be pre-read;
Reading order determining module, for sequentially, the disk cluster shared by respectively file to be pre-read to be defined as into respectively file to be pre-read Reading order;The disk cluster order is used to characterize the disk cluster that the mechanical movement rule based on disk and magnetic head is addressed to Sequencing;
Read module, for according to the reading order after determination, reading the file respectively to be pre-read.
9. device according to claim 8, it is characterised in that the reading order determining module, specifically for will respectively treat Pre-read the disk cluster shared by file and number ascending order, be defined as the reading order of respectively file to be pre-read.
10. device according to claim 8, it is characterised in that described device also includes:
Disk cluster is distributed determining module, for determining the disk cluster shared by respectively file to be pre-read in the disk cluster determining module Before, disk is scanned, the disk cluster distribution of the file respectively to be pre-read is obtained;
Recombination module, for being distributed according to the disk cluster of the file respectively to be pre-read, recombinates the data of the file respectively to be pre-read Storage location recombinated after file respectively to be pre-read, wherein, the overall distribution dispersion of the file respectively to be pre-read after restructuring is small In before restructuring, the overall distribution dispersion is used to characterize respectively position distribution dispersion degree of the file to be pre-read in disk.
11. device according to claim 10, it is characterised in that the recombination module, specifically for from corresponding disk Respectively file to be pre-read is moved in predetermined Coutinuous store space in cluster, wherein the storage in the Coutinuous store space is held Total amount of data of the amount more than or equal to the file respectively to be pre-read.
12. device according to claim 10, it is characterised in that the recombination module, specifically for respectively being treated according to described The disk cluster distribution of file is pre-read, defragmentation is carried out to the file respectively to be pre-read.
13. according to any described device in claim 10-12, it is characterised in that described device also includes:
First overall distribution dispersion determining module, in disk cluster of the recombination module according to the file respectively to be pre-read Before distribution, the data storage location for recombinating the file respectively to be pre-read, it is distributed according to the disk cluster of respectively file to be pre-read, it is determined that The overall distribution dispersion of the file respectively to be pre-read;
The recombination module, if being more than default dispersion specifically for the overall distribution dispersion, is performed according to described each The disk cluster distribution of file to be pre-read, recombinates the data storage location of the file respectively to be pre-read.
14. device according to claim 10, it is characterised in that described device also includes:
Second overall distribution dispersion determining module, for determining the overall distribution dispersion according to following methods:
Determine the disk cluster sum shared by the file respectively to be pre-read;And,
In the disk cluster shared by respectively file to be pre-read, if based on two adjacent disk clusters of disk cluster order in disk Position is non-conterminous, then is designated as 1 leak;
Total leak number is calculated with the ratio of disk cluster sum as the overall distribution dispersion.
CN201710288340.2A 2017-04-27 2017-04-27 Pre-reading method of files and device Active CN106951301B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710288340.2A CN106951301B (en) 2017-04-27 2017-04-27 Pre-reading method of files and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710288340.2A CN106951301B (en) 2017-04-27 2017-04-27 Pre-reading method of files and device

Publications (2)

Publication Number Publication Date
CN106951301A true CN106951301A (en) 2017-07-14
CN106951301B CN106951301B (en) 2018-07-13

Family

ID=59476905

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710288340.2A Active CN106951301B (en) 2017-04-27 2017-04-27 Pre-reading method of files and device

Country Status (1)

Country Link
CN (1) CN106951301B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110032339A (en) * 2019-04-12 2019-07-19 北京旷视科技有限公司 Data migration method, device, system, equipment and storage medium
CN110321080A (en) * 2019-07-02 2019-10-11 北京计算机技术及应用研究所 A kind of warm data pool pre-head method of cross-node
CN111881096A (en) * 2020-07-24 2020-11-03 北京浪潮数据技术有限公司 File reading method, device, equipment and storage medium
CN113377725A (en) * 2021-08-13 2021-09-10 苏州浪潮智能科技有限公司 Pre-reading method and system of kernel client and computer readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101582084A (en) * 2009-06-03 2009-11-18 中兴通讯股份有限公司 Method and device for data storage
US20100146230A1 (en) * 2008-12-09 2010-06-10 Thomson Licensing System for storing and/or retrieving a data-set and method thereof
US20120047189A1 (en) * 2010-08-17 2012-02-23 Iolo Technologies, Llc System and method for efficient data storage
CN105224237A (en) * 2014-05-26 2016-01-06 华为技术有限公司 A kind of date storage method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100146230A1 (en) * 2008-12-09 2010-06-10 Thomson Licensing System for storing and/or retrieving a data-set and method thereof
CN101582084A (en) * 2009-06-03 2009-11-18 中兴通讯股份有限公司 Method and device for data storage
US20120047189A1 (en) * 2010-08-17 2012-02-23 Iolo Technologies, Llc System and method for efficient data storage
CN105224237A (en) * 2014-05-26 2016-01-06 华为技术有限公司 A kind of date storage method and device

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110032339A (en) * 2019-04-12 2019-07-19 北京旷视科技有限公司 Data migration method, device, system, equipment and storage medium
CN110321080A (en) * 2019-07-02 2019-10-11 北京计算机技术及应用研究所 A kind of warm data pool pre-head method of cross-node
CN111881096A (en) * 2020-07-24 2020-11-03 北京浪潮数据技术有限公司 File reading method, device, equipment and storage medium
CN111881096B (en) * 2020-07-24 2022-06-17 北京浪潮数据技术有限公司 File reading method, device, equipment and storage medium
CN113377725A (en) * 2021-08-13 2021-09-10 苏州浪潮智能科技有限公司 Pre-reading method and system of kernel client and computer readable storage medium
CN113377725B (en) * 2021-08-13 2021-11-12 苏州浪潮智能科技有限公司 Pre-reading method and system of kernel client and computer readable storage medium
US11914551B2 (en) 2021-08-13 2024-02-27 Inspur Suzhou Intelligent Technology Co., Ltd. Pre-reading method and system of kernel client, and computer-readable storage medium

Also Published As

Publication number Publication date
CN106951301B (en) 2018-07-13

Similar Documents

Publication Publication Date Title
CN110546611B (en) Reducing power consumption in a neural network processor by skipping processing operations
CN106951301B (en) Pre-reading method of files and device
US8793427B2 (en) Remote memory for virtual machines
CN105205014B (en) A kind of date storage method and device
EP3132355B1 (en) Fine-grained bandwidth provisioning in a memory controller
US9779469B2 (en) Register spill management for general purpose registers (GPRs)
WO2020220971A1 (en) File loading method and apparatus, electronic device, and storage medium
CN107562645B (en) Memory page management method and computing device
CN106709025A (en) Method and device for updating aggregation objects
CN106557436A (en) The memory compression function enabled method of terminal and device
EP3846036B1 (en) Matrix storage method, matrix access method, apparatus and electronic device
US11809953B1 (en) Dynamic code loading for multiple executions on a sequential processor
US11494237B2 (en) Managing workloads of a deep neural network processor
CN114968588A (en) Data caching method and device for multi-concurrent deep learning training task
CN101957729B (en) Logical block transformation method and method and device compatible with reading and writing of user based on same
EP3097492B1 (en) Method and apparatus for preventing bank conflict in memory
US11500962B1 (en) Emulating fine-grained sparsity in a systolic array
US20210200584A1 (en) Multi-processor system, multi-core processing device, and method of operating the same
CN109491785A (en) Internal storage access dispatching method, device and equipment
US20130318302A1 (en) Cache controller based on quality of service and method of operating the same
CN111507885B (en) Mixed primitive rendering method and system based on optimal cache space calculation
US11372677B1 (en) Efficient scheduling of load instructions
CN103365787B (en) The method that nand flash memory memory device and accelerating application start
US8031198B1 (en) Apparatus and method for servicing multiple graphics processing channels
CN107291483A (en) Intelligence deletes the method and electronic equipment of application program

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