Data processing method, device and computer program product

By identifying and pre-reading contiguous file segments from the storage medium into the cache space when the application starts, the problem of long storage medium I/O operation time is solved, improving the application startup speed and efficiency, and reducing interference from environment variables.

CN120909510APending Publication Date: 2025-11-07ZHUHAI KINGSOFT OFFICE SOFTWARE +2
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510997423.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-18
Publication Date
2025-11-07

AI Technical Summary

Technical Problem

During application startup, input/output operations on the storage medium take up a significant amount of time, resulting in slower startup speed and severe interference from system environment variables.

Method used

In response to the application's startup event, it identifies and pre-reads consecutively arranged file segments in the storage medium into the cache space, uses the Windows event tracing mechanism or Hook mechanism to obtain file segment information, and combines the PFN database and file system cluster size to optimize the loading order and position of file segments.

Benefits of technology

It effectively reduces random read operations on storage media, reduces interference from system environment variables during the startup process, improves application startup speed and efficiency, and enhances user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120909510A_ABST
    Figure CN120909510A_ABST
Patent Text Reader

Abstract

The invention relates to a data processing method and device and a computer program product. The method comprises the following steps: in response to a first starting event for triggering an application program, determining a file fragment required for starting the application program from a storage medium; and under the condition that the file fragments are arranged at the first target position of the storage medium, pre-reading the file fragments to a cache space based on the arrangement sequence of the file fragments in the storage medium. The random reading operation of the storage medium is effectively reduced, and the interference of factors such as system environment variables and the like on the starting process is reduced, so that the starting speed and efficiency of the application program are improved, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the field of information technology, and in particular, to a data processing method, device and computer program product. BACKGROUND

[0002] In the related art, the input / output (I / O) operation of the storage medium occupies a large amount of time in the starting process of the application program, greatly affecting the efficiency of software starting. Moreover, the starting process of the application program is not fixed, but is interfered by various variable factors such as system environment, and presents a random reading disk behavior mode. This randomness further increases the time consumption of the storage medium I / O, and further causes the starting speed of the application program to slow down. SUMMARY

[0003] To overcome the problems in the related art, the present disclosure provides a data processing method, device and computer program product.

[0004] According to a first aspect of an embodiment of the present disclosure, a data processing method is provided, comprising:

[0005] In response to a first starting event of an application program, determining a file segment required for starting the application program from a storage medium;

[0006] In a case where the file segment is arranged at a first target position of the storage medium, pre-reading the file segment to a cache space based on an arrangement order of the file segment in the storage medium.

[0007] According to a second aspect of an embodiment of the present disclosure, a data processing device is provided, comprising:

[0008] A first determining module configured to determine a file segment required for starting an application program from a storage medium;

[0009] A first pre-reading module configured to, in a case where the file segment is arranged at a first target position of the storage medium, pre-read the file segment to a cache space based on an arrangement order of the file segment in the storage medium.

[0010] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising:

[0011] A processor;

[0012] A memory for storing processor-executable instructions;

[0013] The processor executes the computer program or instructions to implement the steps of the method of any one of the first aspect.

[0014] According to a fourth aspect of the embodiments of the present disclosure, a non-transitory computer-readable storage medium is provided, the storage medium storing computer programs or instructions, when the computer programs or instructions in the storage medium are executed by a processor, the steps of the method in any one of the first aspect are implemented.

[0015] According to a fifth aspect of the embodiments of the present disclosure, a computer program product is provided, including computer programs or instructions, when the computer programs or instructions are executed by a processor, the steps of the method in any one of the first aspect are implemented. The technical solutions provided by the embodiments of the present disclosure can include the following beneficial effects:

[0016] The technical solutions in the present disclosure, in response to the first starting event of triggering the application program, determine the file segments required for starting the application program from the storage medium, in the case that the file segments required for starting the application program are continuously arranged at the first target position of the storage medium, based on the arrangement order of the file segments in the storage medium, the file segments required for starting the application program are pre-read to the cache space, effectively reducing the random read operation of the storage medium, reducing the interference of system environment variables and other factors on the starting process, thereby improving the starting speed and efficiency of the application program, and improving the user experience.

[0017] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS

[0018] The accompanying drawings, which are incorporated into and form part of the specification, illustrate embodiments consistent with the present disclosure and, together with the specification, serve to explain the principles of the present disclosure.

[0019] Figure 1 is a flowchart of a data processing method according to an exemplary embodiment Figure 1 .

[0020] Figure 2 is a flowchart of a data processing method according to an exemplary embodiment Figure 2 .

[0021] Figure 3 is a flowchart of a data processing method according to an exemplary embodiment Figure 3 .

[0022] Figure 4 is a block diagram of a data processing device according to an exemplary embodiment.

[0023] Figure 5 is a structural schematic diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0024] The exemplary embodiments will be described in detail below with reference to the accompanying drawings. In the following description, unless otherwise indicated, the same numbers on different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments are not meant to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0025] The present disclosure proposes a data processing method, Figure 1 is a flow of the data processing method according to an exemplary embodiment Figure 1 . As Figure 1 shown, the method mainly includes the following steps:

[0026] In step 101, in response to a first start event triggering an application, determine the file segments required for starting the application from the storage medium;

[0027] In step 102, in the case that the file segments are arranged at the first target position of the storage medium, pre-read the file segments to the cache space based on the arrangement order of the file segments in the storage medium.

[0028] It should be noted that the data processing method proposed by the present disclosure can be applied to an electronic device, and can also be applied to a server. Here, the electronic device can include a terminal device, such as a mobile terminal or a fixed terminal. The mobile terminal can include a mobile phone, a tablet computer, a notebook computer, etc. The fixed terminal can include a desktop computer, a smart television, etc. The server, as a kind of computer, can provide computing or application services for other clients (such as computers, smart phones, etc. terminal devices, or even large equipment such as train systems) in the network.

[0029] The data processing method in the embodiment of the present disclosure can be configured in a data processing apparatus, which can be arranged in a server or an electronic device, and the present disclosure does not limit this.

[0030] It should be noted that the execution subject of the embodiment of the present disclosure can be, for example, a central processing unit (CPU) in a server or an electronic device in hardware, and can be, for example, a related background service in a server or an electronic device in software, and the present disclosure does not limit this.

[0031] In the starting process of the application, the file segments can include code and resource segments that need to be loaded into the memory when the application runs. For example, the file segments can include executable code of the application, dynamic link library (DLL), configuration file, resource file (such as icon, string, etc.).

[0032] In some embodiments, the file segments required for starting the application program can be determined from the storage medium based on a Windows Event Tracing (ETW) mechanism. It should be noted that the Windows Event Tracing mechanism is a high-performance event tracing mechanism in the Windows operating system, which is used to collect event information of the system and the application program. ETW sends event data to an event session through setting an event provider in the system kernel and the application program when the first starting event of the application program is triggered, and the event session determines the file segments required for starting the application program from the storage medium.

[0033] In other embodiments, the file segments required for starting the application program can also be determined from the storage medium based on a Hook mechanism. It should be noted that the Hook mechanism can be used to intercept and modify system calls or function calls. Through the Hook mechanism, custom code can be inserted in the process of system calls or function calls, so as to realize the monitoring and modification of the calling process. For example, file operation related system calls such as CreateFile, ReadFile, etc. can be hooked, and then the operation information of the process on the file can be obtained. The implementation of Hook depends on the interception of a specific calling path. The present disclosure can insert code for obtaining the file segments required for starting the application program in the process of system calls or function calls, so as to determine the file segments required for starting the application program from the storage medium based on the first starting event of the application program.

[0034] Figure 2 is a flowchart of a data processing method according to an exemplary embodiment Figure 2 . As shown in Figure 3 , the method mainly includes the following steps:

[0035] In step 201, it is determined whether the file segments required for starting the application program are continuously arranged at the first target position of the storage medium. If the file segments required for starting the application program are continuously arranged at the first target position of the storage medium, step 202 is performed, otherwise, step 203 is performed.

[0036] Here, after determining the file segments required for starting the application program from the storage medium, it can be determined whether the file segments required for starting the application program are arranged continuously on the storage medium. In some embodiments, the file system interface of the storage medium can be invoked to obtain the physical storage location information of each file segment on the storage medium, and the distribution of the file segments on the storage medium can be determined by analyzing the physical storage location information. If the storage locations of the file segments on the storage medium are continuous and the arrangement order matches the order in which the file segments are loaded when the application program is started, it can be determined that the file segments required for starting the application program are arranged continuously at the first target location of the storage medium.

[0037] In step 202, the file segments required for starting the application program are determined from the first target location based on the arrangement order of the file segments in the storage medium.

[0038] In the case where the file segments required for starting the application program are arranged continuously at the first target location of the storage medium, the file segments required for starting the application program can be determined from the first target location based on the arrangement order of the file segments in the storage medium, and the file segments required for starting the application program can be pre-read to the cache space.

[0039] In step 203, the file segments required for starting the application program are determined based on the storage block information of the first target storage block.

[0040] In some embodiments, in the case where the file segments required for starting the application program are arranged at different locations of the storage medium respectively, the method further comprises:

[0041] The first execution parameter of the application program executing a second starting event is obtained, and the second starting event is triggered before the first starting event;

[0042] The first target storage block is determined from the current first structure array based on the first execution parameter;

[0043] The file segments required for starting the application program are determined based on the storage block information of the first target storage block.

[0044] In step 204, the file segments required for starting the application program are pre-read to the cache space.

[0045] Here, after determining the file segments required for starting the application program, the file segments required for starting the application program can be pre-read to the cache space to complete the pre-reading of the file segments.

[0046] In the embodiments of the present disclosure, in the case that the file segments required for starting the application program are arranged in different positions of the storage medium respectively, the first execution parameter of the application program executing a second starting event can be acquired. The second starting event is triggered before the first starting event, and the first execution parameter can include associated data of the application program executing the second starting event, for example, a starting duration of the application program executing starting based on the second starting event, a starting speed of the application program executing starting based on the second starting event, and the like.

[0047] After the first execution parameter is acquired, the first target storage block can be determined from the current first structure array based on the first execution parameter. It should be noted that the structure array (Page Frame Number Database, PFN database) is a data structure used by the operating system to track the virtual allocation of storage blocks and to manage the storage blocks.

[0048] The PFN database can record detailed information of the storage blocks in the current memory through a page frame number entry (Page Frame Number Entry, PFN Entry). The PFN Entry is a structure used in the Windows operating system to describe a physical page frame (Physical Page Frame). Each physical page frame has a unique number in the memory, which is called a page frame number (Page Frame Number, PFN). The PFN Entry is an entry in the PFN database (PFN Database) and is used to store detailed information of the physical page frame. Since each PFN Entry records detailed information of each storage block in the current memory, through the PFN database, the state of the storage block in the current memory can be acquired, and the required storage block can be filtered out from the PFN database, and then the file segments required for starting the application program are confirmed according to the storage block information.

[0049] In the embodiments of the present disclosure, after the first execution parameter is acquired, the first target storage block can be determined from the first structure array based on the first execution parameter, and the file segments required for starting the application program based on the first starting event can be determined based on the storage block information of the first target storage block.

[0050] In the embodiments of the present disclosure, after the first execution parameter is acquired, the first target storage block can be determined from the first array of structure bodies based on the first execution parameter. For example, the first execution parameter can be parsed to extract key information in the first execution parameter, such as the startup duration, the startup speed, and the like of the application program based on the second startup event. Then, the key information in the first execution parameter is compared and matched with the PFN entries in the array of structure bodies to determine the storage block associated with the key information. For example, by analyzing the state and type of the memory storage block recorded in the PFN entry, the storage block with the access frequency greater than the preset frequency and / or the priority higher than the preset priority in the second startup event is found, so as to be determined as the first target storage block. Since the first target storage block determined based on this manner corresponds to the core executable code of the application program, the key DLL file, or the important resource file, and the like, the file segment determined based on the first target storage block can more ensure the normal startup of the application program.

[0051] In some embodiments, in a case where the first execution parameter includes the startup duration of the application program based on the second startup event, the first target storage block is determined from the current first array of structure bodies based on the first execution parameter, including: loading a key file of the application program based on the first startup event, and determining the loading time of the key file; determining a target time window based on the loading time of the key file and the startup duration; and determining the storage block with the loading time in the target time window in the first array of structure bodies as the first target storage block.

