Scheduling method, apparatus and computer readable storage medium

By determining the device priority based on the target device of the operation request and scheduling it in conjunction with the hardware resource status, the problem of low-priority operations consuming resources is solved, thus improving the computer's processing efficiency.

CN122431849APending Publication Date: 2026-07-21BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING ZITIAO NETWORK TECH CO LTD
Filing Date
2025-01-20
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

In existing technologies, low-priority I/O operations consume a lot of resources, resulting in low computer processing efficiency.

Method used

The device priority is determined based on the target device of the operation request, and the decision on whether to issue the operation request is made in combination with the currently available idle hardware resources, so as to avoid low-priority operations consuming too many resources.

Benefits of technology

It improves scheduling efficiency, reduces the impact of low-priority operations on high-priority operations, and enhances the computer's processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122431849A_ABST
    Figure CN122431849A_ABST
Patent Text Reader

Abstract

The present disclosure relates to a scheduling method, device and computer readable storage medium, and relates to the technical field of computers. The scheduling method comprises: determining a device priority corresponding to a first operation request according to a target device of the first operation request; and determining whether to issue the first operation request to the target device for processing according to the device priority and currently idle hardware resources. The technical solution of the present disclosure can improve scheduling efficiency, thereby improving the processing efficiency of the computer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a scheduling method, scheduling device, computer-readable storage medium, and computer program product. Background Technology

[0002] Many current mobile devices use UFS (Universal Flash Storage) as their storage medium. In practice, a UFS ROM is often divided into multiple LUN (Logical Unit Number) identifiers for storage space. Each LUN can have different uses, such as system images, user data, or swap partitions.

[0003] In related technologies, different priorities are set for corresponding I / O (Input / Output) operations based on the different functions of the storage space identified by the LUN. For example, I / O operations that write user data have a higher priority than I / O operations that write the Log. Summary of the Invention

[0004] The inventors of this disclosure have discovered the following problems in the aforementioned related technologies: low-priority operations consume a large amount of resources, reduce scheduling efficiency, and result in low computer processing efficiency.

[0005] In view of this, this disclosure proposes a scheduling technology solution that can improve scheduling efficiency, thereby improving the processing efficiency of the computer.

[0006] According to some embodiments of this disclosure, a scheduling method is provided, including: determining the device priority corresponding to the first operation request based on the target device of the first operation request; and determining whether to send the first operation request to the target device for processing based on the device priority and the currently idle hardware resources.

[0007] In some embodiments, determining whether to send the first operation request to the target device for processing based on the device priority and the currently idle hardware resources includes: determining the hardware resources that need to be reserved corresponding to the device priority based on the device priority; and determining whether to send the first operation request to the target device for processing based on the hardware resources to be reserved and the currently idle hardware resources.

[0008] In some embodiments, determining whether to send a first operation request to a target device for processing based on the hardware resources to be reserved and the currently idle hardware resources includes: in response to the hardware resources to be reserved being less than the currently idle hardware resources, sending a first operation request to the target device for processing.

[0009] In some embodiments, determining whether to send a first operation request to a target device for processing, based on the hardware resources to be reserved and the currently idle hardware resources, includes: in response to the hardware resources to be reserved being no less than the currently idle hardware resources, controlling the first operation request to enter a waiting state until a preset condition is met, the preset condition including other operation requests being completed and / or the waiting time exceeding a threshold.

[0010] In some embodiments, determining whether to send the first operation request to the target device for processing based on the reserved hardware resources and the currently idle hardware resources includes: in response to a preset condition being met, re-determining whether to send the first operation request to the target device for processing based on the reserved hardware resources and the currently idle hardware resources.

[0011] In some embodiments, the device priority is a first device priority or a second device priority, where the first device priority is higher than the second device priority, and the hardware resources that need to be reserved corresponding to the second device priority are more than the hardware resources that need to be reserved corresponding to the first device priority.

[0012] In some embodiments, the device priority is a first device priority, a second device priority, or a third device priority, wherein the third device priority is higher than the second device priority but lower than the first device priority. Determining the hardware resources that need to be reserved corresponding to the device priority based on the device priority includes: in response to the device priority being the third device priority, determining the hardware resources that need to be reserved corresponding to the third device priority based on whether there is an unprocessed second operation request, wherein the device priority corresponding to the second operation request is the first device priority.

[0013] In some embodiments, determining the hardware resources to be retained corresponding to the third device priority based on whether there is an unprocessed second operation request includes: in response to the absence of a second operation request, configuring the hardware resources to be retained corresponding to the third device priority to be equal to the hardware resources to be retained corresponding to the first device priority; and in response to the presence of a second operation request, configuring the hardware resources to be retained corresponding to the third device priority to be less than the hardware resources to be retained corresponding to the first device priority, but more than the hardware resources to be retained corresponding to the second device priority.

[0014] In some embodiments, the hardware resources that need to be reserved include the number of hardware channels that need to be reserved, and the current idle hardware resource status includes the number of currently idle hardware channels.

[0015] In some embodiments, determining whether to send a first operation request to a target device for processing based on device priority and currently idle hardware resources includes: in response to determining that the first operation request should be sent to the target device for processing, sending the first operation request to a work queue corresponding to the device priority, wherein different device priorities correspond to different work queues; and processing the first operation request through the target device according to the processing order in the corresponding work queue.

[0016] In some embodiments, the scheduling method further includes: selecting a first operation request from a plurality of operation requests for processing according to the operation priority, wherein the operation priority is determined based on operation type information and / or context information of the operation initiator.

[0017] In some embodiments, device priority is determined based on the current application scenario.

