IO scheduling method, computer program product, equipment and computer medium

By queuing and priority generation of IO, the problem of improper IO delay and priority scheduling in the prior art is solved, efficient IO scheduling is realized, the IO delay is reduced and the IO requests with high priority and high delay are preferred.

CN120406865AActive Publication Date: 2025-08-01JINAN INSPUR DATA TECH CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202510919987.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-04
Publication Date
2025-08-01
Estimated Expiration
2045-07-04

AI Technical Summary

Technical Problem

The existing IO scheduling algorithms are easily blocked by low-priority requests when processing high-priority IO requests, resulting in an increase in IO delay and cannot effectively distinguish the priority of different IO requests.

Method used

By queuing the to-be-processed IO, the first queue and the second queue are generated, the target priority is generated according to the IO waiting time and the initial priority, and the target priority is sorted and scheduled in the order from large to small, ensuring that the high latency and low priority IO is processed first.

Benefits of technology

Effectively reduce IO delay, take into account priority, improve IO processing performance, and ensure that IO requests with high priority and high delay are promptly responded.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120406865A_ABST
    Figure CN120406865A_ABST
Patent Text Reader

Abstract

The invention discloses an IO scheduling method, a computer program product, equipment and a computer medium, and relates to the technical field of storage. Performing queue division on the to-be-processed IO to obtain a first queue and a second queue; determining IO starting time and IO initial priority of the first queue; determining the IO waiting duration of the first queue according to the current time and the IO starting time of the first queue; generating an IO target priority of the first queue according to the positive correlation between the target priority and the IO waiting duration and the negative correlation between the target priority and the IO initial priority; performing IO sorting on the first queue according to a sequence of IO target priorities from large to small to obtain a third queue; iO scheduling is carried out according to the sequence of the third queue and the second queue. The method has the beneficial effects that the IO with large time delay and low initial priority is preferentially scheduled by means of the IO target priority, the priority is considered while the IO time delay is reduced, and the IO processing performance is better.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of storage technology, and more specifically, to an IO scheduling method, a computer program product, a device, and a computer medium. Background Art

[0002] In a storage system, an IO (Input / Output) scheduling algorithm has an impact on the performance and efficiency of the system. IO scheduling algorithms are mainly divided into two categories: the First Come First Service (FCFS) algorithm and the Priority Scheduling algorithm. However, these algorithms have some limitations in practical applications. For example, the FCFS algorithm cannot distinguish the priorities of different IO requests, which may cause high-priority IO requests to be delayed. The Priority Scheduling algorithm can schedule according to the priorities of IO requests, but in practical applications, there may be a problem of priority inversion, that is, high-priority IO requests are blocked by low-priority IO requests.

[0003] In summary, how to reduce IO latency is an urgent problem to be solved by those skilled in the art at present. Summary of the Invention

[0004] The object of the present invention is to provide an IO scheduling method, which can, to a certain extent, solve the technical problem of how to reduce IO latency. The present invention also provides an IO scheduling method, a computer program product, an electronic device, and a computer-readable storage medium.

[0005] To achieve the above object, the present invention provides the following technical solutions: In a first aspect, there is provided an IO scheduling method, including: Obtaining the IO to be processed; Dividing the IO to be processed into queues to obtain a first queue and a second queue; Determining the IO start time and the initial IO priority of the first queue; Determining the IO waiting duration of the first queue according to the current time and the IO start time of the first queue; Generating the target IO priority of the first queue according to the relationship that the target priority is positively correlated with the IO waiting duration and negatively correlated with the initial IO priority; Sorting the first queue in descending order of the IO target priority to obtain a third queue; Performing IO scheduling in the order of the third queue first and then the second queue.

[0006] On the other hand, dividing the IO to be processed into queues to obtain a first queue and a second queue includes: Determine the partitioning granularity for the IO receiving objects; According to the partitioning granularity, determine the target receiving object for receiving the to-be-processed IO; Using the target receiving object as the queue partitioning granularity, partition the to-be-processed IO to obtain a first queue and a second queue.

[0007] On the other hand, using the target receiving object as the queue partitioning granularity, partitioning the to-be-processed IO to obtain a first queue and a second queue includes: Among the to-be-processed IOs, partition the n IOs with the earliest start time corresponding to the target receiving object into the first queue, where n is a positive integer equal to or greater than 1; Among the to-be-processed IOs, partition the other IOs corresponding to the target receiving object except those in the first queue into the second queue.