[0052] In the embodiments of the present disclosure, the key file of the application program based on the first startup event can be loaded, and the loading time of the key file can be determined. For example, the key file can include the executable file, the dynamic link library (DLL), the configuration file, and the resource file of the application program, and the like. For example, the key file can be the dynamic link library loaded earliest in the process of starting the application program based on the first startup event.

[0053] The loading time can include the time when the file is loaded into the memory. By monitoring and recording the loading time of the key file, basic data can be provided for the subsequent determination of the time window.

[0054] In some embodiments, the loading time can be determined based on the timestamp variable in the PFN entry, for example, the timestamp variable can be determined as the loading time, or when the timestamp variable is updated, the minimum value in all variable values can be determined as the loading time.

[0055] It should be noted that the TimeStamp variable in the PFN entry can be used to confirm the key data of the storage block, wherein the TimeStamp variable is related to the time when the file segment enters the memory, and can be in seconds as a time unit. The TimeStamp variable can be used to indicate the time of the last operation of the current storage block. If the application is in a cold start state, the TimeStamp variable can be used to indicate the time when the file segment on the current storage block enters the memory for the first time.

[0056] Exemplarily, in the PFN entry, the TimeStamp variable records the time when the storage block is last accessed or modified. In the cold start process, the TimeStamp variable can be used to indicate the time when the file segment enters the memory for the first time. In the case of cold start, the operating system loads the necessary files and data into the memory, at this time the storage block is accessed for the first time, and the TimeStamp variable is set to this time. After that, if the storage block is accessed or modified again, the TimeStamp variable will be updated to the latest time.

[0057] In the embodiments of the present disclosure, after determining the loading time of the key file, the target time window can be determined based on the loading time and the startup duration of the application based on the second startup event. The startup duration refers to the total time from the triggering of the second startup event to the completion of the startup of the application. The target time window is a preset time range, which is used to filter out the first target storage block.

[0058] In some embodiments, the target time window can be constituted based on the loading time as a reference and the startup duration as a duration. Taking the key file as an example, which is the earliest loaded dynamic link library in the process of starting the application based on the first startup event, the loading time of the key file can be the time of the earliest loaded dynamic link library in the process of starting the application based on the first startup event.

[0059] After determining the target time window, the storage blocks in the first structure array whose loading time is within the target time window are determined as the first target storage block.

[0060] Taking the key file as an example, which is the earliest loaded dynamic link library in the process of starting the application based on the first startup event, all storage blocks that enter the memory in the process of starting the application based on the second startup event can be filtered out based on the target time window, i.e., the first target storage block.

[0061] It should be noted that the files required in each startup process of the same application are the same. The present disclosure can determine the target time window based on the loading time of the key file of the application loaded based on the first startup event and the startup duration of the application based on the second startup event, and filter the storage blocks in the first structure array based on the target time window to determine the first target storage block.

[0062] In some embodiments, determining the first target storage block from the current first structure array based on the first execution parameter comprises: determining a reference list of the application; determining a candidate storage block from the first structure array according to a target path in the reference list; and determining the first target storage block from the candidate storage block based on the first execution parameter.

[0063] For example, the first structure array can be parsed to obtain all file information in the first structure array, and based on the first start event, key files of the application are loaded, and the loading time of the key files is determined. The candidate storage block is determined from the first structure array according to the target path in the reference list.

[0064] It should be noted that the reference list of the application can be equivalent to a whitelist mechanism, and the reference list includes the set target path, such as the installation path of the application, the plug-in directory (including the cache directory) of the application, and part of the system directory. By setting the target path, the storage block related to the application can be effectively screened out, and the interference of irrelevant storage blocks is reduced.

[0065] For example, the candidate storage block can be determined from the first structure array according to the target path in the reference list, that is, the storage block located in the specified path is determined.

[0066] In some embodiments, the method further comprises: determining the target path based on the attribute information of the application and / or the installation parameter of the application, and storing the target path to the reference list of the application; and in the case that the application is successfully started based on the first start event, updating the reference list of the application based on a second execution parameter of executing the first start event.

[0067] In this embodiment, the target path can be determined based on the attribute information of the application and / or the installation parameter of the application, and the target path is stored to the reference list of the application. The attribute information of the application can include but is not limited to the type, use, and development manufacturer of the application, and the installation parameter can include the installation path, plug-in directory, cache directory, etc. For example, for the application App1, the target path can include the installation path (such as “C:\Program Files\App1”), the plug-in directory (such as “C:\Users<username>\AppData\Roaming\App1\Plugins”), and the cache directory, etc. Through the attribute information of the application and / or the installation parameter of the application, the location range of the files related to the start of the application can be preliminarily determined, and these paths are stored as the initial reference list.

[0068] In a subsequent application startup process, after the application is successfully started based on the first startup event, the reference list of the application can be updated based on a second execution parameter for executing the first startup event. The second execution parameter can include information such as a file path actually accessed during the startup process, access frequency, loading time, and the like. For example, if it is found that the application accesses files in a certain system directory more than a preset number of times during startup, or that the access amount of files in a certain plug-in directory is greater than a preset access amount, these paths can be added to the reference list. At the same time, for paths in the reference list that are accessed less than a preset number of times during the startup process or are no longer used, the priority of the path in the reference list can be reduced, or the path can be deleted from the reference list.

[0069] Through the technical solutions of the present disclosure, the reference list can dynamically adapt to the actual use of the application, continuously optimize the accuracy and efficiency of pre-reading, and ensure that necessary file segments can be more accurately pre-read during subsequent startup, thereby improving the startup speed of the application.

[0070] After the candidate storage block is determined, a first target storage block can be determined from the candidate storage block.

[0071] Here, after the candidate storage block is determined, the first target storage block can be selected and determined from the candidate storage block based on the first execution parameter, that is, the storage block that needs to be loaded by the application during subsequent startup is obtained. Through the screening method of the white list mechanism, the accuracy and efficiency of pre-reading can be effectively improved, the waste of system resources can be reduced, and the pre-reading speed and performance can be ensured.

[0072] In the embodiments of the present disclosure, by analyzing the files loaded during the previous startup process and the corresponding file segments, the file segments that the application will need to read can be determined in advance before the next startup. In this way, during the subsequent startup process, the operating system can prepare and optimize the loading process of these files in advance, thereby improving the startup efficiency of the application.

[0073] In some embodiments, a PFN database snapshot can be obtained, and the first target storage block can be selected from the first array of structures based on the PFN database snapshot. The PFN database snapshot refers to a record of the content of the PFN database at a certain time, and can be used for debugging and analyzing memory usage.

[0074] Taking a target time window with a start time of T1 and an end time of T2 as an example, after the PFN database snapshot is obtained, storage blocks with loading times between T1 and T2 and satisfying at least one of the following conditions can be selected from the snapshot:

[0075] The target storage block is located in the paging pool;

[0076] the target storage block is in a standby list;

[0077] the storage content of the target storage block satisfies a preset format;

[0078] the target storage block has been mapped to the target process.

[0079] It should be noted that in the memory management of the operating system, the paged pool is a memory pool in the kernel mode, used to store data that can be paged. The memory in the paged pool can be swapped to a paging file on a storage medium for reloading into physical memory when needed. Through the paged pool, the operating system can more flexibly manage memory resources, especially when the physical memory is tight.

[0080] In the memory management of the Windows operating system, the memory region in standby refers to the storage block being in a standby list. The standby list is a list used in the memory management of Windows to store storage blocks that have been released but still retain their contents. These storage blocks can be quickly reallocated to processes that need memory, thereby improving the performance of the system.

[0081] The storage content of the target storage block satisfying the preset format includes that the storage content of the target storage block is a file or an image. In memory management, a file can be mapped to memory for quick access to its content, and this mechanism is called a memory-mapped file. Through the memory-mapped file, the content of the file can be directly read and written in memory without explicit file I / O operations, thereby improving performance. An image refers to the representation of an executable file (such as an.exe file) or a dynamic link library (DLL) in memory. When the operating system loads an executable file, it maps the content of the file to memory to form an image. This image contains the code and data of the program for the CPU to execute.

[0082] In the operating system, each process has its own virtual address space, and the physical memory storage block is the actual hardware memory unit. In order for the process to access the physical memory, the operating system needs to map the virtual address to the physical address. This mapping process is handled by the memory management unit (MMU). The target storage block having been mapped to the target process can include that the target storage block has been or has been mapped to the target process.

[0083] In the embodiments of the present disclosure, the PFN database snapshot can be acquired and the target storage block can be screened out, and the storage block loaded within a target time window (T1 to T2) and meeting specific conditions can be screened out from the PFN database snapshot. The conditions can include that the storage block is located in a paging pool or a standby list, the content of the storage block meets a preset format (such as a file or an image), and the storage block has been mapped to a target process. Not only can the use efficiency of the memory be improved, but also the operating system can flexibly manage resources when the memory is tight, the startup speed of an application program can be accelerated, and unnecessary file I / O operations can be reduced. The performance can be improved through the memory mapping file mechanism, and the process can quickly access the required physical memory storage block, thereby improving the overall system performance and user experience.

[0084] After the storage block information of the first target storage block is determined, a file segment required for starting the application program based on the first startup event can be determined based on the storage block information of the first target storage block.

[0085] In some embodiments, the file segment required for starting the application program based on the first startup event is determined based on the storage block information of the first target storage block, including determining the file segment required for starting the application program based on the first startup event based on the size of the first target storage block and the cluster size of the file system.

[0086] In the embodiments of the present disclosure, after the first target storage block is determined, the storage block information of the first target storage block can be acquired, including the size of the first target storage block, the memory address, and the like. In combination with the cluster size of the file system, the file name and the offset corresponding to the first target storage block can be found from the file cache information.

[0087] It should be noted that the offset refers to the starting position of the file segment in the file, the distance relative to the beginning of the file, and is usually measured in bytes. For example, if the offset of a file segment is 1024 bytes, it means that the file segment starts from the 1024th byte of the file. Through the offset, the part to be read in the file can be accurately located. The cluster size of the file system is a basic unit of storage space allocated by the file system, which can be a fixed size (such as 4 KB, 8 KB, etc.). The size of the first target storage block is also fixed (such as 4 KB). Through the size of the first target storage block and the cluster size of the file system, the range of the file segment to be read in the file can be determined. For example, if the size of the first target storage block is 4 KB and the cluster size of the file system is also 4 KB, one first target storage block corresponds to one cluster, so that the starting position and length of the file segment can be directly determined. According to the correspondence between the first target storage block and the file cluster, in combination with the offset, the accurate position of the file segment can be calculated, so that the file segment required for starting the application program can be determined.

[0088] Based on the size of the first target storage block, the cluster size of the file system and the calculation method of the offset, the part of the file that needs to be loaded can be accurately located, unnecessary data reading is avoided, and the startup efficiency is improved. At the same time, through the file name and offset in the file cache information, the corresponding file segment can be quickly found, and the file loading process in the startup process is further optimized.

[0089] In some embodiments, after determining the file segments required for starting the application, a corresponding registry item can be generated for use in the pre-reading stage. Illustratively, the determined file segments and the file segment related information are stored in a specified location in the registry. The file segment related information can include the path, offset, size and priority of the file segment, and other key data. Before entering the pre-reading stage, the operating system reads the registry item and loads these file segments into memory in advance according to the file segment related information in the registry.

[0090] The present disclosure can effectively reduce the storage medium I / O operation during application startup and improve the startup efficiency by loading the file segments in advance in the pre-reading stage.

[0091] In some embodiments, in the case of successfully starting the application based on the first startup event, the method further includes: in response to the end of the application startup, determining a second array of structures after the end of the startup; and updating the first array of structures based on the difference information between the first array of structures and the second array of structures to obtain an updated first array of structures.

[0092] Illustratively, a snapshot of the first array of structures, i.e. a state table containing all current memory storage block information, can be recorded before the application startup. After the application startup is completed, a snapshot of the second array of structures at this time is recorded again, also forming a state table containing all current memory storage block information. By comparing the changes in storage block information in the two snapshots, such as adding, modifying or releasing storage blocks, the specific operations on the memory storage blocks during the application startup can be identified. Then, the first array of structures is updated according to the difference information to reflect the changes in the memory storage blocks after the application startup.

