A computer hard disk cache data preloading method and system
By constructing real-time operation contexts and long-term historical behavior patterns, and combining them with system resource status, the disk cache data preloading task is dynamically scheduled, solving the problems of insufficient accuracy and resource waste in existing preloading methods, and achieving more efficient data preloading.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN YOUZHI COMPUTER TECH CO LTD
- Filing Date
- 2025-06-20
- Publication Date
- 2026-05-19
AI Technical Summary
Existing disk cache data preloading methods suffer from insufficient prediction accuracy, serious resource waste, and inability to respond promptly to sudden user data access demands in environments where user behavior changes dynamically and system resources are subject to instantaneous changes.
By acquiring user operation event information within the application window and system-level window focus switching information, a real-time operation context is constructed; combined with long-term historical behavior patterns, a preloaded data list is generated, and the system I/O resource status is monitored in real time to assess loading costs and predict benefits, calculate preload task priorities, and dynamically schedule disk cache data preload tasks.
It improves the accuracy and efficiency of preloading, reduces resource waste, and enhances the user experience.
Smart Images

Figure CN120670053B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of hard disk caching technology, and in particular to a method and system for preloading computer hard disk cache data. Background Technology
[0002] In daily operation, computer systems frequently need to read data from the hard drive into the memory cache to speed up application startup and execution. To improve efficiency, the system employs data preloading technology, attempting to predict the data that the user will access and load it into the cache before it is actually needed.
[0003] With technological advancements, preloading strategies have evolved into predictions based on users' historical behavior patterns. The system records the file access sequences, access frequencies, and correlations of users in specific applications or tasks to build user behavior models.
[0004] However, user behavior does not entirely follow fixed historical patterns. User actions are dynamic and spontaneous; for example, users may temporarily switch tasks, access data that does not conform to historical records, or perform atypical interactions within the application. Predictions based on historical patterns will have significantly reduced accuracy when user behavior deviates from historical patterns.
[0005] Furthermore, the preloading operation itself consumes disk read / write bandwidth and CPU resources for data transfer management. If large-scale preloading based on potentially outdated or inaccurate historical pattern predictions is performed when the system is currently under high load, such as when other background tasks are heavily reading and writing to the disk, it will further exacerbate system resource contention. Existing preloading methods are beginning to consider the current system resource status, such as CPU load, disk I / O queue depth, and memory availability, and dynamically adjust the scale and timing of preloading accordingly.
[0006] Although these methods take into account the overall system resource status, they are usually based on the overall system load threshold for judgment and adjustment. For the instantaneous, fine-grained changes in data access needs that occur when users quickly switch operation focus within a specific application or between multiple applications, the response of existing methods is still not timely or accurate enough.
[0007] Therefore, in an environment where user behavior changes dynamically and system I / O resources are instantaneously variable, how can we combine real-time fine-grained operation context information of users with prediction results based on long-term historical behavior patterns, and dynamically schedule disk cache data preloading tasks according to the instantaneous system I / O resource status, the loading cost of the data blocks to be loaded, and the predicted benefits, in order to cope with sudden data access needs of users and improve system response speed?
[0008] To address the aforementioned issues, existing technologies urgently need improvement. Summary of the Invention
[0009] In view of the shortcomings of the prior art, this application provides a method and system for preloading computer hard disk cache data, which has the advantages of improving the accuracy and efficiency of preloading, reducing resource waste, and enhancing user experience.
[0010] A first aspect is a method for preloading cached data on a computer hard drive, the method comprising the following steps:
[0011] S1: Obtain user operation event information within the application window and system-level window focus switching information to construct a real-time operation context;
[0012] S2: Record the user's file access sequence, access frequency and file association in the application to build a long-term historical behavior pattern;
[0013] S3: Generate a preloaded data list based on the real-time operation context and the long-term historical behavior pattern;
[0014] S4: Monitor the system I / O resource status in real time and evaluate the loading cost and predicted benefits of each data block in the preloaded data list;
[0015] S5: Calculate the preloading task priority of each data block in the preloaded data list based on the loading cost, the predicted revenue and the system I / O resource status, and schedule the disk cache data preloading task according to the preloading task priority.
[0016] This application proposes a method for preloading computer hard disk cache data. By comprehensively considering user operation events within the application window, system-level window focus switching information, long-term historical behavior habits, and instantaneous system resource load, it dynamically and intelligently generates a preloaded data list to determine which data to preload and when to preload it. This more effectively addresses dynamic changes in user behavior and instantaneous fluctuations in system resources, improving the accuracy and efficiency of preloading. Therefore, the method proposed in this application has the advantages of improving the accuracy and efficiency of preloading, reducing resource waste, and enhancing the user experience.
[0017] Furthermore, step S1 includes:
[0018] S11: Monitor the user's mouse coordinates and key presses within the application window, extract click, hover, and drag events, and record event timestamps and window identifiers;
[0019] S12: Parse the window identifier, obtain the process identifier and window class name of the application to which the window belongs, and construct the application window operation event sequence by combining the event timestamp;
[0020] S13: Obtain the identifier of the focused window in the Windows system and the identifier of its process, and record the window focus switching timestamp;
[0021] S14: Based on the window focus switching timestamp, compare the current focus window identifier with the previous focus window identifier. If there is a change, extract the process identifier and window class name of the application before and after the switch as the window focus switching information.
[0022] S15: The application window operation event sequence and the window focus switching information are sorted and integrated according to their respective event timestamps and window focus switching timestamps to form a real-time operation context that includes user operation events and window focus switching.
[0023] This application proposes a method for preloading computer hard disk cache data. By providing specific methods for obtaining fine-grained operation event information of users in application windows and window focus switching information at the system level, and integrating this information through timestamps, a more comprehensive and accurate real-time operation context is constructed, thereby solving the problem of insufficient information detail.
[0024] Furthermore, step S15 includes:
[0025] S151: Based on the event timestamp and the window focus switching timestamp, construct a global timeline, and insert the application window operation event sequence and the window focus switching information into the global timeline in the order of timestamps to form a preliminary fused event stream;
[0026] S152: For the initially fused event stream, if the time interval between adjacent events is less than a preset threshold, they are determined to be related events, and the related events are merged into a composite event;
[0027] S153: Parse the composite event, extract the user's operation type, operation object, and target window for window focus switching within the application window, and convert them into a unified format event description to form the real-time operation context containing user operation events and window focus switching.
[0028] This application proposes a method for preloading computer hard disk cache data, which provides a more refined way to integrate user operation events and window focus switching information to solve the problem that simple sorting and integration cannot capture the correlation of events, thereby constructing a more accurate real-time operation context that can better reflect the user's instantaneous intentions.
[0029] Furthermore, step S2 includes:
[0030] S21: Monitor the user's file system operations in the application. When a file access event is detected, extract the application identifier and file path, record the access timestamp to form a file access record, and sort the file access record according to the access event timestamp to obtain a file access sequence.
[0031] S22: Periodically scan the file access sequence and count the access frequency of each file access path;
[0032] S23: Analyze the file access records with adjacent times in the file access sequence. If two files are accessed within a preset time window, then establish file association.
[0033] S24: Construct a long-term historical behavior pattern based on the file access sequence, the file access frequency, and the file association. The long-term historical behavior pattern is stored in a graph structure, where nodes represent files, edges represent file associations, and node weights represent access frequencies.
[0034] This application proposes a method for preloading computer hard disk cache data. Through a specific, effective, and structured method for constructing long-term historical behavior patterns, this solution overcomes the shortcomings of insufficient specificity in constructing long-term historical behavior patterns. It lays a solid data foundation for subsequent steps such as generating a preloaded data list, evaluating loading costs and predicting benefits, calculating preload task priorities, and scheduling, thereby improving the accuracy and efficiency of preloading.
[0035] Furthermore, step S23 includes:
[0036] S231: Calculate the time interval between every two adjacent file access records in the file access sequence, and construct a time interval sequence;
[0037] S252: Based on the time interval sequence, an adaptive threshold segmentation algorithm is used to determine a preset time window;
[0038] S253: Analyze the file access records with adjacent times in the file access sequence. If two files are accessed within the preset time window, file association is established. The file association calculation formula is: File association = α / (Time interval + β), where α is an adjustable parameter and β is a smoothing factor. The value of α ranges from 0.5 to 1.0, and the value of β ranges from 0.1 to 0.5.
[0039] Furthermore, step S3 includes:
[0040] S31: Extract the real-time process identifier, real-time window class name, and user operation event information of the application in the real-time operation context; extract the file access sequence and file association of the long-term historical behavior pattern;
[0041] S32: Based on the real-time process identifier and the real-time window class name, match the corresponding file access sequence, and filter the file paths associated with the operation event information from the file access sequence to form a candidate preload file list;
[0042] S33: For each file path in the candidate preloaded file list, find the associated file path that has a file association with it, and add the associated file path whose file association is greater than a preset value to the candidate preloaded file list;
[0043] S34: Deduplicate the file paths and associated file paths in the candidate preload file list, and sort them according to the file access frequency to generate a preload data list.
[0044] Furthermore, step S4 includes:
[0045] S41: Monitor the system I / O resource status in real time, and obtain CPU utilization, hard disk I / O queue length, hard disk read speed, and the data block size of each data block in the preloaded data list;
[0046] S42: Calculate the data block loading time based on the CPU utilization, the hard disk I / O queue length, the data block size, and the hard disk read speed, and convert it into loading cost; Loading cost = Data block size / Hard disk read speed * (1 + CPU utilization) * (1 + Hard disk I / O queue length / Preset queue length threshold);
[0047] S43: Calculate the predicted revenue for each data block based on the file access frequency, file correlation, and path correlation between operation event information and file path in the real-time operation context in the preloaded data list; Predicted revenue = File access frequency * File correlation * Path correlation
[0048] Furthermore, step S5 includes:
[0049] S51: Obtain the CPU utilization and hard disk I / O queue length based on the system I / O resource status, and calculate the system I / O busyness based on the CPU utilization and hard disk I / O queue length;
[0050] S52: Calculate the preloading task priority based on the loading cost, the predicted revenue, and the system I / O busyness: Preloading task priority = (predicted revenue / loading cost) * (1 - system I / O busyness);
[0051] S53: Schedule disk cache data preloading tasks according to the preloading task priority.
[0052] Furthermore, step S53 includes:
[0053] S531: Build a priority queue based on the priority of preloaded tasks;
[0054] S532: Real-time monitoring of system I / O resource status. When the system I / O busyness is lower than the preset busyness threshold, the highest priority preloaded task is taken from the head of the priority queue and submitted to the disk cache management module for execution.
[0055] S533: After the preloading is completed, the corresponding task is removed from the priority queue, and S532 is repeated until the priority queue is empty or the system I / O busyness exceeds the preset busyness threshold.
[0056] Secondly, a computer hard disk cache data preloading system, applied to the steps of any of the methods described above, the system comprising:
[0057] The first building module: obtains user operation event information within the application window and system-level window focus switching information to construct a real-time operation context;
[0058] The second building module records the user's file access sequence, access frequency, and file association in the application to build a long-term historical behavior pattern;
[0059] Generation module: Generates a preloaded data list based on the real-time operation context and the long-term historical behavior pattern;
[0060] Evaluation module: Real-time monitoring of system I / O resource status, and evaluation of the loading cost and predicted benefits of each data block in the preloaded data list;
[0061] Cache module: Based on the loading cost, the predicted benefits and the system I / O resource status, calculate the preloading task priority of each data block in the preloading data list, and schedule disk cache data preloading tasks according to the preloading task priority.
[0062] Beneficial Effects: The computer hard disk cache data preloading method and system proposed in this application dynamically and intelligently generates a preloaded data list by comprehensively considering the user's current operation event information within the application window, system-level window focus switching information, long-term historical behavior habits, and instantaneous system resource load. This determines which data to preload and when to preload it, thereby more effectively responding to dynamic changes in user behavior and instantaneous fluctuations in system resources, improving the accuracy and efficiency of preloading. Therefore, the method proposed in this application has the advantages of improving the accuracy and efficiency of preloading, reducing resource waste, and enhancing the user experience. Attached Figure Description
[0063] Figure 1 This is a flowchart illustrating a method for preloading computer hard disk cache data as proposed in this application.
[0064] Figure 2 This is a structural diagram of a computer hard disk cache data preloading system proposed in this application.
[0065] Figure 3 This is an architecture diagram of a computer hard disk cache data preloading system proposed in this application.
[0066] Labeling explanation: 201, First building module; 202, Second building module; 203, Generation module; 204, Evaluation module; 205, Caching module. Detailed Implementation
[0067] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. The components of the embodiments of this application described and marked in the accompanying drawings can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0068] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this application, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0069] Please refer to Figure 1 Firstly, a method for preloading cached data on a computer hard drive, the method including the following steps:
[0070] S1: Obtain user operation event information within the application window and system-level window focus switching information to construct a real-time operation context;
[0071] S2: Record the user's file access sequence, access frequency and file association in the application to build a long-term historical behavior pattern;
[0072] S3: Generate a preloaded data list based on real-time operation context and long-term historical behavior patterns;
[0073] S4: Monitor the system I / O resource status in real time and evaluate the loading cost and predicted benefits of each data block in the preloaded data list;
[0074] S5: Calculate the preloading task priority of each data block in the preloading data list based on loading cost, predicted benefits and system I / O resource status, and schedule disk cache data preloading tasks according to the preloading task priority.
[0075] Real-time operation context refers to the information set formed by capturing the user's instantaneous interactive behavior in the application window and the changes in window focus at the system level. It can be implemented using technologies such as system event listening and API hooks, for example, monitoring mouse movement, key input, and window activation / deactivation events. Its main purpose is to perceive the user's current focus and potential operation intentions.
[0076] Long-term historical behavior patterns refer to models built by recording and analyzing users' file access history in applications over a long period of time. These models can be implemented using techniques such as file access logs, behavior sequence analysis, and association rule mining. For example, they can be used to count file access frequency, identify file access order, and establish relationships between files. Their main purpose is to reflect users' work habits and data dependencies.
[0077] Loading cost refers to the resource consumption required to read the data block to be preloaded from the hard drive into the cache. It can be evaluated based on the data block size, hard drive read speed, and current system status such as CPU utilization and hard drive I / O queue length. Its main purpose is to quantify the impact of preloading operations on system performance.
[0078] Predicted benefits refer to the potential value that preloading a data block may bring. It can be assessed based on the importance of the data block in historical behavior patterns, its relevance to the current real-time operation context, and the likelihood of it being accessed by users. Its main purpose is to quantify the potential of preloading operations to improve user experience.
[0079] Preloading task priority refers to a ranking index calculated for each data block to be preloaded after comprehensively considering loading costs, predicted benefits, and the current I / O resource status of the system. It can be implemented by weighted calculation or model-based evaluation methods, and its main purpose is to determine the execution order and urgency of preloading tasks.
[0080] As a preferred embodiment, the solution of this application is implemented as follows: User mouse clicks, keyboard inputs, and other events within the active window are captured via system API or hook programs, and the time of occurrence and the corresponding window identifier are recorded; simultaneously, changes in the system's focused window are monitored, and the switching time is recorded. These events are then integrated into a real-time operation context in chronological order.
[0081] The system continuously monitors file system access operations in the background, recording the file paths and times accessed by the application, and counting the number of times each file is accessed. It analyzes access sequences to identify files accessed consecutively within a short period, establishes file relationships, and stores this information as long-term historical behavior patterns, for example, using a database or graph structure.
[0082] When the real-time operation context changes, a list containing potentially accessed files is generated by combining current context information (such as the current application and recent operations) and long-term historical patterns (such as file sequences associated with the current application or operation and high-frequency files).
[0083] The system acquires real-time performance metrics such as CPU utilization and hard disk I / O queue length. For each file in the pre-load list, the loading time is calculated as the loading cost based on its size, current hard disk read speed, and system load; the predicted revenue is calculated based on its access frequency in historical patterns, its relevance, and its matching degree with the current context.
[0084] Based on loading costs, predicted benefits, and system load, a formula is used to calculate the preloading priority of each file. Files to be preloaded and their priorities are placed in a priority queue. A scheduling module continuously monitors the system I / O load; when the load falls below a certain threshold, the highest-priority task is retrieved from the priority queue and submitted to the disk cache management module for preloading.
[0085] Through the above-described scheme, this application can more accurately predict the data that users are about to access, especially when user behavior deviates from historical habits. By combining real-time operational context, the responsiveness and accuracy of prediction are improved. Simultaneously, by evaluating loading costs and predicting benefits in real time, and dynamically scheduling preloading tasks based on the instantaneous system I / O resource status, unnecessary or costly preloading under high load is effectively avoided, reducing resource contention and improving overall system performance and user experience.
[0086] Furthermore, step S1 includes:
[0087] S11: Monitor the user's mouse coordinates and key presses within the application window, extract click, hover, and drag events, and record event timestamps and window identifiers;
[0088] S12: Parse the window identifier, obtain the process identifier and window class name of the application to which the window belongs, and construct the application window operation event sequence by combining the event timestamp;
[0089] S13: Obtain the identifier of the focused window in the Windows system and the identifier of its process, and record the window focus switching timestamp;
[0090] S14: Based on the window focus switching timestamp, compare the current focus window identifier with the previous focus window identifier. If there is a change, extract the process identifier and window class name of the application before and after the switch as window focus switching information.
[0091] S15: Sort and integrate the application window operation event sequence and window focus switching information according to their respective event timestamps and window focus switching timestamps to form a real-time operation context that includes user operation events and window focus switching.
[0092] In this context, mouse coordinates and key presses within the application window refer to the user's actions of moving the mouse within a specific application interface and pressing or releasing keyboard keys.
[0093] Among them, click, hover, and drag events refer to user interaction action types determined based on mouse coordinates and key combinations, which can be identified using event parsing logic.
[0094] Among them, the event timestamp refers to the precise time record of the event, which can be obtained using the timing function provided by the system.
[0095] The window identifier is a unique identifier assigned to each window by the operating system, which can be obtained using system API functions.
[0096] A process identifier is a unique identifier assigned by the operating system to each running program, which can be obtained using system API functions based on the window identifier.
[0097] The window class name is a string used by the operating system to identify the window type, which can be obtained using system API functions based on the window identifier.
[0098] An application window operation event sequence refers to a collection of user operation event records within a specific application window, arranged in chronological order.
[0099] The focus window identifier in Windows is a unique identifier for the window that the user is currently interacting with, and it can be obtained using system API functions.
[0100] A window focus switching timestamp is a precise record of the time when the window focus changes.
[0101] Window focus switching information refers to the information related to the switching of window focus from one window to another, including the application process identifier and window class name before and after the switch.
[0102] In one example, to obtain user operation event information within the application window and system-level window focus switching information, and to construct a real-time operation context, the following approach can be used.
[0103] First, system hooks are set to monitor the user's mouse coordinates and key presses within the application window, capturing messages such as mouse movement, key presses and releases. Based on these message sequences, specific operation events such as clicks, hovers, and drags are determined, while the time of the event and the corresponding window identifier are recorded.
[0104] Next, based on the obtained window identifier, the system API is called to parse the process identifier and window class name of the application to which the window belongs. This information is then combined with the operation events to construct a sequence of application window operation events in chronological order. Simultaneously, the system API is periodically queried to obtain the identifier of the currently focused window and its associated process identifier, and the focus switching time is recorded.
[0105] By comparing the current and previous focus window identifiers, when a window focus switch is detected, the application process identifier and window class name before and after the switch are extracted as window focus switch information. Finally, the application window operation event sequence is merged with the window focus switch information and globally sorted according to their respective timestamps to form a real-time operation context containing user operation events and window focus switches.
[0106] Furthermore, step S15 includes:
[0107] S151: Construct a global timeline based on event timestamps and window focus switching timestamps, and insert the application window operation event sequence and window focus switching information into the global timeline in the order of timestamps to form a preliminary fused event stream;
[0108] S152: For the initially merged event stream, if the time interval between adjacent events is less than a preset threshold, they are judged as related events, and the related events are merged into a composite event;
[0109] S153: Parse the compound event, extract the user's operation type, operation object, and target window for window focus switching within the application window, and convert them into a unified format event description to form a real-time operation context containing user operation events and window focus switching.
[0110] Specifically, in step S151, the global timeline provides a unified time reference system, allowing events from different sources to be compared and ordered on the same time dimension. The initially fused event stream is the result of all the original events arranged in chronological order.
[0111] Furthermore, in step S152, the preset threshold is a time parameter used to define the temporal proximity between events. Related events refer to events that occur consecutively within a short period of time, and are closely linked in time. A composite event is a structure that represents one or more related events as a whole.
[0112] In step S513, parsing the composite event is the process of extracting key information from the composite event. The unified format of the event description organizes the extracted information according to a predetermined structure, which facilitates processing and understanding by subsequent modules.
[0113] As a specific implementation, suppose a user quickly double-clicks a folder icon in a file manager window (Event A) and then immediately switches to a text editor window (Event B).
[0114] When constructing the real-time operation context, the timestamp of event A is recorded first. and the timestamp of event B Construct a global timeline and insert events A and B in chronological order to form a preliminary merged event flow, for example: [Events] , event Next, the time interval between event A and event B is calculated. If this time interval is less than a preset threshold (e.g., set to 300 milliseconds), then events A and B are determined to be related events. Events A and B are then merged into a single composite event.
[0115] Next, this composite event is parsed. The operation type (double-click) and the operation object (folder icon, corresponding to a file path) are extracted from event A. The target window for the window focus switch (text editor window) is extracted from event B. This information is then integrated into a unified event description, such as: "After double-clicking the folder [file path] in the file manager, immediately switch to the text editor."
[0116] This standardized event description forms part of the real-time operational context, more accurately reflecting the user's intention to open a file in the folder and edit it in a text editor.
[0117] Furthermore, step S2 includes:
[0118] S21: Monitor the user's file system operations in the application. When a file access event is detected, extract the application identifier and file path, record the access timestamp to form a file access record, and sort the file access record according to the access timestamp to obtain a file access sequence.
[0119] S22: Periodically scan file access sequences and count the access frequency of each file access path;
[0120] S23: Analyze the file access records with adjacent times in the file access sequence. If two files are accessed within a preset time window, establish file association.
[0121] S24: Construct a long-term historical behavior pattern based on file access sequence, file access frequency, and file association. The long-term historical behavior pattern is stored in a graph structure, where nodes represent files, edges represent file associations, and node weights represent access frequency.
[0122] In one specific embodiment, when a user uses a document editing application, the system can detect that the user sequentially opens "Report Draft.docx", "Data Table.xlsx", and "Reference Image.png".
[0123] Step S21 records these three file access events, including the application identifier (document editor), file path, and their respective access timestamps, and sorts these records by time to form a file access sequence.
[0124] Step S22 periodically counts the access frequency of these files. For example, "Report Draft.docx" may be accessed frequently, while "Reference Image.png" is accessed less frequently. Step S23 analyzes adjacent access records in the file access sequence. If "Report Draft.docx" and "Data Table.xlsx" are accessed consecutively within a short time interval, a file association is established between them. Similarly, if "Data Table.xlsx" and "Reference Image.png" are also accessed within a preset time window, a file association is established between them.
[0125] Step S24 integrates this information to construct a graph structure where "Report Draft.docx", "Data Table.xlsx", and "Reference Image.png" are nodes, connected by edges based on temporal proximity. The weights of the nodes reflect their respective access frequencies. For example, the "Report Draft.docx" node has a higher weight, and it has an edge with the "Data Table.xlsx" node, indicating that the user frequently accesses the data table after accessing the report draft. This graph structure constitutes a concrete instance of the user's long-term historical behavioral pattern within this document editing application.
[0126] Furthermore, step S23 includes:
[0127] S231: Calculate the time interval between every two adjacent file access records in the file access sequence, and construct a time interval sequence;
[0128] S252: Based on the time interval sequence, an adaptive threshold segmentation algorithm is used to determine the preset time window;
[0129] S253: Analyze file access records with adjacent times in the file access sequence. If two files are accessed within a preset time window, file association is established. The file association calculation formula is: File association = α / (time interval + β), where α is an adjustable parameter and β is a smoothing factor. The value of α ranges from 0.5 to 1.0, and the value of β ranges from 0.1 to 0.5.
[0130] This solution improves the quality of long-term historical behavior pattern construction by refining the specific process of establishing file associations, addressing how to more accurately and flexibly determine the time window for judging file associations, and how to quantify the strength of file associations.
[0131] Specifically, by calculating the time interval between every two adjacent file access records in the file access sequence and constructing a time interval sequence, basic data is provided for subsequent analysis of the temporal patterns of file access. The adaptive threshold segmentation algorithm dynamically adjusts the threshold based on the statistical distribution of file access time intervals. This algorithm includes: calculating the mean and standard deviation of the time interval sequence; and using the formula: Threshold = Mean of Time Interval Sequence + k * Standard Deviation of Time Interval Sequence, calculating the initial value of the preset time window, where k is an adjustable parameter. The preset time window is this threshold; the larger the value of k, the larger the threshold and the larger the preset time window; the smaller the value of k, the smaller the threshold and the smaller the preset time window.
[0132] Based on the time interval sequence, an adaptive threshold segmentation algorithm is used to determine the preset time window. This makes the determination of the time window no longer a fixed empirical value, but can be dynamically adjusted according to the actual file access pattern, thereby more accurately reflecting the user's file access habits in different scenarios and improving the adaptability and accuracy of judging file correlation in different applications and tasks.
[0133] Furthermore, the file association calculation formula incorporates the time interval of file access into the association calculation. The smaller the time interval, the larger the calculated association value, reflecting the logic that accesses that are closer in time have a stronger association. By introducing adjustable parameters α and β, the association calculation can be fine-tuned according to actual data or optimization objectives, making the quantified association more reflective of actual needs. This quantified association information is more refined than simple binary association (present or absent), and can more accurately describe the degree of correlation between files, providing a richer and more reliable basis for subsequent preloading prediction and priority ranking based on file association. The long-term historical behavior pattern constructed in this way not only reflects the connection relationship through the edges (associations) between nodes (files), but also reflects the tightness of the relationship through the edge weights (quantified associations). The node weights (access frequency) reflect the overall importance of the file. This more refined and accurate behavior pattern can better support the subsequent preloading decision-making process. Combined with the real-time operation context, it can more effectively predict the data that users are about to access, thereby improving the accuracy and efficiency of preloading.
[0134] Furthermore, step S3 includes:
[0135] S31: Extract the real-time process identifier, real-time window class name, and user operation event information of the application in the real-time operation context; extract the file access sequence and file association of long-term historical behavior patterns;
[0136] S32: Based on the real-time process identifier and the real-time window class name, match the corresponding file access sequence, and filter the file paths associated with the operation event information from the file access sequence to form a candidate preload file list;
[0137] S33: For each file path in the candidate preloaded file list, find the associated file paths that have file association with it, and add the associated file paths with file association greater than a preset value to the candidate preloaded file list;
[0138] S34: Remove duplicate file paths and associated file paths from the candidate preload file list, sort them according to file access frequency, and generate a preload data list.
[0139] This solution combines instantaneous information from real-time operational contexts with stable patterns from long-term historical behavior through a series of steps to generate a more accurate preloaded data list.
[0140] Specifically, by extracting real-time process identifiers, real-time window class names, and user operation event information, the system accurately pinpoints the user's current activity focus and potential intentions. Simultaneously, the acquired file access sequences and file relationships provide historical data that reveals past user behavior and the inherent connections between files.
[0141] By leveraging real-time process identifiers and window class names, historical behavior fragments relevant to the current application are quickly located from a vast sequence of historical file accesses. Based on this, further analysis of the user's real-time operation events is conducted, filtering out the file paths most likely related to the current operation from the matched historical fragments to form a preliminary candidate list. This process effectively combines the user's current specific actions with relevant historical experience, improving the targeting of the initial predictions.
[0142] Then, for each file in the initial candidate list, file relationships recorded in long-term historical behavior patterns are used to find other files that are strongly related to it, and these related files are also added to the candidate list. This step, based on the file access chains discovered in history, predicts which files a user might access next after accessing a certain file, thereby expanding the scope of preloading and responding to potential sudden changes in user behavior.
[0143] Finally, the candidate list, which integrates directly related and associated files, is deduplicated to eliminate duplicates and ensure its validity. The list is then sorted based on file access frequency statistically analyzed from long-term historical behavior patterns, giving higher priority to files with higher historical access frequencies.
[0144] Through this series of steps, this solution generates a preloaded data list that reflects both the user's current fine-grained operational intent and their long-term behavioral habits and inter-file relationships. This list is more accurate and comprehensive than lists generated solely based on simple rules or pure historical statistics, and it can better predict the data the user is about to access. This provides high-quality input for subsequent loading cost, predictive benefit assessment, and task priority calculation, thereby improving the overall accuracy and efficiency of preloading.
[0145] Furthermore, step S4 includes:
[0146] S41: Real-time monitoring of system I / O resource status, obtaining CPU utilization, hard disk I / O queue length, hard disk read speed, and data block size of each data block in the preloaded data list;
[0147] S42: Calculate the data block loading time based on CPU utilization, hard disk I / O queue length, data block size, and hard disk read speed, and convert it into loading cost; Loading cost = Data block size / Hard disk read speed * (1 + CPU utilization) * (1 + Hard disk I / O queue length / Preset queue length threshold);
[0148] S43: Calculate the predicted revenue for each data block based on the file access frequency, file correlation, and path correlation between operation event information and file path in the real-time operation context in the preloaded data list; Predicted revenue = File access frequency * File correlation * Path correlation
[0149] System I / O resource status refers to the current workload and availability of input / output devices (such as hard disks) and related processing units (such as CPUs) in a computer system. It can be obtained by monitoring performance counters or API interfaces provided by the operating system.
[0150] Loading cost refers to the resource consumption required to read a data block from the hard drive into memory.
[0151] Predicted benefits refer to the likelihood that a data block will actually be accessed by a user after it has been preloaded, and the resulting performance improvement value.
[0152] File access frequency refers to the number of times a specific file or data block has been accessed within a certain period of time.
[0153] File association refers to the degree to which two or more files are frequently accessed together in a user's sequence of actions.
[0154] Path relevance refers to the degree of correlation between a user's current real-time action event (such as the mouse hovering over a UI element) and a specific file path.
[0155] In one embodiment, real-time monitoring of system I / O resource status can utilize the performance monitoring interface provided by the operating system. For example, in Windows systems, the Performance Data Helper (PDH) API can be called to obtain CPU utilization, disk I / O queue length (e.g., Avg. Disk Queue Length), and disk read speed (e.g., Disk ReadBytes / sec).
[0156] The size of data blocks in the preloaded data list can be obtained by querying the file system to get the size information of the corresponding file or file segment.
[0157] When calculating the loading cost, the obtained CPU utilization (e.g., 0.5 represents 50%), disk I / O queue length (e.g., 5), disk read speed (e.g., 100 MB / s), and data block size (e.g., 1 MB) are substituted into the formula.
[0158] The preset queue length threshold can be set according to system type and empirical values, for example, set to 10. When calculating predicted revenue, file access frequency can be queried from long-term historical behavior patterns, such as a file being accessed 10 times in the past day.
[0159] File relevance can be calculated based on historical access sequences; for example, the probability of accessing file A followed immediately by accessing file B is 0.8. Path relevance can be determined based on real-time operation context; for example, if the user's mouse is currently hovering over a UI element strongly associated with a file path, the path relevance can be evaluated as 0.9. These values are then substituted into the predicted revenue formula for calculation.
[0160] This cost-benefit-based assessment, combined with real-time system status, helps avoid unnecessary preloading during peak system loads, reducing disruption to normal system operations. It prioritizes preloading data blocks most likely to be accessed by users and with relatively low loading costs. This improves the intelligence of preloading decisions, making preloading resources more efficient and better able to handle sudden data access demands from users, thus improving system response speed.
[0161] Furthermore, step S5 includes:
[0162] S51: Obtain CPU utilization and hard disk I / O queue length based on system I / O resource status, and calculate system I / O busyness based on CPU utilization and hard disk I / O queue length;
[0163] S52: Calculate the preloading task priority based on loading cost, predicted benefits, and system I / O busyness: Preloading task priority = (predicted benefits / loading cost) * (1 - system I / O busyness);
[0164] S53: Schedule disk cache data preloading tasks according to preloading task priority.
[0165] This solution proposes a specific implementation method for calculating the priority of preloaded tasks and scheduling tasks based on loading costs, predicted benefits, and system I / O resource status.
[0166] First, the system I / O resource status is obtained, specifically CPU utilization and disk I / O queue length. These two metrics directly reflect the current system I / O load. Based on these two metrics, a quantified system I / O busyness is calculated. The higher the busyness value, the more strained the system I / O resources are. Specifically, a simple weighted average formula is used for calculation, for example, busyness = w1 * normalized CPU utilization + w2 * normalized disk I / O queue length, where w1 and w2 are weighting coefficients, and their sum is 1.
[0167] Subsequently, when calculating the priority of preloaded tasks, not only was the value of the task itself (the ratio of predicted benefits to loading costs) considered, but the calculated system I / O busyness was also creatively introduced. By multiplying the ratio of predicted benefits to loading costs by (1 - system I / O busyness), the task priority can be dynamically affected by the current system load. When the system I / O busyness is high, the value of (1 - system I / O busyness) is small, thus lowering the calculated task priority, even if the task itself has high benefits. Conversely, when the system I / O busyness is low, this term is close to 1, and the task priority is mainly determined by its benefit-cost ratio. This calculation method ensures that preloading is not blindly performed when system resources are scarce, avoiding exacerbating the system burden, while valuable preloading can be performed more actively when system resources are idle.
[0168] Finally, based on the calculated preload task priorities, the disk cache data preload tasks are scheduled. This means the system will prioritize executing the tasks with the highest priority under the current system load.
[0169] In this way, the solution can ensure that the execution order and timing of preloaded tasks can dynamically adapt to changes in the instantaneous system I / O resource state, thereby making more efficient use of system resources.
[0170] Furthermore, step S53 includes:
[0171] S531: Build a priority queue based on the priority of preloaded tasks;
[0172] S532: Real-time monitoring of system I / O resource status. When the system I / O busyness is lower than the preset busyness threshold, the highest priority preloaded task is taken from the head of the priority queue and submitted to the disk cache management module for execution.
[0173] S533: After the preloading is completed, remove the corresponding task from the priority queue and repeat S532 until the priority queue is empty or the system I / O busyness exceeds the preset busyness threshold.
[0174] In one specific embodiment, a priority queue data structure provided by the standard library can be used to store preloaded tasks. Each task object contains an identifier for the data block to be loaded and a calculated priority value. Real-time monitoring of system I / O resource status can be achieved by calling the performance monitoring APIs provided by the operating system. For example, in Windows systems, the Performance Counter API can be used to obtain metrics such as '% Disk Time' or 'Current Disk Queue Length', and combined with CPU utilization to calculate system I / O busyness. A preset busyness threshold can be set to an empirical value, such as 0.6 or 0.7, indicating that when the hard disk busy time exceeds 60% or 70% of the total time, the system I / O is considered busy.
[0175] The scheduling logic can be implemented in a separate thread that periodically (e.g., every tens or hundreds of milliseconds) checks the system I / O busy level. When the busy level is below a threshold, the thread retrieves a task from the top of the priority queue and submits a preload request by calling system functions related to disk cache management (e.g., specific file system cache control interfaces or driver interfaces). After submission, the thread can either wait for notification of the request's completion (e.g., via event notification or callback function) or submit in non-blocking mode and periodically check the task status. Once the task is complete, it is removed from the priority queue. If the system I / O busy level exceeds the threshold, the scheduling thread can enter a sleep state for a period of time or reduce the frequency of checks to minimize the consumption of system resources until the busy level decreases, at which point normal scheduling checks and submissions resume.
[0176] Please refer to Figure 2 , Figure 3 A computer hard disk cache data preloading system, applied in the steps of any of the above methods, the system comprising:
[0177] First construction module 201: Obtain user operation event information within the application window and system-level window focus switching information to construct a real-time operation context;
[0178] Second building module 202: Records the user's file access sequence, access frequency and file association in the application to build a long-term historical behavior pattern;
[0179] Generation module 203: Generates a preloaded data list based on the real-time operation context and long-term historical behavior patterns;
[0180] Evaluation module 204: Real-time monitoring of system I / O resource status, and evaluation of the loading cost and predicted benefits of each data block in the preloaded data list;
[0181] Cache module 205: Calculates the preloading task priority of each data block in the preloading data list based on loading cost, predicted benefits and system I / O resource status, and schedules disk cache data preloading tasks according to the preloading task priority.
[0182] The first building module 201 refers to the functional unit responsible for sensing the user's current interactive behavior at the system and application levels. It can be implemented using system hooks, message listening mechanisms, event buses, or specific API calls.
[0183] The second building block 202 refers to the functional unit responsible for collecting, storing, and analyzing the long-term file access history of users in the application. It can be implemented using file system filter drivers, logging services, database storage, or graph structure data management.
[0184] The generation module 203 refers to the functional unit that predicts users' potential data access needs based on users' real-time behavior and long-term historical habits and outputs a list of candidate data. It can be implemented using a rule engine, machine learning model, association analysis algorithm or prediction method based on graph traversal.
[0185] The evaluation module 204 refers to the functional unit that acquires the system resource usage in real time and quantifies the potential value and resource consumption of preloaded tasks. It can be implemented using system performance counters, resource monitoring APIs, mathematical models, or statistical analysis methods.
[0186] The cache module 205 refers to the functional unit that determines whether and how to execute the preloading operation based on the priority of the preloading task and the availability of system resources. It can be implemented using a priority queue, a task scheduler, a cache management interface, or an asynchronous I / O mechanism.
[0187] This system decomposes complex data preloading methods into multiple functional modules, enabling comprehensive perception, analysis, and intelligent scheduling of user behavior, historical patterns, and system resource status. Specifically, the first construction module 201 is responsible for acquiring user operation event information within the application window and system-level window focus switching information. By constructing a real-time operation context, the system can capture instantaneous, fine-grained changes in user behavior, providing immediate basis for subsequent predictions.
[0188] The second building module 202 is responsible for recording the user's file access sequence, access frequency, and file associations within the application. By learning from and analyzing this long-term historical data, a stable foundation is provided for predicting the user's future file accesses. Combined with real-time context, this can improve the accuracy and robustness of the predictions.
[0189] The generation module 203 generates a preloaded data list based on the real-time operation context constructed by the first construction module and the long-term historical behavior patterns constructed by the second construction module. This means that the preloaded candidate data is derived from a comprehensive judgment based on the user's current real-time behavior and their historical habits, which improves the relevance of the prediction and avoids the prediction bias caused by relying solely on historical patterns.
[0190] The evaluation module 204 monitors the system's I / O resource status in real time, acquiring key indicators such as CPU utilization and disk I / O queue length, and assessing the loading cost and predicted benefits of each data block in the preloaded data list. The loading cost considers the data block size and the current system I / O activity level, while the predicted benefits integrate the file's historical access frequency, relevance, and correlation with the current real-time operation. Through this detailed cost and benefit assessment, the system can quantify the potential value and system resource consumption of each preloaded task, providing a basis for subsequent intelligent scheduling.
[0191] The caching module 205 calculates the preloading task priority for each data block in the preloading data list based on the loading cost, predicted benefits, and real-time system I / O resource status calculated by the evaluation module. The priority comprehensively considers the potential benefits of preloading, execution cost, and the availability of current system I / O resources. Then, the disk cache data preloading tasks are scheduled according to the calculated priorities.
[0192] This inter-module collaboration and data flow enables the system to efficiently execute the entire preloading process and respond promptly to changes in user behavior and system status. This overcomes the inefficiency and slow response that may result from tightly coupling all functions together, allowing complex methods and steps to be effectively implemented and play their due role.
[0193] In this document, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, without necessarily requiring or implying any such actual relationship or order between these entities or operations.
[0194] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A method for preloading cached data on a computer hard drive, characterized in that, The method includes the following steps: S1: Obtain user operation event information within the application window and system-level window focus switching information to construct a real-time operation context; S2: Record the user's file access sequence, access frequency and file association in the application to build a long-term historical behavior pattern; Step S2 includes: S21: Monitor the user's file system operations in the application. When a file access event is detected, extract the application identifier and file path, record the access timestamp to form a file access record, and sort the file access record according to the access event timestamp to obtain a file access sequence. S22: Periodically scan the file access sequence and count the access frequency of each file access path; S23: Analyze the file access records with adjacent times in the file access sequence. If two files are accessed within a preset time window, then establish file association. S24: Construct a long-term historical behavior pattern based on the file access sequence, the access frequency, and the file association. The long-term historical behavior pattern is stored in a graph structure, where nodes represent files, edges represent file associations, and node weights represent access frequencies. Step S23 includes: S231: Calculate the time interval between every two adjacent file access records in the file access sequence, and construct a time interval sequence; S232: Based on the time interval sequence, an adaptive threshold segmentation algorithm is used to determine a preset time window; S233: Analyze the file access records with adjacent times in the file access sequence. If two files are accessed within the preset time window, file association is established. The file association calculation formula is: File association = α / (Time interval + β), where α is an adjustable parameter and β is a smoothing factor. The value of α ranges from 0.5 to 1.0, and the value of β ranges from 0.1 to 0.
5. S3: Generate a preloaded data list based on the real-time operation context and the long-term historical behavior pattern; S4: Monitor the system I / O resource status in real time and evaluate the loading cost and predicted benefits of each data block in the preloaded data list; Step S4 includes: S41: Monitor the system I / O resource status in real time, and obtain CPU utilization, hard disk I / O queue length, hard disk read speed, and the data block size of each data block in the preloaded data list; S42: Calculate the data block loading time based on the CPU utilization, the hard disk I / O queue length, the data block size, and the hard disk read speed, and convert it into loading cost; Loading cost = Data block size / Hard disk read speed * (1 + CPU utilization) * (1 + Hard disk I / O queue length / Preset queue length threshold); S43: Calculate the predicted revenue for each data block based on the file access frequency, file correlation, and path correlation between operation event information and file path in the real-time operation context in the preloaded data list; Predicted revenue = File access frequency * File correlation * Path correlation. S5: Calculate the preloading task priority of each data block in the preloaded data list based on the loading cost, the predicted revenue and the system I / O resource status, and schedule the disk cache data preloading task according to the preloading task priority.
2. The method for preloading computer hard disk cache data according to claim 1, characterized in that, Step S1 includes: S11: Monitor the user's mouse coordinates and key presses within the application window, extract click, hover, and drag events, and record event timestamps and window identifiers; S12: Parse the window identifier, obtain the process identifier and window class name of the application to which the window belongs, and construct the application window operation event sequence by combining the event timestamp; S13: Obtain the identifier of the focused window in the Windows system and the identifier of its process, and record the window focus switching timestamp; S14: Based on the window focus switching timestamp, compare the current focus window identifier with the previous focus window identifier. If there is a change, extract the process identifier and window class name of the application before and after the switch as the window focus switching information. S15: The application window operation event sequence and the window focus switching information are sorted and integrated according to their respective event timestamps and window focus switching timestamps to form a real-time operation context that includes user operation events and window focus switching.
3. A method for preloading computer hard disk cache data according to claim 2, characterized in that, Step S15 includes: S151: Based on the event timestamp and the window focus switching timestamp, construct a global timeline, and insert the application window operation event sequence and the window focus switching information into the global timeline in the order of timestamps to form a preliminary fused event stream; S152: For the initially fused event stream, if the time interval between adjacent events is less than a preset threshold, they are determined to be related events, and the related events are merged into a composite event; S153: Parse the composite event, extract the user's operation type, operation object, and target window for window focus switching within the application window, and convert them into a unified format event description to form the real-time operation context containing user operation events and window focus switching.
4. A method for preloading computer hard disk cache data according to claim 1, characterized in that, Step S3 includes: S31: Extract the real-time process identifier, real-time window class name, and user operation event information of the application in the real-time operation context; extract the file access sequence and file association of the long-term historical behavior pattern; S32: Based on the real-time process identifier and the real-time window class name, match the corresponding file access sequence, and filter the file paths associated with the operation event information from the file access sequence to form a candidate preload file list; S33: For each file path in the candidate preloaded file list, find the associated file path that has a file association with it, and add the associated file path whose file association is greater than a preset value to the candidate preloaded file list; S34: Deduplicate the file paths and associated file paths in the candidate preload file list, and sort them according to the file access frequency to generate a preload data list.
5. A method for preloading computer hard disk cache data according to claim 1, characterized in that, Step S5 includes: S51: Obtain the CPU utilization and hard disk I / O queue length based on the system I / O resource status, and calculate the system I / O busyness based on the CPU utilization and hard disk I / O queue length; S52: Calculate the preloading task priority based on the loading cost, the predicted revenue, and the system I / O busyness: Preloading task priority = (predicted revenue / loading cost) * (1 - system I / O busyness); S53: Schedule disk cache data preloading tasks according to the preloading task priority.
6. A method for preloading computer hard disk cache data according to claim 5, characterized in that, Step S53 includes: S531: Build a priority queue based on the priority of preloaded tasks; S532: Real-time monitoring of system I / O resource status. When the system I / O busyness is lower than the preset busyness threshold, the highest priority preloaded task is taken from the head of the priority queue and submitted to the disk cache management module for execution. S533: After the preloading is completed, the corresponding task is removed from the priority queue, and S532 is repeated until the priority queue is empty or the system I / O busyness exceeds the preset busyness threshold.
7. A computer hard disk cache data preloading system, characterized in that, The system, applied in the steps of the method according to any one of claims 1-6, comprises: The first building module: obtains user operation event information within the application window and system-level window focus switching information to construct a real-time operation context; The second building module records the user's file access sequence, access frequency, and file association in the application to build a long-term historical behavior pattern; The second building module is also used to monitor the user's file system operations in the application, and when a file access event is detected, extract the application identifier and file path, record the access timestamp to form a file access record, and sort the file access record according to the access event timestamp to obtain a file access sequence; The file access sequence is scanned periodically, and the access frequency of each file access path is counted. Analyze the file access records with adjacent times in the file access sequence. If two files are accessed within a preset time window, then establish a file association. Based on the file access sequence, the access frequency, and the file association, a long-term historical behavior pattern is constructed. The long-term historical behavior pattern is stored in a graph structure, where nodes represent files, edges represent file associations, and node weights represent access frequencies. The second building module is also used to calculate the time interval between every two adjacent file access records in the file access sequence, and to build a time interval sequence; Based on the time interval sequence, an adaptive threshold segmentation algorithm is used to determine a preset time window; Analyze the file access records with adjacent times in the file access sequence. If two files are accessed within the preset time window, file association is established. The file association calculation formula is: File association = α / (Time interval + β), where α is an adjustable parameter and β is a smoothing factor. The value of α ranges from 0.5 to 1.0, and the value of β ranges from 0.1 to 0.
5. Generation module: Generates a preloaded data list based on the real-time operation context and the long-term historical behavior pattern; Evaluation module: Real-time monitoring of system I / O resource status, and evaluation of the loading cost and predicted benefits of each data block in the preloaded data list; The evaluation module is also used to monitor the system I / O resource status in real time, and obtain CPU utilization, hard disk I / O queue length, hard disk read speed, and the data block size of each data block in the preloaded data list; Based on the CPU utilization, the hard disk I / O queue length, the data block size, and the hard disk read speed, the data block loading time is calculated and converted into loading cost; Loading cost = Data block size / Hard disk read speed * (1 + CPU utilization) * (1 + Hard disk I / O queue length / Preset queue length threshold); Based on the file access frequency, file correlation, and path correlation between operation event information and file path in the real-time operation context in the preloaded data list, the predicted revenue for each data block is calculated; Predicted revenue = File access frequency * File correlation * Path correlation. Cache module: Based on the loading cost, the predicted benefits and the system I / O resource status, calculate the preloading task priority of each data block in the preloading data list, and schedule disk cache data preloading tasks according to the preloading task priority.