[0018] According to some other embodiments of this disclosure, a scheduling apparatus is provided, comprising: a determining unit, configured to determine a device priority corresponding to a first operation request based on a target device of the first operation request; and a processing unit, configured to determine whether to send the first operation request to the target device for processing based on the device priority and currently idle hardware resources.

[0019] In some embodiments, the processing unit determines the hardware resources that need to be reserved corresponding to the device priority based on the device priority; and determines whether to send the first operation request to the target device for processing based on the hardware resources to be reserved and the currently idle hardware resources.

[0020] In some embodiments, the processing unit sends a first operation request to the target device for processing in response to the fact that the hardware resources that need to be reserved are less than the currently idle hardware resources.

[0021] In some embodiments, in response to the requirement that the hardware resources to be reserved are not less than the currently idle hardware resources, the processing unit controls the first operation request to enter a waiting state until preset conditions are met, the preset conditions including other operation requests being completed and / or the waiting time exceeding a threshold.

[0022] In some embodiments, in response to the satisfaction of a preset condition, the processing unit re-determines whether to send the first operation request to the target device for processing based on the hardware resources that need to be reserved and the currently idle hardware resources.

[0023] In some embodiments, the device priority is a first device priority or a second device priority, where the first device priority is higher than the second device priority, and the hardware resources that need to be reserved corresponding to the second device priority are more than the hardware resources that need to be reserved corresponding to the first device priority.

[0024] In some embodiments, the device priority is a first device priority, a second device priority, or a third device priority, where the third device priority is higher than the second device priority but lower than the first device priority. In response to the device priority being the third device priority, the processing unit determines the hardware resources that need to be reserved corresponding to the third device priority based on whether there is an unprocessed second operation request. The device priority corresponding to the second operation request is the first device priority.

[0025] In some embodiments, in response to the absence of a second operation request, the processing unit configures the hardware resources to be retained corresponding to the third device priority to be equal to the hardware resources to be retained corresponding to the first device priority; in response to the presence of a second operation request, the processing unit configures the hardware resources to be retained corresponding to the third device priority to be less than the hardware resources to be retained corresponding to the first device priority, but more than the hardware resources to be retained corresponding to the second device priority.

[0026] In some embodiments, the hardware resources that need to be reserved include the number of hardware channels that need to be reserved, and the current idle hardware resource status includes the number of currently idle hardware channels.

[0027] In some embodiments, in response to determining that a first operation request will be sent to a target device for processing, the processing unit sends the first operation request to a work queue corresponding to the device priority, with different device priorities corresponding to different work queues; and processes the first operation request through the target device according to the processing order in the corresponding work queue.

[0028] In some embodiments, the processing unit selects a first operation request from multiple operation requests for processing based on the operation priority, wherein the operation priority is determined based on operation type information and / or context information of the operation initiator.

[0029] In some embodiments, device priority is determined based on the current application scenario.

[0030] According to further embodiments of this disclosure, a scheduling apparatus is provided, comprising: a memory; and a processor coupled to the memory, the processor being configured to execute the scheduling method of any of the above embodiments based on instructions stored in the memory device.

[0031] According to further embodiments of the present disclosure, a computer-readable storage medium is provided having computer instructions stored thereon that, when executed by a processor, implement the scheduling method of any of the above embodiments.

[0032] According to further embodiments of this disclosure, a computer program product is also provided, including instructions that, when executed by a processor, cause the processor to perform the scheduling method according to any of the foregoing embodiments.

[0033] In the above embodiments, the processing priority of the operation request is determined based on the target device of the operation request, and combined with the currently idle hardware resources, a large number of low-priority operations generated by low-priority services are prevented from consuming resources. This improves scheduling efficiency, thereby increasing the computer's processing efficiency.

[0034] Other features, aspects, and advantages of this disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description

[0035] Embodiments of this disclosure are described below with reference to the accompanying drawings. It should be understood that the drawings described below are merely illustrative of some embodiments of this disclosure and are not intended to limit the scope of this disclosure. In the drawings:

[0036] Figure 1 Flowcharts illustrating some embodiments of the scheduling method of this disclosure are provided.

[0037] Figure 2a , 2b Schematic diagrams illustrating some embodiments of the scheduling method of this disclosure;

[0038] Figure 3 Flowcharts illustrating other embodiments of the scheduling method of this disclosure are shown;

[0039] Figure 4 Block diagrams illustrating some embodiments of the scheduling apparatus of this disclosure;

[0040] Figure 5 Block diagrams illustrating other embodiments of the scheduling apparatus of this disclosure;

[0041] Figure 6 Block diagrams showing further embodiments of the scheduling apparatus of this disclosure are presented.

[0042] It should be understood that, for ease of description, the dimensions of the various parts shown in the accompanying drawings are not necessarily drawn to actual scale. The same or similar reference numerals are used in the various drawings to denote the same or similar parts. Therefore, once an item is defined in one drawing, it may not be discussed further in subsequent drawings. Detailed Implementation

[0043] The technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. It should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein.

[0044] It should be understood that the various steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect. Unless otherwise specifically stated, the relative arrangement, numerical expressions, and values ​​of components and steps set forth in these embodiments should be interpreted as merely exemplary and do not limit the scope of this disclosure.

[0045] As used in this disclosure, the term "comprising" and its variations are open-ended terms that include at least the following elements / features but do not exclude other elements / features, i.e., "including but not limited to". The term "based on" means "at least partially based on".

[0046] It should be noted that the concepts of "first," "second," etc., used in this disclosure are used only to distinguish different devices, modules, or units, and are not intended to define the order of functions performed by these devices, modules, or units or their interdependencies. Unless otherwise specified, the concepts of "first," "second," etc., are not intended to imply that the objects described herein must be in a given temporal, spatial, rank, or any other given order.