[0008] On the other hand, using the target receiving object as the queue partitioning granularity, partitioning the to-be-processed IO to obtain a first queue and a second queue includes: Among the to-be-processed IOs, determine the IO set corresponding to each target receiving object; Generate the average latency of the IOs in the IO set; Sort the IO sets in descending order of the average latency to obtain an IO set sorting result; Use the first half of the IO sets in the IO set sorting result as the first queue; Use the second half of the IO sets in the IO set sorting result as the second queue.

[0009] On the other hand, using the target receiving object as the queue partitioning granularity, partitioning the to-be-processed IO to obtain a first queue and a second queue includes: Among the to-be-processed IOs, determine the IO set corresponding to each target receiving object; Generate the average latency of the IOs in the IO set; Sort the IO sets in descending order of the average latency to obtain an IO set sorting result; Use the first half of the IO sets in the IO set sorting result as the first candidate set; Use the second half of the IO sets in the IO set sorting result as the second candidate set; Partition the earliest h IOs in the first candidate set and the earliest k IOs in the second candidate set into the first queue, where k is a positive integer greater than or equal to 1 and h is a positive integer greater than k; Among the IO set sorting results, partition the other IOs except those in the first queue into the second queue.

[0010] On the other hand, get pending IO, including: Check whether the target queue is empty. The target queue is used to store the currently running IO; In response to the target queue being empty, obtaining the submission queue consisting of the latest submitted IOs; Add the IO in the submission queue to the target queue in descending order of IO initial priority; Process the IO in the target queue. After the processing is completed, the remaining IO in the target queue is treated as pending IO.

[0011] On the other hand, get pending IO, including: Check whether the target queue is empty. The target queue is used to store the currently running IO; In response to the existence of IO in the target queue, obtain the submission queue consisting of the latest submitted IO; Add the IO in the submission queue to the tail of the target queue in descending order of IO initial priority; Traverse the submission queue to get the first candidate IO; Get the second candidate IO remaining after processing the IO in the target queue in the historical record; The first candidate IO and the second candidate IO are merged to obtain an IO to be processed.

[0012] On the other hand, after the IO scheduling is performed in the order of the third queue first and the second queue, it also includes: Check whether IO scheduling is completed; In response to continuing the IO scheduling, the process returns to the step of obtaining the submission queue consisting of the latest submitted IO and subsequent steps.

[0013] On the other hand, the IO waiting time of the first queue is determined based on the current time and the IO start time of the first queue, including: Generate the difference between the current time and the IO start time of the first queue; quantizing the difference to obtain a first quantization result; The first quantization result is used as the IO waiting time of the first queue.

[0014] On the other hand, according to the relationship that the target priority is positively correlated with the IO waiting time and negatively correlated with the IO initial priority, the IO target priority of the first queue is generated, including: quantizing the initial IO priority of the first queue to obtain a second quantization result; Generate the I / O target priority of the first queue according to the relationship that the target priority is positively correlated with the I / O waiting duration and negatively correlated with the second quantization result.

[0015] On the other hand, generating the I / O target priority of the first queue according to the relationship that the target priority is positively correlated with the I / O waiting duration and negatively correlated with the second quantization result includes: Generate the I / O target priority of the first queue according to the relationship that the target priority is positively correlated with the I / O waiting duration and negatively correlated with the second quantization result according to the target priority generation formula; The target priority generation formula includes: P = a * T / p + b; Wherein, P represents the I / O target priority of the first queue; T represents the I / O waiting duration; p represents the second quantization result; a and b both represent compensation coefficients.

[0016] On the other hand, perform I / O scheduling in the order of the third queue first and then the second queue, including: Place the second queue after the I / O of the third queue to obtain the latest target queue, and the target queue is used to store the currently running I / O; Perform I / O scheduling according to the target queue.

[0017] In a second aspect, a computer program product is provided, including a computer program / instructions, and when the computer program / instructions are executed by a processor, the steps of the I / O scheduling method described above are implemented.

[0018] In a third aspect, an electronic device is provided, including: A memory for storing a computer program; A processor for implementing the steps of the I / O scheduling method described above when executing the computer program.

[0019] In a fourth aspect, a computer-readable storage medium is provided, in which a computer program is stored, and when the computer program is executed by a processor, the steps of the I / O scheduling method described above are implemented.