[0093] In this way, the updated first array of structures can be used in subsequent application startups to more accurately predict and preload the required file segments. For example, when analyzing a virus sample, the initial state of the PFN database can be recorded before the sample is run, and the final state can be recorded again after the sample is run. By comparing the differences between the two states, the system can identify the modifications to the memory storage blocks made by the virus sample during the running process, and then update the PFN database, so that in subsequent analysis or processing, the system can more effectively identify and respond to similar sample behaviors.

[0094] By updating the structure array in real time, the accuracy and real-time performance of the data in the structure array can be ensured, thereby improving the accuracy of the determined file segment.

[0095] In some embodiments, in a case where the application program is successfully started based on the first start event, the method further includes: in response to a third start event of the application program being triggered, determining a second target storage block from the updated first structure array based on a second execution parameter of executing the first start event; and determining a file segment required for starting the application program based on the third start event based on storage block information of the second target storage block.

[0096] In the embodiments of the present disclosure, in a case where the application program is successfully started based on the first start event, if a third start event of the application program is triggered again, in response to the third start event of the application program being triggered, a second target storage block is determined from the updated first structure array based on a second execution parameter of executing the first start event. For example, the second target storage block related to the third start event is determined from the updated first structure array by using the relevant information in the second execution parameter, such as the start duration, in combination with the latest storage block information in the updated first structure array.

[0097] After the second target storage block is determined, the file segment required for starting the application program based on the third start event can be determined based on the storage block information of the second target storage block. The storage block information usually includes the size, memory address, and access frequency of the storage block, and by analyzing these information, the file segment required for starting the application program can be accurately located.

[0098] For example, after the second target storage block is determined, the storage block information of the second target storage block can be obtained, including the size and memory address of the second target storage block. In combination with the cluster size of the file system, the file name and offset corresponding to the second target storage block can be found from the file cache information.

[0099] It should be noted that the offset refers to the starting position of the file segment in the file, the distance relative to the beginning of the file, and is usually measured in bytes. For example, if the offset of a file segment is 1024 bytes, it means that the file segment starts from the 1024th byte of the file. Through the offset, the part to be read in the file can be accurately located. The cluster size of the file system is the basic unit of storage space allocated by the file system, which can be fixed size (such as 4KB, 8KB, etc.). The size of the second target storage block is also fixed (such as 4KB). Through the size of the second target storage block and the cluster size of the file system, the range of the segment to be read in the file can be determined. For example, if the size of the second target storage block is 4KB and the cluster size of the file system is also 4KB, then one second target storage block corresponds to one cluster, so that the starting position and length of the file segment can be directly determined. According to the correspondence between the second target storage block and the file cluster, combined with the offset, the exact position of the file segment can be calculated, so as to determine the file segment required for starting the application program.

[0100] Based on the calculation method of the size of the second target storage block, the cluster size of the file system and the offset, the part to be loaded in the file can be accurately located, unnecessary data reading is avoided, and the starting efficiency is improved. At the same time, through the file name and the offset in the file cache information, the corresponding file segment can be quickly found, and the file loading process in the starting process is further optimized.

[0101] Through the implementation of the present disclosure, the first structure array is continuously updated and continuously optimized, so that the required file segment can be preloaded more efficiently at each start, and the starting efficiency is improved.

[0102] In some embodiments, during the process of starting the application program, there are multiple processes, and for each process of the application program, the file segment corresponding to the process is determined in the manner of any of the above embodiments, and then the file segment of the application program is obtained. For example, based on the storage block information of the first target storage block, the file segment required for starting the application program based on the first starting event is determined, including: for any process in the process of starting the application program, determining the file segment required for the process based on the storage block information of the first storage block, and then determining the file segment required for starting the application program.

[0103] For example, if the file segment required by the process in the stage from P1 to P2 is needed, the start time (t1) of the stage and the completion time (t2) of the stage can be determined, and the first target storage block in the time period (target time window) is selected from the first structure array, and then the file segment required for running the process is determined based on the storage block information of the first target storage block, and then the file segment required for starting the application program is determined.

[0104] By determining the target time window of the file segment required by the process in the specific stage (from the start time t1 to the completion time t2), the first target storage block in the time period can be accurately screened from the first structure array, and based on the storage block information of the target storage block, the file segment required by the running process is determined, and then based on all the file segments required by the process running, the file segment required for starting the application program is determined.

[0105] In the first aspect, since the data in the first structure array can indicate the specific details of the process work, by determining the first target storage block from the first structure array and determining the file segment required for starting the application program based on the storage block information of the first target storage block, the accurate acquisition of the file segment can be realized; in the second aspect, compared with the way of determining the file segment by relying on the system event tracking mechanism or the system call function in the related art, the additional system resource consumption caused by monitoring and processing the system-level events can be reduced, and the resource utilization efficiency in the application program starting process is improved.

[0106] In some embodiments, the file segment required for starting the application program is pre-read to the cache space, including: loading the first file located at the preset position in the input table of the process image file of the application program; in the case that the loading of the system sub-file in the first file is completed, performing first initialization configuration by using the first initialization function in the preset callback table of the first file; in the case that the first initialization configuration is completed, pre-reading the file segment required for starting the application program, and pre-reading the file segment required for starting the application program to the cache space.

[0107] In step 204, the file segment required for starting the application program is pre-read to the cache space.

[0108] Here, after determining the file segment required for starting the application program, the file segment required for starting the application program can be pre-read to the cache space.

[0109] Figure 3 is a flowchart of a data processing method according to an exemplary embodiment Figure 3 As shown in Figure 2 , the method mainly includes the following steps:

[0110] In step 301, it is determined whether there is a target component. In the case that there is a target component, step 302 is performed, otherwise, step 303 is performed.

[0111] In step 302, in the case that there is a target component in the process of starting the application program, the file segment is pre-read according to the first pre-reading strategy.

[0112] In the case that there is no target component in the process of starting the application, the file segments are pre-read according to a second pre-reading strategy in step 303.

[0113] In some embodiments, after determining the file segments required for starting the application, the method further comprises:

[0114] In the case that there is no target component in the process of starting the application, the file segments are pre-read according to a second pre-reading strategy in step 303.

[0115] In the case that there is no target component in the process of starting the application, the file segments are pre-read according to a second pre-reading strategy in step 303.

[0116] Here, after determining the file segments required for starting the application, different pre-reading strategies can be selected according to whether there is a target component in the starting process. The target component can also be referred to as an effective component, and can include components with preset functions, for example, the target component can be a module that has a key influence on the starting of the application or a module with a relatively high stability requirement, and the target component can affect the dependency relationship and initialization process in the starting process. If there is a target component in the starting process, the file segments are pre-read according to a first pre-reading strategy; if there is no target component, the file segments are pre-read according to a second pre-reading strategy.

[0117] It should be noted that the first pre-reading strategy and the second pre-reading strategy are different, that is, the first pre-reading strategy and the second pre-reading strategy are different pre-reading mechanisms. In some embodiments, different types of components have corresponding pre-reading strategies. Illustratively, different types of components have different stability requirements, and the corresponding pre-reading strategies are also different; again illustratively, different types of components have different importance to the starting of the application, and the corresponding pre-reading strategies are also different.

[0118] In some embodiments, the first pre-reading strategy and the second pre-reading strategy are different, which can include that the speed of pre-reading based on the first pre-reading strategy is different from the speed of pre-reading based on the second pre-reading strategy; the accuracy of pre-reading based on the first pre-reading strategy is different from the accuracy of pre-reading based on the second pre-reading strategy. Illustratively, the speed of pre-reading based on the first pre-reading strategy is greater than the speed of pre-reading based on the second pre-reading strategy; or, the accuracy of pre-reading based on the first pre-reading strategy is higher than the accuracy of pre-reading based on the second pre-reading strategy.

[0119] In some embodiments, the first pre-reading strategy can be a pre-reading strategy of the latest version (new pre-reading), and the second pre-reading strategy can be a pre-reading strategy that has been used historically (old pre-reading).

[0120] The present disclosure selects a corresponding pre-reading strategy according to whether a target component exists, to adapt to different startup scenarios. The first pre-reading strategy and the second pre-reading strategy are respectively for the cases where the target component exists and does not exist, and by loading different files and initialization functions, the corresponding initialization configuration can be performed, so as to realize efficient pre-reading of the file segments required for starting the application program. Not only can the startup efficiency of the application program be improved, the time-consuming of the I / O operation of the storage medium can be reduced, and the user experience can be improved, but also various complex and changeable system environments and application program startup requirements can be coped with.

[0121] In some embodiments, pre-reading the file segments according to the first pre-reading strategy comprises:

[0122] loading a first file located at a preset position in an input table of a process image file of the application program;

[0123] in a case where the loading of the system sub-file in the first file is completed, performing a first initialization configuration by using a first initialization function in a preset callback table of the first file;

[0124] in a case where the first initialization configuration is completed, pre-reading the file segments required for starting the application program.

[0125] It should be noted that when starting the application program, the operating system loads the application program into the memory according to the structure of the process image file, creates the process and the address space of the process, so that the program can run in the memory. The process image file is used to guide the operating system to allocate memory for the program, set the file structure, and load related resources, so as to ensure that the program can be executed correctly.

[0126] The input table of the process image file is a data structure in the process image file (which is an executable file or a DLL), and the input table can list the names and related information of other modules (such as DLL files) and their exported functions that the module depends on at runtime. When the operating system loads the process image file, it will load the required dependent modules according to the information in the input table, and parse the function addresses called in these modules, so as to ensure that the program can correctly call external functions and access resources. The input table can also be referred to as the import table.

[0127] For example, when the user triggers the startup event of the application program, the operating system will find and load the first file according to the preset position in the input table of the process image file of the application program. The preset position can be set as needed. For example, the preset position can be the first preset position in the input table. For another example, the preset position can be the first position in the input table.

[0128] Since the first file can be a file at a top position in an import table of a process image file of the application program (e.g., can be a file at a top position in an import table), the first file is exemplarily before a C runtime library (CRT, such as runtime 140.dll, uCRTbase.dll, etc.). Since the first file is a key file relied on by all components during startup, early loading of the first file is crucial for subsequent application program startup.

[0129] In some embodiments, the operating system can load the first file into the memory by calling a function (e.g., LoadLibrary) or the like. After loading is completed, system sub-files in the first file (such as other related DLL files dependent on the first file) are also loaded. For example, the first file can depend on some basic system DLL files, and these system sub-files are automatically loaded into the memory after the first file is loaded.

[0130] It should be noted that the system sub-file is a basic module in the operating system, and the first file can rely on the system sub-file to complete its own initialization during the loading process. Since the system sub-file is loaded earliest, the first file can be loaded and executed immediately after the system sub-file. In some embodiments, the first file (app_elf.dll) can be a carrier of an early loading framework of ntdll.dll, kernel32.dll, kernelbase.dll, and the like. Exemplarily, the import table of the first file can only have ntdll.dll, kernel32.dll, and kernelbase.dll modules. Among them, ntdll.dll is used to provide an interface between a user mode program and a Windows kernel, and contains an implementation of a system call; kernel32.dll is used to provide core system functions, such as process and thread management, memory management, file operation, and the like; and kernelbase.dll is a basic layer of a Windows API, and is used to provide core system functions and is dependent on other DLLs.

[0131] The present disclosure limits the import table of the first file to ensure that the first file only depends on system sub-files, thereby simplifying the dependency relationship, improving loading efficiency, and ensuring that the first file can be loaded and executed in an early stage of process initialization. The first file is designed as a carrier of an early loading framework, so that the first file can be loaded in an early stage of process initialization. By limiting the import table of the first file to system sub-files, it can be ensured that the system sub-file has been loaded into the memory when the process starts, thereby allowing the first file to execute initialization logic in the early stage.

[0132] After the loading of the system sub-file of the first file is completed, the first initialization function in the preset callback table of the first file can be used for initialization configuration. The preset callback table of the first file is a predefined data structure, and the callback function (the first initialization function) in the preset callback table is called by the system after the first file is loaded, for performing a task related to the initialization of the first file, such as configuring a running environment, registering an event processing function, initializing an internal data structure, and the like, to ensure that the first file and the system sub-file dependent thereon can correctly participate in the starting process of the application program. The first initialization function in the preset callback table is defined in advance, for performing necessary initialization setting after the file is loaded.

[0133] The present disclosure can ensure that the first file and the system sub-file dependent thereon can participate in the subsequent starting process of the application program in a correct state, by calling the first initialization function in the preset callback table of the first file to perform the related initialization operation.