[0047] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0048] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0049] The embodiments of this disclosure are described in detail below with reference to the accompanying drawings; however, this disclosure is not limited to these specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. Furthermore, in one or more embodiments, specific features, structures, or characteristics can be combined in any suitable manner that will be apparent to those skilled in the art from this disclosure.

[0050] As mentioned earlier, a LUN is a unique identifier used to specify a single or group of physical or virtual storage devices that perform I / O operations with a host, as defined by the Small Computer System Interface (SMI) standard. A LUN can be used to identify a subset of data on a disk so that a computing device using that subset can perform operations. SCSI is an I / O interconnect that facilitates data exchange between servers and storage devices through transport protocols. Transport protocols can include Internet SCSI, FC (Fibre Channel), etc. The SCSI initiator in the host initiates a sequence of I / O commands and then transmits them to the target endpoint or receiving storage device. A logical unit is an entity within a SCSI target that responds to I / O commands (including I / O operations).

[0051] For example, in a UFS environment, a LUN is a number used to identify and access logical units within a storage device in storage architectures such as SAN (Storage Area Network) or DAS (Direct Attached Storage). The roles of a LUN in UFS can include the following:

[0052] Resource partitioning and isolation. LUNs allow a physical storage device (such as UFS flash memory) to be divided into multiple logical parts. For example, a high-capacity UFS chip can be divided into different LUNs to provide independent storage space for different users or applications. Each LUN identifies a storage space that can store different data, and these spaces are isolated from each other; different users can only access the data in their corresponding LUN, improving data security and management flexibility.

[0053] Flexible access control. The storage system can set different access permissions based on LUN. For example, for storage spaces identified by LUNs containing sensitive data, strict access control can be set, allowing only specific hosts or users to perform read and write operations; for storage spaces identified by LUNs containing public data, broader access permissions can be allowed.

[0054] Improve storage resource utilization. LUN partitioning allows storage administrators to allocate storage resources more granularly based on actual needs. For example, a small application might only require a small amount of storage space, so it can be allocated a smaller LUN; a large database application can be allocated a larger LUN. This avoids wasting storage space and improves the overall resource utilization of the UFS storage system.

[0055] As mentioned earlier, I / O operations include synchronous and asynchronous I / O operations. Synchronous I / O operations mean that when user space performs an I / O operation, it must wait for the kernel space to complete the I / O operation before continuing with subsequent operations. In other words, other operations can only continue after the kernel space provides the data needed by the user space. Synchronous I / O allows only one I / O operation at a time; file handles are serialized (e.g., atomically processed), meaning two threads cannot perform I / O operations on the same handle simultaneously. Asynchronous I / O means that user space sends an I / O operation request to the kernel to perform the I / O operation without waiting and continues executing its work immediately. Asynchronous I / O operations do not block the current thread, allowing other tasks to continue. When the I / O operation is complete, the kernel notifies user space through a callback function or similar method. Asynchronous I / O operations support multiple threads sending I / O operation requests simultaneously.

[0056] I / O scheduling is the process by which the operating system, when handling multiple I / O requests, uses specific algorithms and strategies to determine which I / O operation request to process first, thereby improving system performance and resource utilization efficiency. The main goal of I / O scheduling strategies is to reduce the waiting time of I / O operation requests and increase system throughput and response speed.

[0057] Each LUN is treated as an independent block device in the system, but from a hardware perspective, these LUNs all share hardware resources on a UFS. For example, UFS has a hardware queue to process commands. If the queue length is X, then X commands can be processed simultaneously. That is, all LUNs share the same hardware queue and can send a maximum of X commands at the same time.

[0058] For example, the priority of an I / O operation request can be determined based on the type of I / O operation and the context of the thread that sent the I / O operation request, which can be used for I / O scheduling.

[0059] However, in some situations, such as asynchronous I / O operations, the lack of thread context information causes all I / O requests to be scheduled with the same priority, making differentiation impossible. This results in low-priority I / O operations consuming a large amount of I / O resources (such as bandwidth), while high-priority I / O operations cannot obtain I / O resources in a timely manner, leading to I / O operation stuttering and reduced computer processing efficiency.

[0060] To address the aforementioned technical problems, the present disclosure introduces a scheduling method for operations, using the target device of the operation as the basis for setting the priority of I / O operation requests.

[0061] For example, for I / O operation requests targeting low-priority devices, the opportunity to be issued is only available when the current hardware queue is relatively idle, and the number of requests issued is also limited to ensure that the queue is not filled; I / O operation requests targeting high-priority devices do not have the above restrictions.

[0062] This reduces the impact of I / O operations on low-priority target devices on I / O operations on high-priority target devices, improves the response speed of I / O operation requests from high-priority target devices, reduces I / O operation latency for users during application use, thereby reducing I / O operation stuttering or frame dropping, and improving computer processing efficiency.

[0063] For example, the technical solution of this disclosure can be implemented through the following embodiments.

[0064] Figure 1 Flowcharts illustrating some embodiments of the scheduling method of this disclosure are shown.

[0065] like Figure 1 As shown, in step 110, the device priority corresponding to the first operation request is determined based on the target device of the first operation request. For example, the first operation request can be an I / O operation request, the target device can be a device identified by a LUN, and the device priority corresponding to the first operation request can be the device priority corresponding to the LUN of the target device; the target device can be the processing object of the first operation request, such as various storage devices, processing devices, etc.

[0066] In step 120, based on the device priority and the currently available hardware resources, it is determined whether to send the first operation request to the target device for processing. For example, the hardware resources can be the hardware queue in UFS used to process commands, and the currently available hardware resources can be the number of currently available hardware queues.

