A multitasking method, device, processor and storage medium
By creating business threads, external strategy threads, and internal strategy threads, and dynamically adjusting the priority of business threads, the problem of high-priority business being unable to be processed in a timely manner and low-priority business waiting for a long time in emergency situations in existing technologies is solved, achieving high efficiency and stability in multi-task processing.
Patent Information
- Application Number
- CN202311451689.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-02
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2043-11-02
AI Technical Summary
Existing multitasking methods cannot handle high-priority tasks in a timely manner in emergency situations, or low-priority tasks cannot be executed for extended periods.
By creating business threads, external policy threads, and internal policy threads, the priority of business threads is dynamically adjusted. External policy threads are used to increase priority in emergency situations, and internal policy threads are used to adjust priority when queuing time is too long. Combined with load balancing algorithms and security authentication mechanisms, the efficiency and security of business processing are ensured.
It enables timely processing of high-priority tasks in emergency situations while avoiding long waiting times for low-priority tasks, thus improving the efficiency and stability of multitasking and ensuring the security of business processing and user experience.
Smart Images

Figure CN117850990B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and more specifically to a multitasking method, apparatus, processor, and storage medium. Background Technology
[0002] With the development of computers, the demand for multi-tasking concurrency scenarios is constantly increasing. There are two existing methods for multi-tasking: the first method, such as... Figure 1A As shown, all services have the same priority. A multi-tasking operating system is used to enable multiple services to be processed in parallel on a single channel. The order in which instructions and responses from different services are sent is not affected by the order of reception; responses that are processed first are sent first.
[0003] The second method, such as Figure 1B As shown, different priorities are set according to the characteristics of the business, and a multi-tasking operating system is used to enable multiple businesses to be processed in parallel on a single channel. The instruction response sending of different businesses is not affected by the receiving order. Businesses with higher priority are processed first, and completed responses are sent first.
[0004] For the first method, if an abnormal situation occurs in a certain business and requires emergency handling, it needs to wait in a queue, and can only be processed when the time slice is rotated to that business.
[0005] Regarding the second method, if high-priority services always have tasks to process, low-priority services will be unable to execute. Summary of the Invention
[0006] The purpose of this invention is to provide a multitasking method, apparatus, processor, and storage medium, which can solve or partially solve the problems existing in the prior art.
[0007] To achieve the above objectives, embodiments of the present invention provide a multi-task processing method, comprising: creating a business thread, an external strategy thread, and an internal strategy thread, wherein the business thread is used to execute business tasks, the external strategy thread is used to adjust the priority of the business tasks on the business thread to a first priority, the internal strategy thread is used to periodically adjust the priority of queued business tasks in the business thread to a second priority, and the priority of the external strategy thread, the priority of the internal strategy thread, the first priority, the second priority, and the default priority of the business tasks of the business thread are sequentially decreased; responding to an externally sent request to adjust the business priority, modifying the priority of a target business through the external strategy thread to adjust it to the first priority, and executing the corresponding business based on the modified priority, wherein the request to adjust the business priority includes the business number of the target business; and disabling the timer on the internal strategy thread through the external strategy thread.
[0008] Optionally, the method further includes: after the first priority service is completed, in response to an externally sent request to restore service priority, restoring the default priority of the target service through the external policy thread and starting the timer, wherein the externally sent request to restore service priority includes: the service number of the target service; when the timer duration reaches a preset duration, waking up the internal policy thread and using the internal policy thread to determine the queuing base value of each queued service through a balancing algorithm; identifying queued services with queuing base values greater than the corresponding queuing threshold as specific services; and modifying the priority of the specific service through the internal policy thread to adjust it to the second priority, and executing the corresponding service based on the modified priority.
[0009] Optionally, determining the queuing base value for each queuing service using the balancing algorithm via the internal strategy thread includes: determining the queuing base value for each queuing service based on the queuing waiting time, urgency level, and weight of each suspended instruction on each queuing service, wherein the weight of each suspended instruction is associated with the default priority of each queuing service.
[0010] Optionally, determining the queuing base value for each queuing service includes: based on the queuing waiting time T of the i-th suspension instruction on each queuing service. i Emergency Level i With weight i The following formula is used to determine the queuing base value Val for each queuing service.
[0011]
[0012] Where n is the total number of suspension instructions for each queuing service.
[0013] Optionally, the method further includes: during the execution of the specific service, updating the queuing base value of the specific service using a load balancing algorithm through the internal strategy thread; if the queuing base value of the specific service is less than or equal to the corresponding queuing threshold, restoring the default priority of the specific service through the internal strategy thread, and executing the corresponding service based on the restored priority; and suspending the internal strategy thread.
[0014] Optionally, the method further includes: establishing a strategy table, the strategy table including a service number for each service and service information associated with the service number; the service information including at least one of: whether modification is allowed, default priority information, and service ID information.
[0015] Optionally, the business information includes whether modification is allowed, and modifying the priority of the target business or the specific business includes: searching the policy table for whether modification is allowed based on the business number of the target business or the specific business; determining whether the priority of the target business or the specific business is allowed to be modified based on the whether modification is allowed information; and modifying the priority of the target business or the specific business when the priority is allowed to be modified.
[0016] Optionally, the step of modifying the priority of the target service through an external policy thread in response to an externally sent request to adjust the service priority includes: obtaining service authentication data with administrator privileges in response to the externally sent request to adjust the service priority, and performing security authentication on the service authentication data; and modifying the priority of the target service through the external policy thread after passing the security authentication.
[0017] Optionally, obtaining business authentication data through administrator privileges includes: encrypting a random number with administrator privileges to obtain business authentication data, wherein the random number is a combination of the current time and a set value.
[0018] Optionally, the policy table further includes: an administrator authentication root key; the business information includes business ID information; and the security authentication of the business authentication data includes: searching for the business ID information associated with the business number in the policy table based on the business number of the target business thread; distributing the administrator authentication root key using the business ID information to obtain a business authentication key; decrypting the business authentication data based on the business authentication key, and determining whether the decrypted data is consistent with the random number; if they are consistent, the security authentication is passed.
[0019] Optionally, restoring the default priority of the target service or the specific service includes: searching the policy table for modification permission information associated with the service number of the target service or the specific service; determining whether the priority of the target service or the specific service is allowed to be modified based on the modification permission information; and restoring the priority of the target service or the specific service to the default priority when the priority of the target service or the specific service is allowed to be modified.
[0020] Optionally, the service information includes default priority information. The step of responding to an externally sent request to restore service priority by restoring the default priority of the target service through the external policy thread includes: responding to an externally sent request to restore service priority by obtaining password manager authentication data through password manager permissions and performing security authentication on the password manager authentication data; and after passing the security authentication, restoring the priority of the target service to the default priority through the external policy thread.
[0021] Optionally, obtaining the password administrator authentication data through the password administrator's authority includes: encrypting a random number through the password administrator's authority to obtain the password administrator authentication data, wherein the random number is a combination of the current time and a set value.
[0022] Optionally, the policy table further includes: a cryptographic supervisor authentication key, and the security authentication of the cryptographic supervisor authentication data includes: decrypting the cryptographic supervisor authentication data based on the cryptographic supervisor authentication key, and determining whether the decrypted data is consistent with the random number; if they are consistent, the security authentication is passed.
[0023] Optionally, the step of responding to an externally sent request to restore service priority and restoring the default priority of the target service through the external policy thread includes: responding to an externally sent request to restore service priority, when the service number of the target service is a pre-set service number used to indicate one-click restoration of all service priorities, restoring the priority of all services to the default priority through the external policy thread.
[0024] Accordingly, embodiments of the present invention also provide a multi-task processing apparatus, comprising: a creation module for creating a business thread, an external strategy thread, and an internal strategy thread, wherein the business thread is used to execute business, the external strategy thread is used to adjust the priority of the business on the business thread to a first priority, the internal strategy thread is used to periodically adjust the priority of the queued business in the business thread to a second priority, and the priority of the external strategy thread, the priority of the internal strategy thread, the first priority, the second priority, and the default priority of the business on the business thread are sequentially decreased; a first adjustment module for responding to a request to adjust the business priority by modifying the priority of the target business through the external strategy thread to adjust it to the first priority, and executing the corresponding business based on the modified priority, wherein the request to adjust the business priority includes the business number of the target business; and a first processing module for disabling the timer on the internal strategy thread through the external strategy thread.
[0025] Optionally, the apparatus further includes: a second processing module, configured to, after the first priority service is completed, respond to an externally sent request to restore service priority, restore the default priority of the target service through the external policy thread and start the timer, wherein the externally sent request to restore service priority includes: the service number of the target service; a wake-up module, configured to, when the duration of the timer reaches a preset duration, wake up the internal policy thread and determine the queuing base value of each queuing service through the internal policy thread using a balancing algorithm; a determination module, configured to determine queuing services with queuing base values greater than the corresponding queuing threshold as specific services; and a second adjustment module, configured to modify the priority of the specific service through the internal policy thread to adjust it to the second priority, and execute the corresponding service based on the modified priority.
[0026] Optionally, determining the queuing base value for each queuing service using the balancing algorithm via the internal strategy thread includes: determining the queuing base value for each queuing service based on the queuing waiting time, urgency level, and weight of each suspended instruction on each queuing service, wherein the weight of each suspended instruction is associated with the default priority of each queuing service.
[0027] Optionally, determining the queuing base value for each queuing service includes: based on the queuing waiting time T of the i-th suspension instruction on each queuing service. i Emergency Level i With weight i The following formula is used to determine the queuing base value Val for each queuing service.
[0028]
[0029] Where n is the total number of suspension instructions for each queuing service.
[0030] Optionally, the apparatus further includes: an update module, configured to update the queuing base value of the specific service using a load balancing algorithm through the internal strategy thread during the execution of the specific service; a third adjustment module, configured to restore the default priority of the specific service through the internal strategy thread and execute the corresponding service based on the restored priority when the queuing base value of the specific service is less than or equal to the corresponding queuing threshold; and a suspension module, configured to suspend the internal strategy thread.
[0031] Optionally, the first module is further configured to establish a policy table, which includes a service number for each service and service information associated with the service number; the service information includes at least one of: whether modification is allowed, default priority information, and service ID information.
[0032] Optionally, the business information includes whether modification is allowed, and modifying the priority of the target business or the specific business includes: searching the policy table for whether modification is allowed based on the business number of the target business or the specific business; determining whether the priority of the target business or the specific business is allowed to be modified based on the whether modification is allowed information; and modifying the priority of the target business or the specific business when the priority is allowed to be modified.
[0033] Optionally, the step of modifying the priority of the target service through an external policy thread in response to an externally sent request to adjust service priority includes: obtaining service authentication data with administrator privileges in response to the externally sent request to adjust service priority, and performing security authentication on the service authentication data; and modifying the priority of the target service through the external policy thread after passing the security authentication.
[0034] Optionally, obtaining business authentication data through administrator privileges includes: encrypting a random number with administrator privileges to obtain business authentication data, wherein the random number is a combination of the current time and a set value.
[0035] Optionally, the policy table further includes: an administrator authentication root key; the business information includes business ID information; and the security authentication of the business authentication data includes: searching for the business ID information associated with the business number in the policy table based on the business number of the target business thread; distributing the administrator authentication root key using the business ID information to obtain a business authentication key; decrypting the business authentication data based on the business authentication key, and determining whether the decrypted data is consistent with the random number; if they are consistent, the security authentication is passed.
[0036] Optionally, restoring the default priority of the target service or the specific service includes: searching the policy table for modification permission information associated with the service number of the target service or the specific service; determining whether the priority of the target service or the specific service is allowed to be modified based on the modification permission information; and restoring the priority of the target service or the specific service to the default priority when the priority of the target service or the specific service is allowed to be modified.
[0037] Optionally, the service information includes default priority information. The step of responding to an externally sent request to restore service priority by restoring the default priority of the target service through the external policy thread includes: responding to an externally sent request to restore service priority by obtaining password manager authentication data through password manager permissions and performing security authentication on the password manager authentication data; and after passing the security authentication, restoring the priority of the target service to the default priority through the external policy thread.
[0038] Optionally, obtaining the password administrator authentication data through the password administrator's authority includes: encrypting a random number through the password administrator's authority to obtain the password administrator authentication data, wherein the random number is a combination of the current time and a set value.
[0039] Optionally, the policy table further includes: a cryptographic supervisor authentication key, and the security authentication of the cryptographic supervisor authentication data includes: decrypting the cryptographic supervisor authentication data based on the cryptographic supervisor authentication key, and determining whether the decrypted data is consistent with the random number; if they are consistent, the security authentication is passed.
[0040] Optionally, the step of responding to an externally sent request to restore service priority and restoring the default priority of the target service through the external policy thread includes: responding to an externally sent request to restore service priority, when the service number of the target service is a pre-set service number used to indicate one-click restoration of all service priorities, restoring the priority of all services to the default priority through the external policy thread.
[0041] Accordingly, embodiments of the present invention also provide a machine-readable storage medium storing instructions that cause a machine to execute the multitasking method described in this application.
[0042] Accordingly, embodiments of the present invention also provide a processor, characterized in that it is used to run a program, wherein the program is run to execute the multitasking method described above.
[0043] The multitasking method provided in this embodiment of the invention first creates a business thread and a strategy thread, and then, in response to an external request to adjust the priority of the business thread, adjusts the priority of the business thread through the strategy thread. This allows the priority of the business to be dynamically adjusted according to business needs and emergency situations, thereby improving the processing efficiency of the business.
[0044] Other features and advantages of the embodiments of the present invention will be described in detail in the following detailed description section. Attached Figure Description
[0045] The accompanying drawings are provided to further illustrate embodiments of the present invention and form part of the specification. They are used together with the following detailed description to explain the embodiments of the present invention, but do not constitute a limitation thereof. In the drawings:
[0046] Figure 1A This is a schematic diagram of a multitasking method provided by existing technology;
[0047] Figure 1B This is a schematic diagram of a multitasking method provided by existing technology;
[0048] Figure 2A This is an example of an applicable scenario for the multi-task processing method provided in the embodiments of the present invention;
[0049] Figure 2B This is an example of an applicable scenario for the multi-task processing method provided in the embodiments of the present invention;
[0050] Figure 3 This is a flowchart of the multi-task processing method provided in the embodiments of the present invention;
[0051] Figure 4 This is a flowchart of a multi-task processing method provided in a specific embodiment of the present invention;
[0052] Figure 5 This is a flowchart of a multi-task processing method provided in a specific embodiment of the present invention;
[0053] Figure 6 This is a flowchart of a multi-task processing method provided in a specific embodiment of the present invention;
[0054] Figure 7 This is a flowchart of a multi-task processing method provided in a specific embodiment of the present invention;
[0055] Figure 8 This is a flowchart of a multi-task processing method provided in a specific embodiment of the present invention;
[0056] Figure 9 This is a flowchart of a multi-task processing method provided in a specific embodiment of the present invention;
[0057] Figure 10 This is a flowchart of a multi-task processing method provided in a specific embodiment of the present invention;
[0058] Figure 11 This is a flowchart of a multi-task processing method provided in a specific embodiment of the present invention; and
[0059] Figure 12 This is a structural diagram of the multitasking processing device provided in an embodiment of the present invention. Detailed Implementation
[0060] The specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustration and explanation only and are not intended to limit the scope of the present invention.
[0061] Figure 3 This is a flowchart of a multi-task processing method provided in an embodiment of the present invention;
[0062] like Figure 3 As shown, the multitasking method includes:
[0063] S310: Create a business thread, an external strategy thread, and an internal strategy thread, wherein the business thread is used to execute business, the external strategy thread is used to adjust the priority of the business on the business thread to the first priority, the internal strategy thread is used to periodically adjust the priority of the queued business in the business thread to the second priority, and the priority of the external strategy thread, the priority of the internal strategy thread, the first priority, the second priority, and the default priority of the business thread decrease sequentially.
[0064] S320: In response to an externally sent request to adjust service priority, the priority of the target service is modified by the external policy thread to be adjusted to the first priority, and the corresponding service is executed based on the modified priority, wherein the request to adjust service priority includes the service number of the target service thread;
[0065] S330: The timer on the internal strategy thread is turned off by the external strategy thread.
[0066] The business thread can be a single thread or multiple business threads. Each business thread is used to execute the same type of business, while the multiple business threads are used to execute different types of business.
[0067] The external strategy thread is used to adjust the priority of the business threads; the internal strategy thread is used to periodically adjust the priority of the queued business threads. The external strategy thread can be set to have the highest priority, and the internal strategy thread can be set to have the second highest priority: when a business needs urgent processing, the external strategy thread can dynamically adjust the priority of the business thread processing that business, thus allowing urgent business to be processed first; when a low-priority business has been queued for a long time without execution, if it is determined that the business exceeds the queuing threshold, the internal strategy thread dynamically adjusts and increases the priority of the business thread processing that business.
[0068] like Figure 2AAs shown, the power distribution network mainly includes three types of equipment: distribution sensing equipment (including photoelectric sensors, data sensors, and other sensing devices), marketing equipment (including smart meters, bidirectional metering meters, and other marketing equipment), and user equipment (including distributed photovoltaic systems, charging piles, etc.). The multi-task platform supports the entire business process for marketing equipment and distribution sensing equipment. Correspondingly, as... Figure 2B As shown, the services corresponding to the power distribution network include: power distribution sensing services, marketing services, and user services.
[0069] For example, in a power distribution network, business 1 (e.g., marketing business) is handled by business thread 1 (e.g., all business on thread 1 has a priority of "6"), business 2 (e.g., user business) is handled by business thread 2 (e.g., all business on thread 2 has a priority of "5"), and business 3 (e.g., power distribution sensing business) is handled by business thread 3 (e.g., all business on thread 3 has a priority of "4"). The external strategy thread has a priority of "10", and the internal strategy thread has a priority of "9". When business 3 requires urgent processing (e.g., when a large amount of smoke suddenly appears, the data collected by the smoke sensor needs to be processed urgently), the external strategy thread can be used to adjust the priority of business thread 3 (e.g., power distribution sensing business) to "8", thereby giving business 3 priority processing; at the same time, the external strategy thread can be used to disable the timer on the internal strategy thread to stop the timer from counting.
[0070] Unless otherwise specified, this document will use the specific examples above to illustrate other content. Of course, the priorities of the three business threads or the priorities of each business function on each business thread (for example, the priority of ordinary user services on business thread 2 is low; the priority of VIP user services is high) can be reasonably set according to the actual situation. For clarity, in this embodiment of the invention, the priorities of the services on each thread are set to the same.
[0071] For example, in a power distribution network, business 1 (e.g., marketing business) is handled by business thread 1 (e.g., all business operations on thread 1 have a priority of "6"), business 2 (e.g., user business) is handled by business thread 2 (e.g., all business operations on thread 2 have a priority of "6"), and business 3 (e.g., power distribution sensing business) is handled by business thread 3 (e.g., all business operations on thread 3 have a priority of "6"), where all business operations have the same priority; the external strategy thread has a priority of "10", and the internal strategy thread has a priority of "9". When business 3 requires urgent processing (e.g., when a large amount of smoke suddenly appears, the data collected by the smoke sensor needs to be processed urgently), the external strategy thread can be used to adjust the priority of business thread 3 (e.g., power distribution sensing business) to "8", thereby giving business 3 priority processing; at the same time, the external strategy thread can be used to disable the timer on the internal strategy thread to control the timer to stop counting.
[0072] If a fire or power outage occurs in the power distribution sensing business and emergency handling is required, waiting for time slices to be executed or for high-priority tasks to be completed before execution can result in serious economic losses due to the inability to handle the situation in a timely manner.
[0073] If a user attempts to pay for charging (i.e., recharge) after a power outage, and the marketing department remains in a processing state, the user will be left without power for an extended period because the marketing department cannot respond to the user's recharge request.
[0074] In some optional implementations, step S320, in response to an externally sent request to adjust service priority, modifies the priority of the target service through the external policy thread, and may include:
[0075] 1) Determine whether the priority of the service can be modified. If the priority of the service can be modified, modify the priority of the service thread through the strategy thread. If the priority of the service cannot be modified, do not perform the priority modification operation.
[0076] 2) Perform security authentication on the process of modifying the priority of the business thread. If the security authentication is successful, modify the priority of the business thread through the policy thread; otherwise, do not perform the priority modification operation.
[0077] It should be noted that step S320 can be implemented using either 1 or 2, or by any combination of the two. For example, 1 and 2 can be combined: first, it is determined whether the priority of the service is allowed to be modified. If the priority of the service is allowed to be modified, then security authentication is performed on the process of modifying the priority of the service thread. After the security authentication is passed, the priority of the service thread is modified through the policy thread; otherwise, the priority modification operation is not performed.
[0078] In this embodiment of the invention, business threads are divided into threads whose priorities can be modified and threads whose priorities cannot be modified. When a certain business needs to be processed urgently, the priority of the business thread can be modified through an external policy thread to improve the efficiency of business execution. Furthermore, before the external policy thread modifies the priority of the business thread, a modification verification is performed. If the business is allowed to be modified, the priority of the business thread is then modified through the external policy thread, thereby ensuring the security and stability of business execution. Furthermore, this embodiment of the invention also proposes an administrator role (administrator privileges). Using the administrator role, one can obtain security permissions for the corresponding business and perform security authentication before the external policy thread modifies the priority of the business thread, thereby preventing the business priority from being maliciously modified.
[0079] The implementation methods 1 and 2 of step S320 will be described below.
[0080] Before step S320, a policy table can be established, which includes a service number for each service and service information associated with the service number; the service information includes at least one of: whether modification is allowed, default priority information, and service ID information.
[0081] In some optional implementations, step S320, in response to an externally sent request to adjust service priority, modifies the priority of the target service through the external policy thread, and may include:
[0082] Based on the service number of the target service, find the information in the policy table related to whether modification is allowed;
[0083] Based on the information regarding whether modification is permitted, determine whether the priority of the target service is allowed to be modified.
[0084] When the priority of the target service can be modified, the priority of the target service is modified.
[0085] In some optional implementations, step S320, in response to an externally sent request to adjust service priority, modifies the priority of the target service through the external policy thread, and may include:
[0086] In response to an externally sent request to adjust service priority, the system obtains service authentication data with administrator privileges and performs security authentication on the service authentication data; and
[0087] After security authentication, the priority of the target service is modified through the external policy thread.
[0088] The step of obtaining business authentication data through administrator privileges may include: encrypting a random number with administrator privileges to obtain business authentication data, wherein the random number is a combination of the current time and a set value;
[0089] The policy table may include: an administrator authentication root key, and the business information includes business ID information; the security authentication of the business authentication data may include: searching for the business ID information associated with the business number in the policy table based on the business number of the target business thread; distributing the administrator authentication root key using the business ID information to obtain a business authentication key; decrypting the business authentication data based on the business authentication key, and determining whether the decrypted data is consistent with the random number; if they are consistent, the security authentication is passed.
[0090] For example, administrators can obtain the current system time, such as 20230712091847, and append 8000000000 to the end of the time to form a 16-byte data M (M is stored by both the system and the administrator, and expires after one use). The business authentication key is used to perform SM1-ECB encryption on M to obtain business authentication data C, and the business number, business authentication data C, and modification priority are sent to the system. The system looks up the business ID using the business number, and uses the business ID to distribute the administrator's authentication root key to obtain the business authentication key. The system uses the distributed business authentication key to perform SM1-ECB decryption on the business authentication data C to obtain a 16-byte plaintext M2. The system compares M2 with M; if they match, the security authentication is successful; otherwise, an error status code is returned, and finally, M is invalidated.
[0091] In the preferred embodiment, step S320, in response to an externally sent request to adjust service priority, modifies the priority of the target service through the external policy thread, and may include:
[0092] In response to an externally sent request to adjust service priority, the following operations are performed through the policy thread:
[0093] Based on the business number of the target business thread, search the policy table for whether modification is allowed and associated with the business number;
[0094] Based on whether the modification information is allowed, determine whether the priority of the service can be modified.
[0095] When the priority of the service can be modified, the service authentication data is obtained with administrator privileges, and the service authentication data is then subjected to security authentication.
[0096] After passing security authentication, the priority of the target service is modified.
[0097] In one embodiment, the method further includes: after the first priority service is completed, in response to an externally sent request to restore service priority, restoring the default priority of the target service through the external policy thread and starting the timer, wherein the externally sent request to restore service priority includes: the service number of the target service; when the duration of the timer reaches a preset duration, waking up the internal policy thread and using the internal policy thread to determine the queuing base value of each queued service through a balancing algorithm; identifying queued services with queuing base values greater than the corresponding queuing threshold as specific services; and modifying the priority of the specific services through the internal policy thread to adjust them to the second priority, and executing the corresponding service based on the modified priority.
[0098] Specifically, determining the queuing base value for each queuing service using the balancing algorithm through the internal strategy thread includes: determining the queuing base value for each queuing service based on the queuing waiting time, urgency level, and weight of each suspended instruction on each queuing service, wherein the weight of each suspended instruction is associated with the default priority of each queuing service.
[0099] The step of determining the queuing base value for each queuing service includes: based on the queuing waiting time T of the i-th suspension instruction on each queuing service. i Emergency Level i With weight i The following formula is used to determine the queuing base value Val for each queuing service.
[0100]
[0101] Where n is the total number of suspension instructions for each queuing service.
[0102] Urgent i The urgency level of a pending instruction within a specific service is determined by analyzing the instruction data received by that service. The urgency level of each instruction within the same service can differ, with 0 representing a non-urgent instruction and values ranging from 1 to 10, where higher values indicate greater urgency. Having multiple pending instructions with an urgency level of 0 within a service will not affect the queuing base value.
[0103] Weight i Weight: The higher the default priority of a business function, the greater its weight.
[0104] Threshold: The queuing threshold for a certain service, stored in the strategy table.
[0105] If the queued service is a recharge service for an electricity user, the suspension instruction can include: recharge instruction for user A, recharge instruction for user B, recharge service for user C, and so on.
[0106] For example, after all services of the first priority (e.g., priority "9") have been completed, in response to an external request to restore service priority, the default priority of the target service can be restored through the external policy thread, and a timer can be started. When handling emergency situations, a series of instruction flows need to be executed together, so the system cannot determine the completion point of an emergency based on the completion of a single instruction; external judgment is required based on the situation. When the external supervisor determines that the emergency handling of the service has been completed, the default service priority is restored. Once the timer's accumulated duration reaches a preset duration (e.g., 1 minute), (e.g., through the external policy thread) the internal policy thread is awakened, and the internal policy thread calculates the queuing base value Val for each queued service (e.g., electricity user recharge service, electricity user meter lookup service, etc.) using the formula described above. If the queuing base value of a user's recharge service is greater than the corresponding queuing threshold, the user's recharge service is identified as a specific service, and the priority of this service is modified to "7" through the internal policy thread. Then, the corresponding service is executed based on the modified priority.
[0107] The step of modifying the priority of the specific service through the internal policy thread includes: searching the policy table for modification permission information associated with the service number of the specific service; determining whether the priority of the specific service is allowed to be modified based on the modification permission information; and modifying the priority of the specific service when the priority of the specific service is allowed to be modified.
[0108] For details on the process of modifying the priority of the specific service, please refer to the above description of the process of modifying the priority of the target service, which will not be repeated here.
[0109] If a low-priority user's service is being processed while a high-priority user's service (such as a VIP) is processing a complex service and remains in a processing state, the low-priority user's request cannot be responded to. As a result, the low-priority user will continue to queue, causing the number of low-priority users in the queue to increase over time, leading to a poor user experience.
[0110] If the data collected by the power distribution sensing business is queued and waiting to be reported, and the marketing or user business is in a continuous processing state, the collected data will be unable to be reported, and the collected data will accumulate, which may cause an overflow.
[0111] In one embodiment, the method further includes: during the execution of the specific service, updating the queuing base value of the specific service using a load balancing algorithm through the internal strategy thread; if the queuing base value of the specific service is less than or equal to the queuing threshold, restoring the default priority of the specific service through the internal strategy thread, and executing the corresponding service based on the restored priority; and suspending the internal strategy thread.
[0112] In other words, as the suspension command in a specific service is processed, the queuing base value of the specific service (electricity user recharge service) is also continuously updated. The queuing base value of the specific service is updated in real time using the formula above. If the updated queuing base value of the specific service is less than or equal to the corresponding queuing threshold, the default priority of the specific service (e.g., "5") is restored through the internal strategy thread, and the corresponding service is executed based on the restored priority. At the same time, the internal strategy thread can be suspended.
[0113] The process of restoring the default priority of the specific service includes: searching the policy table for information on whether modification is allowed based on the service number of the specific service; determining whether the priority of the specific service is allowed to be modified based on the information on whether modification is allowed; and restoring the priority of the specific service to the default priority when the priority of the specific service is allowed to be modified.
[0114] For details on the process of restoring the priority of the specific service, please refer to the detailed description of the process of restoring the priority of the target service below, which will not be repeated here.
[0115] Furthermore, the multi-task processing method provided in this embodiment of the invention may further include a method for the strategy thread to restore the default priority of the business thread, the method further including:
[0116] S310: Create business threads, external strategy threads, and internal strategy threads;
[0117] S320: In response to an externally sent request to adjust service priority, the priority of the target service is modified through the external policy thread to adjust it to the first priority, and the corresponding service is executed based on the modified priority;
[0118] S330: In response to an externally sent request to restore service priority, restore the default priority of the target service through the external policy thread, and execute the corresponding service based on the restored priority.
[0119] The externally sent service priority request includes the service number of the target service.
[0120] Step S330, in response to an externally sent request to restore service priority, restores the priority of the target service through the policy thread, and may include:
[0121] 1) Determine whether the priority of the service can be modified. If the priority of the service can be modified, restore the priority of the service to the default priority through the strategy thread; otherwise, do not perform the priority restoration operation.
[0122] 2) Perform security authentication on the process of restoring the priority of the target service. When the security authentication is passed, restore the priority of the target service to the default priority through the policy thread. Otherwise, do not perform the priority restoration operation.
[0123] It should be noted that step S330 can be implemented using either 1 or 2, or a combination of both. For example, 1 and 2 can be combined: first, it is determined whether the priority of the service is allowed to be modified. If the priority of the service is allowed to be modified, then security authentication is performed on the process of restoring the priority of the service thread. If the security authentication is passed, the priority of the service thread is restored to the default priority through the policy thread; otherwise, the priority restoration operation is not performed.
[0124] This invention proposes a password supervisor role (password supervisor permissions). Before restoring the default priority of a business thread, it is necessary to pass the password supervisor role's permission authentication. Only after successful authentication can the default priority of the business be restored, thereby preventing the business priority from being maliciously modified and restored.
[0125] The following describes implementation methods 1 and 2 respectively.
[0126] In some optional implementations, step S330, in response to an externally sent request to restore service priority, restores the priority of the target service through the policy thread, and may include:
[0127] In response to an externally sent request to restore service priority, the following operations are performed through the policy thread:
[0128] Based on the service number of the target service, find the information in the policy table related to whether modification is allowed;
[0129] Based on the information regarding whether modification is permitted, determine whether the priority of the target service is allowed to be modified.
[0130] When the priority of the target service can be modified, the priority of the target service is restored to the default priority.
[0131] In some optional implementations, step S330, in response to an externally sent request to restore service priority, restores the default priority of the target service through the external policy thread, and may include:
[0132] In response to an externally sent request to restore service priority, the system obtains password administrator authentication data through password administrator privileges and performs security authentication on the password administrator authentication data; and
[0133] After security authentication, the priority of the target service is restored to the default priority through the external policy thread.
[0134] The step of obtaining password administrator authentication data through password administrator privileges includes: encrypting a random number through password administrator privileges to obtain password administrator authentication data, wherein the random number is a combination of the current time and a set value;
[0135] The policy table includes: a cryptographic supervisor authentication key. The security authentication of the cryptographic supervisor authentication data includes: decrypting the cryptographic supervisor authentication data based on the cryptographic supervisor authentication key, and determining whether the decrypted data is consistent with the random number. If they are consistent, the security authentication is passed.
[0136] For example, the system's current time, such as 20230712091847, is obtained through the password administrator's authorization. The time is padded with 8000000000 to form a 16-byte data M (stored by both the system and the password administrator; M expires after one use). The password administrator's authentication key is used to perform SM1-ECB encryption on M to obtain the password administrator's authentication data C. The password administrator then sends the business number and the authentication data C to the system. The system uses the password administrator's authentication key to perform SM1-ECB decryption on the input ciphertext C to obtain a 16-byte plaintext M2. The system compares M2 with M; if they match, authentication is successful; otherwise, an error status code is returned, and M is finally invalidated.
[0137] In the preferred embodiment, step S330, in response to an externally sent request to restore service priority, restores the default priority of the target service through the policy thread, and may include:
[0138] In response to an externally sent request to restore service priority, the following operations are performed through the policy thread:
[0139] Based on the service number of the target service, search the policy table for whether modification is allowed and associated with the service number;
[0140] Based on the information regarding whether modification is permitted, determine whether the priority of the target service is allowed to be modified.
[0141] When the priority of the target service can be modified, the password administrator authentication data is obtained through the password administrator's authority, and the password administrator authentication data is then subjected to security authentication; and
[0142] After security authentication, the priority of the target service is restored to the default priority through the external policy thread.
[0143] In some optional implementations, step S330, in response to an externally sent request to restore service priority, restores the default priority of the target service through the policy thread, and may further include:
[0144] In response to an externally sent request to adjust service priorities, when the service number of the target service is a pre-set service number used to indicate one-click restoration of all service priorities, the priority of all services is restored to the default priority through the external policy thread.
[0145] The embodiments of the present invention will be described below with reference to specific examples.
[0146] In one specific embodiment, a strategy table is first established, as shown in Table 1:
[0147] Table 1
[0148]
[0149] Furthermore, the main thread creates strategy threads (including external and internal strategy threads) and business threads, and suspends these threads after creation, waiting for resources to be available (e.g., ...). Figure 4 (as shown);
[0150] Furthermore, upon receiving business instruction data, the business instruction processing thread is invoked based on the instruction's business number (e.g., ...). Figure 5 (as shown);
[0151] Furthermore, based on the schedule, business processes are executed (such as...). Figure 6 (as shown);
[0152] Furthermore, upon receiving an external request to dynamically adjust the priority of a certain service, the external policy thread is invoked. The input data to the system includes the service number whose priority needs to be modified and the service authentication data. The external policy thread first searches the policy table using the service number to find the service information, determines whether the service's priority can be modified, and if so, performs security authentication using the service authentication data. After successful authentication, the timer is closed. Then, the priority of the service is dynamically adjusted (e.g., ...). Figure 7 (as shown);
[0153] Furthermore, based on the schedule, the business process is re-executed;
[0154] Furthermore, upon receiving an external request to restore the default priority of a certain service, the external policy thread is invoked. The input data to the system consists of the service number whose priority needs to be modified and the password administrator authentication data. The external policy thread first searches the policy table using the service number to find the service information, determines whether the service's priority can be modified, and if so, performs security authentication using the password administrator authentication data. Upon successful authentication, a timer is started. The default priority of the service is then restored (e.g., ...). Figure 8 (as shown);
[0155] Furthermore, based on the schedule, the business process is re-executed;
[0156] Furthermore, when the timer expires, the internal policy thread is invoked. The internal policy thread first looks up the policy table using the service number to find the service information, determines whether the service's priority can be modified, and if modification is allowed, calculates the service's queuing base value according to the balancing algorithm and compares it with the corresponding threshold. If it is greater than the corresponding threshold, the service's priority is modified (e.g., ...). Figure 9 (as shown);
[0157] Furthermore, based on the schedule, the business process is re-executed;
[0158] Furthermore, during the execution of business processing, the queuing baseline value for that business is calculated and compared with the corresponding threshold. If it is less than the corresponding threshold, the default priority of that business is restored (e.g., ...). Figure 10 (As shown).
[0159] Furthermore, based on the schedule, the business process is re-executed.
[0160] Figure 11 This is a flowchart of a multi-task processing method provided in an embodiment of the present invention. The embodiment of the present invention introduces a multi-task operating system to realize parallel processing of multiple services, which can enable multiple services to run simultaneously and improve the overall system efficiency. Through the strategy thread, the priority of services can be dynamically adjusted according to service needs and emergency situations, thereby improving service processing efficiency. At the same time, a security mechanism is introduced to prevent brute-force modification of service priorities. When an emergency situation of a service is resolved, the password manager can restore the priority of that service through the security mechanism to prevent a certain service from constantly occupying high priority and monopolizing resources.
[0161] In the above embodiments, a policy table is configured for the external policy thread and the internal policy thread; of course, depending on the actual situation, a policy table (i.e., an external policy table and an internal policy table) can be configured for the external policy thread and the internal policy thread respectively.
[0162] In summary, the external strategy thread handles emergency situations requiring immediate intervention, while the internal strategy thread addresses issues caused by excessively long service queues. All service priorities adjusted by the external strategy thread are higher than those adjusted by the internal strategy thread. When an external strategy thread adjusts a service priority, if the currently running thread is triggered by the internal strategy thread, the service thread is switched directly. If the service thread switched by the external strategy thread is already running, the internal strategy thread will not be triggered until the service execution is complete or the default priority is restored, at which point the internal strategy thread will be awakened and resume operation.
[0163] Accordingly, embodiments of the present invention also provide a multitasking processing device, such as... Figure 12 As shown, the device includes: a creation module 10, used to create a business thread, an external strategy thread, and an internal strategy thread. The business thread is used to execute business operations. The external strategy thread is used to adjust the priority of the business operations on the business thread to a first priority. The internal strategy thread is used to periodically adjust the priority of the queued business operations in the business thread to a second priority. The priority of the external strategy thread, the priority of the internal strategy thread, the first priority, the second priority, and the default priority of the business operations of the business thread are sequentially decreased. A first adjustment module 20 is used to respond to a request to adjust the business priority by modifying the priority of the target business through the external strategy thread to adjust it to the first priority, and executing the corresponding business based on the modified priority. The request to adjust the business priority includes the business number of the target business. A first processing module 30 is used to disable the timer on the internal strategy thread through the external strategy thread.
[0164] Optionally, the apparatus further includes: a second processing module, configured to, after the first priority service is completed, respond to an externally sent request to restore service priority, restore the default priority of the target service through the external policy thread and start the timer, wherein the externally sent request to restore service priority includes: the service number of the target service; a wake-up module, configured to, when the duration of the timer reaches a preset duration, wake up the internal policy thread and determine the queuing base value of each queuing service through the internal policy thread using a balancing algorithm; a determination module, configured to determine queuing services with queuing base values greater than the corresponding queuing threshold as specific services; and a second adjustment module, configured to modify the priority of the specific service through the internal policy thread to adjust it to the second priority, and execute the corresponding service based on the modified priority.
[0165] Optionally, determining the queuing base value for each queuing service using the balancing algorithm via the internal strategy thread includes: determining the queuing base value for each queuing service based on the queuing waiting time, urgency level, and weight of each suspended instruction on each queuing service, wherein the weight of each suspended instruction is associated with the default priority of each queuing service.
[0166] Optionally, determining the queuing base value for each queuing service includes: based on the queuing waiting time T of the i-th suspension instruction on each queuing service. i Emergency Level i With weight i The following formula is used to determine the queuing base value Val for each queuing service.
[0167]
[0168] Where n is the total number of suspension instructions for each queuing service.
[0169] Optionally, the apparatus further includes: an update module, configured to update the queuing base value of the specific service using a load balancing algorithm through the internal strategy thread during the execution of the specific service; a third adjustment module, configured to restore the default priority of the specific service through the internal strategy thread and execute the corresponding service based on the restored priority when the queuing base value of the specific service is less than or equal to the corresponding queuing threshold; and a suspension module, configured to suspend the internal strategy thread.
[0170] Optionally, the first module is further configured to establish a policy table, which includes a service number for each service and service information associated with the service number; the service information includes at least one of: whether modification is allowed, default priority information, and service ID information.
[0171] Optionally, the business information includes whether modification is allowed, and modifying the priority of the target business or the specific business includes: searching the policy table for whether modification is allowed based on the business number of the target business or the specific business; determining whether the priority of the target business or the specific business is allowed to be modified based on the whether modification is allowed information; and modifying the priority of the target business or the specific business when the priority is allowed to be modified.
[0172] Optionally, the step of modifying the priority of the target service through an external policy thread in response to an externally sent request to adjust service priority includes: obtaining service authentication data with administrator privileges in response to the externally sent request to adjust service priority, and performing security authentication on the service authentication data; and modifying the priority of the target service through the external policy thread after passing the security authentication.
[0173] Optionally, obtaining business authentication data through administrator privileges includes: encrypting a random number with administrator privileges to obtain business authentication data, wherein the random number is a combination of the current time and a set value.
[0174] Optionally, the policy table further includes: an administrator authentication root key; the business information includes business ID information; and the security authentication of the business authentication data includes: searching for the business ID information associated with the business number in the policy table based on the business number of the target business thread; distributing the administrator authentication root key using the business ID information to obtain a business authentication key; decrypting the business authentication data based on the business authentication key, and determining whether the decrypted data is consistent with the random number; if they are consistent, the security authentication is passed.
[0175] Optionally, restoring the default priority of the target service or the specific service includes: searching the policy table for modification permission information associated with the service number of the target service or the specific service; determining whether the priority of the target service or the specific service is allowed to be modified based on the modification permission information; and restoring the priority of the target service or the specific service to the default priority when the priority of the target service or the specific service is allowed to be modified.
[0176] Optionally, the service information includes default priority information. The step of responding to an externally sent request to restore service priority by restoring the default priority of the target service through the external policy thread includes: responding to an externally sent request to restore service priority by obtaining password manager authentication data through password manager permissions and performing security authentication on the password manager authentication data; and after passing the security authentication, restoring the priority of the target service to the default priority through the external policy thread.
[0177] Optionally, obtaining the password administrator authentication data through the password administrator's authority includes: encrypting a random number through the password administrator's authority to obtain the password administrator authentication data, wherein the random number is a combination of the current time and a set value.
[0178] Optionally, the policy table further includes: a cryptographic supervisor authentication key, and the security authentication of the cryptographic supervisor authentication data includes: decrypting the cryptographic supervisor authentication data based on the cryptographic supervisor authentication key, and determining whether the decrypted data is consistent with the random number; if they are consistent, the security authentication is passed.
[0179] Optionally, the step of responding to an externally sent request to restore service priority and restoring the default priority of the target service through the external policy thread includes: responding to an externally sent request to restore service priority, when the service number of the target service is a pre-set service number used to indicate one-click restoration of all service priorities, restoring the priority of all services to the default priority through the external policy thread.
[0180] Accordingly, embodiments of the present invention also provide a machine-readable storage medium storing instructions that cause a machine to execute the multitasking method described in this application.
[0181] Accordingly, embodiments of the present invention also provide a processor, characterized in that it is used to run a program, wherein the program is run to execute the multitasking method described above.
[0182] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0183] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in one or more flowchart illustrations and / or one or more block diagrams.
[0184] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means that implement the functions specified in one or more flowcharts and / or one or more block diagrams.
[0185] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable apparatus, provide steps for implementing the functions specified in one or more flowcharts and / or one or more block diagrams.
[0186] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0187] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0188] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0189] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0190] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A multi-task processing method, characterized in that, The method includes: Create a business thread, an external strategy thread, and an internal strategy thread. The business thread is used to execute business operations. The external strategy thread is used to adjust the priority of the business operations on the business thread to a first priority. The internal strategy thread is used to periodically adjust the priority of the queued business operations in the business thread to a second priority. The priority of the external strategy thread, the priority of the internal strategy thread, the first priority, the second priority, and the default priority of the business operations of the business thread are sequentially decreased. In response to an externally sent request to adjust service priority, the priority of the target service is modified through the external policy thread to be adjusted to the first priority, and the corresponding service is executed based on the modified priority. The request to adjust service priority includes the service number of the target service. The timer on the internal strategy thread is disabled via the external strategy thread; The method further includes: after the first priority service is completed, in response to an externally sent request to restore service priority, restoring the default priority of the target service through the external policy thread and starting the timer, wherein the externally sent request to restore service priority includes: the service number of the target service.
2. The multi-task processing method according to claim 1, characterized in that, The method further includes: When the timer reaches the preset duration, the internal strategy thread is woken up and a queuing base value for each queuing service is determined by the internal strategy thread using a balancing algorithm. Queuing services with a queuing baseline value greater than the corresponding queuing threshold are identified as specific services; and The internal strategy thread modifies the priority of the specific service to the second priority, and executes the corresponding service based on the modified priority.
3. The multi-task processing method according to claim 2, characterized in that, The step of determining the queuing base value for each queuing service using the balancing algorithm through the internal strategy thread includes: determining the queuing base value for each queuing service based on the queuing waiting time, urgency level, and weight of each suspended instruction on each queuing service, wherein the weight of each suspended instruction is associated with the default priority of each queuing service.
4. The multi-task processing method according to claim 3, characterized in that, Determining the queuing base value for each queuing service includes: Based on the queuing waiting time T of the i-th suspension instruction on each queuing service i Emergency Level i With weight The following formula is used to determine the queuing base value Val for each queuing service. Where n is the total number of suspension instructions for each queuing service.
5. The multi-task processing method according to claim 2, characterized in that, The method further includes: During the execution of the specific service, the queuing base value of the specific service is updated by the internal strategy thread using a load balancing algorithm; If the queuing base value for a specific service is less than or equal to the corresponding queuing threshold, the default priority of the specific service is restored through the internal policy thread, and the corresponding service is executed based on the restored priority; and Suspend the internal strategy thread.
6. The multi-task processing method according to claim 5, characterized in that, The method further includes: establishing a strategy table, the strategy table including a service number for each service and service information associated with the service number; the service information including at least one of: whether modification is allowed, default priority information, and service ID information.
7. The multi-task processing method according to claim 6, characterized in that, The business information includes whether modification is permitted. Modifying the priority of the target service or the specific service includes: Based on the business number of the target business or the specific business, find the information in the policy table related to whether modification is allowed; Based on the information regarding whether modification is permitted, determine whether the priority of the target service or the specific service is allowed to be modified; and when the priority of the target service or the specific service is allowed to be modified, modify the priority of the target service or the specific service.
8. The multitasking method according to claim 6, characterized in that, The step of responding to an externally sent request to adjust service priority by modifying the priority of the target service through an external policy thread includes: In response to an externally sent request to adjust service priority, the system obtains service authentication data with administrator privileges and performs security authentication on the service authentication data; and After security authentication, the priority of the target service is modified through the external policy thread.
9. The multi-task processing method according to claim 8, characterized in that, The business authentication data obtained through administrator privileges includes: The random number is encrypted using administrator privileges to obtain business authentication data. The random number is a combination of the current time and a set value.
10. The multi-task processing method according to claim 9, characterized in that, The policy table also includes: an administrator authentication root key, and the business information includes business ID information. The security authentication of the business authentication data includes: Based on the service number of the target service, search the strategy table for the service ID information associated with the service number; The administrator authentication root key is distributed using the business ID information to obtain the business authentication key; The business authentication data is decrypted based on the business authentication key, and it is determined whether the decrypted data is consistent with the random number. If they are consistent, the security authentication is passed.
11. The multitasking method according to any one of claims 6-10, characterized in that, Restore the default priority of the target service or the specific service, including: Based on the business number of the target business or the specific business, find the information in the policy table related to whether modification is allowed; Based on the information regarding whether modification is permitted, determine whether the priority of the target service or the specific service is allowed to be modified; When the priority of the target service or the specific service can be modified, the priority of the target service or the specific service shall be restored to the default priority.
12. The multitasking method according to any one of claims 6-10, characterized in that, The business information includes default priority information. In response to an externally sent request to restore service priority, the default priority of the target service is restored through the external policy thread, including: In response to an externally sent request to restore service priority, the system obtains password administrator authentication data through password administrator privileges and performs security authentication on the password administrator authentication data; and After security authentication, the priority of the target service is restored to the default priority through the external policy thread.
13. The multitasking method according to claim 12, characterized in that, The process of obtaining password administrator authentication data through password administrator privileges includes: The password administrator's authentication data is obtained by encrypting a random number with the password administrator's authority, wherein the random number is a combination of the current time and a set value.
14. The multitasking method according to claim 13, characterized in that, The policy table also includes: the cryptographic supervisor authentication key. The security authentication of the cryptographic supervisor authentication data includes: The cryptographic supervisor authentication data is decrypted based on the cryptographic supervisor authentication key, and it is determined whether the decrypted data is consistent with the random number. If they are consistent, the security authentication is passed.
15. The multitasking method according to any one of claims 6-10, characterized in that, In response to an externally sent request to restore service priority, the default priority of the target service is restored through the external policy thread, including: In response to an externally sent request to restore service priority, when the service number of the target service is a pre-set service number used to indicate one-click restoration of all service priorities, the priority of all services is restored to the default priority through the external policy thread.
16. A multitasking processing device, characterized in that, The device includes: A creation module is used to create business threads, external strategy threads, and internal strategy threads. The business threads are used to execute business operations. The external strategy threads are used to adjust the priority of the business operations on the business threads to the first priority. The internal strategy threads are used to periodically adjust the priority of the queued business operations in the business threads to the second priority. The priority of the external strategy threads, the priority of the internal strategy threads, the first priority, the second priority, and the default priority of the business operations of the business threads are sequentially decreased. The first adjustment module is configured to, in response to a request to adjust service priority, modify the priority of the target service through the external strategy thread to adjust it to the first priority, and execute the corresponding service based on the modified priority, wherein the request to adjust service priority includes the service number of the target service; and The first processing module is used to disable the timer on the internal strategy thread through the external strategy thread; The device further includes: a second processing module, configured to, after the service with the first priority has been executed, respond to an externally sent request to restore the service priority, restore the default priority of the target service through the external policy thread and start the timer, wherein the externally sent request to restore the service priority includes: the service number of the target service.
17. The multitasking processing apparatus according to claim 16, characterized in that, The device further includes: The wake-up module is used to wake up the internal strategy thread and determine the queuing base value for each queuing service by means of a balancing algorithm when the duration of the timer reaches the preset duration. The determination module is used to identify queued services whose queuing base value is greater than the corresponding queuing threshold as specific services; and The second adjustment module is used to modify the priority of the specific service through the internal strategy thread to adjust it to the second priority, and execute the corresponding service based on the modified priority.
18. The multitasking processing apparatus according to claim 17, characterized in that, The step of determining the queuing base value for each queuing service using the balancing algorithm through the internal strategy thread includes: determining the queuing base value for each queuing service based on the queuing waiting time, urgency level, and weight of each suspended instruction on each queuing service, wherein the weight of each suspended instruction is associated with the default priority of each queuing service.
19. The multitasking processing apparatus according to claim 18, characterized in that, Determining the queuing base value for each queuing service includes: Based on the queuing waiting time T of the i-th suspension instruction on each queuing service i Emergency Level i With weight The following formula is used to determine the queuing base value Val for each queuing service. Where n is the total number of suspension instructions for each queuing service.
20. The multitasking processing apparatus according to claim 17, characterized in that, The device further includes: The update module is used to update the queuing base value of the specific service through the internal strategy thread using a load balancing algorithm during the execution of the specific service. The third adjustment module is used to restore the default priority of the specific service through the internal policy thread when the queuing base value of the specific service is less than or equal to the corresponding queuing threshold, and to execute the corresponding service based on the restored priority; and The suspension module is used to suspend the internal strategy thread.
21. The multitasking processing apparatus according to claim 20, characterized in that, The first adjustment module is also used to establish a strategy table, which includes a service number for each service and service information associated with the service number; the service information includes at least one of: whether modification is allowed, default priority information, and service ID information.
22. The multitasking processing apparatus according to claim 21, characterized in that, The business information includes whether modification is permitted. Modifying the priority of the target service or the specific service includes: Based on the business number of the target business or the specific business, find the information in the policy table related to whether modification is allowed; Based on the permission information, determine whether the priority of the target service or the specific service is allowed to be modified; and When the priority of the target service or the specific service can be modified, the priority of the target service or the specific service shall be modified.
23. The multitasking processing apparatus according to claim 21, characterized in that, The step of responding to an externally sent request to adjust service priority by modifying the priority of the target service through an external policy thread includes: In response to an externally sent request to adjust service priority, the system obtains service authentication data with administrator privileges and performs security authentication on the service authentication data; and After security authentication, the priority of the target service is modified through the external policy thread.
24. The multitasking processing apparatus according to claim 23, characterized in that, The business authentication data obtained through administrator privileges includes: The random number is encrypted using administrator privileges to obtain business authentication data. The random number is a combination of the current time and a set value.
25. The multitasking processing apparatus according to claim 24, characterized in that, The policy table also includes: an administrator authentication root key, and the business information includes business ID information. The security authentication of the business authentication data includes: Based on the service number of the target service, search the strategy table for the service ID information associated with the service number; The administrator authentication root key is distributed using the business ID information to obtain the business authentication key; The business authentication data is decrypted based on the business authentication key, and it is determined whether the decrypted data is consistent with the random number. If they are consistent, the security authentication is passed.
26. The multitasking device according to any one of claims 21-25, characterized in that, Restore the default priority of the target service or the specific service, including: Based on the business number of the target business or the specific business, find the information in the policy table related to whether modification is allowed; Based on the information regarding whether modification is permitted, determine whether the priority of the target service or the specific service is allowed to be modified; When the priority of the target service or the specific service can be modified, the priority of the target service or the specific service shall be restored to the default priority.
27. The multitasking device according to any one of claims 21-25, characterized in that, The business information includes default priority information. The step of responding to an externally sent request to restore service priority, and restoring the default priority of the target service through the external policy thread, includes: In response to an externally sent request to restore service priority, the system obtains password administrator authentication data through password administrator privileges and performs security authentication on the password administrator authentication data; and After security authentication, the priority of the target service is restored to the default priority through the external policy thread.
28. The multitasking processing apparatus according to claim 27, characterized in that, The process of obtaining password administrator authentication data through password administrator privileges includes: The password administrator's authentication data is obtained by encrypting a random number with the password administrator's authority, wherein the random number is a combination of the current time and a set value.
29. The multitasking processing apparatus according to claim 28, characterized in that, The policy table also includes: the cryptographic supervisor authentication key. The security authentication of the cryptographic supervisor authentication data includes: The cryptographic supervisor authentication data is decrypted based on the cryptographic supervisor authentication key, and it is determined whether the decrypted data is consistent with the random number. If they are consistent, the security authentication is passed.
30. The multitasking device according to any one of claims 21-25, characterized in that, In response to an externally sent request to restore service priority, the default priority of the target service is restored through the external policy thread, including: In response to an externally sent request to restore service priority, when the service number of the target service is a pre-set service number used to indicate one-click restoration of all service priorities, the priority of all services is restored to the default priority through the external policy thread.
31. A machine-readable storage medium having instructions stored thereon for causing a machine to perform the multitasking method of any one of claims 1-15.
32. A processor, characterized in that, Used to run a program, wherein the program is run to perform the multitasking method as described in any one of claims 1-15.
Citation Information
Patent Citations
System and method of priority-based interrupt steering
WO2019125836A1