[0134] After the first initialization configuration is completed, the operating system starts to pre-read the file segments required for starting the application program, so that the key dependent file (the first file) can be included in the pre-reading process before the critical moment of pre-reading takes effect, by loading the first file in the preset position of the input table of the application program process image file in advance; after the loading of the system sub-file in the first file is completed, the first initialization function in the preset callback table is used for initialization configuration, to ensure that the necessary setting after the file is loaded is completed in time, and to fully prepare for the subsequent pre-reading operation; after the initialization configuration is completed, the pre-reading of the file segments required for starting the application program is started, so as to cover more key file loading links, and to solve the problem that some files cannot be included in the pre-reading process due to the late pre-reading opportunity.

[0135] In some embodiments, the loading of the first file in the preset position of the input table of the application program includes:

[0136] locking the global lock;

[0137] loading the first file into the virtual memory of the current first process, after the locking operation is completed.

[0138] In some embodiments, the pre-reading of the file segments, after the first initialization configuration is completed, includes:

[0139] unlocking the global lock, after the first initialization configuration is completed;

[0140] starting the application program based on the pre-read file segments, after the unlocking operation is successfully performed and the pre-reading of the file segments is successfully completed.

[0141] It should be noted that the global lock is a mechanism for controlling concurrent access, and through locking, it can be ensured that the loading process of the first file will not be disturbed in a multi-threaded or multi-process environment.

[0142] In the embodiments of the present disclosure, before loading the first file at the preset position in the input table of the application program, the operating system will perform a locking operation on the global lock. After completing the locking operation, the first file is loaded into the virtual memory of the current first process, which can avoid resource conflicts and data inconsistency problems that may occur when multiple processes or threads load the first file at the same time.

[0143] After completing the first initialization configuration, an unlocking operation is performed on the global lock. The unlocking operation is to release the resources occupied by the previous locking to allow other processes or threads to continue to access the related resources. In the case of completing the first initialization configuration, the global lock is unlocked. In the case of successfully performing the unlocking operation, the application program is started based on the pre-read file segment. After the unlocking operation is completed, the application program is officially started using the pre-read file segment. Since the file segment has been loaded into the memory in the pre-reading stage, when starting the application program, the required resources can be quickly obtained from the memory, greatly reducing the time for reading data from the disk, thereby improving the startup speed of the application program.

[0144] In some embodiments, loading the first file into the virtual memory of the current first process includes:

[0145] In the case of determining that the first process has not loaded the file segment required for running based on the process information in the process environment block, the first file is loaded into the virtual memory of the first process, and in the case of loading the first file into the virtual memory of the first process, the process information in the process environment block is updated based on the process information of the first process.

[0146] It should be noted that the process environment block (Process Environment Block, PEB) is used to store information related to the process, which can include key information of the process, such as module loading information (including base addresses of executable files and dynamic link libraries), environment variables, process parameters, memory allocation information, heap information, debugging information, etc. The file segment required for running includes determining the file segment required for running and loading the file segment required for running.

[0147] When loading the first file into the virtual memory of the current first process, the present disclosure first determines whether the first process has loaded the file segment required for running based on the process information in the process environment block. If it is determined according to the record in the process environment block that the first process has not loaded the file segment required for running, a loading operation is performed to load the first file into the virtual memory of the first process.

[0148] In the case of loading the first file into the virtual memory of the first process, the process information in the process environment block can be updated based on the process information of the first process, so that the process environment block can accurately reflect the current actual state of the first process, including the key information such as the loaded file. By updating the process information in the process environment block in a timely manner, the life cycle and resource usage of the first process can be better tracked and managed.

[0149] In some embodiments, in the case of determining that the first process does not load the required file segment based on the process information in the process environment block, the first file is loaded into the virtual memory of the first process, including:

[0150] In the case that the first process does not load the required file segment and the process image file includes the first file, the first file is loaded into the virtual memory of the first process.

[0151] In some embodiments, in the case that the first process does not load the required file segment and the disk storing the process image file does not include the file segment required by the first process, a prompt information of loading failure is output.

[0152] Here, after determining that the first process does not load the required file segment based on the process information in the process environment block, it is further determined whether the process image file contains the first file. If the first process does not load the required file segment and the process image file indeed contains the first file, the first file can be loaded into the virtual memory of the first process.

[0153] In the case that the first process does not load the required file segment and the disk storing the process image file does not include the file segment required by the first process, a prompt information of loading failure is output, so that the user or administrator can be promptly fed back when the key file cannot be loaded, facilitating problem troubleshooting and solution. When it is detected that the necessary file segment is missing in the disk, the prompt information can remind the user to take appropriate measures, such as checking whether the file is damaged, whether it is mistakenly deleted, or whether it needs to be reinstalled related components, etc., to ensure that the application program can have a clear prompt when encountering file loading problems.

[0154] In some embodiments, the file segment required by the starting application program is pre-read, including:

[0155] In the process of pre-reading the second file required by the starting application program, in the case that an interruption occurs when loading the first file segment of the second file, an interruption event is triggered;

[0156] In response to an interrupt event, the read request for the first file segment is merged with the read request for the second file segment in the second file to obtain the target request;

[0157] Pre-read the first and second file segments based on the target request.

[0158] During the pre-fetching of the second file required to launch the application, interruptions to the second file's read operation may occur. For example, disk read errors, file system corruption, or other system anomalies may prevent the pre-fetching operation from completing successfully. Another example is when loading a segment of the second file, if that segment is already in the cache, requests for each segment will be split. New requests may be inserted between these segments by other processes, causing the file segments to become discontinuous and ultimately leading to the failure of the expected continuous I / O.

[0159] In the event of an interruption in the second file, this disclosure triggers an interruption event. In response to the interruption event, the read request for the first file segment and the read request for the second file segment adjacent to the first file segment are merged to obtain a target request. Based on the target request, the first file segment and the second file segment are pre-read.

[0160] like Figure 4 As shown, suppose the second file (e.g., gdi32.dll) has four file fragments: fragment A, fragment B, fragment C, and fragment D. All four fragments are required for the application startup process. Of these four fragments, fragment B has already been loaded into the system cache, meaning it has been used by another process. However, fragments A, C, and D have not yet been loaded into the cache.

[0161] To address the above situation, if an application layer initiates a read request for four file fragments—file fragment A, file fragment B, file fragment C, and file fragment D—when the read request reaches the system cache, it will be split into two read requests. Since file fragment B is already in the cache, the read request is further divided into a first read request for file fragment A, and a second read request for both file fragments C and D. After the read requests are split, the first read request is stored in the file system's request queue (IO queue), and then the second read request is also stored in the system's request queue (IO queue).

[0162] However, if a new request is inserted by other processes between the first read request and the second read request, because there is only one request queue in the whole system, if a read request is split into two and inserted into the request queue respectively, the new request may be inserted by other processes in between, which may finally result in discontinuity of the file segments and finally result in failure of the expected continuous IO.

[0163] For example, the corresponding read disk order becomes: first read the file segment A based on the first read request, then read other data based on other requests between the first read request and the second read request, and then read the file segment C and the file segment D based on the second read request, resulting in discontinuity of the file segments.

[0164] In some embodiments, in the case of an interruption in loading the first file segment of the second file, the interruption event is triggered, including: in loading the first file segment of the second file, if it is determined that the first file segment exists in the system cache, it is determined that the first file segment has been used by other processes, at this time it is determined that an interruption occurs, and the interruption event can be triggered.

[0165] In other embodiments, the interruption event can be triggered by file mapping. Illustratively, after the file mapping maps the file segment to the virtual address space, a page fault interruption is triggered when the process accesses a storage block (for example, a page of physical memory) that has not been loaded into the physical memory, that is, the interruption event is triggered. For example, an application program can specify a virtual address range to be accessed in advance based on the PrefetchVirtualMemory interface, and then determine whether to trigger the interruption event.

[0166] In the embodiments of the present disclosure, by triggering the interruption event when the pre-reading starts the file segment required by the application program, the read request of the first file segment and the second file segment is merged to form a target request, and the pre-reading is performed based on the target request. On the one hand, the number of IO operations in the pre-reading process can be reduced on the basis of ensuring the continuity of the file segment, the pre-reading efficiency is improved, the consumption of system resources is reduced, and the starting speed of the application program is improved; on the other hand, when an interruption occurs in the pre-reading process, the pre-reading operation can be effectively recovered and continued, the integrity of the file segment required by the application program during starting is ensured, and the application program starting delay caused by the interruption in the pre-reading is reduced.

[0167] In some embodiments, in the case of completing the first initialization configuration, the file segment required by the application program is pre-read, including:

[0168] In the case of completing the first initialization configuration, the file segment required by the second process is pre-read;

[0169] determining the pre-reading of the application is complete.

[0170] In the case where the first initialization configuration is complete, the operating system begins pre-reading the file segments required by the application. For an application containing multiple processes, not only the file pre-reading of the current first process is involved, but also the pre-reading of the file segments required by the second process. In some embodiments, the system identifies and locates the key files and resources relied on by the second process during startup and running, which can include: dependent DLL files, configuration files, data files, etc. By pre-reading these file segments in advance, it can be ensured that the required files of the second process exist in the memory when the second process starts, thereby reducing the startup delay of the second process.

[0171] In the case where the file segments required by all processes of the application are complete, the pre-reading of the application is determined to be complete. The present disclosure can continuously monitor and manage the pre-reading operation until the file requirements of all related processes are met. When the file segments of all processes are successfully pre-read and stored in the memory, the pre-reading task can be marked as complete. In turn, it ensures that the startup process of the entire application can be efficient and smooth, as all necessary file resources have been prepared in advance, and the various components of the application can start quickly without waiting for the files to be loaded from the disk, thereby improving the startup speed of the application.

[0172] In some embodiments, the method further comprises:

[0173] encapsulating the system sub-file in the initial file of the application;

[0174] adding a preset callback table including the first initialization function to the initial file to obtain a first file;

[0175] adding the first file to a preset position of an input table of the process image file.

[0176] In the embodiments of the present disclosure, during the development stage of the application, in order to ensure that the first file can be loaded at the appropriate time during the startup process of the application, the input table of the process image file needs to be configured. In some embodiments, the system sub-file can be encapsulated in the initial file of the application, and a preset callback table including the first initialization function can be added to the initial file to obtain a first file, and then the first file can be added to a preset position of an input table of the process image file.

[0177] Exemplarily, the system files required for starting the application can be screened to determine the system sub-files necessary for starting the application, and the system sub-files are encapsulated into the initial file to construct an initial file framework containing the basic components. Then a preset callback table (for example, a TLS callback table) is created, a first initialization function containing initialization logic is added to the preset callback table, and the initial file integrated with the preset callback table is inserted into the preset position of the input table of the process image file, so as to ensure that the system can preferentially identify and load the first file when the process is loaded. The preset callback table can execute the corresponding functions in a preset order when the application is started, thereby realizing the control of the application initialization process.

[0178] In some embodiments, after the system sub-files are determined, the initial file can be compiled. Then the initial file generated by the compiler can be modified to add a preset callback table to the initial file. The preset callback table allows the specified callback function to be automatically executed when the file is loaded into the process, thereby realizing early initialization. The TLS callback mechanism is a mechanism used in the Windows system to execute specific code when the file is loaded and unloaded. By adding a TLS callback table in the resource part of the file, it can be ensured that the specified callback function is automatically called when the file is loaded. The function (for example, EarlyInitialize) for performing early initialization is added to the TLS callback table, so that when the first file is loaded into the process, the system automatically calls the callback function to execute the early initialization logic.

[0179] After obtaining the first file, the process image file (for example, an executable file.exe) generated by the compiler can be modified to add a first file input item in the input table of the process image file. The input table defines the file list that needs to be loaded when the process is started. By modifying the input table, it can be ensured that the first file is loaded when the process is created.

[0180] In some embodiments, the loading order of the first file can be defined by modifying the order of the input table or reorganizing the entries of the input table. For example, in the input table, the input item of the first file is adjusted to the frontmost position. By adjusting the order of the input table, it can be ensured that the first file is the first file to be loaded, thereby ensuring the priority execution of the early initialization logic.

