Mobile hard disk data transmission dynamic bandwidth allocation method based on USB4 protocol
Through fine-grained semantic feature analysis and dynamic bandwidth allocation methods, the problem of insufficient granularity of task classification and incomplete dependencies in USB4 mobile hard disks is solved, and bandwidth utilization and task throughput performance are improved.
Patent Information
- Application Number
- CN202510516138.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-23
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2045-04-23
AI Technical Summary
The existing USB4 mobile hard disk bandwidth allocation technology has insufficient task classification granularity, incomplete dependency modeling, and lack of prediction model dimensions, resulting in real-time task delay fluctuations, reduced throughput of high-reliability tasks and low overall bandwidth utilization.
By analyzing the fine-grained semantic features of mobile hard disk transmission tasks, generating semantic vectors, building a data transmission task dependency graph, calculating key path weights, and using long and short-term memory networks to predict bandwidth requirements, using dynamic channel priority allocation and cache-aware scheduling to achieve dynamic bandwidth allocation.
It improves the overall bandwidth utilization rate, solves the problems of task delay fluctuations and throughput declines, and realizes efficient allocation of bandwidth resources.
Smart Images

Figure CN120263757A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of bandwidth allocation, and particularly to a method for dynamically allocating bandwidth for mobile hard disk data transmission based on the USB4 protocol. Background Art
[0002] With the commercialization of the USB4 protocol, its bandwidth allocation mechanism based on a dual-channel architecture (Isochronous and Bulk) provides a theoretical maximum throughput capacity of 80 Gbps for peripheral data transmission. Currently, mainstream mobile hard disks generally adopt a static bandwidth allocation strategy based on task priorities, where the USB4 controller preferentially allocates Isochronous channel bandwidth for real-time streaming media tasks and allocates the Bulk channel for bulk data transmission.
[0003] There have been several research results in the academic community in the field of dynamic bandwidth allocation, such as an elastic bandwidth adjustment algorithm based on traffic prediction, a multi-objective optimization model combined with QoS level division, etc. However, the above-mentioned USB4 mobile hard disk bandwidth allocation technologies have problems such as insufficient task classification granularity, incomplete dependency relationship modeling, and missing dimensions in the prediction model, resulting in latency fluctuations in real-time tasks, throughput degradation in highly reliable tasks, and low overall bandwidth utilization. Summary of the Invention
[0004] In view of the above existing problems, the present invention is proposed.
[0005] Therefore, the present invention provides a method for dynamically allocating bandwidth for mobile hard disk data transmission based on the USB4 protocol to solve the problem of low overall bandwidth utilization.
[0006] To solve the above technical problems, the present invention provides the following technical solutions:
[0007] In a first aspect, the present invention provides a method for dynamically allocating bandwidth for mobile hard disk data transmission based on the USB4 protocol, which includes:
[0008] Analyze the transmission tasks of the mobile hard disk, obtain the fine-grained semantic features of the data transmission tasks, and generate semantic vectors. The fine-grained semantic features include the file type and transmission purpose of the transmission tasks;
[0009] Based on the semantic vectors of the data transmission tasks, construct a data transmission task dependency graph of the mobile hard disk and calculate the critical path weights of each data transmission task;
[0010] Based on the critical path weights and semantic vectors, combined with the real-time status information of the mobile hard disk and the historical data transmission task status information, use a long short-term memory network to predict the bandwidth requirements;
[0011] By obtaining the available bandwidth and channel occupancy rate of the USB4 protocol, dynamic channel priority allocation and cache-aware scheduling are adopted to dynamically allocate the bandwidth for the mobile hard disk data transfer task.
[0012] As a preferred solution of the mobile hard disk data transfer dynamic bandwidth allocation method based on the USB4 protocol described in the present invention, wherein: the generating of the semantic vector is specifically as follows.
[0013] Classify the data transfer tasks according to the fine-grained semantic features of the data transfer tasks.
[0014] Based on the sequential read rate requirement of the mobile hard disk in the high-real-time task transfer scenario and combined with the Isochronous channel characteristics of the USB4 protocol, determine the real-time transfer rate threshold.
[0015] Calculate the ratio of the average transfer rate of the data transfer in the set recent period to the real-time transfer rate threshold as the real-time requirement index.
[0016] Based on the block size distribution of the mobile hard disk in the backup scenario and combined with the Bulk channel characteristics of the USB4 protocol, determine the typical block size of the high-reliability task and determine the typical block size threshold of the high-reliability task.
[0017] Calculate the ratio of the block size of the transferred file to the typical block size threshold of the high-reliability task as the reliability requirement index and as the real-time requirement index.
[0018] Calculate the semantic score of the data transfer task according to the real-time requirement index and the reliability requirement index.
[0019] Form a semantic vector with the semantic score, real-time requirement index and reliability requirement index of the data transfer task, and update it at a preset frequency.
[0020] As a preferred solution of the mobile hard disk data transfer dynamic bandwidth allocation method based on the USB4 protocol described in the present invention, wherein: the constructing of the data transfer task dependency graph of the mobile hard disk is specifically as follows.
[0021] Obtain the task information of the data transfer task.
[0022] The task information includes task identifier, timestamp, data flow direction, initial priority, cache occupancy rate and channel occupancy rate.
[0023] Check the data flow direction, confirm the explicit dependency relationship, and calculate the weight of the explicit dependency edge.
[0024] Based on the cache occupancy rate and channel occupancy rate, calculate the cache competition intensity and bandwidth competition intensity, identify the implicit dependency relationship, and calculate the weight of the implicit dependency edge.
[0025] Construct a task dependency graph with each data transfer task as a node and the dependency relationships between data transfer tasks as edges, and perform integrity verification.
[0026] As a preferred solution of the dynamic bandwidth allocation method for mobile hard disk data transfer based on the USB4 protocol according to the present invention, wherein: calculating the critical path weight of each data transfer task specifically includes the following steps.
[0027] Based on the task dependency graph, obtain the data volume, cache occupancy rate, and channel occupancy rate of each data transfer task, and calculate the comprehensive influence factor of each path of data transfer.
[0028] Compare the comprehensive influence factors of each path, and select the path with the largest comprehensive influence factor as the critical path.
[0029] Based on the critical path and the total data volume of data transfer tasks on the critical path, calculate the critical path weight.
[0030] By querying the USB4 controller data transfer task list, when a new task is detected to be added, reconstruct the task dependency graph, and re-identify the critical path and calculate the critical path weight.
[0031] As a preferred solution of the dynamic bandwidth allocation method for mobile hard disk data transfer based on the USB4 protocol according to the present invention, wherein: predicting the bandwidth demand specifically includes the following steps.
[0032] Initialize the lightweight long short-term memory network structure.
[0033] Define the loss function, and update and optimize the lightweight long short-term memory network parameters by minimizing the loss function using the Adam optimizer.
[0034] Collect historical data transfer task status information and actual bandwidth demand from the mobile hard disk log, standardize them, splice them into training time series vectors, and train the lightweight long short-term memory network structure.
[0035] Input the time series vector into the trained lightweight long short-term memory network to output the predicted bandwidth demand.
[0036] As a preferred solution of the dynamic bandwidth allocation method for mobile hard disk data transfer based on the USB4 protocol according to the present invention, wherein: dynamically allocating the bandwidth of mobile hard disk data transfer tasks specifically includes the following steps.
[0037] Set the channel priority allocation rule according to the semantic score and critical path weight of the data transfer task.
[0038] Comprehensively predict the bandwidth demand, data transmission task scheduling period, mobile hard disk performance, available bandwidth, and critical path weight, and calculate the initial allocated bandwidth;
[0039] Check if the current channel cache is overloaded and pause the data transmission tasks with low critical path weights, and update the available bandwidth;
[0040] Based on the updated available bandwidth, recalculate the allocated bandwidth.
[0041] As a preferred solution of the dynamic bandwidth allocation method for mobile hard disk data transmission based on the USB4 protocol described in the present invention, wherein: the steps of setting the channel priority allocation rule are as follows.
[0042] When the semantic score of a data transmission task is higher than the median of the semantic scores of all data transmission tasks, preferentially allocate the Isochronous channel;
[0043] When the critical path weight of a data transmission task is higher than the median of the critical path weights of all data transmission tasks, preferentially allocate the Bulk channel.
[0044] As a preferred solution of the dynamic bandwidth allocation method for mobile hard disk data transmission based on the USB4 protocol described in the present invention, wherein: the steps of updating the available bandwidth are as follows.
[0045] Based on queuing theory, capture the fixed critical point of cache overload and set the cache threshold;
[0046] Compare the cache occupancy rate of the current channel with the cache threshold. If the cache occupancy rate of the current channel is greater than the cache threshold, it is determined that the cache is overloaded; otherwise, it is determined that the cache is normal;
[0047] Calculate the median value of the critical path weights of all data transmission tasks in the channel. When the cache is overloaded, pause the data transmission tasks with critical path weights lower than the median value and release the bandwidth to the available bandwidth.
[0048] In a second aspect, the present invention provides a computer device, including a memory and a processor, where: the memory stores a computer program, and wherein: when the computer program is executed by the processor, it implements any step of the dynamic bandwidth allocation method for mobile hard disk data transmission based on the USB4 protocol described in the first aspect of the present invention.
[0049] In a third aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored, and wherein: when the computer program is executed by the processor, it implements any step of the dynamic bandwidth allocation method for mobile hard disk data transmission based on the USB4 protocol described in the first aspect of the present invention.
[0050] The beneficial effects of the present invention are as follows: The present invention parses metadata through SCSI commands and classifies task types to achieve precise matching of task type-channel characteristics. By constructing a task dependency graph with explicit / implicit dependencies and dynamically calculating the critical path weights, it solves the logical dependencies between indexing tasks and transmission tasks, as well as the resource competition bottleneck problem during multi-task concurrency. The bandwidth secondary allocation mechanism based on dynamic priority rules improves the overall bandwidth utilization rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0052] Figure 1 It is a flowchart of a dynamic bandwidth allocation method for mobile hard disk data transmission based on the USB4 protocol.
[0053] Figure 2 It is a flowchart of generating semantic vectors.
[0054] Figure 3 It is a flowchart of constructing a data transmission task dependency graph for a mobile hard disk.
[0055] Figure 4 It is a flowchart of dynamically allocating the bandwidth for mobile hard disk data transmission tasks. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0056] To make the above objects, features, and advantages of the present invention more obvious and understandable, the following will provide a detailed description of the specific embodiments of the present invention in conjunction with the accompanying drawings of the specification.
[0057] Many specific details are set forth in the following description in order to fully understand the present invention. However, the present invention can also be implemented in other ways different from those described herein. Those skilled in the art can make similar extensions without departing from the connotation of the present invention. Therefore, the present invention is not limited by the specific embodiments disclosed below.
[0058] Secondly, the so-called "one embodiment" or "embodiment" herein refers to a specific feature, structure, or characteristic that can be included in at least one implementation manner of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it an individual or selectively exclusive embodiment with other embodiments.
[0059] Refer to Figures 1 to 4, which is an embodiment of the present invention. This embodiment provides a method for dynamically allocating bandwidth for mobile hard disk data transmission based on the USB4 protocol, including the following steps:
[0060] S1. Analyze the transmission tasks of the mobile hard disk, obtain the fine-grained semantic features of the data transmission tasks, and generate semantic vectors. The fine-grained semantic features include the file type and transmission purpose of the transmission tasks.
[0061] Parse the metadata of the mobile hard disk transmission tasks through the SCSI command of the USB4 protocol, and extract the file type and transmission purpose;
[0062] Specifically, send a standard SCSI command to the mobile hard disk to obtain the file extension (such as ".mp4", etc.) to determine the file type. At the same time, use the SCSI MODE SENSE command to obtain the host transmission instruction, such as "play" or "backup", to determine the transmission purpose;
[0063] According to the file type and transmission purpose, classify the tasks into high-real-time tasks (for example, files such as ".mp4" and ".mkv" for video or audio playback), high-reliability tasks (for example, files such as ".bak" and ".sql" for data backup), and ordinary tasks (for example, files such as ".txt" and ".zip" for daily copying);
[0064] Among them, the classification basis is that high-real-time tasks require low-latency transmission to avoid playback stuttering, high-reliability tasks require high throughput and error-free transmission to ensure data integrity, and ordinary tasks have no strict performance requirements to save bandwidth.
[0065] Calculate the real-time requirement index of the transmission task, and the value range is [0, 1]. For high-real-time tasks, the real-time requirement index takes the value of 1, indicating that a low-latency channel is required to be prioritized. For ordinary files, the real-time requirement index takes the value of 0, indicating no real-time requirement. For other situations, obtain the average transmission rate in the set recent period through the SCSI READ CAPACITY command, and calculate the real-time requirement index. The calculation formula is as follows:
[0066]
[0067] Among them, I1 is the real-time requirement index, R1 is the average transmission rate in the set recent period, and R2 is the real-time transmission rate threshold;
[0068] It should be noted that based on the sequential read rate requirements of the external hard drive in high-real-time task transfer scenarios and combined with the characteristics of the Isochronous channel of the USB4 protocol, the real-time transfer rate threshold is determined. Specifically, in the application scenario of the external hard drive, high-real-time tasks are mainly video stream playback or real-time editing (such as 1080p or 4K videos), which require low latency (<5ms) and stable bandwidth. The sequential read rate of the video stream depends on the video coding standard (such as H.264 / H.265) and resolution. The Isochronous channel of the USB4 protocol is designed for real-time data transfer, and the allocated bandwidth needs to match the video stream rate to avoid buffer overflow or playback stuttering, reflecting the minimum rate requirements of real-time tasks and being higher than non-real-time tasks. By analyzing the sequential read rate distribution of the external hard drive in the video stream scenario (such as 10 - 25MB / s for 1080p and 30 - 60MB / s for 4K), the median of the rate range is selected as the real-time transfer rate threshold to balance the requirements of high and low resolutions and be higher than the random access rate of ordinary file copying (usually <30MB / s), thus accurately distinguishing real-time tasks;
[0069] Calculate the reliability requirement index of the transfer task, and the value range is [0, 1]. For high-reliability tasks, the reliability requirement index takes the value of 1, and for ordinary files, the reliability index takes the value of 0. For other cases, use the SCSI READCAPACITY command to obtain the block size of the transferred file and calculate the reliability requirement index. The calculation formula is as follows:
[0070]
[0071] Where, I2 is the reliability requirement index, B1 is the block size of the transferred file, and B2 is the typical block size threshold for high-reliability tasks;
[0072] It should be noted that based on the block size distribution of the external hard drive in the backup scenario and combined with the characteristics of the Bulk channel of the USB4 protocol, the typical block size for high-reliability tasks is determined. Specifically, high-reliability tasks require high throughput (>100MB / s) and low error rate (<0.01%), so large-block data transfer is used to reduce the addressing overhead and improve efficiency to cover most high-reliability task transfer tasks. The Bulk channel of the USB4 protocol is designed for high-throughput large-block data, and the block size directly affects the transfer efficiency (large blocks reduce interrupts). By analyzing the block size distribution of data transfer tasks (such as 1 - 4MB for system backup and 512KB - 8MB for database backup), the lower limit of the block size range is selected as the typical block size threshold for high-reliability tasks;
[0073] According to the real-time requirement index and the reliability requirement index, calculate the semantic score of the transfer task. The calculation formula is as follows:
[0074] A = ω1I1 + ω2I2;
[0075] Wherein, A is the semantic score of the transmission task, ω1 is the real-time weight, and its value range is [0.4, 0.6], ω2 is the reliability weight, [0.2, 0.4];
[0076] The semantic score, real-time requirement index, and reliability requirement index of the transmission task are combined to form a semantic vector, and the semantic vector is updated by the USB4 controller at a preset frequency.
[0077] S2. Based on the semantic vector of the data transmission task, construct a data transmission task dependency graph of the external hard drive, and calculate the critical path weight of each data transmission task.
[0078] Query the data transmission task list through the USB4 controller, including high-real-time tasks, high-reliability tasks, ordinary tasks, and index generation tasks, and obtain the task information of the data transmission task, including task identifier, timestamp, data flow direction, initial priority, cache occupancy rate, and channel occupancy rate (read the Isochronous or Bulk channel occupancy rate through the USB4 controller);
[0079] Among them, the index generation task is a pre-task for high-real-time tasks, high-reliability tasks, and ordinary tasks. It refers to the file index task generated by the external hard drive before data transmission, providing data organization support for subsequent transmission, and is recognized by the USB4 controller and added to the task queue;
[0080] Specifically, the host initiates a data transmission task through SCSI commands (such as WRITE, MODE SELECT), and submits an index generation task to the USB4 controller according to the transmission purpose of the data transmission task. The USB4 controller parses the SCSI command, recognizes the index generation requirement, creates an index generation task, adds it to the task queue, and assigns a task identifier, timestamp, data flow direction, initial priority, cache occupancy rate, and channel occupancy rate;
[0081] Taking each data transmission task as a node and the dependency relationship between data transmission tasks as an edge, construct a task dependency graph, where the dependency relationship includes explicit dependency relationships and implicit dependency relationships;
[0082] Specifically, traverse the data transmission task list, and compare the sequence of data transmission tasks according to the timestamps of each data transmission task in the transmission task list;
[0083] Check the data flow direction and confirm the explicit dependency relationship. Specifically, extract the timestamp and data flow direction field of each data transfer task from the data transfer task list, calculate the timestamp difference between the data transfer task and the index generation task, and verify whether the timestamp difference is less than the data transfer task scheduling period (USB4 frame interval). If it is less, it means the timestamp verification passes; otherwise, it means it fails. Then, conduct data flow direction matching verification, that is, check whether the data flow direction field of the data transfer task contains the task identifier of the index generation task. If it contains, it means the data flow direction matching verification passes; otherwise, it means it fails. When both the timestamp verification and the data flow direction matching are satisfied, generate the explicit dependency relationship, calculate the weight of the explicit dependency edge, and the calculation formula is as follows:
[0084]
[0085] Among them, ω3 is the weight of the explicit dependency edge, E1 is the data volume of the data transfer task, and E2 is the data volume of the index generation task corresponding to the data transfer task;
[0086] It should be noted that when a mobile hard disk (NTFS, exFAT) performs data transfer, it needs to first execute the index generation task (generate a directory structure, such as the MFT table), and subsequent data transfer tasks depend on its output, which is manifested as the data flow direction in the task queue. The USB4 controller manages the data transfer task list through SCSI commands (such as WRITE, READ), and the explicit dependency relationship between data transfer tasks is recorded through the logical block address (LBA) and data flow direction field (32-bit task identifier pair) of the command description block (CDB). For example, the index generation task generates an index file, and the CDB of the high-reliability task references the LBA of this index to form an explicit dependency relationship;
[0087] Based on the cache occupancy rate and channel occupancy rate, calculate the cache competition intensity and bandwidth competition intensity to identify the implicit dependency relationship. Specifically, read the cache occupancy rate and channel occupancy rate of each data transfer task from the USB4 controller, and calculate the cache competition intensity and bandwidth competition intensity between data transfer tasks. The calculation formulas are as follows:
[0088] S1 = C1 + C2 - 1;
[0089] S2 = max(0, D1 + D2 - 0.9);
[0090] Among them, S1 is the cache competition intensity, C1 and C2 are the cache occupancy rates of data transfer task 1 and data transfer task 2 respectively, S2 is the bandwidth competition intensity, and D1 and D2 are the channel occupancy rates of data transfer task 1 and data transfer task 2 respectively;
[0091] When S1 > 0 or S2 > 0, generate the implicit dependency relationship, calculate the weight of the implicit dependency edge, and the calculation formula is as follows:
[0092] ω4 = 0.62S1 + 0.38S2;
[0093] Among them, ω4 is the weight of the implicit dependency edge;
[0094] It should be noted that the "1" and "2" in data transfer task 1 and data transfer task 2 do not refer to order or other references, but only distinguish between two different data transfer tasks;
[0095] Furthermore, the USB4 controller manages the cache and bandwidth. Task competition for the cache and channels leads to performance bottlenecks. The external hard drive is limited by the cache and bandwidth. High-real-time tasks preferentially occupy the Isochronous channel, which may reduce the bandwidth of the Bulk channel for high-reliability tasks;
[0096] Store the explicit and implicit dependency edges as an adjacency list, complete the construction of the task dependency graph, and verify the integrity of the task dependency graph;
[0097] Specifically, perform a depth-first search on the task dependency graph to check for the existence of loops. Starting from each node, recursively traverse the explicit and implicit dependency edges, record the access path. If it is found that a certain node has been visited and is in the current path, it indicates a loop. When a loop is encountered, remove the implicit dependency edge with the lowest weight to obtain a directed acyclic task dependency graph;
[0098] Based on the task dependency graph, obtain the data volume, cache occupancy rate, and channel occupancy rate of each data transfer task, calculate the comprehensive impact factor of each path of data transfer, and select the path with the largest comprehensive impact factor as the critical path. The calculation formula is as follows:
[0099] i = ∑E i + 50∑C i + 40∑D i ;
[0100] Among them, I is the comprehensive impact factor, E i represents the data volume of the i-th data transfer task on the path, C i is the cache occupancy rate of the i-th data transfer task on the path, D i is the channel occupancy rate of the i-th data transfer task on the path, and i is the index variable of the number of data transfer tasks on the path;
[0101] Based on the critical path and the total data volume of the data transfer tasks on the critical path, calculate the critical path weight. The calculation formula is as follows:
[0102]
[0103] Among them, ω jis the critical path weight of the j-th data transfer task, P j is the initial priority of the j-th data transfer task, E j is the data volume of the j-th data transfer task, and ∑E represents the total data volume of data transfer tasks on the critical path of the j-th data transfer task, A j is the semantic score of the j-th data transfer task, C j is the cache occupancy rate of the j-th data transfer task on the critical path, D j is the channel occupancy rate of the j-th data transfer task on the critical path. α, β, and δ are the influence coefficients of semantic score, cache occupancy rate, and channel occupancy rate on bandwidth allocation, and their value ranges are [0.2, 0.4], [0.1, 0.3], and [0.1, 0.2] respectively;
[0104] Detect the addition of new tasks by querying the data transfer task list of the USB4 controller, reconstruct the task dependency graph, and re-identify the critical path and calculate the critical path weight;
[0105] Sort out the critical path weights of all data transfer tasks, store them as a floating-point array of critical path weights in the order of task identifiers, and output as the priority basis for bandwidth allocation.
[0106] S3. Based on the critical path weight and semantic vector, combined with the real-time status information of the external hard drive and the historical data transfer task status information, use the long short-term memory network to predict the bandwidth demand.
[0107] Query the data volume, critical path weight, and semantic vector of data transfer tasks within a preset period in the data transfer task list of the USB4 controller;
[0108] Read the real-time status information of the external hard drive within the same preset period. Among them, the external hard drive status information includes hard drive performance, cache occupancy rate, and channel occupancy rate;
[0109] Specifically, read the external hard drive performance through the SMART interface, in MB / s, indicating the current read and write speed of the external hard drive, and read the cache occupancy rate and channel occupancy rate through the cache management interface of the USB4 controller;
[0110] Normalize (normalize to [0, 1]) the data volume, critical path weight, semantic vector, and real-time status information of the data transfer tasks of the external hard drive within the preset period, and splice them into a time series vector as the input of the lightweight long short-term memory network;
[0111] Collect historical data transfer task status information (including historical mobile hard disk status information, data volume, critical path weight, and semantic vector of historical data transfer tasks) and actual bandwidth requirements from the mobile hard disk log, standardize them, and splice them into a training time series vector;
[0112] Initialize the lightweight long short-term memory network structure;
[0113] Specifically, configure a lightweight long short-term memory network, including 1 layer of recurrent neural network and 32 hidden units. The lightweight long short-term memory network parameters include a weight matrix and a bias vector;
[0114] Define a loss function. By minimizing the loss function, use the Adam optimizer to update and optimize the lightweight long short-term memory network parameters. The calculation formula is as follows:
[0115]
[0116] where L is the loss value of the lightweight long short-term memory network, N is the number of samples of the training time series vector, k is the index variable of the number of samples, and F′ k is the predicted bandwidth requirement of the k-th training time series vector, and F k is the actual bandwidth requirement of the k-th training time series vector;
[0117] Input the training time series vector into the lightweight long short-term memory network, perform forward propagation calculation, calculate the hidden state, and output the predicted bandwidth requirement. The calculation formula is as follows:
[0118] h t = tanh(W h [X k (t), h t-1 + b h );
[0119] F′ k = W o h t + b o ;
[0120] where h t is the hidden state at time step t, tanh represents the hyperbolic tangent activation function, W h is the weight matrix of the hidden state, b h is the bias vector of the hidden state, X k (t) is the k-th training time series vector of the input at time step t, h t-1 is the hidden state at time step t - 1, W o is the weight matrix of the output layer, and b o is the bias value of the output layer;
[0121] Check F' k within the range to ensure that F' k is within the maximum bandwidth range of the USB4 protocol. If it exceeds the range, it means that this F' k is incorrect and should be deleted; otherwise, it is retained.
[0122] When the lightweight long short-term memory network finishes training all training time series vectors, pause the training.
[0123] Input the time series vector, predict the bandwidth requirements, traverse all data transfer tasks, sort the predicted bandwidth requirements according to the task identifier, and generate an array of floating-point numbers for bandwidth requirements.
[0124] As data transfer progresses, regularly refresh the actual bandwidth requirements and the status of historical data transfer tasks, update and train the lightweight long short-term memory network, and generate a new array of floating-point numbers for bandwidth requirements.
[0125] S4. By obtaining the available bandwidth and channel occupancy rate of the USB4 protocol, and adopting dynamic channel priority allocation and cache-aware scheduling, dynamically allocate the bandwidth for the mobile hard disk data transfer task.
[0126] Through the bandwidth management interface of the USB4 controller, read the total bandwidth, access the USB4 controller register, query the total bandwidth occupancy of all current tasks, subtract the allocated bandwidth, and calculate the difference as the available bandwidth.
[0127] Set the channel priority allocation rules according to the semantic score and critical path weight.
[0128] Specifically, when the semantic score of a data transfer task is higher than the median of the semantic scores of all data transfer tasks, preferentially allocate the Isochronous channel. When the critical path weight of a data transfer task is higher than the median of the critical path weights of all data transfer tasks, preferentially allocate the Bulk channel.
[0129] Based on the comprehensive prediction of bandwidth requirements, data transfer task scheduling period, mobile hard disk performance, available bandwidth, and critical path weight, calculate the initial allocated bandwidth. The calculation formula is as follows:
[0130]
[0131] where H l is the initial allocated bandwidth for data transfer task l, γ is the weight of the predicted bandwidth requirement, with a value range of [0.5, 0.7], F' l is the predicted bandwidth requirement for data transfer task l, C l is the data volume of data transfer task l, T is the data transfer task scheduling period, G is the current mobile hard disk performance, and J is the current available bandwidth.
[0132] Through the USB4 controller cache management interface, query the cache status register and read the cache occupancy rate of the current channel (Isochronous channel or Bulk channel).
[0133] Check if the cache of the current channel is overloaded and pause the data transfer tasks with low critical path weights to release bandwidth and relieve cache pressure.
[0134] Specifically, based on queuing theory, capture the fixed critical point of cache overload, set the cache threshold, query the cache status register through the USB4 controller cache management interface, obtain the cache occupancy rate of the current channel (Bulk channel or Isochronous channel), compare the cache occupancy rate of the current channel with the cache threshold. If the cache occupancy rate of the current channel is greater than the cache threshold, it is determined that the cache is overloaded; otherwise, it is determined that the cache is normal.
[0135] Calculate the median value of the critical path weights of all data transfer tasks within the channel. When the cache is overloaded, pause the data transfer tasks with critical path weights lower than the median value, release the bandwidth to the available bandwidth, and complete the update of the available bandwidth.
[0136] Based on the updated available bandwidth, recalculate and allocate the bandwidth.
[0137] This embodiment also provides a computer device applicable to the case of the dynamic bandwidth allocation method for mobile hard disk data transmission based on the USB4 protocol, including: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the dynamic bandwidth allocation method for mobile hard disk data transmission based on the USB4 protocol as proposed in the above embodiment.
[0138] This computer device can be a terminal. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, a carrier network, NFC (Near Field Communication), or other technologies. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, a trackball, or a touchpad provided on the computer device housing, or an external keyboard, touchpad, or mouse, etc.
[0139] This embodiment also provides a storage medium, on which a computer program is stored. When the program is executed by a processor, it implements the method for dynamically allocating bandwidth for mobile hard disk data transmission based on the USB4 protocol as proposed in the above embodiment; the storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM for short), electrically erasable programmable read-only memory (EEPROM for short), erasable programmable read-only memory (EPROM for short), programmable read-only memory (PROM for short), read-only memory (ROM for short), magnetic memory, flash memory, magnetic disk or optical disc.
[0140] In summary, the present invention parses metadata through SCSI commands, classifies task types, and realizes the precise matching of task type-channel characteristics. By constructing a task dependency graph with explicit / implicit dependencies and dynamically calculating the critical path weights, it solves the logical dependencies between indexing tasks and transmission tasks, as well as the resource competition bottleneck problem during multi-task concurrency. The bandwidth secondary allocation mechanism based on dynamic priority rules improves the overall bandwidth utilization rate.
[0141] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention, and they should all be covered within the scope of the claims of the present invention.
Claims
1. A method for dynamically allocating bandwidth for mobile hard disk data transmission based on the USB4 protocol, characterized in that: including Analyze the transfer tasks of the external hard drive, obtain the fine-grained semantic features of the data transfer tasks, and generate semantic vectors. The fine-grained semantic features include the file type and transfer purpose of the transfer tasks; Based on the semantic vectors of the data transfer tasks, construct a data transfer task dependency graph for the external hard drive and calculate the critical path weights of each data transfer task; Based on the critical path weights and semantic vectors, combine the real-time status information of the external hard drive and the historical data transfer task status information, and use a long short-term memory network to predict the bandwidth requirements; By obtaining the available bandwidth and channel occupancy rate of the USB4 protocol, adopt dynamic channel priority allocation and cache-aware scheduling to dynamically allocate the bandwidth of the external hard drive data transfer tasks.
2. The dynamic bandwidth allocation method for mobile hard disk data transmission based on the USB4 protocol according to claim 1, wherein: The specific steps for generating the semantic vectors are as follows Classify the data transfer tasks according to the fine-grained semantic features of the data transfer tasks; Based on the sequential read rate requirements of the external hard drive in high-real-time task transfer scenarios, combined with the Isochronous channel characteristics of the USB4 protocol, determine the real-time transfer rate threshold; Calculate the ratio of the average transfer rate of data transfer within a set recent period to the real-time transfer rate threshold as the real-time requirement index; Based on the block size distribution of the external hard drive in the backup scenario, combined with the Bulk channel characteristics of the USB4 protocol, determine the typical block size of high-reliability tasks and the typical block size threshold of high-reliability tasks; Calculate the ratio of the block size of the transferred file to the typical block size threshold of high-reliability tasks as the reliability requirement index and as the real-time requirement index; Calculate the semantic score of the data transfer task according to the real-time requirement index and the reliability requirement index; Form a semantic vector with the semantic score, real-time requirement index, and reliability requirement index of the data transfer task, and update it at a preset frequency.
3. The dynamic bandwidth allocation method for mobile hard disk data transmission based on the USB4 protocol according to claim 1, wherein: The specific steps for constructing the data transfer task dependency graph of the external hard drive are as follows Obtain the task information of the data transfer tasks; The task information includes task identifier, timestamp, data flow direction, initial priority, cache occupancy rate, and channel occupancy rate; Check the data flow direction, confirm the explicit dependency relationship, and calculate the weight of the explicit dependency edge; Based on the cache occupancy rate and channel occupancy rate, calculate the cache competition intensity and bandwidth competition intensity, identify the implicit dependency relationship, and calculate the weight of the implicit dependency edge; Take each data transfer task as a node and the dependency relationship between data transfer tasks as an edge to construct a task dependency graph and perform integrity verification.
4. The dynamic bandwidth allocation method for mobile hard disk data transmission based on the USB4 protocol according to claim 1, wherein: The specific steps for calculating the critical path weight of each data transfer task are as follows Based on the task dependency graph, obtain the data volume, cache occupancy rate, and channel occupancy rate of each data transfer task, and calculate the comprehensive impact factor of each path of the data transfer; Compare the comprehensive impact factors of each path and select the path with the largest comprehensive impact factor as the critical path; Based on the critical path and the total data volume of the data transfer tasks on the critical path, calculate the critical path weight; By querying the USB4 controller data transfer task list, when a new task is detected to be added, reconstruct the task dependency graph, and re-identify the critical path and calculate the critical path weight.
5. The dynamic bandwidth allocation method for mobile hard disk data transmission based on the USB4 protocol according to claim 1, wherein: The prediction of bandwidth requirements is carried out as follows: Initialize the lightweight long short-term memory network structure; Define the loss function, and update and optimize the lightweight long short-term memory network parameters by minimizing the loss function using the Adam optimizer; Collect historical data transfer task status information and actual bandwidth requirements from the external hard drive log, standardize them, splice them into a training time series vector, and train the lightweight long short-term memory network structure; Input the time series vector into the trained lightweight long short-term memory network to output the predicted bandwidth requirement.
6. The dynamic bandwidth allocation method for mobile hard disk data transmission based on the USB4 protocol according to claim 1, wherein: The dynamic allocation of bandwidth for external hard drive data transfer tasks is carried out as follows: Set the channel priority allocation rule according to the semantic score and critical path weight of the data transfer task; Calculate the initial allocated bandwidth by comprehensively considering the predicted bandwidth requirement, data transfer task scheduling period, external hard drive performance, available bandwidth, and critical path weight; Check if the current channel cache is overloaded and pause the data transfer tasks with low critical path weights, and update the available bandwidth; Recalculate the allocated bandwidth based on the updated available bandwidth.
7. The method for dynamically allocating bandwidth for mobile hard disk data transmission based on the USB4 protocol according to claim 6, wherein: The setting of the channel priority allocation rule is carried out as follows: When the semantic score of the data transfer task is higher than the median of the semantic scores of all data transfer tasks, the Isochronous channel is preferentially allocated; When the critical path weight of the data transfer task is higher than the median of the critical path weights of all data transfer tasks, the Bulk channel is preferentially allocated.
8. The dynamic bandwidth allocation method for mobile hard disk data transmission based on the USB4 protocol according to claim 6, characterized in that: The update of the available bandwidth is carried out as follows: Based on queuing theory, capture the fixed critical point of cache overload and set the cache threshold; Compare the cache occupancy rate of the current channel with the cache threshold. If the cache occupancy rate of the current channel is greater than the cache threshold, it is determined that the cache is overloaded; otherwise, it is determined that the cache is normal; Calculate the median value of the critical path weights of all data transfer tasks in the channel. When the cache is overloaded, pause the data transfer tasks with critical path weights lower than the median value and release the bandwidth to the available bandwidth.
9. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that: When the processor executes the computer program, it implements the steps of the dynamic bandwidth allocation method for external hard drive data transfer according to any one of claims 1 to 8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements the steps of the dynamic bandwidth allocation method for external hard drive data transfer according to any one of claims 1 to 8.
Citation Information
Patent Citations
Bandwidth adjustment method and system based on service priority, and storage medium
CN118138925A
Distributed account book remote data synchronization method and system
CN119449829A
Video transmission method and system based on streaming processing
CN119562138A
Big data platform scheduling task and data collaborative smooth migration method and system
CN119576506A
Multi-task data analysis method and device and storage medium
CN119847752A