[0067] In the above embodiments, the processing priority of the operation request is determined based on the target device of the operation request, and combined with the currently idle hardware resources, a large number of low-priority operations generated by low-priority services are prevented from consuming resources. This improves scheduling efficiency, thereby increasing the computer's processing efficiency.

[0068] The following examples illustrate how to configure device priorities.

[0069] In some embodiments, device priority is determined based on the current application scenario. For example, the application scenario may include storing or retrieving system images, storing or retrieving user data, exchanging partitions, etc.; different application scenarios may correspond to different performance requirements (such as high or low requirements for real-time performance, high or low requirements for reliability, etc.), and the device priority of the target device of the first operation request can be configured according to the performance requirements corresponding to the application scenario of the first operation request.

[0070] For example, in the current application scenario of swap partitioning (such as memory swapping), the first operation request is to swap data to the swap partition, and the real-time requirement is low. In this case, the device priority of the target device of the first operation request can be set to a lower device priority (such as the second device priority mentioned below).

[0071] For example, a device priority configuration module can be configured for the system, which is used by the upper-layer system to configure the relevant device priorities according to the current application scenario; the device priority configuration module can be implemented through file nodes.

[0072] In the above embodiments, different device priorities are configured according to different application scenarios, so that device scheduling can adaptively meet different performance requirements, improve scheduling efficiency, and thus improve the processing efficiency of the computer.

[0073] The following examples illustrate how to determine currently available hardware resources.

[0074] In some embodiments, storage devices such as UFS and eMMC (Embedded Multi Media Card) support multi-hardware channel technology, meaning they can process multiple read and write commands simultaneously. The system's device driver layer can use tags to represent hardware channels, with one tag corresponding to one hardware channel in the storage device. When a hardware channel is occupied, the tag corresponding to that channel is set to occupied. By checking the number of currently occupied tags, the number of commands being processed (e.g., the number of commands processed by the storage device) can be obtained, thereby determining the amount of currently available hardware resources.

[0075] For example, a tag can correspond to a hardware channel of a storage device. During hardware initialization, the number of tags can be initialized based on the actual number of storage devices; for instance, to achieve parallel processing in software, the number of tags can be twice the number of hardware channels. During I / O request processing in the driver layer, the number of currently idle tags can be obtained. In response to the existence of idle tags, these tags are set to occupied status, and then a command (such as an I / O request) is sent to the storage device. After the storage device completes processing using the hardware channel corresponding to the aforementioned tag, it notifies the device driver layer via an interrupt, setting the aforementioned tag to idle status. In response to all tags being occupied, a blocking waiting state is entered until an idle tag becomes available.

[0076] For example, based on the device priority of the target device of the current I / O operation request and the number of currently idle tags, it can be determined whether to send the current I / O operation request to the UFS device related to the previous I / O operation request.

[0077] In the above embodiments, the processing priority of the operation request is determined based on the target device of the operation request, and combined with the currently idle hardware resources, a large number of low-priority operations generated by low-priority services are prevented from consuming resources. This improves scheduling efficiency, thereby increasing the computer's processing efficiency.

[0078] The following examples illustrate how to combine device priority and currently available hardware resources for scheduling.

[0079] In some embodiments, based on device priority, the hardware resources that need to be reserved corresponding to the device priority are determined; based on the hardware resources to be reserved and the currently idle hardware resources, it is determined whether to send the first operation request to the target device for processing. For example, the hardware resources to be reserved may be hardware resources that the system needs to reserve for other operation requests or other tasks; the hardware resources to be reserved include the number of hardware channels to be reserved, and the current idle hardware resources include the number of currently idle hardware channels.

[0080] In some embodiments, during the process of acquiring the idle state tag, the current I / O request can be prioritized based on the LUN of the target device. For example, scheduling can be based on the hardware resources that need to be reserved corresponding to the current device priority; the higher the device priority, the fewer hardware resources need to be reserved.

[0081] For example, if the number of hardware resources that need to be reserved is less than the number of currently idle hardware resources, the first operation request is sent to the target device for processing. This involves determining whether the number of currently idle tags is greater than the number of tags that need to be reserved; if it is greater, an idle tag is returned, and this tag is marked as occupied for processing the current I / O operation request; the current I / O operation request is then sent to the relevant hardware for processing, thus completing the I / O operation request dispatch and processing.

[0082] For example, in response to the requirement that the hardware resources to be reserved are not less than the currently idle hardware resources, the first operation request is controlled to enter a waiting state until a preset condition is met. The preset condition includes the completion of other operation requests and / or the waiting time exceeding a threshold. In response to the preset condition being met, based on the required reserved hardware resources and the currently idle hardware resources, it is re-determined whether to send the first operation request to the target device for processing. For example, it is determined whether the number of tags in the current idle state is greater than the number of tags to be reserved; in response to a lesser number, the current thread is controlled to enter an I / O wait state, and the CPU enters a wait state; in response to a new I / O operation request being completed or the waiting time exceeding a timeout, the above judgment steps are repeated.

[0083] In the above embodiments, the current operation request is processed differently based on the target device and device priority. This reduces the processing speed of operation requests from low-priority devices while reserving certain hardware resources (e.g., represented by the number of tags) for operation requests from high-priority devices. This ensures that operation requests from high-priority devices are processed promptly, improving the computer's processing efficiency.

[0084] The following examples illustrate, through examples, the configuration of hardware resources that need to be reserved for different device priorities.

[0085] In some embodiments, the device priority is a first device priority or a second device priority, where the first device priority is higher than the second device priority; the hardware resources that need to be reserved corresponding to the second device priority are more than the hardware resources that need to be reserved corresponding to the first device priority.