[0181] Exemplarily, a dynamic link library module named app_elf.dll, i.e., an initial file, can be created, and the input table of the initial file only contains three DLLs of ntdll.dll, kernel32.dll and kernelbase.dll. The initial file is designed as a carrier of an early loading framework, which means that it will be loaded in an early stage of process initialization. A function for performing early initialization, i.e., a first initialization function, is defined and exported in the initial file, so as to enable other modules to call the function. This mechanism allows specific initialization logic to be performed in an early stage of process startup. Then the initial file generated by the compiler is modified to add a TLS callback table and add the function for performing early initialization to the TLS callback table, to obtain a first file. The process image file generated by the compiler can also be modified to add a first file input item in the input table of the process image file and adjust the input order of the first file to the first position.

[0182] The preset callback table can contain the first initialization function. The first file is placed in a preset position of the input table of the process image file, so that the first file and the callback function thereof can be loaded and executed in an early stage of application startup, and the first file in the preset position can be executed before the CRT. In this way, the application can be loaded and initialized in a predetermined order in the startup, so as to optimize the pre-reading process, improve the startup efficiency, ensure the efficiency and stability of the startup process, and customize the configuration of the input table of the process image file, which is an important basis for optimizing the pre-reading, so that the application can fully utilize system resources in the startup process and reduce unnecessary delay.

[0183] In some embodiments, the file segments are pre-read according to a second pre-reading strategy, including:

[0184] loading a second initialization function in the C runtime library;

[0185] performing a second initialization configuration based on the second initialization function, and pre-reading the file segments required for starting the application after the second initialization configuration is completed.

[0186] It should be noted that the C runtime library (CRT) is a basic library for running an application, which contains standard functions and functions for supporting basic operations and running environments of programs.

[0187] In the embodiments of the present disclosure, after the pre-reading of the file segments required for starting the application is completed, the operating system continues to load the second initialization function in the C runtime library to provide support for further initialization of the application.

[0188] The second initialization configuration is used to set and adjust the environment of the C runtime library, for example, initialize memory management, file operation, input / output (IO) system, etc., to ensure that the application program can correctly use the functions provided by the C runtime library during runtime, thereby providing a guarantee for stable operation of the application program.

[0189] It should be noted that the first initialization function is a function located in the preset callback table of the first file, which is used to perform initialization operations related to the first file after the first file and its system sub-files are loaded, such as configuring the running environment of the file, registering the callback function, initializing the data structure, etc., to ensure that the first file can correctly participate in the startup process of the application program; and the second initialization function is located in the C runtime library, which is used to set and adjust the environment of the C runtime library after the pre-read file segment, such as initializing memory management, file operation, input / output system, etc., to provide basic support for stable operation of the application program. The first initialization configuration is mainly for the first file and its dependent system sub-files to ensure that they can work normally in the pre-reading stage; the second initialization configuration focuses on the C runtime library to prepare for the overall operation of the application program.

[0190] After the second initialization configuration is completed, the operating system starts the application program using the pre-read file segment, wherein the pre-read file segment includes various resources and data required for the operation of the application program, such as code segments, data segments, configuration files, resource files, etc. By pre-reading the file segment, the delay of file loading during the formal operation of the application program can be reduced, the startup efficiency can be improved, the application program can quickly enter the running state, and the startup process can be smoother.

[0191] In step 304, it is determined whether the pre-reading based on the first pre-reading strategy fails. Here, if the pre-reading based on the first pre-reading strategy succeeds, step 305 is performed; if the pre-reading based on the first pre-reading strategy fails, step 306 is performed.

[0192] In step 305, the file segment used in the process of starting the application program and the file record of the file segment are moved to the second target position of the storage medium.

[0193] In step 306, the current position of the file segment used in the process of starting the application program and the file record of the file segment in the storage medium is maintained unchanged.

[0194] In some embodiments, the method further comprises:

[0195] In the case of pre-reading based on the first pre-reading strategy fails and / or pre-reading based on the second pre-reading strategy, the file fragment used in the process of starting the application program and the current position of the file record of the file fragment in the storage medium are maintained unchanged;

[0196] In the case of pre-reading based on the first pre-reading strategy succeeds, the file fragment used in the process of starting the application program and the file record of the file fragment are moved to the second target position of the storage medium.

[0197] In the embodiments of the present disclosure, when pre-reading based on the first pre-reading strategy (new pre-reading) fails or pre-reading based on the second pre-reading strategy (old pre-reading) is used, the file fragment used in the process of starting the application program and the file record thereof in the storage medium are maintained unchanged. In this way, in the case of pre-reading failure or using the set pre-reading strategy (old pre-reading), the original state of the file on the storage medium is not affected. That is, in the case of pre-reading failure or using the set pre-reading strategy (old pre-reading), the file can still be accessed and loaded according to the original position of the file in the storage medium, and problems such as file association error or data inconsistency caused by file position change can be avoided.

[0198] When pre-reading based on the first pre-reading strategy succeeds, the file fragment used in the process of starting the application program and the file record thereof can be moved to the second target position of the storage medium, that is, the successfully pre-read file fragment is stored in the new target position.

[0199] In the embodiments of the present disclosure, the first pre-reading strategy is the latest version of the pre-reading strategy (new pre-reading), and when pre-reading based on the first pre-reading strategy succeeds, the file fragment used in the process of starting the application program and the file record thereof are moved to the second target position of the storage medium to optimize the storage layout and improve the subsequent file access efficiency. The second pre-reading strategy is a historical pre-reading strategy (old pre-reading), and when pre-reading based on the first pre-reading strategy fails or the second pre-reading strategy is directly used for pre-reading, the current position of the file fragment and the file record thereof in the storage medium is maintained unchanged to ensure that the original state of the file on the storage medium is not disturbed when pre-reading fails or the old pre-reading strategy is used, thereby providing a stable basis for subsequent solution formulation or re-pre-reading, and thus ensuring the application program starting efficiency and system stability.

[0200] In step 205, in the case that the file fragments are arranged in different positions of the storage medium and the file fragments are pre-read to the cache space, after successfully starting the application program, the file fragment used in the process of starting the application program and the file record of the file fragment are moved to the second target position of the storage medium.

[0201] In some embodiments, in the case that the file fragments are arranged in different positions of the storage medium and the file fragments are pre-read to the cache space, the method further comprises:

[0202] In the case of successful starting of the application, the file fragment used in the process of starting the application and the file record of the file fragment are moved to a second target location of the storage medium.

[0203] In some embodiments, in the case of successful starting of the application, the file fragment used in the process of starting the application and the file record of the file fragment are moved to a second target location of the storage medium, comprising: in the case of successful starting of the application, determining the file fragment used in the process of starting the application as a target file fragment; determining a physical address of the target file fragment on the storage medium; determining a target file record of the target file fragment from a master file table metadata file, and determining a physical address of the target file record on the storage medium; and moving the target file fragment and the target file record to the second target location of the storage medium based on the physical address of the target file fragment and the physical address of the target file record.

[0204] In the embodiments of the present disclosure, the physical address of the target file fragment on the storage medium can be determined. The physical address can be a logical cluster number (LCN) of the target file fragment on the storage medium.

[0205] For each successful starting of the application, the rearrangement of the file fragment is triggered once, that is, the following steps are performed once: determining a physical address of a target file fragment on a storage medium, determining a target file record of the target file fragment from a master file table metadata file, and determining a physical address of the target file record on the storage medium, and moving the target file fragment and the target file record to a second target location of the storage medium based on the physical address of the target file fragment and the physical address of the target file record. It should be noted that the metadata file is used to store and manage the related information of the file record, and can include the metadata of the file, such as the file name, size, creation time, modification time, access permission, and the physical address of the file record on the storage medium. In some embodiments, the metadata file can include a master file table (MFT) file, that is, an MFT file. In other embodiments, the metadata file can also include a file allocation table (FAT) file, that is, a FAT file.

[0206] In some embodiments, the physical address of the target file fragment on the storage medium can be determined by invoking a storage medium file system interface or using a storage medium analysis tool. In the file system interface based approach, the storage medium arrangement software sends a query instruction to the file system, with the identifier of the target file fragment as the input parameter. The file system finds the corresponding file record (target file record) in the directory structure according to the identifier, and then determines the physical address of the target file fragment on the storage medium based on the target file record.

[0207] For example, the physical address of the target file fragment on the storage medium can be obtained by sending an input / output (I / O) request of FSCTL_GET_RETRIEVAL_POINTERS to the Windows system. Here, the logical cluster number (LCN) of the target file fragment on the storage medium can be obtained by sending an I / O request of FSCTL_GET_RETRIEVAL_POINTERS to the Windows system. FSCTL_GET_RETRIEVAL_POINTERS is a control code for retrieving the storage location of file data on the storage medium. By sending the I / O request to the Windows system and associating it with the target file fragment, the system returns the physical address information of the storage medium corresponding to the target file fragment, i.e., the LCN, thereby achieving accurate positioning of the physical location of the target file fragment on the storage medium.

[0208] In the storage medium analysis tool based approach, the storage medium analysis tool can scan the sectors of the storage medium one by one, parse the file to which each sector belongs according to the file system format and rules, and thus determine the physical address of the target file fragment. In addition, in the NTFS file system environment, the physical storage location pointer of the file fragment can be obtained by parsing the record (target file record) of the target file in the master file table (MFT), and thus the physical address of the target file fragment can be determined.

[0209] It should be noted that the master file table (MFT) is a core component of the NTFS file system, which stores the metadata information of each file in the file system. Determining the target file record of the target file fragment from the metadata file means finding the record corresponding to the target file fragment by parsing the entries in the MFT. This record contains detailed information of the target file fragment, such as file attributes, file size, storage location (such as LCN) of the file fragment on the storage medium, etc.

[0210] In the embodiments of the present disclosure, after the target file record is determined, the physical location of the target file record on the storage medium can be determined. For example, when the storage medium data is parsed, the location of all file records can be located according to the NTFS file system rule, the entire metadata file is traversed and each file record is parsed, the virtual address of the file record corresponding to the file is determined first, and then the virtual address is mapped to the physical address on the storage medium. For example, the virtual cluster number (VCN) of the file record can be mapped to the LCN on the storage medium.

[0211] In some other embodiments, the target file record of the target file segment is determined from the master file table metadata file, and the physical address of the target file record on the storage medium is determined, including: determining file information of the target file segment, and determining the target file record based on the file information; determining the physical address of the target file record on the storage medium from the pre-stored physical addresses of the file records of the metadata file in the target array.

[0212] In some embodiments, the file information of the target file segment can be obtained through a file system interface or a storage medium analysis tool. The file information includes but is not limited to the file name, the file size, the creation time, the modification time, the access time, the file attribute (such as read-only, hidden, etc.), the virtual cluster number (VCN) range of the file, and the record number of the file in the MFT (for example, the record number in the MFT header).

[0213] For example, the file information of the target file segment is queried through the file system interface to obtain the file name, the file size, the timestamp, the file attribute, and the basic information, and the record number of the file in the metadata file. Then, the corresponding record position in the metadata file is accessed according to the obtained record number, and the MFT record is parsed to extract the file attribute information and the position information (such as the mapping relationship between the VCN and the LCN) of the file data. Then, the physical location of the target file segment on the storage medium is determined through the mapping relationship between the VCN and the LCN obtained by parsing, so as to determine the target file record.

[0214] In some embodiments, when the file information includes the file identifier, the target file record is determined based on the file information, including: comparing the file identifier with the preset identifiers in the target array one by one to determine the target identifier matched with the file identifier; and determining the file record corresponding to the target identifier as the target file record.

[0215] In some embodiments, the target array can be a structured data table including a plurality of entries, each entry corresponding to a file record in the metadata file. Each entry stores at least a preset identifier (such as a Record Number of the file record or a hash value of the file name) and a physical address of the corresponding file record.

[0216] In some embodiments, the preset identifier and the physical address of each file record can be obtained by scanning the metadata file and stored in the target array. The preset identifier can be a unique identifier such as a Record Number of the file record or a hash value of the file name.

[0217] When the target file record needs to be determined, the file identifier can be extracted from the file information. For example, the file identifier can be a unique identifier of the file (such as a full path of the file name or a hash value of the file), and each entry in the target array is traversed to compare the file identifier with the preset identifier in each entry. The comparison algorithm can be selected according to the type of the preset identifier. For example, if the preset identifier is a hash value of the file name, a corresponding hash comparison algorithm is used; if it is a Record Number, a numerical comparison is performed.

