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

Pre-reading method of files and device Download PDF

Info

Publication number
CN106951301B
CN106951301B CN201710288340.2A CN201710288340A CN106951301B CN 106951301 B CN106951301 B CN 106951301B CN 201710288340 A CN201710288340 A CN 201710288340A CN 106951301 B CN106951301 B CN 106951301B
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.)
Active
Application number
CN201710288340.2A
Other languages
Chinese (zh)
Other versions
CN106951301A (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

This application involves technical field of information processing more particularly to a kind of pre-reading method of files and device, to solve the problems, such as it is existing in the prior art need to improve file pre-read efficiency;Method provided by the embodiments of the present application includes determining the occupied disk cluster of file respectively to be pre-read;By the occupied disk cluster sequence of respectively file to be pre-read, it is determined 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.In this way, in pre-reading file processes, logical offset in the embodiment of the present application not according still further to file sequentially reads file, but it is read by disk cluster sequence, so that the reading of file to be pre-read is the characteristics of storage in disk according to file and the priority of magnetic head addressing is orderly read, so magnetic head is not necessarily to address back and forth, to improve the efficiency that file is pre-read.

Description

Pre-reading method of files and device
Technical field
This application involves technical field of information processing more particularly to pre-reading method of files and device.
Background technology
Large software (such as large-scale network game and business software) is time-consuming longer when starting, this causes period of reservation of number long, Poor user experience.So the prior art reduces the stand-by period by software Acceleration of starting technology.
It is to read the file needed for starting after startup starts from disk in initial software start-up course.And from disk It is time-consuming longer to read file, so, the method for existing software Acceleration of starting is typically to be pre-read by file to improve startup speed.
It refers to reading required file in caching from disk that called file, which is pre-read,.So the process of software Acceleration of starting Generally:Software is started required file first to read in file system cache from disk;Software startup start after, then from File is read in caching, without reading file from disk, to improve startup speed.
Inventor is the study found that in existing file pre-head method:According to the sequence of the logical offset of file to be pre-read, successively Read respectively file to be pre-read.And since 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.Number 1,2,3,4,5 is the logical offset according to file to be pre-read in Fig. 1 The sequencing being addressed.By in Fig. 1 wait the distribution for pre-reading file it is found that logically offset be addressed when, need magnetic Head addresses back and forth.For example, first addressing 1 after, need 1 the right side address 2, the file 3 of next reading but on 2 left side. It is finished so on up to will need to be pre-read file reading.This causes single addressing duration to increase so that the pre- reading rate of file It is limited.It still needs to solve so how to improve the efficiency that file is pre-read.
Invention content
The embodiment of the present application provides a kind of pre-reading method of files, and pre-reading efficiency needs solving file in the prior art carries High problem.
A kind of pre-reading method of files provided by the embodiments of the present application, including:
Determine the occupied disk cluster of file respectively to be pre-read;
By the sequence of the respectively occupied disk cluster of file to be pre-read, it is determined as the reading order of respectively file to be pre-read;It is described Sequencing of the disk cluster sequence 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 provided by the embodiments of the present application, including:
Disk cluster determining module, for determining the occupied disk cluster of file respectively to be pre-read;
Reading order determining module, for by the sequence of the respectively occupied disk cluster of file to be pre-read, being determined as respectively waiting for pre- Read the reading order of file;The sequence of the disk cluster is for characterizing what the mechanical movement rule based on disk and magnetic head was addressed to The sequencing of disk 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 comprising memory and processor, wherein described to deposit Reservoir is for storing program instruction, and the processor is for calling the program 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 storage media, the computer-readable recording medium storage There are computer executable instructions, the computer executable instructions are for making the computer execute pre-reading method of files.
In the embodiment of the present application:When file is pre-read, the occupied disk cluster of file respectively to be pre-read is determined;It respectively will wait pre-reading The sequence of the occupied disk cluster of file, is determined as the reading order of respectively file to be pre-read;According to the reading order after determination, read Take the file respectively to be pre-read.In this way, in pre-reading file processes, not according still further to the logical offset of file in the embodiment of the present application File is sequentially read, but is read by the sequence of disk cluster so that the reading of file to be pre-read is deposited in disk according to file The priority of the characteristics of putting and magnetic head addressing is orderly read, so magnetic head is without addressing back and forth, is pre-read to improving file Efficiency.
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 flow diagram that the embodiment of the present application one provides;
Fig. 3 is the schematic diagram of disk provided by the embodiments of the present application and the magnetic head characteristics of motion;
Fig. 4 is the schematic diagram provided by the embodiments of the present application for illustrating loophole;
Fig. 5 is the flow diagram that the software that the embodiment of the present application two provides starts pre-reading method of files in scene;
Fig. 6 is the structural schematic diagram of the pre- read apparatus of file provided by the embodiments of the present application;
Fig. 7 is the structural schematic diagram of computing device provided by the embodiments of the present application.
Specific implementation mode
For ease of understanding, first to the invention relates to some nouns explain, including:
1, disk cluster:At least one sector of disk constitutes a disk cluster, and data can be as unit of disk cluster when storing It is stored.
2, disk cluster is numbered, and there are one corresponding numbers for each disk cluster in disk.
3, the sequence of disk cluster:Elder generation for characterizing the disk cluster that the mechanical movement rule based on disk and magnetic head is addressed to Sequence afterwards.
4, it is distributed dispersion:For characterizing file position distribution dispersion degree in disk.
5, 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 a entirety in disk.
6, magnetic track:Using disk center as the center of circle, the disk of disk is divided into multiple donuts, each annulus is one A magnetic track, data are stored in magnetic track.
Achievement according to the inventor's study determines in the embodiment of the present application when file is pre-read shared by file respectively to be pre-read Disk cluster;By the sequence of the respectively occupied disk cluster of file to be pre-read, it is determined as the reading order of respectively file to be pre-read;Root According to the reading order after determination, the file respectively to be pre-read is read.In this way, in pre-reading file processes, in the embodiment of the present application File is not read sequentially according still further to the logical offset of file, but read by the sequence of disk cluster so that the reading of file to be pre-read It is the characteristics of storage in disk according to file to take and the priority of magnetic head addressing is orderly read, so magnetic head without seeking back and forth Location, 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 the accompanying drawings of the specification.It needs It is noted that pre-reading method of files provided by the embodiments of the present application 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 are applicable in.For example, it is desired to when segment processing mass data, Before treatment during one piece of data, when needing to pre-read rear one piece of data, the method for the embodiment of the present application is also suitable.
As shown in Fig. 2, for the flow diagram of pre-reading method of files provided by the embodiments of the present application, include the following steps:
Step 201:Determine the occupied disk cluster of file respectively to be pre-read.
Step 202:By the sequence of the respectively occupied disk cluster of file to be pre-read, the reading for being determined as respectively file to be pre-read is suitable Sequence;The priority that the sequence of the disk cluster 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 conditions, as shown in figure 3, disk unidirectionally runs at high speed, cooperation magnetic head moves radially to read data.Therefore This, magnetic head addressing is according to the addressing of 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 navigates on the magnetic track, as disc rotation magnetic head first reaches file 4, then according to It is secondary to pass through file 3,5,1 and 2.So mechanical movement rule as first reaches file 4, then pass through file 3,5,1 and 2 successively.It needs It is noted that the disk of different manufacturers different model is due to hardware configuration difference and control magnetic head and disc unit in the prior art The addressing rules of tool rotation are different, and the mechanical movement rule of disk also can not Unify legislation.So when it is implemented, can root It is determined according to the concrete condition of specific disk, as long as can determine that the sequencing for the disk cluster being addressed to can be applicable in this Apply for that embodiment, the application are not construed as limiting this.
When it is implemented, since disk cluster number size can indicate the sequence of disk cluster, so respectively will can wait pre-reading The sequence of the occupied disk cluster number of file from small to large, is determined as the reading order of respectively file to be pre-read.In this way, again really It is easy to operate to determine reading order, it is easy to implement.
Step 203:According to the reading order after determination, the file respectively to be pre-read is read.
For example, continuing the example that file to be pre-read shown in FIG. 1 is distributed in disk.Since file to be pre-read is in magnetic The sequence of the disk cluster 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 sequence according to 1,2,3,4,5, magnetic head without addressing back and forth, so the application is implemented Example can reduce the magnetic head addressing time, improve file and pre-read efficiency.
For ease of further understanding pre-reading method of files provided by the embodiments of the present application, 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 waits for Pre-read the dispersion of file being distributed in disk.In the case where hardware performance is close, the distribution dispersion of file is higher It is longer to pre-read this document occupied time.In view of this, addressing the time to be further reduced magnetic head, step 201 (determines The respectively occupied disk cluster of file to be pre-read) before, the further comprising the steps of A1- steps A2 of the method:
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 respectively file respectively to be pre-read after the data storage location for pre-reading file is recombinated, wherein after recombination Before respectively the overall distribution dispersion of file to be pre-read is less than recombination, the overall distribution dispersion is for characterizing respectively file to be pre-read Position distribution dispersion degree in disk.
Dispersion degree, that 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 may be used Whether the storage location of file continuously indicates.If storage location continuously if indicate that dispersion degree is minimum;If storage location Discontinuously, then the fewer expression dispersion degree of loophole quantity between storage location is lower.Wherein, loophole indicates the fragment position of file It sets discontinuous in disk.For example, it is spaced at least one disk cluster between the fragment 1 and fragment 2 of file to be pre-read, and this is at least One disk cluster is used to store the data of other files, then has loophole between fragment 1 and fragment 2.
It should be noted that respectively the occupied disk cluster of file to be pre-read can change after step A2 recombinations, institute It also needs to execute step 201 after step A2, when file is pre-read to redefine the respectively occupied disk cluster of file to be pre-read.
By step A1- steps A2 it is found that pre-reading the data storage location of file by treating and being recombinated so that respectively wait for pre- It reads overall distribution dispersion of the file in disk to decrease, magnetic head addressing time when file is pre-read so as to reduce, Further increase the efficiency that file is pre-read.
Wherein, in one embodiment, it for overall distribution dispersion above-mentioned, can be determined, be wrapped according to following methods Include step B1- steps B3:
Step B1:Determine the occupied disk cluster sum of the file respectively to be pre-read.
Step B2:In the respectively occupied disk cluster of file to be pre-read, if two magnetic that the sequence based on disk cluster is adjacent Position of the disk cluster in disk is non-conterminous, then is denoted as 1 loophole.
Wherein, the execution sequence of step B1 and step B2 are unrestricted.
Step B3:Total loophole number is calculated with the ratio of disk cluster sum as the overall distribution dispersion.
There is 1 leakage as shown in figure 4, being separated by 1 disk cluster between file 1 and file 2 and being then denoted as between file 1 and file 2 Hole.It is separated by multiple disk clusters between file 4 and file 5,1 loophole is denoted as between file 4 and file 5.Respectively file institute to be pre-read The disk cluster sum of occupancy is 10, and loophole number is 3, then overall distribution dispersion is 0.3.It is of course also possible to which user's percentage comes Indicate that overall distribution dispersion, the embodiment of the present application are not construed as limiting this.
Further, when it is implemented, for the ease of easily determining loophole, in the embodiment of the present application, step B2 can have Body includes step B21:
Step B21:By the disk cluster number of respectively file to be pre-read, size order sorts by number.
Wherein it is possible to be ranked sequentially according to number is descending, can also be ranked sequentially according to number is ascending.
Step B22:For two disk clusters number of arbitrary neighborhood in the ranking, if adjacent two disk clusters number Discontinuously, then it is denoted as 1 loophole.
Namely, it is generally the case that the disk cluster number of adjacent discs cluster is continuous in disk, if disk cluster number does not connect It is continuous that represent position of two disk clusters in disk non-conterminous.In this way, being numbered by disk cluster, it may be convenient to pass through statistical number The mode of amount and ratio calculated, to determine that the overall distribution dispersion of file to be pre-read, computational methods simplicity are easy to implement.
Certainly, it should be noted that according to the definition of the overall distribution dispersion in the embodiment of the present application, any determination is whole The method of body dispersion is suitable for the embodiment of the present application, is not construed as limiting to this.For example, according to provided by the embodiments of the present application true The method of fixed entirety dispersion, if file to be pre-read in disk in occupied disk cluster, adjacent two disk cluster in sequence Non-conterminous in the position of disk is that can be identified as 1 loophole.The method for so determining loophole number based on this principle is also fitted For the embodiment of the present application.
After having understood overall distribution dispersion, further, for ease of realize treat pre-read the recombination of file so as to In the overall distribution dispersion for reducing 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, can make to wait pre-reading File distribution is concentrated, and the overall distribution dispersion of file to be pre-read is reduced.It should be noted that the method for defragmentation can root It is realized according to the prior art, is suitable for the embodiment of the present application.
Further, magnetic head addressing number can also influence file and pre-read efficiency, in order to enable file in the embodiment of the present application It pre-reads to may particularly include close to physics limit, step A2 and is moved to respectively file to be pre-read in advance from corresponding disk cluster In determining Coutinuous store space, wherein the memory capacity in the Coutinuous store space is greater than or equal to the file respectively to be pre-read Total amount of data.
When it is implemented, 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 whole dispersion of file to be pre-read is several It is 0.In addition, be stored in Coutinuous store space, magnetic head addresses 1 time, compared with the existing technology in multiple addressing, seek Location number is substantially reduced.In this way, the speed that the time spent by magnetic head addressing is almost determined by hardware performance namely file is pre-read Degree can be almost close to physics limit.
Certainly, the data storage location for recombinating file to be pre-read needs to expend process resource and time.The application is real It applies 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, it recombinates described each Before the data storage location of file to be pre-read, the further comprising the steps of C1- steps C2 of the method:
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, execute 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, it if overall distribution dispersion is less than or equal to default dispersion, can not recombinate.Wherein, it presets discrete Degree can determine that the embodiment of the present application is not construed as limiting this according to actual demand.
For example, when it is implemented, before recombinating for the first time, dispersion is preset without judging whether overall distribution dispersion is more than 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 again due to other reasons.It 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 It is recombinated when dispersion, being equivalent to realizes recombination of having ready conditions.Can effectively limit the number of recombination, save process resource and Recombination takes.
Due in the embodiment of the present application, starting all to determine the respectively occupied disk cluster of file to be pre-read when file is pre-read, Then the sequence of the disk cluster 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 all to redefine since recombination or other reasons change and respectively wait pre-reading The occupied disk cluster of file.When file is pre-read can complete errorless reading need to be pre-read file.
In the following, pre-reading method of files provided by the embodiments of the present application is understood for ease of the overall situation, by embodiment two with large size For software Acceleration of starting, it is explained.
Embodiment two
As shown in figure 5, being this method flow diagram, include the following steps:
Step 501:Disk is scanned, respectively the disk cluster distribution of file to be pre-read.
Step 502:It determines the total amount of data of the file respectively to be pre-read, and determines that one piece of memory capacity is more than in disk Or the Coutinuous store space equal to the total quantity.
Wherein, the total amount of data of the file respectively to be pre-read can determine before step 501, that is to say, that specific to execute Opportunity can determine that the embodiment of the present application is not construed as limiting 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:Determine the occupied disk cluster of file respectively to be pre-read.
Step 505:The respectively occupied disk cluster of file to be pre-read is numbered into ascending sequence, is determined as respectively waiting pre-reading The reading order of file.
Step 506:According to the reading order after determination, reads 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 since the speed for reading file 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, do not interfere in software start-up course, from text Part system cache reads the speed of file.
Step 508:After software upgrading, disk is scanned, obtains the disk cluster distribution of the file respectively to be pre-read.
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, 502 are thened follow the steps, If it is not, thening follow the steps 504.
It should be noted that if when the overall distribution dispersion is less than or equal to default dispersion, without executing file It pre-reads, then it can also end operation.
It can be seen that in the embodiment of the present application, by recombinating file to be pre-read into Coutinuous store space, will wait pre-reading The overall distribution dispersion of file is reduced to 0, and is read when pre-reading file from Coutinuous store space, it is only necessary to 1 addressing.Phase For the prior art, magnetic head addressing number and magnetic head addressing duration all substantially reduce.It is opened so large software can be greatly speeded up The dynamic efficiency accelerated.
It, can be in addition, in another application scenarios, such as when training based on mass data deep learning model in batches In the data of training present lot, the data of next batch are pre-read in advance, to reduce whole time consumption for training.
Embodiment three
Conceived based on same application, a kind of device corresponding with pre-reading method of files additionally provided in the embodiment of the present application, Since the principle that the device solves the problems, such as is similar to the method for the embodiment of the present application, the implementation of the device may refer to method Implementation, overlaps will not be repeated.
As shown in fig. 6, for the structural schematic diagram of the pre- read apparatus of file provided by the embodiments of the present application, including:
Disk cluster determining module 601, for determining the occupied disk cluster of file respectively to be pre-read;
Reading order determining module 602, for by the sequence of the respectively occupied disk cluster of file to be pre-read, being determined as respectively waiting for Pre-read the reading order of file;The sequence of the disk cluster is addressed to for characterizing the mechanical movement rule based on disk and magnetic head Disk cluster sequencing;
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, is specifically used for, shared by respectively file to be pre-read Disk cluster numbers ascending sequence, is determined as the reading order of respectively file to be pre-read.
Wherein, in one embodiment, described device further includes:
Disk cluster is distributed determining module, for determining the respectively occupied magnetic of file to be pre-read in the disk cluster determining module Before disk cluster, disk is scanned, obtains the disk cluster distribution of the file respectively to be pre-read;
Recombination module recombinates the file respectively to be pre-read for being distributed according to the disk cluster of 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 recombination is discrete Before degree is less than recombination, the overall distribution dispersion is for characterizing 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 respectively 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 carries out defragmentation to the file respectively to be pre-read.
Wherein, in one embodiment, described device further includes:
First overall distribution dispersion determining module, for the magnetic in the recombination module 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, 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 executes if being more than default dispersion specifically for the overall distribution dispersion according to institute The disk cluster distribution for stating respectively file to be pre-read, recombinates the data storage location of the file respectively to be pre-read.
Wherein, in one embodiment, described device further includes:
Second overall distribution dispersion determining module, for determining the overall distribution dispersion according to following methods:
Determine the occupied disk cluster sum of the file respectively to be pre-read;And
In the respectively occupied disk cluster of file to be pre-read, if adjacent two disk clusters of the sequence based on disk cluster are in magnetic Position in disk is non-conterminous, then is denoted as 1 loophole;
Total loophole 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, is specifically used for:
By the disk cluster number of respectively file to be pre-read, size order sorts by number;
For two disk clusters number of arbitrary neighborhood in the ranking, if adjacent two disk clusters number is discontinuous, Then it is denoted as 1 loophole.
The pre- read apparatus of file provided by the embodiments of the present application determines that file respectively to be pre-read is occupied when file is pre-read Disk cluster;By the sequence of the respectively occupied disk cluster of file to be pre-read, it is determined as the reading order of respectively file to be pre-read;According to true Reading order after fixed reads the file respectively to be pre-read.In this way, in pre-reading file processes, in the embodiment of the present application no longer File is sequentially read according to the logical offset of file, but is read by the sequence of disk cluster so that the reading of file to be pre-read is What the priority of the characteristics of being stored in disk according to file and magnetic head addressing was orderly read, so magnetic head is not necessarily to address back and forth, To improve the efficiency that file is pre-read.
The embodiment of the present application also provides a kind of computing device, which is specifically as follows desktop computer, portable Formula computer, smart mobile phone, tablet computer, personal digital assistant (Personal Digital Assistant, PDA) etc..Such as Shown in Fig. 7, which may include central processing unit (Center Processing Unit, CPU) 701, memory 702, input equipment 703, output equipment 704 etc., input equipment may include keyboard, mouse, touch screen etc., and output equipment can be with Including showing equipment, such as liquid crystal display (Liquid Crystal Display, LCD), cathode-ray tube (Cathode Ray Tube, CRT) etc..
Memory may include read-only memory (ROM) and random access memory (RAM), and provide storage to processor The program 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 the program instruction for calling memory to store, and processor according to the program instruction of acquisition for executing: Determine the occupied disk cluster of file respectively to be pre-read;By the sequence of the respectively occupied disk cluster of file to be pre-read, it is determined as respectively waiting for Pre-read the reading order of file;The sequence of the disk cluster is addressed to for characterizing the mechanical movement rule based on disk and magnetic head Disk cluster sequencing;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 storage media, for being stored as used in above-mentioned computing device Computer program instructions, it includes the programs for executing above-mentioned pre-reading method of files.
The computer storage media can be any usable medium or data storage device that computer can access, packet Include but be not limited to magnetic storage (such as floppy disk, hard disk, tape, magneto-optic disk (MO) etc.), optical memory (such as CD, DVD, BD, HVD etc.) and semiconductor memory (such as it is ROM, EPROM, EEPROM, nonvolatile memory (NAND FLASH), solid State hard disk (SSD)) etc..
Finally it should be noted that:Above example is only to illustrate the technical solution of 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 of ordinary skill in the art that:It still may be used With technical scheme described in the above embodiments is modified or equivalent replacement of some of the technical features; And these modifications or replacements, each embodiment technical solution of the application that it does not separate the essence of the corresponding technical solution spirit and Range.

Claims (12)

1. a kind of pre-reading method of files, which is characterized in that the method includes:
Determine the occupied disk cluster of file respectively to be pre-read;
The suitable of each occupied disk cluster of file to be pre-read is determined according to the occupied disk cluster number size of respectively file to be pre-read The sequence of the respectively occupied disk cluster of file to be pre-read is determined as the reading order of respectively file to be pre-read by sequence;The disk cluster Sequence be used to characterize the sequencing of 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 characterized in that, the determination respectively the occupied disk cluster of file to be pre-read it Before, the method further 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 described whole before the overall distribution dispersion of the file respectively to be pre-read after recombination is less than recombination Body distribution dispersion is for characterizing respectively position distribution dispersion degree of the file to be pre-read in disk.
3. according to the method described in claim 2, it is characterized 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 greater than or equal to the total amount of data of the file respectively to be pre-read.
4. according to the method described in claim 2, it is characterized 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.
5. according to any method in claim 2-4, which is characterized 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, the method further 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, execute 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.
6. according to the method described in claim 2, it is characterized in that, the method further includes:
The overall distribution dispersion is determined according to following methods:
Determine the occupied disk cluster sum of the file respectively to be pre-read;And
In the respectively occupied disk cluster of file to be pre-read, if adjacent two disk clusters of the sequence based on disk cluster are in disk Position it is non-conterminous, then be denoted as 1 loophole;
Total loophole number is calculated with the ratio of disk cluster sum as the overall distribution dispersion.
7. a kind of pre- read apparatus of file, which is characterized in that described device includes:
Disk cluster determining module, for determining the occupied disk cluster of file respectively to be pre-read;
Reading order determining module, for determining respectively text to be pre-read according to the occupied disk cluster number size of respectively file to be pre-read The sequence of the respectively occupied disk cluster of file to be pre-read is determined as respectively file to be pre-read by the sequence of the occupied disk cluster of part Reading order;The sequence of the disk cluster is for characterizing 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.
8. device according to claim 7, which is characterized in that described device further includes:
Disk cluster is distributed determining module, for determining the respectively occupied disk cluster of 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 recombinates the data of the file respectively to be pre-read for being distributed according to the disk cluster 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 recombination is small Before recombination, the overall distribution dispersion is for characterizing respectively position distribution dispersion degree of the file to be pre-read in disk.
9. device according to claim 8, which is characterized in that the recombination module is specifically used for from corresponding disk cluster It is middle that respectively file to be pre-read is moved in predetermined Coutinuous store space, wherein the memory capacity in the Coutinuous store space More than or equal to the total amount of data of the file respectively to be pre-read.
10. device according to claim 8, which is characterized in that the recombination module, specifically for according to it is described respectively wait for it is pre- The disk cluster distribution for reading file carries out defragmentation to the file respectively to be pre-read.
11. according to any device in claim 8-10, which is characterized in that described device further includes:
First overall distribution dispersion determining module, for the disk cluster in the recombination module according to the file respectively to be pre-read It is distributed, before the data storage location for recombinating the file respectively to be pre-read, is distributed, is determined according to the disk cluster of respectively file to be pre-read The overall distribution dispersion of the file respectively to be pre-read;
The recombination module executes if being more than default dispersion specifically for the overall distribution dispersion according to described each The disk cluster of file to be pre-read is distributed, and recombinates the data storage location of the file respectively to be pre-read.
12. device according to claim 8, which is characterized in that described device further includes:
Second overall distribution dispersion determining module, for determining the overall distribution dispersion according to following methods:
Determine the occupied disk cluster sum of the file respectively to be pre-read;And
In the respectively occupied disk cluster of file to be pre-read, if adjacent two disk clusters of the sequence based on disk cluster are in disk Position it is non-conterminous, then be denoted as 1 loophole;
Total loophole 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 CN106951301A (en) 2017-07-14
CN106951301B true 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)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110032339B (en) * 2019-04-12 2022-11-04 北京旷视科技有限公司 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
CN111881096B (en) * 2020-07-24 2022-06-17 北京浪潮数据技术有限公司 File reading method, device, equipment and storage medium
CN113377725B (en) 2021-08-13 2021-11-12 苏州浪潮智能科技有限公司 Pre-reading method and system of kernel client and computer readable storage medium