[0086] For example, if the first device priority is a high device priority, the corresponding number of tags to be retained is the first number (0 or a positive integer), such as 0, meaning no hardware resources need to be retained. The first number can also be other positive integers, such as an integer representing 1 / 5 of the total number of tags. In response to the current operation request corresponding to the first device priority, the number of high-priority operation requests being processed is incremented by 1; in response to the completion of the current operation request, the number of high-priority operation requests being processed is decremented by 1. This number serves as the scheduling basis for the third device priority to improve scheduling efficiency.

[0087] For example, if the second device has a lower device priority, the number of tags that need to be retained is a second number that is greater than the first number, such as an integer representing half of the total number of tags.

[0088] In this way, based on the target device of the current operation request, the request is processed differently according to device priority. This reduces the processing speed of operation requests from low-priority devices while reserving certain hardware resources for operation requests from high-priority devices. Consequently, it ensures that operation requests from high-priority devices are processed promptly, improving the computer's processing efficiency.

[0089] In some embodiments, the device priority is a first device priority, a second device priority, or a third device priority, where the third device priority is higher than the second device priority but lower than the first device priority. In response to a device priority being the third device priority, the hardware resources corresponding to the third device priority that need to be reserved are determined based on whether there are currently any unprocessed second operation requests. The device priority corresponding to the second operation request is the first device priority.

[0090] For example, in response to the absence of a second operation request, the hardware resources that need to be reserved corresponding to the third device priority are configured to be equal to the hardware resources that need to be reserved corresponding to the first device priority; in response to the presence of a second operation request, the hardware resources that need to be reserved corresponding to the third device priority are configured to be less than the hardware resources that need to be reserved corresponding to the first device priority, but more than the hardware resources that need to be reserved corresponding to the second device priority.

[0091] For example, if the second device priority is a medium device priority, in response to the current operation request corresponding to the medium device priority, it determines whether the current operation is an operation request corresponding to a high device priority that has not been processed (this can be determined based on the number of high priority operation requests being processed as maintained above). If no such operation request exists, the number of tags that need to be retained corresponding to the medium device priority is set to the first number (e.g., 0, the same as the high device priority). If a tag that needs to be retained corresponding to the medium device priority exists, the number of tags that need to be retained is set to the third number, where the third number is greater than the first number and less than the second number, such as an integer representing 1 / 3 of the total number of tags.

[0092] In this way, based on the target device of the current operation request, the currently processed high-priority operation requests, and the currently available hardware resources, the current operation requests are processed according to device priority. This reduces the processing speed of operation requests from low-priority devices while reserving certain hardware resources for operation requests from high-priority devices. Therefore, it ensures that operation requests from high-priority devices are processed promptly, improving the computer's processing efficiency.

[0093] For asynchronous I / O operation requests, the thread sending the request submits it to the operating system and returns immediately without waiting for the actual processing of the I / O operation. The actual submission of I / O operation requests to the I / O scheduler is done through a work queue (i.e., a type of kernel thread). I / O operation requests for different target devices are all submitted through the same work queue. If the work queue sending low-priority I / O operation requests is blocked, subsequent high-priority I / O operation requests to that work queue will also fail to be sent.

[0094] In view of the above, the following examples illustrate how to handle different types of operation requests.

[0095] In some embodiments, for operation requests of type synchronous I / O, each synchronous I / O operation sends an I / O operation request in a certain thread context and then waits for the I / O request to complete; it is possible to control the thread that sends the low device priority I / O operation request to enter a waiting state, so as to retain the tag for the processing thread of other high device priority I / O operation requests to continue running.

[0096] In some embodiments, for operation requests of type asynchronous I / O, multiple work queues can be introduced to correspond to operation requests with different device priorities, that is, different work queues are used to send operation requests with different device priorities. For example, three work queues can be configured for the first device priority, the second device priority, and the third device priority, namely, a high-priority work queue, a low-priority work queue, and a ZTO priority work queue.

[0097] For example, in response to determining that the first operation request will be sent to the target device for processing, the first operation request is sent to a work queue corresponding to the device priority, with different device priorities corresponding to different work queues; the first operation request is processed by the target device according to the processing order in the corresponding work queue.

[0098] In this way, even if the work queue for low-priority devices is blocked, it will not affect the execution of work queues for high- and medium-priority devices. This ensures that operation requests from higher-priority devices are processed promptly, improving the computer's processing efficiency.

[0099] The following examples illustrate how the current operation request is selected.

[0100] In some embodiments, a first operation request is selected from multiple operation requests for processing based on operation priority, wherein the operation priority is determined based on operation type information and / or context information of the operation initiator.

[0101] For example, the system can be configured with an I / O scheduling module to queue the BIOs issued by each task according to the type of BIO (I / O operation request) and the context information of the initiator, and send the queued BIOs to the device driver layer in the form of Request.

[0102] In the above embodiments, operation requests are processed sequentially based on both operation priority and device priority. This reduces the processing speed of operation requests from low-priority devices while reserving certain hardware resources for operation requests from high-priority devices. Consequently, this ensures that operation requests from high-priority devices are processed promptly, improving the computer's processing efficiency.

[0103] Figure 2a , 2b Schematic diagrams illustrating some embodiments of the scheduling method of this disclosure are shown.

[0104] like Figure 2a As shown, the publicly disclosed scheduling method can be implemented using the I / O stack in the diagram. The I / O stack may include VFS (Virtual File System), page cache, mapper layer, disk file system, block I / O layer, device-specific driver, and HW (hardware layer), where IRQ stands for interrupt request. For example, the block I / O layer and device-specific driver are used to execute the scheduling method in any of the above embodiments. For instance, the block I / O layer can be used for tag management, and the device-specific driver is used to execute the aforementioned scheduling method.