[0218] When the preset identifier matching the file identifier is found, the preset identifier is determined as the target identifier. The preset identifier matching the file identifier can be the same preset identifier as the file identifier. Then, the physical address of the target file record is obtained according to the entry corresponding to the target identifier. The present disclosure can quickly and accurately determine the target file record from the target array. By using the pre-constructed target array, the complexity of comparing the file identifier with the preset identifier is reduced, thereby improving the efficiency of file record retrieval and providing accurate file record information for subsequent file arrangement operations.

[0219] In some embodiments, when the file information includes file header information, determining the target file record based on the file information includes: obtaining a target sequence number of a file record to which the target file segment belongs from the file header information; and determining the file record with the target sequence number in the target array as the target file record.

[0220] It should be noted that the sequence number of the file record can be the sequence number of the file record in the metadata file, used to indicate the position of the file record in the metadata file, i.e., the sequential offset of the current file record relative to the first file record. The sequential offset refers to the positional relationship of the file record in the metadata file, which can be the relative sequential position between the current file record and the first file record. In the metadata file, the file records can be arranged in a predetermined order, and each file record can have a unique sequence number for identifying the position of the file record in the metadata file. In some embodiments, the sequential offset of the file record can be indicated by the sequence number, for example, if the sequence number of a file record is 5, the sequential offset of the file record can be 4, indicating that the file record is located at the 4th position after the first file record.

[0221] In some embodiments, the file header information can be accessed by using an application programming interface (API) provided by the operating system, where the file header information includes the basic attributes of the file and the metadata used by the system internally to manage the file. In some embodiments, the file header information of the target file segment can be obtained by calling an API function and passing in the identifier (such as the file path) of the target file segment, where the file header information can include the size, creation time, access time, file attributes (such as read-only, hidden, etc.), and target sequence number of the file record to which the target file segment belongs, and other key metadata.

[0222] For example, if the metadata file includes two metadata file segments, the first metadata file segment includes 5 file records, the second metadata file segment includes 3 file records, and the target sequence number of the file record to which the target file segment belongs is 8 obtained by parsing the file header information, the 3rd file record in the second metadata file segment can be determined as the file record to which the target file segment belongs, i.e., the target file record.

[0223] After determining the target file record, the physical address of the target file record on the storage medium can be determined from the pre-stored physical addresses of the file records of the metadata file in the target array. The target array pre-stores the physical addresses of the file records in the metadata file. The target array can be constructed during the system initialization phase or the file preprocessing phase. For example, the physical addresses of each file record can be obtained by pre-scanning the entire metadata file, and these physical addresses can be stored in the target array. When the physical address of the target file record is needed, the record number of the target file record in the metadata file is directly used as an index to quickly find the corresponding physical address in the target array.

[0224] The physical address of each file record in the metadata file is stored in advance, which changes the traditional real-time traversal and analysis of MFT from the bottom. After determining the target file record, the corresponding physical address is quickly located in the target array, which greatly improves the search efficiency, avoids repeated scanning and analysis of MFT, and significantly shortens the time consumption of determining the physical address.

[0225] In some embodiments, the target array is generated based on the following method: for each file record in the metadata file, determining the physical address of the file record; based on the record identifier and / or serial number of all file records in the metadata file, storing the physical address of the file record to an initial array to obtain the target array.

[0226] When analyzing the metadata file, the physical address of each file record in the metadata file can be determined, and then the obtained physical address of the file record is stored one by one to an initial array based on the record identifier and / or serial number of all file records in the metadata file to obtain a target array. It should be noted that the initial array refers to an array structure defined or created in advance before storing the physical address of the file record, and the initial array can include a pre-created empty array or an array containing the physical address of part of the file record. The target array refers to the final generated array after storing the physical address of the file record, which contains the physical address of each file record in the metadata file. It should be noted that the target array is the output result of the entire processing process, and the target array can be generated by storing the physical address of the file record one by one in the initial array.

[0227] In some embodiments, in the NTFS file system, the physical address of the file record can be determined by querying the related attribute in the MFT entry. For example, each MFT entry contains a data attribute that stores the location of the actual data of the file on the storage medium (disk), and the data attribute can indicate the starting cluster number of the file record and the size of the file. Combined with the cluster size of the file system, the physical address of the file record on the disk can be calculated. For example, if the starting cluster number of the file is 100 and the cluster size is 4KB, the size of the file is 8KB, then the physical address of the file record starts from cluster 100 and occupies two clusters, i.e. the position of 4KB*100 to 4KB*101.

[0228] In some embodiments, each file record in the metadata file has a unique record identification (e.g., record number) and a sequence number. To generate the target array, each file record in the metadata file can be traversed. For example, for a file record with a record identification of 100 and a sequence number of 5, the physical address of the file record can be obtained by parsing the data attribute of the file record, which is cluster number 2048 on the disk. Then, the physical address 2048 of the file record can be stored in the corresponding position of the target array according to the order of the record identification or the order of the sequence number. By establishing the mapping relationship between the identification information of the file record and the physical address through the target array, the physical location of the file can be quickly located according to the record identification or the sequence number.

[0229] The technical solution of the present disclosure can establish the corresponding relationship between the file record and the physical address, and on the other hand, the target array can be used to more effectively locate and operate the related file data, thereby improving the efficiency and accuracy of file processing.

[0230] In some embodiments, for each file record in the metadata file, the physical address of the file record is determined by determining the physical address of the metadata file on the storage medium, determining the metadata file segment in which the file record is located, and determining the virtual address of the file record based on the position of the file record in the metadata file segment, and determining the physical address of the file record based on the physical address of the metadata file, the virtual address of the metadata file segment, and the virtual address of the file record.

[0231] It should be noted that the metadata file can be composed of multiple metadata file segments, and each metadata file segment can include at least one file record.

[0232] In some embodiments, the raw data of the storage medium can be parsed through a storage medium analysis tool or a file system interface. In the NTFS file system, the partition structure and file system metadata of the storage medium contain the location information of the metadata file, and the physical address of the metadata file on the storage medium can be determined. For example, by parsing the information in the partition boot record (Partition Boot Record) or the volume boot record (Volume Boot Record), the key structure of the file system, such as the physical address of the metadata file, can be found.

[0233] For example, in the parsing process, it is determined that the starting position of the metadata file corresponds to a logical cluster number (LCN) of 10, which is obtained by analyzing the metadata structure of the file system, and can be used to represent the starting physical address of the metadata file on the storage medium, i.e., the offset of the starting position of the metadata file relative to the starting position of the storage medium. In some embodiments, this information can be stored in the super block (Super Block) or other data structure of the file system to indicate the location of the key system file.

[0234] After obtaining the physical address of the metadata file on the storage medium, the physical position of each file record in the metadata file can be further determined based on the physical address of the metadata file on the storage medium. Illustratively, the physical address of each file record on the storage medium can be calculated by traversing each metadata file segment of the metadata file and combining the relative position of each file record in the metadata file with the physical address of the metadata file on the storage medium. By converting the relative position of the file record to the absolute position on the storage medium, the physical position of each file record is accurately determined.

[0235] It should be noted that in the NTFS file system, the position of the file record in the metadata file segment refers to the specific offset or logical order of the file record in the metadata file segment. Each metadata file segment can contain multiple file records, and each file record is arranged in a set order, such as being sequentially stored from the starting position of the metadata file segment. The position of the file record can be determined by its byte offset in the metadata file segment, for example, the first file record starts at offset 0, and the second file record starts at the position where the first record ends.

[0236] After determining the metadata file segment where the file record is located and the position of the file record in the metadata file segment, the virtual address of the file record can be determined based on the position of the file record in the metadata file segment. The virtual position of the file record can include the VCN of the file record, which is used to indicate the offset of the position of the file record relative to the starting position of the metadata file.

[0237] In some embodiments, determining the metadata file segment where the file record is located and determining the virtual address of the file record based on the position of the file record in the metadata file segment includes:

[0238] determining the number of file records in the metadata file segment based on the metric attribute of the file record in the metadata file and the metric attribute of the metadata file segment;

[0239] The virtual address of the file record is determined based on the number of file records and the location of the file record in the metadata file segment.

[0240] It should be noted that the metric attribute of the file record can be fixed. For each metadata file segment, the size of the metadata file segment can be determined, i.e., the metric attribute of the metadata file segment. Exemplarily, in the NTFS file system, the metric attribute of the metadata file segment can be obtained, for example, the metric attribute of each metadata file segment can be determined when the file system is created.

[0241] In some embodiments, the metric attribute of the file segment can include the byte length of the file segment. Exemplarily, in the file system, the size of the file segment can be represented by the byte length. For example, a file segment contains 1024 KB, indicating the size of the space occupied by the file segment on the storage medium. For another example, the size of the metadata file segment can be 4 KB or 8 KB.

[0242] In other embodiments, the file segment can also be measured based on the start offset and the byte length. For example, the start offset of a file segment is 2048 KB and the length is 512 KB, indicating that the file segment starts from the position 2048 bytes from the beginning of the file and continues for 512 KB.

[0243] In some embodiments, the number of file records in the metadata file segment can be determined based on the ratio of the byte length of the metadata file segment to the byte length of the file record in the metadata file. Taking the byte length of the metadata file segment as 5 KB and the byte length of the file record as 1 KB, the number of file records in the metadata file segment is determined to be 5; taking the byte length of the metadata file segment as 3 KB and the byte length of the file record as 1 KB, the number of file records in the metadata file segment is determined to be 3.

[0244] After determining the number of file records in the metadata file segment, the virtual address of the file record can be determined based on the number of file records in the metadata file segment and the location of the file record in the metadata file segment. Exemplarily, the VCN of the first file record (file record 1) in the metadata file segment is 0, and the VCN of the second file record (file record 2) is 1.

[0245] The present disclosure efficiently determines the virtual address of the file record by calculating the number of file records in the metadata file segment, and combining the location of the file record in the segment, reduces complex analysis, simplifies the operation process, and improves the efficiency of file management.

[0246] After obtaining the virtual address of the file record, the physical address of the file record can be determined based on the physical address of the metadata file, the virtual address of the metadata file segment, and the virtual address of the file record. The physical address of the file record can include an LCN of the file record, and the LCN of the file record is used to indicate the location of the file record relative to the start position of the storage medium.

[0247] In some embodiments, determining the physical address of the file record based on the physical address of the metadata file, the virtual address of the metadata file segment, and the virtual address of the file record includes: determining the physical address of the metadata file segment based on the physical address of the metadata file and the virtual address of the metadata file segment; and determining the physical address of the file record based on the physical address of the metadata file segment and the virtual address of the file record.

[0248] It should be noted that the physical address of the metadata file segment is used to indicate the offset of the metadata file segment relative to the start position of the storage medium.

[0249] For each file record in the metadata file, the virtual address of the metadata file segment in which the file record is located can be determined, where the virtual address of the metadata file segment is used to indicate the offset of the location of the metadata file segment relative to the start position of the metadata file. In some embodiments, the virtual address of the metadata file segment can include a VCN of the metadata file segment. For example, if the VCN of the metadata file segment is 5, it indicates that the offset value of the location of the metadata file segment relative to the start position of the metadata file is 5; if the VCN of the metadata file segment is 30, it indicates that the offset value of the location of the metadata file segment relative to the start position of the metadata file is 30.

[0250] The present disclosure can determine the physical address of the metadata file segment based on the physical address of the metadata file and the virtual address of the metadata file segment. After obtaining the physical address of the first metadata file segment, the physical address of the file record in the first metadata file segment can be determined based on the physical address of the first metadata file segment and the virtual address of the file record in the first metadata file segment.

[0251] Exemplarily, the physical address (LCN) of the metadata file is 10, the virtual address (VCN) of the first metadata file segment is 5, and the physical address (LCN) of the first metadata file segment is 5+10. There are 5 file records in the first metadata file segment, wherein the virtual address of file record 1 in the first metadata file segment is 0, the virtual address of file record 2 in the first metadata file segment is 1, the virtual address of file record 3 in the first metadata file segment is 2, the virtual address of file record 4 in the first metadata file segment is 3, and the virtual address of file record 5 in the first metadata file segment is 4. The physical address of the corresponding file record 1 is 5+10+0, the physical address of the corresponding file record 2 is 5+10+1, the physical address of the corresponding file record 3 is 5+10+2, the physical address of the corresponding file record 4 is 5+10+3, and the physical address of the corresponding file record 5 is 5+10+4.