[0020] An I / O scheduling method provided by the present invention obtains the I / O to be processed; divides the I / O to be processed into queues to obtain a first queue and a second queue; determines the I / O start time and the initial I / O priority of the first queue; determines the I / O waiting duration of the first queue according to the current time and the I / O start time of the first queue; generates the target I / O priority of the first queue according to the relationship that the target priority is positively correlated with the I / O waiting duration and negatively correlated with the initial I / O priority; sorts the I / O of the first queue in descending order of the target I / O priority to obtain a third queue; and performs I / O scheduling in the order of the third queue first and the second queue second. The beneficial effects of the present invention are as follows: First, the I / O to be processed is divided into a first queue and a second queue, realizing a preliminary division of the I / O to be processed by means of queues, and subsequently, the I / O of the corresponding queue can be flexibly processed according to requirements; and the I / O waiting duration can be generated according to the current time and the I / O start time of the first queue, realizing the quantification of the I / O delay. Then, according to the relationship that the target priority is positively correlated with the I / O waiting duration and negatively correlated with the initial I / O priority, the target I / O priority of the first queue is generated. In this way, the larger the target I / O priority, the greater the I / O delay and the smaller the initial priority. Finally, if the I / O of the first queue is sorted in descending order of the target I / O priority to obtain a third queue and the I / O scheduling is performed in the order of the third queue first and the second queue second, the I / O with a large delay and a low initial priority can be scheduled first, taking into account the priority while reducing the I / O delay, and the I / O processing performance is better. A computer program product, an electronic device, and a computer-readable storage medium provided by the present invention also solve the corresponding technical problems. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained according to the provided drawings without creative efforts.

[0022] Figure 1 It is a flowchart of an I / O scheduling method provided by an embodiment of the present invention; Figure 2 It is a flowchart for storing I / O scheduling; Figure 3 It is a schematic diagram for initial I / O scheduling; Figure 4 It is a schematic diagram for multiple I / O scheduling; Figure 5 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention; Figure 6Another structural schematic diagram of an electronic device provided by an embodiment of the present invention. Detailed implementation manners

[0023] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0024] Please refer to Figure 1 , Figure 1 A flowchart of an IO scheduling method provided by an embodiment of the present invention.

[0025] An IO scheduling method provided by an embodiment of the present invention may include the following steps: Step S101: Obtain the IO to be processed.

[0026] In practical applications, the IO currently required to be processed can be obtained according to the application scenario as the IO to be processed. The IO to be processed can be the IO currently newly received that needs to be processed or the IO that has not been processed completely before, etc. The present invention does not make specific limitations here.

[0027] In an exemplary embodiment, during the process of obtaining the IO to be processed, if it is the first time to perform IO processing, there is no IO that has not been processed completely before. At this time, the IO to be processed can be determined only according to the IO currently newly received that needs to be processed, that is, it can be detected whether the target queue is empty. The target queue is used to store the currently running IO. In response to the target queue being empty, obtain the submission queue composed of the latest submitted IO. Add the IO in the submission queue to the target queue in the order from the highest to the lowest initial priority of the IO, that is, in the order from the smallest to the largest value of the initial priority of the IO. Process the IO in the target queue. After the processing is completed, use the remaining IO in the target queue as the IO to be processed.

[0028] In an exemplary embodiment, during the process of obtaining the I / O to be processed, if I / O processing has been performed before, there are I / Os that were not completely processed before and newly received I / Os. Therefore, it is necessary to determine the I / O to be processed comprehensively based on the currently newly received I / O to be processed and the I / Os that were not completely processed before. That is, it is possible to detect whether the target queue is empty. The target queue is used to store the currently running I / Os. In response to the existence of I / Os in the target queue, obtain the submission queue composed of the latest submitted I / Os. Add the I / Os in the submission queue to the end of the target queue in the order of the initial I / O priority from high to low. Traverse the submission queue to obtain the first candidate I / Os. Obtain the second candidate I / Os remaining after processing the I / Os in the target queue recorded in the history. Merge the first candidate I / Os and the second candidate I / Os to obtain the I / O to be processed.

[0029] In an exemplary embodiment, after performing I / O scheduling in the order of the third queue first and then the second queue, if I / O scheduling continues, it is also possible to detect whether to end I / O scheduling. In response to continuing I / O scheduling, return to execute the steps of obtaining the submission queue composed of the latest submitted I / Os and subsequent steps to comprehensively determine the I / O to be processed based on the currently newly received I / O to be processed and the I / Os that were not completely processed before for I / O scheduling.

[0030] Step S102: Divide the I / O to be processed into a first queue and a second queue.

[0031] In practical applications, after obtaining the I / O to be processed that is currently required, the I / O to be processed can be divided into a first queue and a second queue first, so as to subsequently process the I / Os using the first queue and the second queue.