[0105] like Figure 2bAs shown, the system converts each task (Task A, Task B...Task N) into a BIO; the system can be configured with an I / O scheduling module (such as an I / O Elevator Scheduler) to queue the BIOs issued by each task according to the BIO type and the context information of the initiator, based on the operation priority; the queued BIOs are sent to the device driver layer in the form of a Request; the device driver layer uses a device priority management module (such as LUN priority resource management) to execute the scheduling method in any of the above embodiments, and according to the scheduling result, sends the I / O operation request to the hardware command queue of the UFS in the form of a UFS command; the UFS executes each I / O operation request according to the scheduling result, and the UFS may include multiple devices (LUN_0~LUN_X).

[0106] Figure 3 Flowcharts illustrating some other embodiments of the scheduling method of this disclosure are shown.

[0107] like Figure 3 As shown, in step 310, the target device for obtaining the I / O operation request is obtained.

[0108] In step 320, the device priority of the target device is determined. If the device priority is the first device priority (i.e., high device priority), step 330 is executed; if the device priority is the second device priority (i.e., low device priority), step 340 is executed; if the device priority is the third device priority (i.e., medium device priority), step 350 is executed.

[0109] In step 330, for high device priority, the number of tags to be retained is set to 0, that is, no tags are retained; the number of high-priority I / O operation requests being processed is incremented by 1 (and decremented by 1 after the I / O operation request is completed).

[0110] In step 340, for low device priority, the number of tags that need to be retained is set to 1 / 2 of the total number of tags.

[0111] In step 350, for medium device priority, first determine whether there are any unprocessed high device priority I / O operation requests (this can be obtained by checking if the number of high priority I / O operation requests being processed is 0); if not, set the number of tags to be retained to 0 (step 330); if they exist, set the number of tags to be retained to 1 / 3 of the total number of tags (step 360).

[0112] In step 370, it is determined whether the number of tags currently in an idle state is greater than the number of tags that need to be retained; if it is greater, step 380 is executed; if it is not greater, step 390 is executed.

[0113] In step 380, an idle tag is returned and marked as occupied; the I / O operation request is sent to the actual hardware for processing, and the I / O operation request dispatch and processing is completed.

[0114] In step 390, the current thread is controlled to enter the I / O wait state, and the CPU enters the waiting state; in response to a new I / O request to complete or the waiting time exceeds the threshold, step 370 is repeated.

[0115] In some embodiments, when the operation priority is determined based on the operation type and context information, a device priority is added during the process of issuing I / O operation requests to the hardware queue. The device priority of the I / O operation request is divided according to the target device of the I / O operation request. I / O operation requests with low device priority are subject to stricter restrictions, those with medium device priority are subject to more lenient restrictions, and those with high device priority are not restricted.

[0116] For example, if hardware resources are unavailable, the current thread enters an I / O wait state, meaning it suspends for a period of time before retrying. Low-priority I / O requests are processed when the number of idle resources in the current hardware queue exceeds a certain threshold (e.g., half the queue length). High-priority I / O requests are processed when the number of idle resources in the current hardware queue is greater than zero; medium-priority I / O requests are processed only if there are no outstanding high-priority I / O requests, and if there are outstanding high-priority I / O requests, the number of idle resources in the current hardware queue must be greater than zero before processing can proceed.

[0117] In the above embodiments, the processing priority of the operation request is determined based on the target device of the operation request. Combined with currently available idle hardware resources, this avoids a large number of low-priority operations from low-priority services consuming resources. In this way, operation requests from lower-priority devices are more likely to enter a waiting state, thus speeding up the processing of operation requests from higher-priority devices and slowing down the processing of operation requests from lower-priority devices, thereby improving computer processing efficiency.

[0118] Figure 4 Block diagrams illustrating some embodiments of the scheduling apparatus of this disclosure are shown.

[0119] like Figure 4 As shown, the scheduling device 4 includes: a determining unit 41, used to determine the device priority corresponding to the first operation request based on the target device of the first operation request; and a processing unit 42, used to determine whether to send the first operation request to the target device for processing based on the device priority and the currently idle hardware resources.

[0120] In some embodiments, the processing unit 42 determines the hardware resources that need to be reserved corresponding to the device priority based on the device priority; and determines whether to send the first operation request to the target device for processing based on the hardware resources to be reserved and the currently idle hardware resources.

[0121] In some embodiments, in response to the fact that the hardware resources that need to be reserved are less than the currently idle hardware resources, the processing unit 42 sends a first operation request to the target device for processing.

[0122] In some embodiments, in response to the requirement that the hardware resources to be reserved are not less than the currently idle hardware resources, the processing unit 42 controls the first operation request to enter a waiting state until a preset condition is met, the preset condition including that other operation requests are completed and / or the waiting time exceeds a threshold.

[0123] In some embodiments, in response to the preset condition being met, the processing unit 42 re-determines whether to send the first operation request to the target device for processing based on the hardware resources that need to be reserved and the currently idle hardware resources.

[0124] In some embodiments, the device priority is a first device priority or a second device priority, where the first device priority is higher than the second device priority, and the hardware resources that need to be reserved corresponding to the second device priority are more than the hardware resources that need to be reserved corresponding to the first device priority.

[0125] In some embodiments, the device priority is a first device priority, a second device priority, or a third device priority. The third device priority is higher than the second device priority but lower than the first device priority. In response to the device priority being the third device priority, the processing unit 42 determines the hardware resources that need to be reserved corresponding to the third device priority based on whether there is an unprocessed second operation request. The device priority corresponding to the second operation request is the first device priority.