Citations (2)

* 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
CN105224237A (en) * 2014-05-26 2016-01-06 华为技术有限公司 A kind of date storage method and device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2196895A1 (en) * 2008-12-09 2010-06-16 Thomson Licensing System for storing and/or retrieving a data-set and method thereof
US9043373B2 (en) * 2010-08-17 2015-05-26 Iolo Technologies, Llc System and method for efficient data storage

Patent Citations (2)

* 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
CN105224237A (en) * 2014-05-26 2016-01-06 华为技术有限公司 A kind of date storage method and device

Also Published As

Publication number Publication date
CN106951301A (en) 2017-07-14

Similar Documents

Publication Publication Date Title
CN106951301B (en) Pre-reading method of files and device
EP3132355B1 (en) Fine-grained bandwidth provisioning in a memory controller
CN105205014B (en) A kind of date storage method and device
US8793427B2 (en) Remote memory for virtual machines
US10416932B2 (en) Dirty data management for hybrid drives
US9201810B2 (en) Memory page eviction priority in mobile computing devices
US8380916B2 (en) Control of page access in memory
US8607234B2 (en) Batch scheduling with thread segregation and per thread type marking caps
US20110023033A1 (en) Scheduling of threads by batch scheduling
CN110308875A (en) Data read-write method, device, equipment and computer readable storage medium
WO2022095815A1 (en) Graphics card memory management method and apparatus, device, and system
US12020065B2 (en) Hierarchical processor selection
CN111095204A (en) Scheduling file prefetching for cache memory to reduce latency
CN106709025A (en) Method and device for updating aggregation objects
CN109271253A (en) A kind of resource allocation method, apparatus and system
US9069621B2 (en) Submitting operations to a shared resource based on busy-to-success ratios
US11635904B2 (en) Matrix storage method, matrix access method, apparatus and electronic device
CN108121601A (en) A kind of application resource dispatching device and method based on weight
US11494237B2 (en) Managing workloads of a deep neural network processor
CN107196999B (en) Method and equipment for transmitting information flow push data
CN101957729B (en) Logical block transformation method and method and device compatible with reading and writing of user based on same
CN117251275B (en) Multi-application asynchronous I/O request scheduling method, system, equipment and medium
CN103365787B (en) The method that nand flash memory memory device and accelerating application start
CN105893118B (en) A kind of information processing method and electronic equipment
US8031198B1 (en) Apparatus and method for servicing multiple graphics processing channels

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