A method for password device adaptive dynamic adjustment of execution task priority
By calculating task priorities using a dynamic weighted model, the problems of low resource utilization and uneven latency in traditional cryptographic devices under high concurrency environments are solved. This enables dynamic adjustment of the task queue and resource optimization, thereby improving the efficiency and stability of the system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TOEC ANCHEN INFORMATION TECH
- Filing Date
- 2026-03-13
- Publication Date
- 2026-06-12
AI Technical Summary
Traditional cryptographic devices cannot adapt to dynamic loads in high-concurrency, multi-tasking environments, resulting in low resource utilization and an inability to distinguish the latency requirements of different tasks, which affects critical business operations and system stability.
A dynamic weighted model is used to calculate task priorities. Through the linkage and adaptation of task characteristics, system load, and resource allocation, the task queue and resource allocation are dynamically adjusted, including task type, data volume, and user level weight table. The system load status is monitored in real time and priority adjustment is triggered.
It improves the efficiency of task processing and data security, enhances the system's throughput in high-concurrency scenarios, optimizes resource utilization and real-time performance, and ensures the priority processing of critical tasks.
Smart Images

Figure CN122195607A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of cryptographic device technology, and in particular relates to a method for adaptively and dynamically adjusting the priority of execution tasks in a cryptographic device. Background Technology
[0002] With the rapid development of information technology and the widespread application of the Internet, data security has become a crucial issue in today's society. Cryptographic devices, as key equipment for protecting data security and privacy, directly impact the security and stability of the entire information system through their performance and efficiency. Traditional cryptographic devices typically employ static scheduling strategies when performing encryption and decryption tasks, processing tasks according to a fixed priority order. However, in today's high-concurrency, multi-tasking environments, this static scheduling strategy reveals numerous shortcomings.
[0003] Cryptographic devices, as core cryptographic processing equipment, typically need to handle encryption / decryption requests from multiple users simultaneously. Traditional cryptographic devices employ static task scheduling strategies, processing tasks according to FIFO (First-In-First-Out) or fixed priority. However, this approach has the following problems:
[0004] Unable to adapt to dynamic load: When multiple users simultaneously initiate high-computational-load requests (e.g., SM4 large file encryption), low-priority tasks may be blocked for a long time, affecting critical business operations.
[0005] Low resource utilization: Static scheduling cannot dynamically adjust the allocation of computing resources according to task type (e.g., SM4 encryption and SM2 signing), resulting in some cores being overloaded while other cores are idle.
[0006] Lack of real-time guarantee: In the national cryptographic algorithms, symmetric encryption such as SM4 is usually used in high-throughput scenarios (e.g., financial transactions, video encryption), while SM2 signature is used for identity authentication. The two have different requirements for latency, but traditional methods cannot intelligently distinguish them. Summary of the Invention
[0007] In view of this, the present invention aims to overcome the shortcomings of the above-mentioned problems in the prior art and proposes a method for adaptively and dynamically adjusting the execution task priority of cryptographic devices. The method calculates the task priority through a dynamic weighted model to achieve the linkage adaptation of "task characteristics-system load-resource allocation", thereby improving the efficiency of task processing and the security of data.
[0008] To achieve the above objectives, the technical solution of the present invention is implemented as follows:
[0009] In a first aspect, the present invention provides a method for a cryptographic device to adaptively and dynamically adjust the priority of execution tasks, comprising the following steps:
[0010] Step 1: The system scheduling module receives the task request sent by the client and parses it to obtain the task type, data volume, and user level information;
[0011] Step 2: Based on the task type, data volume, and user level, query the preset task type weight table, data volume weight table, and user level weight table respectively to obtain the corresponding task type weight Ti, data volume weight Di, and user level weight Ui;
[0012] Step 3: Calculate the initial priority score Pi of the task based on the weighted priority calculation model:
[0013] ;
[0014] Where w1, w2, and w3 are adjustable weight coefficients, and w1 + w2 + w3 = 1;
[0015] Step 4: Insert tasks into a custom priority queue based on their Pi values, and sort them from highest to lowest Pi value;
[0016] Step 5: The system scheduling module performs hierarchical scheduling and resource allocation for tasks based on the Pi value;
[0017] Step 6: The system scheduling module monitors the system load status in real time, triggers the priority dynamic adjustment mechanism, recalculates the Pi value of all tasks, and reorders the queue;
[0018] Step 7: When the task is completed or times out, the system scheduling module reclaims resources.
[0019] Furthermore, in step 2, the task type weight Ti is preset according to the functional category to which the task belongs, as shown in Table 1.
[0020] Table 1
[0021]
[0022] The data volume weight Di is divided into several levels based on the amount of data processed by the task, as shown in Table 2.
[0023] Table 2
[0024]
[0025] User level weights (Ui) are preset based on user identity type, as shown in Table 3.
[0026] Table 3
[0027]
[0028] Furthermore, in step 5, the task is divided into three priority queues based on the Pi value and then scheduled differently:
[0029] High-priority queue: Pi≥80, bound to a dedicated CPU core, and scheduled with priority by a dedicated thread pool;
[0030] Medium priority queue: 50≤Pi<80, shares CPU core, resources are allocated according to priority;
[0031] Low-priority queue: Pi < 50, uses time-slice round-robin scheduling, limiting CPU and memory usage.
[0032] Furthermore, it also includes a dynamic task migration mechanism:
[0033] When a task in the medium-priority queue is detected to be delayed beyond a preset threshold, the Pi value of the task at the head of the queue is temporarily increased. If the high-priority condition is met, the task is moved to the high-priority queue.
[0034] When a high-priority task times out or runs out of resources, its Pi value is temporarily reduced. If it falls below the high-priority threshold, it is downgraded to the medium-priority queue.
[0035] Furthermore, in step 6, the system load status includes CPU utilization, memory usage, and average task queue latency.
[0036] The dynamic adjustment mechanism is activated when any of the following trigger conditions are met:
[0037] The average latency of the task queue is >200ms;
[0038] CPU utilization >85%;
[0039] Memory usage > 90%.
[0040] Furthermore, the dynamic adjustment mechanism is shown in Table 4.
[0041] Table 4
[0042]
[0043] Furthermore, the resource recovery in step 7 includes:
[0044] After a task is completed, memory used by lower priority tasks will be reclaimed first.
[0045] Forcefully release resources after the task times out to avoid prolonged occupation.
[0046] In a second aspect, the present invention provides a system for a cryptographic device to adaptively and dynamically adjust the priority of execution tasks, comprising:
[0047] Task parsing module: The system scheduling module receives the task request sent by the client and parses it to obtain the task type, data volume and user level information;
[0048] Task attribute parsing module: Based on task type, data volume and user level, query the preset task type weight table, data volume weight table and user level weight table respectively to obtain the corresponding task type weight Ti, data volume weight Di and user level weight Ui;
[0049] Priority calculation module: Calculates the initial priority score Pi of the task based on the weighted priority calculation model.
[0050] ;
[0051] Where w1, w2, and w3 are adjustable weight coefficients, and w1 + w2 + w3 = 1;
[0052] Queue Management Module: Inserts tasks into a custom priority queue based on their Pi value, and sorts them from highest to lowest Pi value;
[0053] Scheduling and execution module: The system scheduling module performs hierarchical scheduling and resource allocation for tasks based on the Pi value;
[0054] Monitoring and feedback module: The system scheduling module monitors the system load status in real time, triggers the priority dynamic adjustment mechanism, recalculates the Pi value of all tasks, and reorders the queue;
[0055] Resource recycling module: When a task is completed or times out, the system scheduling module reclaims resources.
[0056] Thirdly, the present invention provides an electronic device including a processor and a memory communicatively connected to the processor and used to store executable instructions of the processor, wherein the processor is used to execute the above-described method for adaptively and dynamically adjusting the priority of execution tasks of a cryptographic device.
[0057] Fourthly, the present invention provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the aforementioned method for adaptively and dynamically adjusting the execution task priority of a cryptographic device.
[0058] Compared with existing technologies, the method for adaptively and dynamically adjusting the execution task priority of cryptographic devices described in this invention has the following advantages:
[0059] 1) Pure software adaptation: This invention does not require modification of the hardware of the cryptographic device and can be directly deployed on existing devices;
[0060] 2) Dynamic adaptability: This invention adjusts the weight coefficient based on CPU / memory load, which is superior to the static priority scheme; the priority-based resource allocation mechanism supports dynamic migration of tasks between queues, balancing resource utilization and task response speed.
[0061] 3) Low cost and high efficiency: Compared with traditional scheduling, this invention significantly improves throughput in high-concurrency scenarios without additional hardware costs. The key system indicators are optimized through a dynamic priority adjustment mechanism, as shown in Table 5.
[0062] Table 5
[0063]
[0064] 4) Refined task classification: Based on the characteristics of cryptographic tasks (system operation / encryption / signature / hashing, etc.), data volume, and user level, a multi-dimensional classification system is established, and a baseline Ti value is assigned to each task type to ensure that the initial priority of critical tasks is reasonable.
[0065] 5) Real-time monitoring and feedback loop: By monitoring system load, queue latency and other indicators every 100ms, priority recalculation and resource reclamation are triggered to form a "monitoring-adjustment-execution-feedback" loop to ensure the stability of the system in complex scenarios. Attached Figure Description
[0066] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an undue limitation of the invention. In the drawings:
[0067] Figure 1 This is a flowchart of the method of the present invention;
[0068] Figure 2 This is a flowchart of a task adaptive dynamic priority scheduling and resource allocation method according to the present invention. Detailed Implementation
[0069] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other.
[0070] The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0071] refer to Figure 1-2 This invention provides a method for adaptively and dynamically adjusting the priority of execution tasks in a cryptographic device, comprising the following steps:
[0072] Step 101: The system scheduling module receives the task request sent by the client;
[0073] Step 102: The system scheduling module parses the structured data stream to obtain information such as algorithm name, data volume, user level parameters, and task data;
[0074] Step 103: The system scheduling module extracts Ti (task type weight) based on the task algorithm type and refers to the task type weight table (e.g., SM2 signature Ti=70, ECC key pair generation Ti=60).
[0075] Step 104: The system scheduling module extracts Di (data volume weight) based on the file size and data length carried in the task request, referring to the task type weight table (e.g., 5MB corresponds to Di=60, 20MB corresponds to Di=80).
[0076] Step 105: The system scheduling module extracts Ui based on the user identity identifier (such as administrator account / ordinary user ID) in the task request and compares it with the user level weight table (such as administrator Ui=20, ordinary user Ui=10);
[0077] Step 106: The system scheduling module calls the dynamic priority calculation method based on Ti, Di, and Ui obtained from the lookup table. This will give you the priority of the task request.
[0078] Step 107: The system scheduling module encapsulates task requests into structure objects containing Pi values and updates the custom task queue sorted by Pi values from high to low.
[0079] Step 108: The system scheduling module allocates resources to execute the highest priority task, while delaying the scheduling of lower priority tasks. The resource allocation rules are as follows:
[0080] 1) High priority (Pi≥80): Add to a separate task queue, and execute the current task in the queue first by prioritizing polling;
[0081] 2) Medium priority (50≤Pi<80): Runs in the usual single-threaded task loop. Low priority (Pi<50): Uses a rate-limiting strategy. When a task is written to the buffer, if the data size is ≤1MB, it is scheduled and executed with a fixed delay of 50ms; if the data size is >1MB, the portion exceeding 1MB is first split into a temporary queue. After the tasks in the current buffer are completed and the space is released, the split tasks in the temporary queue are scheduled with a 50ms delay to avoid a single task occupying too much buffer resources.
[0082] Step 109: The system scheduling module reclaims resources when a task is completed or a task times out. The specific reclamation mechanism is as follows:
[0083] 1) Once a task is completed, it should be promptly reclaimed, prioritizing the reclamation of memory quotas from low-priority tasks;
[0084] 2) Timeout Reclamation: After a task completes, promptly reclaim memory and other resources, prioritizing the release of memory quotas occupied by lower-priority tasks; if a task times out, forcibly release the task to avoid prolonged resource occupation.
[0085] Step 110: System Scheduling Module. The system scheduling module recalculates the Pi value of all tasks and sorts the queues by "periodic checks" (every 100ms) or "trigger conditions" (such as queue delay exceeding 200ms), ensuring that the priority matches the real-time system status.
[0086] The working process of the present invention will be described below through specific embodiments.
[0087] Example 1: Task scheduling under low system load
[0088] This embodiment describes the task scheduling process of the method of the present invention under low system load conditions.
[0089] The scenario is set as follows:
[0090] User type: Regular user (Ui=10)
[0091] Task type: SM2 signature (Ti=70)
[0092] Data size: 12MB (>10MB, Di=80)
[0093] Default weighting coefficients: w1=0.5, w2=0.3, w3=0.2
[0094] System status: CPU utilization 35%, memory usage 60%.
[0095] Step 1: The system scheduling module receives the SM2 signature task request, parses it to find that the task type is SM2 signature, the data size is 12MB, and the user level is ordinary user.
[0096] Step 2: The task attribute parsing module queries the weight table to obtain Ti=70, Di=80, and Ui=10.
[0097] Step 3: The priority calculation module calculates the initial priority score according to the formula:
[0098] Pi=0.5×70+0.3×80+0.2×10=35+24+2=61.
[0099] Step 4: Since 50≤Pi=61<80, the task is inserted into the priority queue.
[0100] Step 5: The scheduling and execution module executes tasks using a medium-priority queue scheduling strategy, sharing CPU cores (except 0-1).
[0101] Step 6: The monitoring feedback module detected that the system was in a low load state (CPU=35%, memory=60%), and dynamic adjustment was not triggered.
[0102] Step 7: After the task is completed, the resource recycling module reclaims the resources used by the task.
[0103] Example 2: Dynamic Adjustment of the System Under High Load
[0104] This embodiment describes the dynamic adjustment process of the method of the present invention under high system load conditions.
[0105] The scenario is set as follows (continued from Example 1):
[0106] The system status changed to: CPU utilization increased to 90%, memory usage to 85%.
[0107] Step 1: The monitoring feedback module detects that the CPU utilization rate is >85%, triggering the dynamic adjustment mechanism.
[0108] Step 2: Weight Adjustment: Increase the task type weight w1 to 0.6, and adjust w2=0.24 and w3=0.16 proportionally (keeping the total sum to 1).
[0109] Step 3: The priority calculation module recalculates the Pi value for all tasks:
[0110] Pi=0.6×70+0.24×80+0.16×10=42+19.2+1.6=62.8.
[0111] Step 4: The Pi value is increased by 1.8, but it is still in the medium priority range (50≤62.8<80), and the task remains in the medium priority queue.
[0112] Step 5: Resource allocation adjustment: Limit the CPU quota of low priority queues to 50%, and increase the priority of resource allocation for medium priority queues.
[0113] Step 6: The queue management module reorders the queues according to the new Pi value.
[0114] Example 3: Dynamic Task Migration Scenario
[0115] This embodiment describes the process of dynamic migration of tasks between queues.
[0116] The scenario is set as follows (continued from Example 2):
[0117] The latency of the medium-priority queue continued to increase, reaching 350ms.
[0118] Step 1: The monitoring feedback module detects that the delay of the medium-priority queue is >300ms and triggers the dynamic migration mechanism.
[0119] Step 2: Temporarily increment the Pi value of the task at the head of the medium-priority queue (i.e., the SM2 signature task in Example 2) by 15:
[0120] Pi = 62.8 + 15 = 77.8.
[0121] Step 3: At this point, Pi = 77.8, which is still less than 80 and has not reached the high-priority queue threshold, so the task will not be migrated for the time being.
[0122] Assumption: If the original Pi value of the task is high, such as 70.4, and after adding 15 it becomes 85.4, then Pi≥80 is satisfied, and the task is moved to the high priority queue.
[0123] Step 4: After migration, the task is bound to CPU cores 0-1 and scheduled with priority using a dedicated thread pool.
[0124] Example 4: Dynamic Adjustment in High Memory Usage Scenarios
[0125] This embodiment describes the dynamic adjustment process under high memory usage scenarios.
[0126] The scenario is set as follows:
[0127] System memory usage reached 92%.
[0128] A high-priority task (SM4 encryption, Ti=80, Di=80, Ui=20) is currently unable to execute due to insufficient memory.
[0129] Step 1: The monitoring feedback module detects that the memory usage rate is >90% and triggers the dynamic adjustment mechanism.
[0130] Step 2: Weight Adjustment: Reduce the user level weight w3 to 0.1 (default 0.2), and adjust w1=0.55 and w2=35 proportionally.
[0131] Step 3: Recalculate the Pi value for all tasks:
[0132] Pi=0.55×80+0.35×80+0.1×20=44+28+2=74.
[0133] Step 4: The original high-priority task (Pi≥80) is downgraded to medium priority (Pi=74) due to weight adjustment.
[0134] Step 5: The resource reclamation module forcibly reclaims 50% of the memory quota of low-priority tasks.
[0135] Step 6: Pause memory allocation for low-priority queues and prioritize releasing non-urgent memory.
[0136] Step 7: The downgraded task waits for scheduling in the medium priority queue.
[0137] Example 5: Task Timeout Handling Scenario
[0138] This embodiment describes the handling process after a task execution timeout.
[0139] The scenario is set as follows:
[0140] The execution time of SM4 encryption tasks in the high-priority queue exceeds 500ms.
[0141] Step 1: The monitoring feedback module detects that the SM4 encryption task execution time exceeds 500ms, triggering the task timeout handling mechanism.
[0142] Step 2: Priority Adjustment: Temporarily reduce the Ti value of this task by 20%.
[0143] Ti′=Ti×(1−20%)=80×0.8=64.
[0144] Step 3: Recalculate the Pi value (assuming Di=80, Ui=20, default weights):
[0145] Pi=0.5×64+0.3×80+0.2×20=32+24+4=60.
[0146] Step 4: Since Pi=60<80, the task is downgraded to the medium priority queue.
[0147] Step 5: The resource recycling module releases the dedicated resources occupied by this task.
[0148] Example 6:
[0149] A system for adaptively and dynamically adjusting the priority of execution tasks in a cryptographic device, comprising:
[0150] Task parsing module: The system scheduling module receives the task request sent by the client and parses it to obtain the task type, data volume and user level information;
[0151] Task attribute parsing module: Based on task type, data volume and user level, query the preset task type weight table, data volume weight table and user level weight table respectively to obtain the corresponding task type weight Ti, data volume weight Di and user level weight Ui;
[0152] Priority calculation module: Calculates the initial priority score Pi of the task based on the weighted priority calculation model.
[0153] ;
[0154] Where w1, w2, and w3 are adjustable weight coefficients, and w1 + w2 + w3 = 1;
[0155] Queue Management Module: Inserts tasks into a custom priority queue based on their Pi value, and sorts them from highest to lowest Pi value;
[0156] Scheduling and execution module: The system scheduling module performs hierarchical scheduling and resource allocation for tasks based on the Pi value;
[0157] Monitoring and feedback module: The system scheduling module monitors the system load status in real time, triggers the priority dynamic adjustment mechanism, recalculates the Pi value of all tasks, and reorders the queue;
[0158] Resource recycling module: When a task is completed or times out, the system scheduling module reclaims resources.
[0159] Example 7:
[0160] An electronic device includes a processor and a memory communicatively connected to the processor and used to store processor-executable instructions, the processor being used to execute the aforementioned method for adaptively and dynamically adjusting the priority of execution tasks by a cryptographic device.
[0161] Example 8:
[0162] A computer-readable storage medium storing a computer program, which, when executed by a processor, implements the aforementioned method for adaptively and dynamically adjusting the execution task priority of a cryptographic device.
[0163] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in this disclosure all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0164] It should be noted that personal information collected from users should be used for legitimate and reasonable purposes and should not be shared or sold outside of these legitimate uses. Furthermore, such collection / sharing should only be conducted after receiving the user's informed consent, including but not limited to notifying the user to read the user agreement / user notice and sign an agreement / authorization that includes authorization of relevant user information before the user uses the function. In addition, any necessary steps must be taken to protect and safeguard access to such personal information data and ensure that others with access to personal information data comply with their privacy and procedures.
[0165] This disclosure is intended to provide implementation schemes for users to selectively prevent the use or access to their personal information data. Specifically, this disclosure is intended to provide hardware and / or software to prevent or block access to such personal information data. Once personal information data is no longer needed, risks can be minimized by restricting data collection and deleting data. Furthermore, where applicable, such personal information is de-identified to protect user privacy.
[0166] The acquisition, transmission, storage, use, and processing of data in this disclosed technical solution all comply with the relevant provisions of national laws and regulations.
[0167] It should be noted that in the embodiments disclosed herein, certain software, components, models, and other existing solutions in the industry may be mentioned. These should be considered as exemplary and are intended only to illustrate the feasibility of implementing the technical solution of this application. However, they do not mean that the applicant has used or necessarily used such solutions.
[0168] In the foregoing descriptions of the embodiments, the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this disclosure. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0169] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this disclosure, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0170] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing custom logic functions or processes, and the scope of preferred embodiments of this disclosure includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as will be understood by those skilled in the art to which embodiments of this disclosure pertain.
[0171] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-including system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which programs can be printed, because programs can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0172] It should be understood that various parts of this disclosure can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. If implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0173] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
[0174] Furthermore, the functional units in the various embodiments of this disclosure can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
[0175] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of the present disclosure have been shown and described above, it is to be understood that the above embodiments are exemplary and should not be construed as limiting the present disclosure. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present disclosure.
Claims
1. A method for adaptively and dynamically adjusting the execution task priority of a cryptographic device, characterized in that: Includes the following steps: Step 1: The system scheduling module receives the task request sent by the client and parses it to obtain the task type, data volume, and user level information; Step 2: Based on the task type, data volume, and user level, query the preset task type weight table, data volume weight table, and user level weight table respectively to obtain the corresponding task type weight Ti, data volume weight Di, and user level weight Ui; Step 3: Calculate the initial priority score Pi of the task based on the weighted priority calculation model: ; Where w1, w2, and w3 are adjustable weight coefficients, and w1 + w2 + w3 = 1; Step 4: Insert tasks into a custom priority queue based on their Pi values, and sort them from highest to lowest Pi value; Step 5: The system scheduling module performs hierarchical scheduling and resource allocation for tasks based on the Pi value; Step 6: The system scheduling module monitors the system load status in real time, triggers the priority dynamic adjustment mechanism, recalculates the Pi value of all tasks, and reorders the queue; Step 7: When the task is completed or times out, the system scheduling module reclaims resources.
2. The method for adaptively and dynamically adjusting the execution task priority of a cryptographic device according to claim 1, characterized in that: In step 2, The task type weight Ti is preset according to the major functional category to which the task belongs, including system-level basic operations, encryption / decryption, signature / verification, key management, key negotiation, hash operation and file operation, each corresponding to a different Ti value; The data volume weight Di is divided into several levels based on the amount of data processed by the task, each corresponding to a different Di value; User level weights (UI) are preset based on user identity type, including administrators and ordinary users, each corresponding to a different UI value.
3. The method for adaptively and dynamically adjusting the execution task priority of a cryptographic device according to claim 1, characterized in that: In step 5, the task is divided into three priority queues based on the Pi value and then scheduled differently: High-priority queue: Pi≥80, bound to a dedicated CPU core, and scheduled with priority by a dedicated thread pool; Medium priority queue: 50≤Pi<80, shares CPU core, resources are allocated according to priority; Low-priority queue: Pi < 50, uses time-slice round-robin scheduling, limiting CPU and memory usage.
4. A method for adaptively and dynamically adjusting the execution task priority of a cryptographic device according to claim 3, characterized in that: It also includes a dynamic task migration mechanism: When a task in the medium-priority queue is detected to be delayed beyond a preset threshold, the Pi value of the task at the head of the queue is temporarily increased. If the high-priority condition is met, the task is moved to the high-priority queue. When a high-priority task times out or runs out of resources, its Pi value is temporarily reduced. If it falls below the high-priority threshold, it is downgraded to the medium-priority queue.
5. A method for adaptively and dynamically adjusting the execution task priority of a cryptographic device according to claim 1, characterized in that: In step 6, the system load status includes CPU utilization, memory usage, and average task queue latency. The dynamic adjustment mechanism is activated when any of the following trigger conditions are met: The average latency of the task queue is >200ms; CPU utilization >85%; Memory usage > 90%.
6. A method for adaptively and dynamically adjusting the execution task priority of a cryptographic device according to claim 5, characterized in that: The dynamic adjustment mechanism includes: High-load scenarios (CPU > 85%): Increase the task type weight w1, decrease w2 and w3, and limit the CPU quota for low-priority tasks; High memory usage scenarios (memory > 90%): Reduce user level weight w3 and forcibly reclaim memory quotas for low-priority tasks; Task timeout scenario: Temporarily reduce its Ti value or remove it from the dedicated thread pool, depending on the task type; Resource contention scenario: Pre-allocate resources to high-priority tasks, and forcibly terminate low-priority tasks when necessary.
7. A method for adaptively and dynamically adjusting the execution task priority of a cryptographic device according to claim 1, characterized in that: The resource recovery in step 7 includes: After a task is completed, memory used by lower priority tasks will be reclaimed first. Forcefully release resources after the task times out to avoid prolonged occupation.
8. A system for adaptively and dynamically adjusting the priority of execution tasks in a cryptographic device, characterized in that: include: Task parsing module: The system scheduling module receives the task request sent by the client and parses it to obtain the task type, data volume and user level information; Task attribute parsing module: Based on task type, data volume and user level, query the preset task type weight table, data volume weight table and user level weight table respectively to obtain the corresponding task type weight Ti, data volume weight Di and user level weight Ui; Priority calculation module: Calculates the initial priority score Pi of the task based on the weighted priority calculation model. ; Where w1, w2, and w3 are adjustable weight coefficients, and w1 + w2 + w3 = 1; Queue Management Module: Inserts tasks into a custom priority queue based on their Pi value, and sorts them from highest to lowest Pi value; Scheduling and execution module: The system scheduling module performs hierarchical scheduling and resource allocation for tasks based on the Pi value; Monitoring and feedback module: The system scheduling module monitors the system load status in real time, triggers the priority dynamic adjustment mechanism, recalculates the Pi value of all tasks, and reorders the queue; Resource recycling module: When a task is completed or times out, the system scheduling module reclaims resources.
9. An electronic device comprising a processor and a memory communicatively connected to the processor and used for storing processor-executable instructions, characterized in that: The processor is used to execute the method described in any one of claims 1-7.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it implements the method described in any one of claims 1-7.