[0252] Exemplarily, the physical address (LCN) of the metadata file is 10, the virtual address (VCN) of the second metadata file segment is 30, and the physical address (LCN) of the second metadata file segment is 30+10. There are 3 file records in the second metadata file segment, wherein the virtual address of file record 5 in the second metadata file segment is 0, the virtual address of file record 6 in the second metadata file segment is 1, and the virtual address of file record 7 in the second metadata file segment is 2. The physical address of the corresponding file record 5 is 30+10+0, the physical address of the corresponding file record 6 is 30+10+1, and the physical address of the corresponding file record 7 is 30+10+2. The first metadata file segment and the second metadata file segment can be two adjacent file segments in the storage medium, and there is free space between the first metadata file segment and the second metadata file segment.

[0253] After obtaining the physical addresses of the file records in the metadata file, the physical addresses of the file records can be stored in a target array based on the record identifiers and / or serial numbers of the file records. Exemplarily, an empty target array can be created to store the physical addresses of the file records and the corresponding identification information. The obtained record identifiers, serial numbers, and calculated physical addresses are stored in the target array. For example, if the record identifier of a file record is 8 and the serial number is 1, an entry {record identifier: 8, serial number: 1, physical address: 30+10+2} is added to the target array.

[0254] The present disclosure stores the physical addresses of the file records in the metadata file and their identification information in the target array, providing efficient support for subsequent quick lookup of the physical addresses of the file records, and avoiding complex operations of real-time parsing of the metadata file.

[0255] After obtaining the physical address of the target file record on the storage medium, the target file fragment and the target file record can be moved to a second target location of the storage medium based on the physical address of the target file fragment and the physical address of the target file record.

[0256] In some embodiments, available space (the second target location) on the storage medium can be determined and ensured to have enough continuous space to accommodate the target file fragment and the target file record, the target file fragment and the target file record are read from their original physical addresses (the physical address of the target file fragment and the physical address of the target file record) to a memory buffer, and then the target file fragment and the target file record are written from the buffer to the second target location of the storage medium.

[0257] In some embodiments, during the process of moving the target file fragment and the target file record to the second target location of the storage medium, an update operation can be triggered, and the file system can update the metadata structure, including the metadata file and the related allocation table, based on the update operation to indicate the new location of the file fragment and the file record. The update operation ensures the consistency of the file system and the integrity of the data.

[0258] In other embodiments, after successfully moving the target file fragment and the target file record to the second target location of the storage medium, the old data at the original location can be cleaned up, thereby completing the entire file rearrangement process. Through the file rearrangement scheme of the present disclosure, the layout of the files and file records on the storage medium is optimized, the storage medium seek time and data access delay are reduced, and the storage medium IO performance is improved.

[0259] In some embodiments, the second target location is determined based on the following manner: in response to the end of the application startup, the second target location is determined based on the distribution information of the data on the storage medium and / or the data processing performance of each location on the storage medium; and the target file fragment is a file fragment required by the application startup.

[0260] It should be noted that when the application startup process ends, the data distribution information on the storage medium can be collected, including but not limited to the current location of the file fragment, the file size, the file type, and the usage of each area of the storage medium. At the same time, the data processing performance of each location on the storage medium, such as read / write speed, read / write time, etc. is analyzed. According to this information, an optimal second target location can be selected, which can be a region on the storage medium with the best read / write performance and capable of providing enough continuous space to improve data access speed and thereby optimize the subsequent running performance of the application. Exemplarily, in response to the end of the application startup, a bitmap of the storage medium can be obtained, and the second target location can be determined based on the bitmap of the storage medium. For example, the second target location can be determined from a location close to the periphery of the bitmap.

[0261] In some embodiments, after the application is successfully started, the LCN of the target file fragment on the storage medium can be obtained by sending an I / O request of FSCTL_GET_RETRIEVAL_POINTERSD to the volume device driver, then a continuous and large enough free area (second target position) is found in the volume, and the target file fragment is moved to the second target position by FSCTL_MOVE_FILE request to complete the rearrangement.

[0262] In some embodiments, after the application ends, a preset time period can be waited for, and in the case that the preset time period is reached, the second target position is determined based on the distribution information of the data on the storage medium and / or the data processing performance of each position on the storage medium, and the target file fragment and the target file record are moved to the second target position of the storage medium based on the physical address of the target file fragment and the physical address of the target file record, wherein the target file fragment is a file fragment used by the application in this start process.

[0263] In some embodiments, in response to a third start event of triggering the application, the file record is read from the second target position; and the file fragment required for starting the application is determined from the second target position based on the file record.

[0264] After the next start is started, the file fragment required for starting the application can be pre-read from the storage medium after rearrangement, thereby improving the pre-reading speed of the file fragment.

[0265] The present disclosure determines the second target position according to the data distribution and performance of the storage medium after the application ends and a preset time period is waited for, and moves the related file fragments and records to the position, which avoids storage medium operation during application running, thereby improving user experience, optimizing file layout to improve storage medium I / O efficiency, and shortening subsequent start time.

[0266] It should be noted that the target file fragment and the target file record can have corresponding second target positions respectively, i.e., the target file fragment and the target file record can be stored in continuous second target positions, or can be stored in corresponding second target positions respectively.

[0267] In some embodiments, in the case that the target file fragment and the target file record are moved to the second target position of the storage medium, the method further comprises: in response to a next start event of triggering the application, reading the file record from the second target position; and determining the file fragment required for starting the application from the second target position based on the file record.

[0268] In the case of detecting a new starting event, the disclosure can directly read the relevant file record from the second target position which is pre-optimized. Since the file record and the file segment have been moved to the continuous area with better read-write performance on the storage medium, the necessary file segment can be loaded from the second target position faster, thereby significantly reducing the starting time of the application.

[0269] In some embodiments, determining the file segment required for starting the application from the storage medium comprises:

[0270] In the case that the file segment required for starting the application does not exist in the cache space, determining the file segment required for starting the application from the storage medium;

[0271] Pre-reading the file segment required for starting the application to the cache space comprises:

[0272] In the case that the starting type of the application is cold starting, pre-reading the file segment required for starting the application to the cache space.

[0273] In the embodiments of the disclosure, when the application needs to be started, it can be determined whether the file segment required for starting the application exists in the cache space. If the file segment required for starting the application does not exist in the cache space, the file segment required for starting the application is determined from the storage medium. In the case that the required file does not exist in the cache, the storage medium is accessed again, thereby improving the starting efficiency.

[0274] It should be noted that cold starting refers to the first starting of the application after a long time (long time) of non-use. For the application of cold starting, all necessary files and resources need to be loaded. In the case of confirming that the application is cold starting, the file segment required for starting the application can be pre-read to the cache space, which can reduce the waiting time of the user. Because the pre-reading process is performed in the early stage of starting the application, the subsequent file access can be directly obtained from the cache without accessing the storage medium again.

[0275] Figure 4 is a data processing device block diagram according to an exemplary embodiment. As shown in Figure 5 The data processing device 400 mainly includes:

[0276] The first determining module 401 is configured to determine the file segment required for starting the application from the storage medium;

[0277] The first pre-reading module 402 is configured to, in the case that the file segment is arranged in the first target position of the storage medium, pre-read the file segment to the cache space based on the arrangement order of the file segment in the storage medium.

[0278] In some embodiments, in a case where the file segments required for starting the application are respectively arranged at different locations of the storage medium, the apparatus 400 further comprises:

[0279] an obtaining module configured to obtain a first execution parameter of a second starting event of the application, the second starting event being triggered before the first starting event;

[0280] a second determining module configured to determine, based on the first execution parameter, a first target storage block from the current first array of structures;

[0281] a third determining module configured to determine, based on storage block information of the first target storage block, a file segment.

[0282] In some embodiments, in a case where the first execution parameter comprises a starting duration of the application based on the second starting event, the second determining module is configured to:

[0283] load a key file of the application based on the first starting event;

[0284] determine a target time window based on a loading time of the key file and the starting duration;

[0285] determine, as the first target storage block, a storage block in the first array of structures whose loading time is within the target time window.

[0286] In some embodiments, in a case where the file segments are respectively arranged at different locations of the storage medium and the file segments are pre-read to the cache space, the apparatus 400 further comprises:

[0287] a first processing module configured to, in a case where the application is successfully started, move, to a second target location of the storage medium, a file record of a file segment used in a process of starting the application and the file segment.

[0288] In some embodiments, in a case where the file segments required for starting the application are determined, the apparatus 400 further comprises:

[0289] a second pre-reading module configured to, in a case where a target component exists in a process of starting the application, pre-read the file segments according to a first pre-reading strategy;

[0290] a third pre-reading module configured to, in a case where the target component does not exist in the process of starting the application, pre-read the file segments according to a second pre-reading strategy.

[0291] In some embodiments, the second pre-reading module is configured to:

[0292] loading a first file located at a preset position in an input table of a process image file of the application program;

[0293] performing a first initialization configuration using a first initialization function in a preset callback table of the first file upon completion of loading a system sub-file in the first file;

[0294] pre-reading a file segment upon completion of the first initialization configuration.

[0295] In some embodiments, the second pre-reading module is configured to:

[0296] performing a locking operation on a global lock;

[0297] loading the first file into a virtual memory of a current first process upon completion of performing the locking operation.

[0298] In some embodiments, the second pre-reading module is configured to:

[0299] performing an unlocking operation on the global lock upon completion of the first initialization configuration;

[0300] starting the application program based on the pre-read file segment upon successful execution of the unlocking operation and successful pre-reading of the file segment.

[0301] In some embodiments, the second pre-reading module is configured to:

[0302] loading the first file into a virtual memory of the first process upon determining that the first process does not load a required file segment based on process information in a process environment block, and updating the process information in the process environment block based on process information of the first process upon loading the first file into the virtual memory of the first process.

[0303] In some embodiments, the second pre-reading module is configured to:

[0304] loading the first file into a virtual memory of the first process upon determining that the first process does not load a required file segment and that the process image file includes the first file.

[0305] In some embodiments, the third pre-reading module is configured to:

[0306] loading a second initialization function in a C runtime library;

[0307] perform a second initialization configuration based on the second initialization function, and read ahead a file segment required by the application program in a case where the second initialization configuration is completed.

[0308] In some embodiments, the apparatus 400 further comprises:

[0309] a second processing module configured to maintain the current position of a file segment used in the process of starting the application program and a file record of the file segment in the storage medium unchanged in a case where the pre-reading based on the first pre-reading strategy fails and / or the pre-reading based on the second pre-reading strategy succeeds;

[0310] a third processing module configured to move the file segment used in the process of starting the application program and the file record of the file segment to a second target position of the storage medium in a case where the pre-reading based on the first pre-reading strategy succeeds.

[0311] In some embodiments, the third processing module is configured to:

[0312] determine a physical address of a target file segment on the storage medium;

[0313] determine a target file record of the target file segment from the metadata file, and determine a physical address of the target file record on the storage medium;

[0314] move the target file segment and the target file record to the second target position based on the physical address of the target file segment and the physical address of the target file record.

[0315] In some embodiments, the third processing module is configured to:

[0316] determine file information of the target file segment, and determine the target file record based on the file information;

[0317] determine the physical address of the target file record on the storage medium from the physical address of the file record of the metadata file in the target array.

[0318] In some embodiments, the third processing module is configured to:

[0319] determine the physical address of each of the file records in the metadata file;

[0320] store the physical address of the file record to an initial array based on the record identification and / or serial number of all the file records in the metadata file to obtain the target array.

[0321] In some embodiments, the third processing module is configured to:

[0322] determine the physical address of the metadata file on the storage medium;

[0323] for each of the file records, determine the metadata file segment in which the file record is located, and determine the virtual address of the file record based on the position of the file record in the metadata file segment;

[0324] determine the physical address of the file record based on the physical address of the metadata file, the virtual address of the metadata file segment, and the virtual address of the file record.

[0325] In some embodiments, the third processing module is configured to:

[0326] determine the physical address of the metadata file segment based on the physical address of the metadata file and the virtual address of the metadata file segment;

[0327] determine the physical address of the file record based on the physical address of the metadata file segment and the virtual address of the file record.

[0328] In some embodiments, the third processing module is configured to:

