CN113157433A - Resource allocation method, electronic device, and computer-readable medium - Google Patents

Resource allocation method, electronic device, and computer-readable medium Download PDF

Info

Publication number
CN113157433A
CN113157433A CN202110208968.3A CN202110208968A CN113157433A CN 113157433 A CN113157433 A CN 113157433A CN 202110208968 A CN202110208968 A CN 202110208968A CN 113157433 A CN113157433 A CN 113157433A
Authority
CN
China
Prior art keywords
linked list
strategy
policy
transmission request
priority
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110208968.3A
Other languages
Chinese (zh)
Other versions
CN113157433B (en
Inventor
崔显科
刘伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hefei Macrosilicon Technology Co ltd
Original Assignee
Hefei Macrosilicon Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hefei Macrosilicon Technology Co ltd filed Critical Hefei Macrosilicon Technology Co ltd
Priority to CN202110208968.3A priority Critical patent/CN113157433B/en
Publication of CN113157433A publication Critical patent/CN113157433A/en
Application granted granted Critical
Publication of CN113157433B publication Critical patent/CN113157433B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5021Priority

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Systems (AREA)

Abstract

The present disclosure provides a resource allocation method, including: and allocating resources to the transmission requests to be scheduled in the plurality of linked lists according to the priorities and the strategy types corresponding to the linked lists, wherein the linked lists are matched with the priorities and the strategy types of the Universal Serial Bus (USB) equipment pointed by the transmission requests to be scheduled, and the priorities and/or the strategy types corresponding to different linked lists in the plurality of linked lists are different. The present disclosure also provides an electronic device, a computer readable medium.

Description

Resource allocation method, electronic device, and computer-readable medium
Technical Field
The disclosed embodiments relate to the field of computer technologies, and in particular, to a resource allocation method, an electronic device, and a computer-readable medium.
Background
Universal Serial Bus (USB) devices are widely used in life due to their advantages of convenience in carrying, unified standards, support for hot plug, and support for connection of multiple devices. Generally, a computer has a plurality of USB controllers and a plurality of USB interfaces, wherein one USB controller corresponds to one hub, and one hub corresponds to one or more USB interfaces. And a plurality of USB interfaces under the same hub share the bandwidth of one USB controller.
In some related arts, when one USB controller connects a plurality of USB devices at the same time, transmission efficiency of each USB device is low.
Disclosure of Invention
The embodiment of the disclosure provides a resource allocation method, an electronic device and a computer readable medium.
In a first aspect, an embodiment of the present disclosure provides a resource allocation method, including:
and allocating resources to the transmission requests to be scheduled in the plurality of linked lists according to the priorities and the strategy types corresponding to the linked lists, wherein the linked lists are matched with the priorities and the strategy types of the Universal Serial Bus (USB) equipment pointed by the transmission requests to be scheduled, and the priorities and/or the strategy types corresponding to different linked lists in the plurality of linked lists are different.
In some embodiments, the resource allocation method further comprises:
in response to any one transmission request, determining the priority and the policy type of the USB equipment pointed by the transmission request;
and adding the transmission request to a first target linked list according to the priority and the strategy type of the USB equipment pointed by the transmission request, wherein the first target linked list is a linked list matched with the priority and the strategy type of the USB equipment pointed by the transmission request in the plurality of linked lists.
In some embodiments, before the step of determining the priority and the policy type of the USB device to which the transmission request is directed in response to any one transmission request, the resource allocation method further includes:
when any USB device is accessed, generating a strategy table entry corresponding to the accessed USB device in a scheduling strategy table, wherein the strategy table entry corresponding to the accessed USB device comprises the priority and the strategy type corresponding to the accessed USB device.
In some embodiments, the attached USB device comprises at least one endpoint; the step of generating a policy table entry corresponding to the accessed USB device in the scheduling policy table includes:
determining the priority of each endpoint in the accessed USB equipment;
respectively determining the strategy type of each endpoint according to the priority of each endpoint in the accessed USB equipment;
and generating a policy table entry corresponding to each endpoint according to the priority and the policy type of each endpoint in the accessed USB equipment.
In some embodiments, the transmission request carries a device identifier and an endpoint identifier of the USB device to which the transmission request is directed, and the transmission request is directed to an endpoint corresponding to the endpoint identifier; in response to any one of the transfer requests, the step of determining the priority and policy type of the USB device to which the transfer request is directed includes:
and responding to the transmission request, inquiring the scheduling policy table according to the equipment identifier and the endpoint identifier carried by the transmission request, and determining the priority and the policy type of the endpoint corresponding to the endpoint identifier.
In some embodiments, the step of adding the transfer request to the first target linked list according to the priority and policy type of the USB device to which the transfer request is directed includes:
judging whether the first target linked list exists or not;
when the first target linked list does not exist, creating the first target linked list according to the priority and the strategy type of the USB equipment pointed by the transmission request;
adding the transmission request to the first target linked list;
adding the transmission request to the first target linked list when the first target linked list exists.
In some embodiments, the step of allocating resources to the transmission requests to be scheduled in the plurality of linked lists according to the priority and the policy type corresponding to each of the plurality of linked lists includes:
determining a scheduling strategy corresponding to each linked list according to the strategy type corresponding to each linked list;
judging whether a scheduling strategy corresponding to the linked list is met;
and when the scheduling strategy corresponding to the linked list is met, executing one to-be-scheduled transmission request in the linked list.
In some embodiments, the scheduling policy corresponding to the linked list includes scheduling transmission requests to be scheduled in the linked list according to a predetermined time period;
the step of judging whether the scheduling policy corresponding to the linked list is satisfied includes:
creating a timer, the timer satisfying the predetermined time period;
and when the timer is up, judging that the scheduling strategy corresponding to the linked list is satisfied.
In some embodiments, the scheduling policy corresponding to the linked list includes scheduling transmission requests to be scheduled in the linked list according to a predetermined number of cycles;
the step of judging whether the scheduling policy corresponding to the linked list is satisfied includes:
creating a counter;
and when the value of the counter is equal to the number of the transmission requests executed in one preset number period, judging that the scheduling strategy corresponding to the linked list is satisfied.
In some embodiments, the scheduling policy corresponding to the linked list includes scheduling a transmission request to be scheduled in the linked list when there is no other linked list that is satisfied by the scheduling policy;
the step of judging whether the scheduling policy corresponding to the linked list is satisfied includes:
judging whether other linked lists meeting the scheduling strategy exist or not;
and when other linked lists which are met by the scheduling policy do not exist, judging that the scheduling policy corresponding to the linked list is met.
In some embodiments, the step of allocating resources to the transmission requests to be scheduled in the plurality of linked lists according to the priority and the policy type corresponding to each of the plurality of linked lists further includes:
and when a plurality of linked lists which are satisfied by the scheduling strategy exist, distributing resources for the transmission requests to be scheduled in each linked list which are satisfied by the scheduling strategy according to the priority corresponding to each linked list which is satisfied by the scheduling strategy.
In some embodiments, the resource allocation method further comprises:
updating the priority and/or the policy type of the USB equipment pointed by the policy updating request according to the policy updating request;
and under the condition of meeting the updating condition, adding the transmission request of the USB equipment pointed by the strategy updating request to a second target linked list, wherein the second target linked list is a linked list which is matched with the priority and the strategy type of the USB equipment pointed by the updated transmission request in the plurality of linked lists.
In some embodiments, the step of adding the transmission request of the USB device to which the policy update request is directed to the second target linked list in case that the update condition is satisfied includes:
judging whether the USB equipment pointed by the strategy updating request has a transmission request which is executed;
when the USB equipment pointed by the strategy updating request does not have the executing transmission request, deleting the transmission request of the USB equipment pointed by the strategy updating request from a linked list;
and adding the transmission request of the USB equipment pointed by the strategy updating request to the second target linked list.
In some embodiments, the resource allocation method further comprises:
and when any USB equipment is disconnected, deleting the strategy table entry of the disconnected USB equipment in the scheduling strategy table.
In a second aspect, an embodiment of the present disclosure provides an electronic device, including:
one or more processors;
a memory having one or more programs stored thereon, which when executed by the one or more processors, cause the one or more processors to implement any one of the resource allocation methods described in the first aspect of the embodiments of the present disclosure;
one or more I/O interfaces connected between the processor and the memory and configured to enable information interaction between the processor and the memory.
In a third aspect, the present disclosure provides a computer-readable medium, on which a computer program is stored, where the computer program, when executed by a processor, implements any one of the resource allocation methods described in the first aspect of the present disclosure.
In the embodiment of the disclosure, according to the priority and the policy type of the USB device, the transmission request initiated by the USB device driver is added to the linked lists corresponding to different priorities and policy types, and the transmission request in each linked list is scheduled according to the priority and policy type corresponding to each linked list, and the priority and policy type of the USB device can enable the transmission request in the linked list corresponding to the high priority to preferentially allocate USB resources or allocate more USB resources; in addition, the priority and the scheduling policy of the USB device in the embodiment of the present disclosure can be dynamically modified, so that the USB resource allocated to any USB device can be flexibly controlled, the transmission request of multiple USB devices can be finely controlled, and the USB transmission efficiency can be improved.
Drawings
The accompanying drawings are included to provide a further understanding of the embodiments of the disclosure and are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description serve to explain the principles of the disclosure and not to limit the disclosure. The above and other features and advantages will become more apparent to those skilled in the art by describing in detail exemplary embodiments thereof with reference to the attached drawings, in which:
FIG. 1 is a flow chart of a resource allocation method in an embodiment of the present disclosure;
FIG. 2 is a flow chart of some steps in another method for allocating resources in the disclosed embodiment;
FIG. 3 is a flowchart of some steps in another resource allocation method according to an embodiment of the present disclosure;
FIG. 4 is a flowchart illustrating some steps in a method for allocating resources according to yet another embodiment of the present disclosure;
FIG. 5 is a flowchart illustrating some steps in a method for allocating resources according to yet another embodiment of the present disclosure;
FIG. 6 is a flowchart illustrating some steps in a method for allocating resources according to yet another embodiment of the present disclosure;
FIG. 7 is a flowchart illustrating some steps in a method for allocating resources according to yet another embodiment of the present disclosure;
FIG. 8 is a flowchart illustrating some steps in a method for allocating resources according to yet another embodiment of the present disclosure;
FIG. 9 is a flowchart illustrating some steps in a method for allocating resources according to yet another embodiment of the present disclosure;
FIG. 10 is a flowchart illustrating some steps in a method for allocating resources according to yet another embodiment of the present disclosure;
FIG. 11 is a flowchart illustrating some steps in a method for allocating resources according to yet another embodiment of the present disclosure;
FIG. 12 is a flowchart illustrating some steps in a method for allocating resources according to yet another embodiment of the present disclosure;
FIG. 13 is a flowchart illustrating some steps in a method for allocating resources according to yet another embodiment of the present disclosure;
FIG. 14 is a flowchart illustrating some steps in a method for allocating resources according to yet another embodiment of the present disclosure;
fig. 15 is a block diagram of an electronic device provided by an embodiment of the present disclosure;
fig. 16 is a block diagram of a computer-readable medium provided by an embodiment of the present disclosure.
Detailed Description
In order to make those skilled in the art better understand the technical solution of the present disclosure, the resource allocation method, the electronic device, and the computer readable medium provided in the present disclosure are described in detail below with reference to the accompanying drawings.
Example embodiments will be described more fully hereinafter with reference to the accompanying drawings, but which may be embodied in different forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Embodiments of the present disclosure and features of embodiments may be combined with each other without conflict.
As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the relevant art and the present disclosure, and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
Through research by the inventors of the present disclosure, it is found that, in some related technologies, when one USB controller is connected to multiple USB devices simultaneously, the USB controller executes transmission requests initiated by USB device drivers in a time division multiplexing manner, or sequentially executes transmission requests initiated by USB device drivers, and multiple USB devices share the bandwidth of the USB controller "fairly", but cannot schedule transmission requests of multiple USB devices flexibly, resulting in that the transmission efficiency of the USB devices is low.
In view of the above, in a first aspect, referring to fig. 1, an embodiment of the present disclosure provides a resource allocation method, including:
in step S300, resources are allocated to the transmission requests to be scheduled in the plurality of linked lists according to the priorities and policy types corresponding to the respective linked lists in the plurality of linked lists, where the linked lists are matched with the priorities and policy types of the USB devices to which the transmission requests to be scheduled point, and the priorities and/or policy types corresponding to different linked lists in the plurality of linked lists are different.
In the embodiment of the present disclosure, the priority and the policy type of the USB device may be that the USB device is automatically classified and configured by the system when the USB device accesses; or the configuration may be performed by modifying the priority and/or policy type of the USB device after the USB device is accessed. The embodiment of the present disclosure is not particularly limited in this regard.
In the embodiment of the present disclosure, the role of the priority includes configuring a corresponding policy type for the USB device according to the priority, for example, configuring a policy type capable of preferentially allocating USB resources or a policy type capable of allocating more USB resources for a high-priority USB device; the role of the priority also includes executing the corresponding transmission request from high to low according to the priority when the policy types of the plurality of USB devices are the same, so that the USB device with the high priority can allocate the USB resource preferentially or can allocate more USB resources.
In the embodiment of the present disclosure, the priorities of different USB devices may be the same or different, and the policy types of different USB devices may also be the same or different, which is not particularly limited in the embodiment of the present disclosure. The transmission requests initiated by different USB device drivers are stored in a plurality of linked lists, and the priority and the strategy type corresponding to the transmission request in each linked list are the same.
According to the method for allocating the resources of the transmission request, the transmission request initiated by the USB device driver is added into the linked lists corresponding to different priorities and strategy types according to the priority and the strategy type of the USB device, and the transmission request in each linked list is scheduled according to the priority and the strategy type corresponding to each linked list, wherein the priority and the strategy type of the USB device can enable the transmission request in the linked list corresponding to the high priority to be allocated with the USB resources preferentially or more USB resources; in addition, the priority and the scheduling policy of the USB device in the embodiment of the present disclosure can be dynamically modified, so that the USB resource allocated to any USB device can be flexibly controlled, the transmission request of multiple USB devices can be finely controlled, and the USB transmission efficiency can be improved.
In some embodiments, referring to fig. 2, the resource allocation method further includes:
in step S100, in response to any one transmission request, determining a priority and a policy type of a USB device to which the transmission request is directed;
in step S200, the transmission request is added to a first target linked list according to the priority and policy type of the USB device to which the transmission request points, where the first target linked list is a linked list matched with the priority and policy type of the USB device to which the transmission request points, from among the plurality of linked lists.
It should be noted that, in the embodiment of the present disclosure, a transfer request directed to a USB device refers to a transfer request initiated by a driver of the USB device and intended to send data to or receive data from the USB device. The transmission request may correspond to any one of four transmission modes of the USB, Bulk transmission (Bulk transmission), Control transmission (Control transmission), Interrupt transmission (Interrupt transmission), and Isochronous transmission (Isochronous transmission). The embodiment of the present disclosure is not particularly limited in this regard. As an alternative implementation, the transmission request in step S100 is a Bulk transmission request.
In the embodiment of the present disclosure, a scheduling policy table is set, and is used to store information such as the priority of the USB device, the corresponding relationship of the policy types, and the like. The policy table entries of the USB device in the scheduling policy table may be dynamically created, modified, or deleted. In step S100, the priority and policy type of the USB device may be determined by querying the scheduling policy table.
Accordingly, referring to fig. 3, in some embodiments, before step S100, the resource allocation method further includes:
in step S400, when any USB device accesses, a policy entry corresponding to the accessed USB device is generated in the scheduling policy table, where the policy entry corresponding to the accessed USB device includes a priority and a policy type corresponding to the accessed USB device.
IN an embodiment of the present disclosure, the USB device includes a plurality of endpoints, each endpoint corresponding to a direction, the direction corresponding to the endpoint including an Input (IN) direction from the USB device to the host or an Output (OUT) direction from the host to the USB device. In the disclosed embodiment, each endpoint of a USB device is configured with a priority and a policy type.
Accordingly, referring to fig. 4, in some embodiments, the attached USB device includes at least one endpoint; step S400 includes:
in step S410, determining the priority of each endpoint in the accessed USB device;
in step S420, according to the priority and policy type of each endpoint in the accessed USB device;
in step S430, a policy entry corresponding to each endpoint is generated according to the priority and policy type of each endpoint in the accessed USB device.
As an alternative implementation, the endpoint information of the USB device is added to the scheduling policy table at USB device enumeration.
In the embodiment of the present disclosure, the scheduling policy table further includes a device Identification (ID) of the USB device, and identifies each endpoint in the USB device with an endpoint identification. In the embodiment of the present disclosure, a transmission request initiated by a USB device driver carries a USB device ID and an endpoint identifier, and in step S100, a priority and a policy type of an endpoint are determined according to the USB device ID and the endpoint identifier carried by the transmission request.
Correspondingly, referring to fig. 5, in some embodiments, the transmission request carries a device identifier and an endpoint identifier of the USB device to which the transmission request is directed, and the transmission request is directed to an endpoint corresponding to the endpoint identifier; the step S100 includes:
in step S101, in response to the transmission request, the scheduling policy table is queried according to the device identifier and the endpoint identifier carried in the transmission request, and the priority and the policy type of the target endpoint are determined.
It should be noted that, in the embodiment of the present disclosure, the device identifier of the USB device is not particularly limited. For example, a device number (device number) allocated by the system to the USB device may be used as the device identifier of the USB device, or an address allocated by the system to the USB device may be used as the device identifier of the USB device. The embodiment of the present disclosure does not make any special limitation on the endpoint identifier, where the endpoint identifier carries the direction information of the endpoint. For example, the bendpointdessage field IN the endpoint identifier may be used as the endpoint identifier, the bendpointdessage field is 1 BYTE (BYTE) long, BIT (BIT)7 is the endpoint direction (0 represents OUT, 1 represents IN), and BIT0-BIT6 represents the endpoint number.
In the embodiment of the present disclosure, if there exists a linked list corresponding to the priority and policy type of the USB device to which the transmission request points, the transmission request is directly added to the linked list corresponding to the priority and policy type of the USB device to which the transmission request points; if the linked list corresponding to the priority and the policy type of the USB equipment pointed by the transmission request does not exist, the linked list corresponding to the priority and the policy type of the USB equipment pointed by the transmission request needs to be created.
Accordingly, referring to fig. 6, in some embodiments, step S200 comprises:
in step S201, determining whether the first target linked list exists;
when the first target linked list does not exist, in step S202, creating the first target linked list according to the priority and the policy type of the USB device to which the transmission request points;
in step S203, adding the transmission request to the first target linked list;
when the first target linked list exists, in step S204, the transmission request is added to the first target linked list.
In the embodiment of the present disclosure, each policy type corresponds to one scheduling policy, and a scheduling policy established in advance can be determined according to the policy type.
Accordingly, referring to fig. 7, in some embodiments, step S300 includes:
in step S310, determining a scheduling policy corresponding to each linked list according to a policy type corresponding to each linked list;
in step S320, determining whether a scheduling policy corresponding to the linked list is satisfied;
when the scheduling policy corresponding to the linked list is satisfied, in step S330, one to-be-scheduled transmission request in the linked list is executed.
The scheduling policy is not particularly limited in the embodiments of the present disclosure. For example, the transmission requests in the execution chain table may be periodic according to a predetermined time; or the transmission requests in the periodic execution linked list can be determined according to a preset number; the transmission requests in the linked list may also be executed according to whether they are idle, wherein idle is indicated if there are no other transmission requests that need to be executed.
Accordingly, referring to fig. 8, in some embodiments, the scheduling policy corresponding to the linked list includes scheduling transmission requests to be scheduled in the linked list according to a predetermined time period;
step S320 includes:
in step S321, a timer is created, the timer satisfying the predetermined time period;
and when the timer is up, judging that the scheduling strategy corresponding to the linked list is satisfied.
It should be noted that, scheduling the transmission request to be scheduled in the linked list according to the predetermined time period means executing one transmission request to be scheduled in the linked list every predetermined time period.
In the embodiment of the present disclosure, scheduling policies with different predetermined time periods may be set, and correspond to different policy types, respectively. For example, configuring a policy type of a scheduling policy with a shorter predetermined time period for a high-priority USB device, thereby enabling the high-priority USB device to preferentially allocate and allocate more USB resources; and configuring the strategy type with a scheduling strategy of a longer preset time period for the USB equipment with low priority, so that the USB equipment with low priority is allocated with less USB resources.
Accordingly, referring to fig. 9, in some embodiments, the scheduling policy corresponding to the linked list includes scheduling transmission requests to be scheduled in the linked list according to a predetermined number of cycles;
step S320 includes:
in step S322, a counter is created;
and when the value of the counter is equal to the number of the transmission requests executed in one preset number period, judging that the scheduling strategy corresponding to the linked list is satisfied.
It should be noted that, scheduling the transmission requests to be scheduled in the linked list according to the predetermined number of cycles means executing one transmission request to be scheduled in the linked list every time the predetermined number of transmission requests to be scheduled is executed, where the predetermined number is equal to the length of the predetermined number of cycles.
In the embodiment of the present disclosure, scheduling policies with different predetermined number of cycles may be set, corresponding to different policy types, respectively. For example, configuring a policy type of a scheduling policy with a smaller predetermined number of cycles for a high priority USB device, thereby enabling the high priority USB device to preferentially allocate and allocate more USB resources; and configuring the strategy type of the scheduling strategy with a larger preset number of cycles for the USB equipment with low priority, so that the USB equipment with low priority is allocated with less USB resources.
Accordingly, referring to fig. 10, in some embodiments, the scheduling policy corresponding to the linked list includes scheduling a transmission request to be scheduled in the linked list when there is no other linked list that is satisfied by the scheduling policy;
step S320 includes:
in step S323, it is determined whether there are other linked lists that the scheduling policy satisfies;
and when other linked lists which are met by the scheduling policy do not exist, judging that the scheduling policy corresponding to the linked list is met.
It should be noted that the to-be-scheduled transmission request in the scheduling linked list when there is no other linked list that satisfies the scheduling policy means that there is no to-be-scheduled transmission request in another linked list that needs to be executed at the current time point, and the scheduling policy corresponding to the other linked list may not be satisfied, or there is no to-be-scheduled transmission request in the other linked list. The embodiment of the present disclosure is not particularly limited in this regard.
In the embodiment of the present disclosure, when the policy types corresponding to the plurality of linked lists are the same, the transmission request in the corresponding linked list is executed from high to low according to the priority, so that the USB device with the high priority can preferentially allocate the USB resource or can allocate more USB resources.
Accordingly, referring to fig. 11, in some embodiments, step S300 further comprises:
in step S340, when there are multiple linked lists that are satisfied by the scheduling policy, allocating resources to the transmission request to be scheduled in each linked list that is satisfied by the scheduling policy according to the priority corresponding to each linked list that is satisfied by the scheduling policy.
It should be noted that, in the embodiment of the present disclosure, when a scheduling policy is satisfied and a transmission request to be scheduled in a linked list needs to be executed, if there are other transmission requests being executed, the transmission request to be scheduled is taken out from the linked list and executed after the execution of the transmission request being executed is completed.
In the disclosed embodiment, the priority and policy type of the USB device may be dynamically modified.
Accordingly, referring to fig. 12, in some embodiments, the task resource allocation method further includes:
in step S510, according to the policy update request, updating the priority and/or policy type of the USB device to which the policy update request is directed;
in step S520, in a case that the update condition is satisfied, the transmission request of the USB device to which the policy update request points is added to a second target linked list, where the second target linked list is a linked list, of the plurality of linked lists, that matches the priority and policy type of the USB device to which the transmission request points after update.
Accordingly, referring to fig. 13, in some embodiments, step S520 includes:
in step S521, it is determined whether there is an executing transmission request in the USB device to which the policy update request is directed;
when the USB device to which the policy update request is directed does not have an executing transmission request, in step S522, the transmission request of the USB device to which the policy update request is directed is deleted from the linked list;
in step S523, the transmission request of the USB device to which the policy update request is directed is added to the second target linked list.
In the embodiment of the present disclosure, the policy update request in step S510 may be input in various ways, for example, an interface for changing the priority and/or the policy type may be provided in an application program corresponding to the USB device, and a user may manually modify the priority and/or the policy type of the USB device; the priority and/or the strategy type of the USB device can be intelligently changed by the operating system according to the application scene; and voice analysis for changing the priority and/or the policy type of the USB device by the user can be acquired by utilizing voice input of the intelligent device at the operating system level and translated into a corresponding policy updating request. The embodiment of the present disclosure is not particularly limited in this regard.
In some embodiments, referring to fig. 14, the resource allocation method further includes:
in step S600, when any USB device is disconnected, the policy table entry of the disconnected USB device in the scheduling policy table is deleted.
In a second aspect, referring to fig. 15, an embodiment of the present disclosure provides an electronic device, including:
one or more processors 101;
a memory 102, on which one or more programs are stored, which, when executed by one or more processors, cause the one or more processors to implement any one of the resource allocation methods described in the first aspect of the embodiments of the present disclosure;
one or more I/O interfaces 103 coupled between the processor and the memory and configured to enable information interaction between the processor and the memory.
The processor 101 is a device with data processing capability, and includes but is not limited to a Central Processing Unit (CPU) and the like; memory 102 is a device having data storage capabilities including, but not limited to, random access memory (RAM, more specifically SDRAM, DDR, etc.), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), FLASH memory (FLASH); an I/O interface (read/write interface) 103 is connected between the processor 101 and the memory 102, and can realize information interaction between the processor 101 and the memory 102, which includes but is not limited to a data Bus (Bus) and the like.
In some embodiments, the processor 101, memory 102, and I/O interface 103 are interconnected via a bus 104, which in turn connects with other components of the computing device.
In a third aspect, referring to fig. 16, an embodiment of the present disclosure provides a computer-readable medium, on which a computer program is stored, where the computer program, when executed by a processor, implements any one of the resource allocation methods described in the first aspect of the embodiment of the present disclosure.
In order to make the technical solutions provided by the embodiments of the present disclosure more clearly understood by those skilled in the art, the technical solutions provided by the embodiments of the present disclosure are described in detail below by specific examples:
example one
And (4) creating, modifying and deleting the scheduling policy table.
When detecting the access of the Bulk transmission type USB device, the system creates a scheduling policy table (table one) according to the following format, and adds one row for each adding of a Bulk type endpoint, namely one policy table entry:
watch 1
Device identification Endpoint identification Priority level Policy type
0 0x1 0 1
1 0x2 1 2
1 0x82 1 1
The equipment identification of the USB equipment is the device number allocated to the equipment by the system, and each USB equipment is unique; the endpoint identifier is a bEndPointAddress field IN the USB endpoint descriptor and is 1 BYTE length, BIT7 is the endpoint direction (0 represents OUT, 1 represents IN), BIT0-BIT6 represents the endpoint number; the priority is the highest priority from 0, and the higher the value is, the lower the priority is; policy types 1, 2, and 3 represent scheduling policies for the controller different from each other, for example, it may be defined that 1 represents that no other device processes the device transmission request when transmitting, 2 represents that the device transmission request is scheduled every 10ms, and 3 represents that the device transmission request is scheduled every 10 other devices.
When the USB equipment is disconnected, deleting the strategy table entry of the USB equipment in the scheduling strategy table;
when the priority and the policy type corresponding to a certain UBS device or endpoint need to be changed, the policy table entry corresponding to the USB device or endpoint in the policy table entry is modified.
Example two
Scheduling of transmission requests.
The USB device driver submits a USB Bulk transmission request to the USB controller driver, and the endpoint information is added into the scheduling policy table during device enumeration;
after receiving the Bulk transmission request, the USB controller driver searches a scheduling policy table according to the equipment identifier and the endpoint identifier of the USB equipment;
after the priority and the strategy type of the USB equipment or the endpoint are inquired, the Bulk transmission request is added into a linked list corresponding to the priority and the strategy type of the USB equipment or the endpoint, wherein, a group of linked lists are respectively arranged IN the IN direction and the OUT direction, at least one of the priority and the strategy type corresponding to different linked lists is different, and the strategy types corresponding to the linked lists IN the same direction and the same priority are the same;
the USB controller driver determines a scheduling strategy according to the strategy type, for example, if a transmission request in the linked list is to be scheduled at intervals, a corresponding timer needs to be established for the linked list, and timing is started after each transmission processing request of the linked list is processed; and after the timer is up, if no other transmission request is executed, taking out one transmission request from the linked list and executing, otherwise, taking out the transmission request after waiting for the other transmission request to be finished.
EXAMPLE III
Real-time modification of priorities and/or policy types.
The policy update request may be input in various ways, for example, an interface for changing the priority and/or the policy type may be provided in an application program corresponding to the USB device, and the user may manually modify the priority and/or the policy type of the USB device; the priority and/or the strategy type of the USB device can be intelligently changed by the operating system according to the application scene; the voice input of the intelligent equipment can be used for obtaining the voice analysis of the user changing the priority and/or the strategy type of the USB equipment on the operating system level and translating the voice analysis into the corresponding strategy updating request;
the strategy update of the USB equipment is sent to the corresponding equipment driver, and the driving layer updates the scheduling strategy table;
if the USB equipment has unfinished transmission requests and transmission requests which are not scheduled by the USB controller, the transmission requests are directly deleted from the chain table where the USB equipment is located before and then added into the chain table corresponding to the existing priority; if the transmission request is scheduled and executed by the USB controller, the subsequent operation is executed after the transmission request is finished;
and the USB controller driver schedules the new transmission request according to the scheduling rule of the linked list corresponding to the existing priority.
It will be understood by those of ordinary skill in the art that all or some of the steps of the methods, systems, functional modules/units in the devices disclosed above may be implemented as software, firmware, hardware, and suitable combinations thereof. In a hardware implementation, the division between functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be performed by several physical components in cooperation. Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on computer readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). The term computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data, as is well known to those of ordinary skill in the art. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, Digital Versatile Disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by a computer. In addition, communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media as known to those skilled in the art.
Example embodiments have been disclosed herein, and although specific terms are employed, they are used and should be interpreted in a generic and descriptive sense only and not for purposes of limitation. In some instances, features, characteristics and/or elements described in connection with a particular embodiment may be used alone or in combination with features, characteristics and/or elements described in connection with other embodiments, unless expressly stated otherwise, as would be apparent to one skilled in the art. Accordingly, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the scope of the disclosure as set forth in the appended claims.