[0032] In an exemplary embodiment, during the process of dividing the I / O to be processed into a first queue and a second queue, the queue division can be performed according to the I / O processing requirements. For example, the queue division can be performed according to the recipients of the I / O to be processed. That is, the division granularity of the I / O recipients can be determined. This division granularity is used to determine the division unit of the I / O recipients. For example, if the division granularity is a block in storage, then the I / O recipients are individual blocks. Correspondingly, if the division granularity is a page in storage, then the I / O recipients are individual pages. According to the division granularity, determine the target recipients that receive the I / O to be processed. Use the target recipients as the queue division granularity to divide the I / O to be processed into a first queue and a second queue.

[0033] In an exemplary embodiment, when dividing the to-be-processed IOs into a first queue and a second queue with the target receiving object as the queue division granularity, among the to-be-processed IOs, the n IOs with the earliest start time corresponding to the target receiving object can be divided into the first queue, where n is a positive integer equal to or greater than 1; among the to-be-processed IOs, the other IOs corresponding to the target receiving object except those in the first queue can be divided into the second queue. Since the IOs with the earliest start time represent the IOs with the highest latency, this embodiment is equivalent to dividing the n IOs with the highest latency in each target receiving object into the first queue and the remaining IOs into the second queue. In this way, the IOs with the highest latency in each target receiving object can be preferentially processed, avoiding the situation of long-term accumulation of IOs in a single target receiving object and ensuring the stability of IO processing.

[0034] In an exemplary embodiment, when dividing the to-be-processed IOs into a first queue and a second queue with the target receiving object as the queue division granularity, it is possible to divide all the IOs in a single target receiving object with the target receiving object as the granularity, that is, among the to-be-processed IOs, determine the IO set corresponding to each target receiving object; generate the average latency of the IOs in the IO set; sort the IO set in descending order of the average latency to obtain the sorted result of the IO set; use the first half of the IO set in the sorted result of the IO set as the first queue; use the second half of the IO set in the sorted result of the IO set as the second queue. In this way, if the average latency of the IO set corresponding to a single target receiving object is higher, the position of the IO set of this target receiving object in the sorted result of the IO set is more forward and is more likely to be divided into the first queue for preferential processing. Thus, all the IOs in the target receiving object with the highest average latency can be preferentially processed, avoiding the continuous decline of the IO processing progress of this target receiving object due to the long-term accumulation of all the IOs in a single target receiving object. In other words, the target receiving object with long-term accumulation of IOs can be cleaned up in time to ensure that the target receiving object can continuously and stably process IOs.

[0035] In an exemplary embodiment, the queue division granularity is used to divide the IO to be processed into queues. In the process of obtaining the first queue and the second queue, the queue division can be performed based on the single IO delay and the overall IO delay in the target receiving object. That is, the IO set corresponding to each target receiving object can be determined in the IO to be processed; the average delay of the IO in the IO set is generated; the IO sets are sorted in descending order according to the average delay to obtain the IO set sorting result; the IO sets in the first half of the IO set sorting result are used as the first candidate set; the IO sets in the second half of the IO set sorting result are used as the second candidate set; the h IOs with the earliest start time in the first candidate set and the k IOs with the earliest start time in the second candidate set are divided into the first queue, k is a positive integer greater than or equal to 1, and h is a positive integer greater than k, for example, if k is 1, then h is 2, and so on; in the IO set sorting result, other IOs except the first queue are divided into the second queue. In this way, the first candidate set is the IO in the target receiving object with higher average latency in the IO set sorting result, and the second candidate set is the IO in the target receiving object with lower average latency in the IO set sorting result. Subsequently, if the h IOs with the earliest start time in the first candidate set and the k IOs with the earliest start time in the second candidate set are divided into the first queue, since k is a positive integer greater than or equal to 1 and h is a positive integer greater than k, more IOs with higher IO latency will be placed in the first queue for priority processing. In this way, the IO with the highest latency in each target receiving object will be prioritized, and the target receiving object with higher overall latency will have more IOs prioritized. On the basis of reducing the IO latency of a single target receiving object, the target receiving object with higher latency can be restored more quickly, the IO latency between target receiving objects can be unified, and the stability of IO processing between target receiving objects can be guaranteed.

[0036] Step S103: Determine the IO start time and IO initial priority of the first queue.

[0037] Step S104: Determine the IO waiting time of the first queue according to the current time and the IO start time of the first queue.

[0038] Step S105: Generate the IO target priority of the first queue according to the relationship that the target priority is positively correlated with the IO waiting time and negatively correlated with the IO initial priority.

[0039] Step S106: sorting the IOs of the first queue in descending order of IO target priority to obtain a third queue.