[0126] In some embodiments, in response to the absence of a second operation request, the processing unit 42 configures the hardware resources to be retained corresponding to the third device priority to be equal to the hardware resources to be retained corresponding to the first device priority; in response to the presence of a second operation request, the processing unit 42 configures the hardware resources to be retained corresponding to the third device priority to be less than the hardware resources to be retained corresponding to the first device priority, but more than the hardware resources to be retained corresponding to the second device priority.

[0127] In some embodiments, the hardware resources that need to be reserved include the number of hardware channels that need to be reserved, and the current idle hardware resource status includes the number of currently idle hardware channels.

[0128] In some embodiments, in response to determining that a first operation request will be sent to a target device for processing, the processing unit 42 sends the first operation request to a work queue corresponding to the device priority, with different device priorities corresponding to different work queues; and processes the first operation request through the target device according to the processing order in the corresponding work queue.

[0129] In some embodiments, the processing unit 42 selects a first operation request from a plurality of operation requests for processing according to the operation priority, wherein the operation priority is determined based on operation type information and / or context information of the operation initiator.

[0130] In some embodiments, device priority is determined based on the current application scenario.

[0131] Figure 5 Block diagrams illustrating other embodiments of the scheduling apparatus of this disclosure are shown.

[0132] Memory 51 is used to store one or more computer-readable instructions. Memory 51 may include any combination of various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory, including but not limited to random access memory (RAM), dynamic random access memory (DRAM), static random access memory (SRAM), read-only memory (ROM), and flash memory. Memory 51 may, for example, store operating systems, application programs, bootloaders, databases, and other programs, as well as various application programs and various data.

[0133] The processor 52 is configured to execute computer-readable instructions to implement the scheduling method described in any of the foregoing embodiments. Specific implementations of each step of the scheduling method can be found in the above embodiments; repeated details will not be elaborated upon here.

[0134] Processor 52 can be configured to execute the steps of the scheduling method in any of the above embodiments. Processor 52 can be embodied in various processing devices, such as a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The central processing unit (CPU) can be an x86 or ARM architecture, etc.

[0135] The processor 52 and the memory 51 can communicate with each other directly or indirectly. For example, the processor 52 and the memory 51 can communicate via a network. The network can include a wireless network, a wired network, and / or any combination of wireless and wired networks. The processor 52 and the memory 51 can also communicate with each other via a system bus, which is not limited in this disclosure.

[0136] It should be noted that Figure 5 The components of the scheduling device 51 shown are merely exemplary and not limiting; the scheduling device 51 may have other components depending on the actual application requirements. The processor 52 can control other components in the scheduling device 5 to perform the desired functions.

[0137] The scheduling device 5 can be implemented by software, firmware and / or hardware, and can be integrated into a device with the relevant application installed.

[0138] Figure 6 Block diagrams showing further embodiments of the scheduling apparatus of this disclosure are presented.

[0139] Figure 6 The scheduling device 6 shown can be a computer system with a dedicated hardware structure, which can perform corresponding functions when the relevant application is installed.

[0140] The dispatching device 6 includes, but is not limited to, mobile terminals such as smartphones, laptops, personal digital assistants (PDAs), tablet PCs, PMPs (portable multimedia players), in-vehicle terminals (such as in-vehicle navigation terminals), wearable devices, and fixed terminals such as digital televisions and desktop computers.

[0141] like Figure 6As shown, the Central Processing Unit (CPU) 61 performs various processes based on a program stored in the Read-Only Memory (ROM) 62 or a program loaded from the storage section 68 into the Random Access Memory (RAM) 63. The RAM 63 stores data required as needed when the CPU 61 performs various processes, etc. The CPU is merely exemplary; it could also be other types of processors, such as the various processors described above. The ROM 62, RAM 63, and storage section 68 can be various forms of computer-readable storage media. It should be noted that although... Figure 6 The diagram shows ROM 62, RAM 63 and storage section 68, but one or more of them may be combined or located in the same or different memory or storage modules.

[0142] CPU 61, ROM 62 and RAM 63 are interconnected via bus 64. Input / output interface 65 is also connected to bus 64.

[0143] The following components are connected to the input / output interface 65: input section 66, such as a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output section 67, including displays such as cathode ray tube (CRT), liquid crystal display (LCD), speakers, vibrators, etc.; storage section 68, including hard disk, magnetic tape, etc.; and communication section 69, including network interface cards such as LAN cards, modems, etc. Communication section 69 allows communication processing via a network such as the Internet. It is easy to understand that, although... Figure 6 The portion of the scheduling device 6 shown communicates via bus 64, but it can also communicate via a network or other means, wherein the network may include a wireless network, a wired network, and / or any combination of wireless and wired networks.

[0144] As needed, drive 610 is also connected to input / output interface 65. Removable media 611, such as disks, optical disks, magneto-optical disks, semiconductor memories, etc., are installed on drive 610 as needed, so that computer programs read from them can be installed into storage section 68 as needed.

[0145] When the above series of processes are implemented through software, the program constituting the software can be installed from a network such as the Internet or a storage medium such as removable medium 611.

[0146] According to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, some embodiments of this disclosure include a computer program product that, when run on a computer, causes the computer to implement the scheduling method described in any of the foregoing embodiments. The computer program product includes computer instructions carried on a computer-readable medium, containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer instructions can be downloaded and installed from a network via communication section 69, or installed from storage section 68, or installed from ROM 62. When the computer program is executed by CPU 61, the scheduling method of any embodiment of this disclosure is performed.

[0147] It should be noted that, in the context of this disclosure, a computer-readable medium can be a tangible medium that may contain or store programs for use by or in conjunction with an instruction execution system, apparatus, or device.