Claims (16)

1. A method of resource allocation, comprising:
and allocating resources to the transmission requests to be scheduled in the plurality of linked lists according to the priorities and the strategy types corresponding to the linked lists, wherein the linked lists are matched with the priorities and the strategy types of the Universal Serial Bus (USB) equipment pointed by the transmission requests to be scheduled, and the priorities and/or the strategy types corresponding to different linked lists in the plurality of linked lists are different.
2. The resource allocation method of claim 1, wherein the resource allocation method further comprises:
in response to any one transmission request, determining the priority and the policy type of the USB equipment pointed by the transmission request;
and adding the transmission request to a first target linked list according to the priority and the strategy type of the USB equipment pointed by the transmission request, wherein the first target linked list is a linked list matched with the priority and the strategy type of the USB equipment pointed by the transmission request in the plurality of linked lists.
3. The resource allocation method according to claim 2, wherein, prior to the step of determining the priority and policy type of the USB device to which the transmission request is directed in response to any one of the transmission requests, the resource allocation method further comprises:
when any USB device is accessed, generating a strategy table entry corresponding to the accessed USB device in a scheduling strategy table, wherein the strategy table entry corresponding to the accessed USB device comprises the priority and the strategy type corresponding to the accessed USB device.
4. The resource allocation method of claim 3, wherein the attached USB device comprises at least one endpoint; the step of generating a policy table entry corresponding to the accessed USB device in the scheduling policy table includes:
determining the priority of each endpoint in the accessed USB equipment;
respectively determining the strategy type of each endpoint according to the priority of each endpoint in the accessed USB equipment;
and generating a policy table entry corresponding to each endpoint according to the priority and the policy type of each endpoint in the accessed USB equipment.
5. The resource allocation method according to claim 4, wherein the transmission request carries a device identifier and an endpoint identifier of the USB device to which the transmission request points, and the transmission request points to an endpoint corresponding to the endpoint identifier; in response to any one of the transfer requests, the step of determining the priority and policy type of the USB device to which the transfer request is directed includes:
and responding to the transmission request, inquiring the scheduling policy table according to the equipment identifier and the endpoint identifier carried by the transmission request, and determining the priority and the policy type of the endpoint corresponding to the endpoint identifier.
6. The resource allocation method according to any one of claims 2 to 5, wherein the step of adding the transmission request to the first target linked list according to the priority and policy type of the USB device to which the transmission request is directed comprises:
judging whether the first target linked list exists or not;
when the first target linked list does not exist, creating the first target linked list according to the priority and the strategy type of the USB equipment pointed by the transmission request;
adding the transmission request to the first target linked list;
adding the transmission request to the first target linked list when the first target linked list exists.
7. The resource allocation method according to claim 1, wherein the step of allocating resources for the transmission requests to be scheduled in the plurality of linked lists according to the priority and the policy type corresponding to each of the plurality of linked lists comprises:
determining a scheduling strategy corresponding to each linked list according to the strategy type corresponding to each linked list;
judging whether a scheduling strategy corresponding to the linked list is met;
and when the scheduling strategy corresponding to the linked list is met, executing one to-be-scheduled transmission request in the linked list.
8. The resource allocation method according to claim 7, wherein the scheduling policy corresponding to the linked list comprises scheduling transmission requests to be scheduled in the linked list according to a predetermined time period;
the step of judging whether the scheduling policy corresponding to the linked list is satisfied includes:
creating a timer, the timer satisfying the predetermined time period;
and when the timer is up, judging that the scheduling strategy corresponding to the linked list is satisfied.
9. The resource allocation method according to claim 7, wherein the scheduling policy corresponding to the linked list comprises scheduling transmission requests to be scheduled in the linked list according to a predetermined number of cycles;
the step of judging whether the scheduling policy corresponding to the linked list is satisfied includes:
creating a counter;
and when the value of the counter is equal to the number of the transmission requests executed in one preset number period, judging that the scheduling strategy corresponding to the linked list is satisfied.
10. The resource allocation method according to claim 7, wherein the scheduling policy corresponding to the linked list comprises scheduling transmission requests to be scheduled in the linked list when there is no other linked list that is satisfied by the scheduling policy;
the step of judging whether the scheduling policy corresponding to the linked list is satisfied includes:
judging whether other linked lists meeting the scheduling strategy exist or not;
and when other linked lists which are met by the scheduling policy do not exist, judging that the scheduling policy corresponding to the linked list is met.
11. The method according to any one of claims 7 to 10, wherein the step of allocating resources for the transmission requests to be scheduled in the plurality of linked lists according to the priority and policy type corresponding to each of the plurality of linked lists further comprises:
and when a plurality of linked lists which are satisfied by the scheduling strategy exist, distributing resources for the transmission requests to be scheduled in each linked list which are satisfied by the scheduling strategy according to the priority corresponding to each linked list which is satisfied by the scheduling strategy.
12. The resource allocation method according to any one of claims 1 to 5 and 7 to 10, wherein the resource allocation method further comprises:
updating the priority and/or the policy type of the USB equipment pointed by the policy updating request according to the policy updating request;
and under the condition of meeting the updating condition, adding the transmission request of the USB equipment pointed by the strategy updating request to a second target linked list, wherein the second target linked list is a linked list which is matched with the priority and the strategy type of the USB equipment pointed by the updated transmission request in the plurality of linked lists.
13. The resource allocation method of claim 12, wherein the step of adding the transmission request of the USB device to which the policy update request is directed to the second target linked list if the update condition is satisfied comprises:
judging whether the USB equipment pointed by the strategy updating request has a transmission request which is executed;
when the USB equipment pointed by the strategy updating request does not have the executing transmission request, deleting the transmission request of the USB equipment pointed by the strategy updating request from a linked list;
and adding the transmission request of the USB equipment pointed by the strategy updating request to the second target linked list.
14. The resource allocation method according to any one of claims 3 to 5, wherein the resource allocation method further comprises:
and when any USB equipment is disconnected, deleting the strategy table entry of the disconnected USB equipment in the scheduling strategy table.
15. An electronic device, comprising:
one or more processors;
memory having one or more programs stored thereon that, when executed by the one or more processors, cause the one or more processors to implement the method of resource allocation according to any one of claims 1 to 14;
one or more I/O interfaces connected between the processor and the memory and configured to enable information interaction between the processor and the memory.
16. A computer-readable medium, on which a computer program is stored which, when being executed by a processor, carries out the resource allocation method according to any one of claims 1 to 14.
CN202110208968.3A 2021-02-24 2021-02-24 Resource allocation method, electronic device, and computer-readable medium Active CN113157433B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110208968.3A CN113157433B (en) 2021-02-24 2021-02-24 Resource allocation method, electronic device, and computer-readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110208968.3A CN113157433B (en) 2021-02-24 2021-02-24 Resource allocation method, electronic device, and computer-readable medium