[0040] Step S107: IO scheduling is performed in the order of the third queue first and the second queue second.

[0041] In practical applications, after the queues for I / O to be processed are divided into the first and second queues, the I / O scheduling can be determined based on the first and second queues to reduce I / O latency. In this process, the I / O start time and initial I / O priority of the first queue can be determined first. The I / O start time refers to the time when I / O starts to be processed. The I / O start time can be flexibly determined based on the application scenario, and the smaller the value of the initial I / O priority, the higher the initial I / O priority. Secondly, the I / O waiting time of the first queue is determined based on the current time and the I / O start time of the first queue. The I / O waiting time is used to represent the I / O latency, so that the I / O waiting time, or I / O waiting latency, can be incorporated into the I / O scheduling process in the future. Furthermore, based on the relationship that the target priority is positively correlated with the IO wait time and negatively correlated with the IO initial priority, the IO target priority of the first queue is generated. In this way, the longer the IO wait time and the smaller the IO initial priority, the higher the IO target priority. Then, the IOs of the first queue are sorted in descending order according to the IO target priority. If a third queue is obtained, the IO with a larger IO target priority is positioned closer in the third queue and is more likely to be processed first, thereby achieving positive sorting of IO with the help of IO latency and IO initial priority. Finally, if IO scheduling is performed in the order of the third queue first and then the second queue, IO with a larger IO latency and a higher IO initial priority can be scheduled first.

[0042] In an exemplary embodiment, in the process of determining the IO waiting time of the first queue based on the current time and the IO start time of the first queue, the difference between the current time and the IO start time of the first queue can be generated; the difference is quantized to obtain a first quantization result, and this quantization is equivalent to converting the difference into a result that can represent the priority. For example, the increase in the IO delay after the priority increases by one level can be determined, and then the difference is quantized according to this increase to obtain a first quantization result, etc.; the first quantization result is used as the IO waiting time of the first queue. In other words, the first quantization result needs to be applied to characterize the IO waiting time so that the first quantization result can be subsequently applied to perform IO scheduling.

[0043] In an exemplary embodiment, based on the relationship that the target priority is positively correlated with the IO waiting time and negatively correlated with the IO initial priority, in the process of generating the IO target priority of the first queue, the IO initial priority of the first queue also needs to be quantified to obtain a second quantization result, so as to determine the IO target priority in conjunction with the first quantization result; that is, the IO target priority of the first queue needs to be generated based on the target priority and the IO waiting time, that is, based on the relationship that the target priority is positively correlated with the first quantization result and negatively correlated with the second quantization result.

[0044] In an exemplary embodiment, in the process of generating the I / O target priority of the first queue according to the relationship that the target priority is positively correlated with the I / O waiting duration and negatively correlated with the second quantization result, the I / O target priority of the first queue can be generated according to the target priority generation formula based on the relationship that the target priority is positively correlated with the I / O waiting duration and negatively correlated with the second quantization result; the target priority generation formula includes: P = a * T / p + b; where P represents the I / O target priority of the first queue; T represents the I / O waiting duration; p represents the second quantization result; a and b both represent compensation coefficients. In a specific application scenario, the values of a and b can be flexibly determined according to actual needs. For example, a can be 1 and b can be 0. In this case, the target priority generation formula is P = T / p.

[0045] In an exemplary embodiment, in the process of performing I / O scheduling in the order of the third queue first and then the second queue, the I / O of the second queue can be placed after the I / O of the third queue to obtain the latest target queue, and the target queue is used to store the currently running I / O; perform I / O scheduling according to the target queue to perform organized scheduling of I / O by means of the target queue.

[0046] An I / O scheduling method provided by the present invention includes: obtaining the I / O to be processed; performing queue division on the I / O to be processed to obtain a first queue and a second queue; determining the I / O start time and the I / O initial priority of the first queue; determining the I / O waiting duration of the first queue according to the current time and the I / O start time of the first queue; generating the I / O target priority of the first queue according to the relationship that the target priority is positively correlated with the I / O waiting duration and negatively correlated with the I / O initial priority; performing I / O sorting on the first queue in descending order of the I / O target priority to obtain a third queue; performing I / O scheduling in the order of the third queue first and then the second queue. The beneficial effects of the present invention are as follows: First, the I / O to be processed is divided into a first queue and a second queue, realizing the preliminary division of the I / O to be processed by means of the queue, and subsequently, the I / O of the corresponding queue can be flexibly processed according to requirements; and the I / O waiting duration can be generated according to the current time and the I / O start time of the first queue, realizing the quantification of the I / O delay. Then, according to the relationship that the target priority is positively correlated with the I / O waiting duration and negatively correlated with the I / O initial priority, the I / O target priority of the first queue is generated. In this way, the larger the I / O target priority, the larger the I / O delay and the smaller the initial priority. Finally, if the first queue is sorted in descending order of the I / O target priority to obtain a third queue and the I / O scheduling is performed in the order of the third queue first and then the second queue, the I / O with a large delay and a low initial priority can be scheduled first, taking into account the priority while reducing the I / O delay, and the I / O processing performance is better.