[0329] determine the number of file records in the metadata file segment based on the metric attribute of the file records in the metadata file and the metric attribute of the metadata file segment;

[0330] determine the virtual address of the file record based on the number and the position of the file record in the metadata file segment.

[0331] In some embodiments, the third processing module is configured to:

[0332] compare the file identifier with the preset identifiers in the target array one by one to determine the target identifier that matches the file identifier;

[0333] determine the file record corresponding to the target identifier as the target file record.

[0334] In some embodiments, the third processing module is configured to:

[0335] parse the target sequence number of the file record to which the target file segment belongs from the file header information;

[0336] determine the file record with the target sequence number in the target array as the target file record.

[0337] In some embodiments, the third processing module is configured to:

[0338] In response to the application completing the starting operation, determining the second target position based on distribution information of data on the storage medium and / or data processing performance of each position on the storage medium.

[0339] The target file segment is a file segment required for starting the application.

[0340] In some embodiments, the third processing module is configured to:

[0341] In response to a third starting event of the application being triggered, reading the file record from the second target position;

[0342] Determining a file segment required for starting the application from the second target position based on the file record.

[0343] In some embodiments, the first determining module 401 is configured to:

[0344] In the case where the file segment required for starting the application does not exist in the cache space, determining a file segment required for starting the application from the storage medium;

[0345] The first pre-reading module 402 is configured to:

[0346] In the case where the starting type of the application is cold starting, pre-reading the file segment required for starting the application to the cache space.

[0347] As to the apparatus in the above embodiments, the specific manners in which the modules perform operations have been described in detail in the embodiments of the method, and thus will not be described in detail here.

[0348] Based on the same inventive concept, the embodiments of the present disclosure provide an electronic device, which can be the computer or terminal in one or more of the above embodiments. Figure 5 is a structural schematic diagram of an electronic device according to an exemplary embodiment. As shown in Figure 4 The electronic device 500 adopts general computer hardware, and includes a processor 501, a memory 502, a bus 503, an input device 504, and an output device 505.

[0349] In some possible implementations, the memory 502 can include computer storage media in the form of volatile and / or non-volatile memory, such as read-only memory and / or random access memory. The memory 502 can store operating systems, application programs, other program modules, executable code, program data, user data, and the like.

[0350] Input device 504 can be used to input commands and information to electronic device 500, such as a keyboard or pointing device, e.g., a mouse, trackball, touchpad, microphone, joystick, game pad, satellite television antenna, scanner, or similar device. Input device 504 can be connected through bus 503 to processor 501.

[0351] Output device 505 can be used to output information from electronic device 500, and can include peripheral output devices other than a monitor, such as a speaker and / or a printing device. Output device 505 can also be connected to processor 501 through bus 503.

[0352] Electronic device 500 can be connected to a network, such as a local area network (LAN), through antenna 506. In a networked environment, executable instructions can be stored in remote storage devices, not limited to local storage.

[0353] When processor 501 in electronic device 500 executes executable code or application programs stored in memory 502, electronic device 500 can implement the file processing method in the above embodiments, and the specific execution process is described above and will not be repeated here.

[0354] The above memory 502 can store executable instructions for implementing the functions of the first determination module 401 and the first pre-reading module 402 in the above embodiments. Figure 4 The above memory 502 can store executable instructions for implementing the functions of the first determination module 401 and the first pre-reading module 402 in the above embodiments. Figure 5 The functions / implementation processes of the first determination module 401 and the first pre-reading module 402 in the above embodiments can be implemented by processor 501 calling executable instructions stored in memory 502, and the specific implementation process and functions are described above with reference to the related embodiments. ​ The functions / implementation processes of the first determination module 401 and the first pre-reading module 402 in the above embodiments can be implemented by processor 501 calling executable instructions stored in memory 502, and the specific implementation process and functions are described above with reference to the related embodiments.

[0355] Based on the same inventive concept, the embodiments of the present disclosure also provide a storage medium. The storage medium stores instructions. When the instructions are run on a computer, the computer is used to execute the data processing method in one or more of the above embodiments.

[0356] Based on the same inventive concept, the embodiments of the present disclosure also provide a computer program or computer program product. When the computer program product is executed on a computer, the computer is caused to implement the data processing method in one or more of the above embodiments.

[0357] Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the features disclosed herein. It is intended that the disclosure be construed as including any paterns, uses, or adaptations of the features disclosed and / or inherent in the specification and / or the embodiments as well as modifications

[0358] It is to be understood that the disclosure is not limited to the precise construction hereinafter described and as shown in the attached drawings, and that various changes in shape, size and arrangements of parts can be made without departing from the scope of the present disclosure. The scope of the present disclosure is limited only by the claims appended hereto.

Claims

1. A data processing method, characterized by, The method comprises: determining file segments required for starting an application from a storage medium in response to a first starting event of triggering the application; pre-reading the file segments to a cache space based on an arrangement order of the file segments in the storage medium in a case that the file segments are arranged at a first target position of the storage medium.

2. The method of claim 1, wherein, In a case that the file segments required for starting the application are arranged at different positions of the storage medium respectively, the method further comprises: obtaining a first execution parameter of a second starting event of executing the application, the second starting event being triggered before the first starting event; determining a first target storage block from a current first structure array based on the first execution parameter; determining the file segments based on storage block information of the first target storage block.

3. The method of claim 2, wherein, In a case that the first execution parameter comprises a starting duration of starting the application based on the second starting event, the determining the first target storage block from the current first structure array based on the first execution parameter comprises: loading a key file of the application based on the first starting event; determining a target time window based on a loading time of the key file and the starting duration; determining a storage block in the first structure array whose loading time is within the target time window as the first target storage block.

4. The method of claim 2, wherein, In a case that the file segments are pre-read to the cache space in the case that the file segments are arranged at different positions of the storage medium respectively, the method further comprises: moving a file record of the file segments used in a process of starting the application to a second target position of the storage medium in a case that the application is successfully started.

5. The method of claim 1, wherein, In a case that the file segments required for starting the application are determined, the method further comprises: pre-reading the file segments according to a first pre-reading strategy in a case that a target component exists in a process of starting the application; pre-reading the file segments according to a second pre-reading strategy in a case that the target component does not exist in the process of starting the application.

6. The method of claim 5, wherein, The pre-reading the file segments according to the first pre-reading strategy comprises: loading a first file at a preset position in an input table of the application; performing a first initialization configuration by using a first initialization function of the first file in a case that a system sub-file in the first file is loaded completely; pre-reading the file segments in a case that the first initialization configuration is completed.

7. The method of claim 6, wherein, The loading the first file at the preset position in the input table of the application comprises: locking a global lock; loading the first file to a virtual memory of a current first process in a case that the locking operation is executed completely.

8. The method of claim 7, wherein, The pre-reading the file segments in the case that the first initialization configuration is completed comprises: unlocking the global lock in the case that the first initialization configuration is completed; starting the application based on the pre-read file segments in a case that the unlocking operation is executed successfully and the file segments are pre-read successfully.

9. The method of claim 7, wherein, The loading the first file to the virtual memory of the current first process comprises: In a case where it is determined based on the process information in the process environment block that the first process does not load a file segment required for running, the first file is loaded into the virtual memory of the first process, and in a case where the first file is loaded into the virtual memory of the first process, the process information in the process environment block is updated based on the process information of the first process.

10. The method of claim 9, wherein, The loading of the first file into the virtual memory of the first process in a case where it is determined based on the process information in the process environment block that the first process does not load a file segment required for running comprises: In a case where the first process does not load a file segment required for running and the process image file comprises the first file, the first file is loaded into the virtual memory of the first process.

11. The method of claim 5, wherein, The pre-reading of the file segment according to the second pre-reading strategy comprises: loading a second initialization function; performing a second initialization configuration based on the second initialization function, and in a case where the second initialization configuration is completed, pre-reading the file segment.

12. The method of claim 5, wherein, The method further comprises: In a case where the pre-reading based on the first pre-reading strategy fails and / or the pre-reading based on the second pre-reading strategy succeeds, maintaining the current position of the file segment used in the process of starting the application program and the file record of the file segment in the storage medium unchanged; In a case where the pre-reading based on the first pre-reading strategy succeeds, moving the target file segment used in the process of starting the application program and the file record of the target file segment to a second target position of the storage medium.

13. The method of claim 4, wherein, The moving of the target file segment used in the process of starting the application program and the file record of the target file segment to a second target position of the storage medium comprises: determining the physical address of the target file segment on the storage medium; determining the target file record of the target file segment from the metadata file and determining the physical address of the target file record on the storage medium; based on the physical address of the target file segment and the physical address of the target file record, moving the target file segment and the target file record to the second target position.

14. The method of claim 13, wherein, The determining of the target file record of the target file segment from the metadata file and the determining of the physical address of the target file record on the storage medium comprise: determining the file information of the target file segment and determining the target file record based on the file information; determining the physical address of the target file record on the storage medium from the physical address of the file record of the metadata file in the target array.

15. The method of claim 14, wherein, The method further comprises generating a target array, comprising: for each of the file records in the metadata file, determining the physical address of the file record; based on the record identifier and / or the serial number of all the file records in the metadata file, storing the physical address of the file record to an initial array to obtain the target array.

16. The method of claim 15, wherein, The determining of the physical address of the file record for each of the file records in the metadata file comprises: determining the physical address of the metadata file on the storage medium; For each of the file records, a metadata file segment where the file record is located is determined, and a virtual address of the file record is determined based on a position of the file record in the metadata file segment; A physical address of the file record is determined based on the physical address of the metadata file, the virtual address of the metadata file segment, and the virtual address of the file record.

17. The method of claim 16, wherein, The determining of the physical address of the file record based on the physical address of the metadata file, the virtual address of the metadata file segment, and the virtual address of the file record comprises: The physical address of the metadata file segment is determined based on the physical address of the metadata file and the virtual address of the metadata file segment; The physical address of the file record is determined based on the physical address of the metadata file segment and the virtual address of the file record.

18. The method of claim 16, wherein, The determining of the virtual address of the file record and the virtual address of the metadata file segment where the file record is located comprises: The number of file records in the metadata file segment is determined based on a metric attribute of file records in the metadata file and a metric attribute of the metadata file segment; The virtual address of the file record is determined based on the number and the position of the file record in the metadata file segment.

19. The method of claim 14, wherein, In a case where the file information comprises a file identifier, the determining of the target file record based on the file information comprises: The file identifier is compared with preset identifiers in the target array one by one to determine a target identifier matching the file identifier; The file record corresponding to the target identifier is determined as the target file record.

20. The method of claim 14, wherein, In a case where the file information comprises file header information, the determining of the target file record based on the file information comprises: A target serial number of a file record to which the target file segment belongs is parsed from the file header information; The file record with the target serial number in the target array is determined as the target file record.

21. The method of claim 4, wherein, The second target position is determined in the following manner: In response to completion of a starting operation of an application program, the second target position is determined based on distribution information of data on the storage medium and / or data processing performance of each position on the storage medium; The target file segment is a file segment required for starting the application program.

22. The method of claim 4, wherein, In a case where the target file segment and the target file record are moved to the second target position of the storage medium, the method further comprises: In response to triggering of a third starting event of the application program, the file record is read from the second target position; Based on the file record, a file segment required for starting the application program is determined from the second target position.

23. The method according to any one of claims 1 to 22, characterized in that, The determining of the file segment required for starting the application program from the storage medium comprises: In a case where the file segment required for starting the application program does not exist in the cache space, the file segment required for starting the application program is determined from the storage medium; The file segment required by the starting application is pre-read to the cache space, comprising: In the case that the starting type of the application is cold starting, the file segment is pre-read to the cache space.

24. A data processing apparatus, characterized by Comprising: A first determining module configured to determine a file segment required by a starting application from a storage medium; A first pre-reading module configured to, in the case that the file segment is arranged at a first target position of the storage medium, pre-read the file segment to a cache space based on an arrangement order of the file segment in the storage medium.

25. A computer program product comprising computer programs or instructions, characterized in that, The computer program or instructions are executed by the processor to implement the steps of the method in any one of claims 1 to 23.

Citation Information

Patent Citations

  • Linux operation system and startup method thereof

    CN102662714A

  • Terminal starting acceleration device and method

    CN107122209A

  • Starting method and device for applications in Android system

    CN108762833A

  • Mobile device App starting acceleration method and device based on IO sequence perception

    CN116126424A