Publications (2)

Publication Number Publication Date
CN113157433A true CN113157433A (en) 2021-07-23
CN113157433B CN113157433B (en) 2024-06-04

Family

ID=76883364

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110208968.3A Active CN113157433B (en) 2021-02-24 2021-02-24 Resource allocation method, electronic device, and computer-readable medium

Country Status (1)

Country Link
CN (1) CN113157433B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101482854A (en) * 2009-02-10 2009-07-15 深圳华为通信技术有限公司 USB multi-channel transmission method, system and main unit
CN103019975A (en) * 2012-11-20 2013-04-03 福建星网锐捷网络有限公司 Universal serial bus (USB) transmission control method and host equipment
CN103019810A (en) * 2011-09-19 2013-04-03 辉达公司 Scheduling and management of compute tasks with different execution priority levels
US20170337091A1 (en) * 2016-05-17 2017-11-23 International Business Machines Corporation Allocating compute offload resources
CN111813520A (en) * 2020-07-01 2020-10-23 Oppo广东移动通信有限公司 Thread scheduling method and device, storage medium and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101482854A (en) * 2009-02-10 2009-07-15 深圳华为通信技术有限公司 USB multi-channel transmission method, system and main unit
CN103019810A (en) * 2011-09-19 2013-04-03 辉达公司 Scheduling and management of compute tasks with different execution priority levels
CN103019975A (en) * 2012-11-20 2013-04-03 福建星网锐捷网络有限公司 Universal serial bus (USB) transmission control method and host equipment
US20170337091A1 (en) * 2016-05-17 2017-11-23 International Business Machines Corporation Allocating compute offload resources
CN111813520A (en) * 2020-07-01 2020-10-23 Oppo广东移动通信有限公司 Thread scheduling method and device, storage medium and electronic equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
王国裕;李玄华;张红升: "Android应用框架层usb驱动设计及在DAB接收机上的应用", 《电子质量》, no. 3, 31 March 2015 (2015-03-31), pages 26 - 29 *
申阳德: "测试测量仪器USB桥驱动及固件设计", 《中国优秀硕士论文电子期刊网(中国优秀硕士论文电子期刊网)》, 31 March 2016 (2016-03-31), pages 138 - 5177 *