[0047] To facilitate the understanding of the I / O scheduling solution provided by the present invention, the I / O scheduling process will now be described in conjunction with the blocks in the storage. The corresponding I / O scheduling process can be as follows Figure 2 as shown, including the following processes: For the business virtual machines in the upper layer of the storage, according to the services running on the virtual machines, the virtual machines are classified into levels. Taking high, medium, and low three priorities as an example, and using the numbers 1, 2, and 3 to mark the three levels respectively; Set two I / O queues. The target queue listcur stores the currently running I / O, and the submission queue listnew stores the I / O submitted from the upper layer to the storage engine in this round; When processing the first round of I / O, the listcur queue is empty. The data in the listnew queue is divided into three queues pri1, pri2, and pri3 according to the priorities respectively, and the start time timestart of each I / O is recorded. pri1, pri2, and pri3 represent the I / O queues with priority levels 1, 2, and 3 respectively; Add pri1, pri2, and pri3 to listcur in turn, as Figure 3 shown, Figure 3 In the figure, IO1, IO2, and IO3 represent three example I / O operations. Traverse listcur, submit the I / O to the disk, and record the information of the unfinished I / O, including the target storage block denoted as blockcur, the position of the I / O in the current listcur, the start time timestart of the I / O, and the priority priority, and obtain the listinfo for recording the I / O information; For the second round and subsequent I / O, add listnew to the end of listcur, traverse listnew, record the target storage block, the position of the I / O in listcur, the start time of the I / O, and the priority, and put the information into listinfo; Traverse listinfo. For example, pick out the first I / O of blockcur and put it into the first queue listfirst in turn, and place the remaining I / O into the second queue listend in turn; Calculate the quantized waiting time timewait of the I / O in listfirst according to timestart and the current time timenow; Take the ratio of timewait to the initial priority priority to obtain the parameter representing the I / O priority in listfirst, that is, obtain the target priority timepri, that is, timepri = (timenow - timestart) / priority; Rearrange the I / Os in listfirst according to timepri from largest to smallest to obtain the third queue list1first, and place the I / Os in listend after the rearranged queue to obtain the new listcur, as Figure 4 shown; Traverse and process the I / Os in listcur. After this round, repeat the steps of adding listnew to the end of listcur and later for the I / Os in the second round and subsequent rounds.

[0048] The present invention also provides an electronic device, a computer-readable storage medium, and a computer program product, all of which have the corresponding effects of an I / O scheduling method provided by an embodiment of the present invention. Please refer to Figure 5 , Figure 5 which is a schematic structural diagram of an electronic device provided by an embodiment of the present invention.

[0049] An electronic device provided by an embodiment of the present invention includes a memory 201 and a processor 202. A computer program is stored in the memory 201. When the processor 202 executes the computer program, the steps of the I / O scheduling method described in any of the above embodiments are implemented.

[0050] Please refer to Figure 6 , another electronic device provided by an embodiment of the present invention may further include: an input port 203 connected to the processor 202 for transmitting externally input commands to the processor 202; a display unit 204 connected to the processor 202 for displaying the processing result of the processor 202 to the outside; a communication module 205 connected to the processor 202 for realizing communication between the electronic device and the outside. The display unit 204 may be a display panel, a laser scanning display, etc.; the communication methods adopted by the communication module 205 include but are not limited to Mobile High-Definition Link (MHL), Universal Serial Bus (USB), High-Definition Multimedia Interface (HDMI), wireless connections: Wireless Fidelity (WiFi), Bluetooth communication technology, low-power Bluetooth communication technology, and communication technology based on IEEE802.11s.

[0051] A computer-readable storage medium provided by an embodiment of the present invention stores a computer program. When the computer program is executed by a processor, the steps of the I / O scheduling method described in any of the above embodiments are implemented.

[0052] The computer-readable storage medium involved in the present invention includes random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROM (Compact Disc Read-Only Memory), or any other form of storage medium known in the technical field.