[0148] A computer-readable medium may be a computer-readable storage medium, a computer-readable signal medium, or any combination thereof.

[0149] Computer-readable storage media include, but are not limited to, systems, apparatuses, or devices that are electrical, magnetic, optical, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. Computer instructions are stored on the computer-readable storage medium that, when executed by a processor, implement the scheduling method described in any of the foregoing embodiments.

[0150] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0151] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0152] In some embodiments, a computer program is also provided, comprising: instructions that, when executed by a processor, cause the processor to perform the scheduling method described in any of the foregoing embodiments. For example, the instructions may be embodied in computer program code.

[0153] In embodiments of this disclosure, computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof. These programming languages ​​include, but are not limited to, object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network (including a local area network (LAN) or a wide area network (WAN)), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0154] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0155] The functions described above can be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary hardware logic components that can be used include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0156] While specific embodiments of this disclosure have been described in detail by way of example, those skilled in the art should understand that the examples are for illustrative purposes only and not intended to limit the scope of this disclosure. Those skilled in the art should understand that modifications can be made to the above embodiments without departing from the scope and spirit of this disclosure. The scope of this disclosure is defined by the appended claims.

Claims

1. A scheduling method, comprising: Determine the device priority corresponding to the first operation request based on the target device of the first operation request; Based on the device priority and currently available hardware resources, determine whether to send the first operation request to the target device for processing.

2. The scheduling method according to claim 1, wherein, The step of determining whether to send the first operation request to the target device for processing based on the device priority and currently available hardware resources includes: Based on the device priority, determine the hardware resources that need to be reserved corresponding to the device priority; Based on the hardware resources that need to be reserved and the currently idle hardware resources, determine whether to send the first operation request to the target device for processing.

3. The scheduling method according to claim 2, wherein, The step of determining whether to send the first operation request to the target device for processing based on the hardware resources that need to be reserved and the currently idle hardware resources includes: In response to the fact that the hardware resources that need to be reserved are less than the currently available hardware resources, the first operation request is sent to the target device for processing.

4. The scheduling method according to claim 2, wherein, The step of determining whether to send the first operation request to the target device for processing based on the hardware resources that need to be reserved and the currently idle hardware resources includes: In response to the requirement that the amount of hardware resources to be reserved is not less than the amount of currently idle hardware resources, the first operation request is controlled to enter a waiting state until a preset condition is met, the preset condition including that other operation requests are completed and / or the waiting time exceeds a threshold.

5. The scheduling method according to claim 4, wherein, The step of determining whether to send the first operation request to the target device for processing based on the hardware resources that need to be reserved and the currently idle hardware resources includes: In response to the preset condition being met, based on the hardware resources that need to be reserved and the currently idle hardware resources, it is re-determined whether to send the first operation request to the target device for processing.

6. The scheduling method according to claim 2, wherein, The device priority is either a first device priority or a second device priority, where the first device priority is higher than the second device priority, and the second device priority corresponds to more hardware resources that need to be reserved than the first device priority.

7. The scheduling method according to claim 6, wherein, The device priority is a first device priority, a second device priority, or a third device priority, wherein the third device priority is higher than the second device priority but lower than the first device priority. The step of determining the hardware resources that need to be reserved corresponding to the device priority based on the device priority includes: In response to the device priority being the third device priority, the hardware resources that need to be reserved corresponding to the third device priority are determined based on whether there is an unprocessed second operation request. The device priority corresponding to the second operation request is the first device priority.

8. The scheduling method according to claim 7, wherein, The step of determining the hardware resources that need to be reserved corresponding to the priority of the third device based on whether there are currently any unprocessed second operation requests includes: In response to the absence of the second operation request, the hardware resources that need to be reserved corresponding to the priority of the third device are configured to be equal to the hardware resources that need to be reserved corresponding to the priority of the first device. In response to the existence of the second operation request, the hardware resources that need to be reserved corresponding to the third device priority are configured to be less than the hardware resources that need to be reserved corresponding to the first device priority, but more than the hardware resources that need to be reserved corresponding to the second device priority.

9. The scheduling method according to claim 2, wherein, The hardware resources that need to be reserved include the number of hardware channels that need to be reserved, and the current idle hardware resource status includes the number of currently idle hardware channels.

10. The scheduling method according to any one of claims 1-9, wherein, The step of determining whether to send the first operation request to the target device for processing based on the device priority and currently available hardware resources includes: In response to determining that the first operation request will be sent to the target device for processing, the first operation request is sent to a work queue corresponding to the device priority, and different device priorities correspond to different work queues; The first operation request is processed by the target device according to the processing order in the corresponding work queue.

11. The scheduling method according to any one of claims 1-9, further comprising: Based on the operation priority, the first operation request is selected from multiple operation requests for processing. The operation priority is determined based on operation type information and / or context information of the operation initiator.

12. The scheduling method according to any one of claims 1-9, wherein, The device priority is determined based on the current application scenario.

13. A scheduling device, comprising: The determining unit is configured to determine the device priority corresponding to the first operation request based on the target device of the first operation request. The processing unit is configured to determine, based on the device priority and currently available hardware resources, whether to send the first operation request to the target device for processing.

14. A scheduling device, comprising: Memory; and A processor coupled to the memory, the processor being configured to execute the scheduling method of any one of claims 1-12 based on instructions stored in the memory.

15. A computer-readable storage medium having stored thereon computer instructions that, when executed by a processor, implement the scheduling method according to any one of claims 1-12.

16. A computer program product comprising instructions that, when executed by a processor, cause the processor to perform the scheduling method according to any one of claims 1-12.