Also Published As

Publication number Publication date
CN113157433B (en) 2024-06-04

Similar Documents

Publication Publication Date Title
US8635387B2 (en) Enhanced I/O performance in a multi-processor system via interrupt affinity schemes
US9582326B2 (en) Quality of service classes
EP3605347B1 (en) Systems and methods for i/o prioritization in nvme-compliant storage devices
KR20150117221A (en) Method and apparatus for a preemptive scheduling scheme in a real time operating system
US7373445B2 (en) Method and apparatus for allocating bus access rights in multimaster bus systems
US9563443B2 (en) Information processing device, peripheral device control method, and non-transitory computer readable medium storing filter driver for controlling a power state of a peripheral device
CN116302617B (en) Method for sharing memory, communication method, embedded system and electronic equipment
CN107343023A (en) Resource allocation methods, device and electronic equipment in a kind of Mesos management cluster
CN112162852A (en) Multi-architecture CPU node management method, device and related components
TW201737103A (en) Modular communication framework
US11093291B2 (en) Resource assignment using CDA protocol in distributed processing environment based on task bid and resource cost
CN111562883B (en) Cache management system, method and device for solid state disk
WO2019239522A1 (en) Control controller and vehicle control system
CN113157433B (en) Resource allocation method, electronic device, and computer-readable medium
WO2000028418A1 (en) Scheduling resource requests in a computer system
CN112527490A (en) Node resource control method and device, electronic equipment and storage medium
CN112463027B (en) I/O processing method, system, equipment and computer readable storage medium
CN112463028B (en) I/O processing method, system, equipment and computer readable storage medium
CN114675954A (en) Task scheduling method and device
CN104040477A (en) A method and terminal for scheduling storage resource
CN113468442A (en) Resource bit flow distribution method, computing device and computer storage medium
JP2000259430A (en) Processing method for computer system
CN110955644A (en) IO control method, device, equipment and storage medium of storage system
CN117093345B (en) Task linked list execution method and device, terminal equipment and storage medium
CN112260914B (en) Virtual Modbus ID generation method and device and gateway

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 230088 north, 9th floor, B1 building, animation base, 800 Wangjiang West Road, high tech Zone, Hefei City, Anhui Province

Applicant after: Hongjing Microelectronics Technology Co.,Ltd.

Address before: 230088 north, 9th floor, B1 building, animation base, 800 Wangjiang West Road, high tech Zone, Hefei City, Anhui Province

Applicant before: HEFEI MACROSILICON TECHNOLOGY CO.,LTD.

GR01 Patent grant
GR01 Patent grant