[0053] A computer program product provided by an embodiment of the present invention includes a computer program / instructions. When the computer program / instructions are executed by a processor, the following steps are implemented: Obtain the IO to be processed; Perform queue division on the IO to be processed to obtain a first queue and a second queue; Determine the IO start time and the initial IO priority of the first queue; Determine the IO waiting duration of the first queue according to the current time and the IO start time of the first queue; Generate the target IO priority of the first queue according to the relationship that the target priority is positively correlated with the IO waiting duration and negatively correlated with the initial IO priority; Sort the first queue in descending order of the IO target priority to obtain a third queue; Perform IO scheduling in the order of the third queue first and then the second queue.

[0054] A computer program product provided by an embodiment of the present invention can guide a processor to obtain an IO to be processed; divide the IO to be processed into queues to obtain a first queue and a second queue; determine the IO start time and the initial IO priority of the first queue; determine the IO waiting duration of the first queue according to the current time and the IO start time of the first queue; generate the target IO priority of the first queue according to the relationship that the target priority is positively correlated with the IO waiting duration and negatively correlated with the initial IO priority; sort the IO of the first queue in descending order of the target IO priority to obtain a third queue; perform IO scheduling in the order of the third queue first and then the second queue. The beneficial effects of the present invention are as follows: With the help of the computer program / instructions in the computer program product, the processor first divides the IO to be processed into a first queue and a second queue, realizing the preliminary division of the IO to be processed with the help of queues, and then the IO of the corresponding queue can be flexibly processed according to requirements; and the IO waiting duration can be generated according to the current time and the IO start time of the first queue, realizing the quantification of the IO delay. Then, according to the relationship that the target priority is positively correlated with the IO waiting duration and negatively correlated with the initial IO priority, the target IO priority of the first queue is generated. In this way, the greater the target IO priority, the greater the IO delay and the smaller the initial priority. Finally, if the IO of the first queue is sorted in descending order of the target IO priority to obtain a third queue and the IO scheduling is performed in the order of the third queue first and then the second queue, the IO with a large delay and a low initial priority can be scheduled first, taking into account the priority while reducing the IO delay, and the IO processing performance is better.

[0055] For the descriptions of relevant parts in a computer program product, an electronic device, and a computer-readable storage medium provided by an embodiment of the present invention, please refer to the corresponding detailed descriptions in an IO scheduling method provided by an embodiment of the present invention, which will not be elaborated here. In addition, for the parts in the above technical solutions provided by the embodiments of the present invention that are consistent with the implementation principles of the corresponding technical solutions in the prior art, no detailed descriptions are given to avoid excessive elaboration.

[0056] It should also be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising one..." does not exclude the existence of additional identical elements in the process, method, article or device comprising the element.

[0057] The foregoing description of the disclosed embodiments enables those skilled in the art to practice or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. An I / O scheduling method, characterized in that, Including: Obtain the to-be-processed IO; Perform queue partitioning on the to-be-processed IO to obtain a first queue and a second queue; Determine the IO start time and the initial IO priority of the first queue; Determine the IO waiting duration of the first queue according to the current time and the IO start time of the first queue; Generate the target IO priority of the first queue according to the relationship that the target priority is positively correlated with the IO waiting duration and negatively correlated with the initial IO priority; Sort the IO in the first queue in descending order according to the target IO priority to obtain a third queue; Perform IO scheduling in the order of the third queue first and then the second queue.

2. The IO scheduling method according to claim 1, wherein Performing queue partitioning on the to-be-processed IO to obtain a first queue and a second queue includes: Determine the partitioning granularity of the IO receiving object; Determine the target receiving object for receiving the to-be-processed IO according to the partitioning granularity; Perform queue partitioning on the to-be-processed IO with the target receiving object as the queue partitioning granularity to obtain a first queue and a second queue.

3. The IO scheduling method according to claim 2, characterized in that, Performing queue partitioning on the to-be-processed IO with the target receiving object as the queue partitioning granularity to obtain a first queue and a second queue includes: Among the to-be-processed IO, partition the n IOs with the earliest start time corresponding to the target receiving object into the first queue, where n is a positive integer equal to or greater than 1; Among the to-be-processed IO, partition the other IOs corresponding to the target receiving object except the first queue into the second queue.

4. The IO scheduling method according to claim 2, wherein Performing queue partitioning on the to-be-processed IO with the target receiving object as the queue partitioning granularity to obtain a first queue and a second queue includes: Among the to-be-processed IO, determine the IO set corresponding to each target receiving object; Generate the average delay of the IOs in the IO set; Sort the IO set in descending order according to the average delay to obtain the IO set sorting result; Use the first half of the IO sets in the IO set sorting result as the first queue; Use the second half of the IO sets in the IO set sorting result as the second queue.

