Computer and quality of service control method and apparatus
A computer, a method and apparatus for controlling quality of service (QoS), where the method comprises allocating, to at least one container of the computer, a container identity (ID), sending a bus request to a system bus, searching, according to the bus request, for a QoS parameter corresponding to both the container ID and a hardware device ID, and configuring, according to the found QoS parameter, a resource required when the container corresponding to the QoS parameter uses the hardware device corresponding to the QoS parameter. Hence, the system bus may perform corresponding QoS control according to the QoS parameter corresponding to both the container ID and the hardware device ID such that the hardware device allocated to the container can meet resource requirements of a process group in the container.
1. A computer, comprising:
a system bus comprising a bus management device;
a processor coupled to the system bus;
a storage coupled to the system bus, the storage comprising an operating system, and the operating system comprising a scheduling subsystem; and
at least one other device coupled to the system bus,
the processor being configured to invoke the scheduling subsystem to allocate, to at least one container of the computer, a container identity (ID) corresponding one-to-one to the at least one container,
the processor or the at least one other device being configured to send a bus request carrying the container ID and a hardware device ID of a hardware device used by the at least one container indicated by the container ID to the system bus, the hardware device comprising a memory in the storage or the processor, and the bus request being sent to the system bus comprising sending, to the system bus using a first memory management (MM) subsystem in the operating system, the bus request carrying the container ID and the hardware device ID, and
the bus management device being configured to:
search, according to the bus request, for a quality of service (QoS) parameter corresponding to both the container ID and the hardware device ID, the QoS parameter being stored in the bus management device; and
configure, according to the found QoS parameter, a resource required when the at least one container corresponding to the QoS parameter uses the hardware device corresponding to the QoS parameter, the resource comprising at least one of bandwidth, a delay, or a priority.
2. The computer of claim 1 , wherein the hardware device comprises the at least one other device, the at least one other device comprises at least one of a network device, an encryption/decryption device, a display device, or a video encoding/decoding device, and when sending the bus request to the system bus, the processor is further configured to:
invoke the first MM subsystem in the operating system using the at least one container to configure a device page table for the at least one other device and store the device page table in a memory in the storage, the device page table comprising the container ID; and
send a page table read instruction to the at least one other device using the first MM subsystem, the page table read instruction instructing a second MM subsystem in the at least one other device to read the device page table from the memory, and the second MM subsystem being comprised in device software of the at least one other device.
3. The computer of claim 1 , wherein the at least one other device is further configured to send, to the system bus, the bus request carrying the container ID and the hardware device ID, and the container ID in the bus request is read by a second MM subsystem from the memory.
4. The computer of claim 1 , wherein the processor is further configured to:
set, using the first MM subsystem in the operating system, page table attributes of all page tables in the operating system to using an application specific ID (ASID); and
divide each ASID bit sequence into a container ID sequence and a process ID sequence using the scheduling subsystem.
5. The computer of claim 4 , wherein the processor is further configured to instruct, using the scheduling subsystem, the first MM subsystem to set a container ID in an ASID corresponding to a process established in the at least one container to the container ID of the at least one container in which the process is located, and the ASID corresponding to the process being located in a process page table corresponding to the process.
6. The computer of claim 4 , wherein the processor is further configured to instruct, using the scheduling subsystem, the first MM subsystem to modify a container ID in an ASID corresponding to a migrated process of the at least one container to a container ID of a container to which the migrated process is migrated, and the ASID corresponding to the migrated process being located in a process page table corresponding to the migrated process.
7. The computer of claim 1 , wherein the processor is further configured to receive, using the scheduling subsystem, the QoS parameter of the at least one container for each hardware device set by a user, and write the QoS parameter to the bus management device using the scheduling subsystem.
8. A quality of service (QoS) control method, applied to a computer comprising a system bus, a processor, a storage, and at least one other device, the system bus comprising a bus management device, and the method comprising:
allocating, to at least one container of the computer, a container identity (ID) corresponding one-to-one to the at least one container;
sending a bus request carrying the container ID and a hardware device ID of a hardware device used by the at least one container indicated by the container ID to the system bus, the hardware device comprising a memory in the storage or the processor, and the bus request being sent to the system bus comprising sending, to the system bus using a first memory management (MM) subsystem in an operating system, the bus request carrying the container ID and the hardware device ID;
searching, according to the bus request, for a QoS parameter corresponding to both the container ID and the hardware device ID, the QoS parameter being stored in the bus management device; and
configuring, according to the found QoS parameter, a resource required when the at least one container corresponding to the QoS parameter uses the hardware device corresponding to the QoS parameter, the resource comprising at least one of bandwidth, a delay, or a priority.
9. The method of claim 8 , wherein the hardware device comprises the at least one other device, the at least one other device comprising at least one of a network device, an encryption/decryption device, a display device, or a video encoding/decoding device, and sending the bus request to the system bus comprising:
invoking the first MM subsystem in the operating system using the at least one container to configure a device page table for the at least one other device and store the device page table in a memory in the storage, the device page table comprising the container ID;
sending a page table read instruction to the at least one other device, the page table read instruction instructing a second MM subsystem in the at least one other device to read the device page table from the memory, the second MM subsystem being comprised in device software of the at least one other device; and
sending, by the at least one other device of the computer to the system bus, the bus request carrying the container ID and the hardware device ID, the container ID in the bus request being read by the second MM subsystem from the memory.
10. The method of claim 8 , wherein the operating system of the computer comprises a scheduling subsystem, the operating system being stored in the storage, and allocating the container ID comprising invoking the scheduling subsystem to allocate, to the at least one container, the container ID corresponding one-to-one to the at least one container.
11. The method of claim 10 , wherein before invoking the scheduling subsystem to allocate the container ID, the method further comprises:
setting, using the first MM subsystem in the operating system, page table attributes of all page tables in the operating system to using an application specific ID (ASID); and
dividing each ASID bit sequence into a container ID sequence and a process ID sequence using the scheduling subsystem.
12. The method of claim 11 , wherein after allocating the container ID, the method further comprises instructing, using the scheduling subsystem, the first MM subsystem to set a container ID in an ASID corresponding to a process established in the at least one container to the container ID of the at least one container in which the process is located, and the ASID corresponding to the process being located in a process page table corresponding to the process.
13. The method of claim 12 , wherein after allocating the container ID, the method further comprises instructing, using the scheduling subsystem, the first MM subsystem to modify a container ID in an ASID corresponding to a migrated process of the at least one container to a container ID of a container to which the migrated process is migrated, and the ASID corresponding to the migrated process being located in a process page table corresponding to the migrated process.
14. The method of claim 10 , wherein after allocating the container ID, the method further comprises receiving, using the scheduling subsystem, the QoS parameter of the at least one container for each hardware device set by a user, and writing the QoS parameter to the bus management device using the scheduling subsystem.
15. A non-transitory computer-readable storage medium comprising instructions, which when executed by a computer comprising a system bus, a processor, a storage, and at least one other device, cause the computer to execute a method that comprises:
allocating, to at least one container of the computer, a container identity (ID) corresponding one-to-one to the at least one container, the computer comprising an operating system stored in the storage, the operating system comprising a scheduling subsystem, and the container ID being allocated to the at least one container of the computer by invoking the scheduling subsystem to allocate, to the at least one container, the container ID corresponding one-to-one to the at least one container;
sending a bus request carrying the container ID and a hardware device ID of a hardware device used by the at least one container indicated by the container ID to the system bus;
searching, according to the bus request, for a quality of service (QoS) parameter corresponding to both the container ID and the hardware device ID, the QoS parameter being stored in a bus management device of the system bus; and
configuring, according to the found QoS parameter, a resource required when the at least one container corresponding to the QoS parameter uses the hardware device corresponding to the QoS parameter, the resource comprising at least one of bandwidth, a delay, or a priority.
16. The non-transitory computer-readable storage medium of claim 15 , wherein the hardware device comprises the at least one other device, the at least one other device comprising at least one of a network device, an encryption/decryption device, a display device, or a video encoding/decoding device, and sending the bus request to the system bus comprising:
invoking a first memory management (MM) subsystem in the operating system using the at least one container to configure a device page table for the at least one other device and store the device page table in a memory in the storage, the device page table comprising the container ID;
sending a page table read instruction to the at least one other device, the page table read instruction instructing a second MM subsystem in the at least one other device to read the device page table from the memory, and the second MM subsystem being comprised in device software of the at least one other device; and
sending, by the at least one other device of the computer to the system bus, the bus request carrying the container ID and the hardware device ID, the container ID in the bus request being read by the second MM subsystem from the memory.
17. The non-transitory computer-readable storage medium of claim 15 , wherein the hardware device comprises a memory in the storage or the processor, and sending the bus request to the system bus comprises sending, by the processor of the computer to the system bus using a first memory management (MM) subsystem in the operating system, the bus request carrying the container ID and the hardware device ID.
18. The non-transitory computer-readable storage medium of clad wherein before invoking the scheduling subsystem to allocate the container ID, the method further comprises:
setting, using a first memory management (MM) subsystem in the operating systet page table attributes of all page tables in the operating system to using an application specific ID (ASID); and
dividing each ASID bit sequence into a container ID sequence and a process ID sequence using the scheduling subsystem.
19. The computer of claim 1 , wherein the processor is further configured to receive, using the scheduling subsystem, the QoS parameter of the at least one container for a target hardware device set by the user, and write the QoS parameter to the bus management device using the scheduling subsystem, the target hardware device referring to a hardware device that the at least one container uses at frequency greater than a preset frequency threshold.
20. The method of claim 10 , wherein after allocating the container ID, the method further comprises receiving, using the scheduling subsystem, the QoS parameter of the at least one container for a target hardware device set by the user, and writing the QoS parameter to the bus management device using the scheduling subsystem, the target hardware device referring to a hardware device that the at least one container uses at frequency greater than a preset frequency threshold.