5. The IO scheduling method according to claim 2, wherein, Performing queue partitioning on the to-be-processed IO with the target receiving object as the queue partitioning granularity to obtain a first queue and a second queue includes: Among the to-be-processed IO, determine the IO set corresponding to each target receiving object; Generate the average delay of the IOs in the IO set; Sort the IO set in descending order according to the average delay to obtain the IO set sorting result; Use the first half of the IO sets in the IO set sorting result as the first candidate set; Use the second half of the IO sets in the IO set sorting result as the second candidate set; Partition the earliest h IOs in the first candidate set and the earliest k IOs in the second candidate set into the first queue, where k is a positive integer greater than or equal to 1, and h is a positive integer greater than k; Among the IO set sorting result, partition the other IOs except the first queue into the second queue.

6. The IO scheduling method according to claim 1, wherein Obtaining the to-be-processed IO includes: Detect whether the target queue is empty, and the target queue is used to store the currently running IOs; In response to the target queue being empty, obtain the submission queue composed of the latest submitted IOs; Add the I / Os in the submission queue to the target queue in descending order of the initial I / O priority; Process the I / Os in the target queue. After the processing is completed, regard the remaining I / Os in the target queue as the to-be-processed I / Os.

7. The IO scheduling method according to claim 1, wherein Obtain the to-be-processed I / Os, including: Detect whether the target queue is empty. The target queue is used to store the currently running I / Os; In response to the existence of I / Os in the target queue, obtain the submission queue composed of the latest submitted I / Os; Add the I / Os in the submission queue to the tail of the target queue in descending order of the initial I / O priority; Traverse the submission queue to obtain the first candidate I / Os; Obtain the second candidate I / Os remaining after processing the I / Os in the target queue in the historical record; Merge the first candidate I / Os and the second candidate I / Os to obtain the to-be-processed I / Os.

8. The IO scheduling method according to claim 7, wherein After performing I / O scheduling in the order of the third queue first and then the second queue, further include: Detect whether to end the I / O scheduling; In response to continuing the I / O scheduling, return to execute the steps of obtaining the submission queue composed of the latest submitted I / Os and subsequent steps.

9. The I / O scheduling method according to any one of claims 1 to 8, characterized in that Determine the I / O waiting duration of the first queue according to the current time and the I / O start time of the first queue, including: Generate the difference between the current time and the I / O start time of the first queue; Quantify the difference to obtain the first quantization result; Use the first quantization result as the I / O waiting duration of the first queue.

10. The I / O scheduling method according to claim 9, wherein Generate the I / O target priority of the first queue according to the relationship that the target priority is positively correlated with the I / O waiting duration and negatively correlated with the initial I / O priority, including: Quantify the initial I / O priority of the first queue to obtain the second quantization result; Generate the I / O target priority of the first queue according to the relationship that the target priority is positively correlated with the I / O waiting duration and negatively correlated with the second quantization result.

11. The I / O scheduling method according to claim 10, wherein, Generate the I / O target priority of the first queue according to the relationship that the target priority is positively correlated with the I / O waiting duration and negatively correlated with the second quantization result, including: According to the target priority generation formula, generate the I / O target priority of the first queue according to the relationship that the target priority is positively correlated with the I / O waiting duration and negatively correlated with the second quantization result; The target priority generation formula includes: P = a * T / p + b; Wherein, P represents the I / O target priority of the first queue; T represents the I / O waiting duration; p represents the second quantization result; a and b both represent compensation coefficients.

12. The IO scheduling method according to claim 1, wherein Perform I / O scheduling in the order of the third queue first and then the second queue, including: Place the second queue after the I / Os of the third queue to obtain the latest target queue. The target queue is used to store the currently running I / Os; Perform I / O scheduling according to the target queue.

13. A computer program product, comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, the steps of the I / O scheduling method according to any one of claims 1 to 12 are implemented.

14. An electronic device, characterized in that, Include: A memory for storing a computer program; A processor for implementing the steps of the I / O scheduling method according to any one of claims 1 to 12 when executing the computer program.

15. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the I / O scheduling method according to any one of claims 1 to 12 are implemented.

Citation Information

Patent Citations

  • IO scheduling method and apparatus

    CN105549910A

  • Task scheduling method and device, electronic equipment and computer readable storage medium

    CN110837410A

  • Task scheduling processing method and device, electronic equipment and storage medium

    CN111813554A

  • Resource scheduling method, device and device, and storage medium

    CN112181645A

  • Task processing method and system based on multistage queues

    CN114860395A