File processing method and device

By classifying files to be detected by file type and setting priority, the problems of low detection efficiency and high resource consumption in the prior art are solved, and the processing efficiency of virus files and the overall performance of network security equipment are improved.

CN119088516APending Publication Date: 2024-12-06NEW H3C SECURITY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411083426.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-07
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

When existing network security devices perform security protection, the efficiency of detecting all files is inefficient, resulting in large CPU and memory consumption, affecting throughput, and due to the small proportion of virus files, a large amount of useless work may lead to viruses being spared.

Method used

By classifying the files to be detected by file type and setting processing priority according to the virus occurrence probability of each file type, writing and reading tasks are optimized, and setting high processing priority for high virus probability file types to ensure high priority The file will be processed first.

Benefits of technology

It improves the processing efficiency of virus files, improves the anti-virus detection capabilities and overall performance of network security devices, and ensures timely processing of high-processing priority files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119088516A_ABST
    Figure CN119088516A_ABST
Patent Text Reader

Abstract

The invention provides a file processing method and device, and relates to the technical field of safety protection. The method comprises the steps of obtaining a to-be-detected file; writing a task for processing the to-be-detected file into a task queue to which the file type of the to-be-detected file belongs; and according to the task processing proportion corresponding to each file type and the processing priority of each file type, reading a corresponding number of tasks from the task queues corresponding to each file type, and processing the to-be-detected files corresponding to the read tasks. The files are processed according to the file types and the processing priorities of the file types, priority processing of the files with the high processing priorities is guaranteed, and the processing efficiency of the virus files can be improved by setting the high processing priorities of the virus files.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of security protection technology, and in particular to a file processing method and device. Background Art

[0002] With the continuous advancement of computer technology and the popularization of the Internet, digital information is spreading rapidly around the world, and computers have become an indispensable tool in people's daily life and work. However, with the rapid iteration of technology, computer viruses and various malware are also emerging and evolving at an alarming rate, seriously threatening information security and user privacy. In order to more effectively combat the increasingly rampant network threats, various antivirus technologies have emerged. Network security devices with antivirus technology, such as firewalls, are deployed at the entrance of the enterprise network to isolate viruses outside the enterprise network and provide a solid defense for the data security of the enterprise intranet.

[0003] However, when network security devices are currently performing security protection, they perform security checks on all files that flow through the network security device, which affects the network throughput of the network security device and has low detection efficiency. On the one hand, when the antivirus engine detects files, it will consume a lot of CPU and memory of the network security device, thus affecting the throughput of the network device; on the other hand, detecting all files will do a lot of useless work and waste the detection engine. After all, virus files still account for a minority of network traffic. Moreover, the performance of network security devices is limited. When the CPU or memory usage reaches a certain level, it will cause the inability to continue to detect files, resulting in virus files being missed. Summary of the invention

[0004] In view of this, the present application provides a file processing method and device to improve the processing efficiency of virus files.

[0005] Specifically, the present application is implemented through the following technical solutions:

[0006] According to a first aspect of the present application, a file processing method is provided, which is applied to a network security device, and the method includes:

[0007] Get the file to be tested;

[0008] Writing the task of processing the file to be detected into the task queue to which the file type of the file to be detected belongs;

[0009] According to the task processing ratio corresponding to each file type and the processing priority of each file type, a corresponding number of tasks are read from the task queue corresponding to each file type, and the files to be detected corresponding to the read tasks are processed, wherein the processing priority of each file type is positively correlated with the probability that a virus exists in files of that file type.

[0010] According to a second aspect of the present application, a file processing device is provided, which is applied to a network security device, and the device includes:

[0011] An acquisition unit, used for acquiring a file to be detected;

[0012] A writing unit, used for writing the task of processing the file to be detected into the task queue to which the file type of the file to be detected belongs;

[0013] A reading unit, used for reading a corresponding number of tasks from a task queue corresponding to each file type according to a task processing ratio corresponding to each file type and a processing priority of each file type;

[0014] The processing unit is used to process the to-be-detected file corresponding to the read task, wherein the processing priority of each file type is positively correlated with the probability that a virus exists in the file of that type.

[0015] According to the third aspect of the present application, an electronic device is provided, including a processor and a machine-readable storage medium, the machine-readable storage medium storing a computer program that can be executed by the processor, and the processor is prompted by the computer program to execute the method provided in the first aspect of the embodiment of the present application.

[0016] According to the fourth aspect of the present application, a machine-readable storage medium is provided, which stores a computer program. When called and executed by a processor, the computer program prompts the processor to execute the method provided in the first aspect of the embodiment of the present application.

[0017] Beneficial effects of the embodiments of the present application:

[0018] The file processing method and device provided in the embodiment of the present application obtain the file to be detected; write the task of processing the file to be detected into the task queue to which the file type of the file to be detected belongs; read the corresponding number of tasks from the task queue corresponding to each file type according to the task processing ratio corresponding to each file type and the processing priority of each file type, and process the file to be detected corresponding to the read task. Since the processing priority of each file type is positively correlated with the probability of the existence of viruses in the file of that file type, the greater the probability of the virus appearing in a certain file type, the higher the processing priority can be set for the file type. In this way, the files are processed according to the file type and the processing priority of the file type, which ensures the priority processing of files with higher processing priorities, thereby ensuring the processing efficiency of files with high processing priorities, that is, improving the processing efficiency of virus files. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1It is a flowchart of a file processing method provided by an embodiment of the present application;

[0020] Figure 2a This is a task diagram in a task queue provided by an embodiment of the present application;

[0021] Figure 2b It is a schematic diagram of another task queue running out of tasks provided by an embodiment of the present application;

[0022] Figure 3 is a structural schematic diagram of a file processing device provided in an embodiment of the present application;

[0023] Figure 4 It is a hardware structure diagram of an electronic device for implementing a file processing method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0024] Here, exemplary embodiments will be described in detail, and examples thereof are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application.

[0025] The terms used in this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in this article refers to and includes any or all possible combinations of one or more corresponding listed items.

[0026] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0027] The file processing method provided by this application is described in detail below.

[0028] See also Figure 1 , Figure 1This is a flowchart of a file processing method provided by the present application. The method can be applied to network security devices, which can be but not limited to firewalls, intrusion prevention, cloud security and other devices. When the above network security device implements the method, it can include the following steps:

[0029] Step 101: Obtain the file to be detected.

[0030] In order to ensure the security of the network where the network security device is located, the network security device will perform security detection on the files flowing through the device. For the convenience of description, the files flowing into the network security device are recorded as the above-mentioned files to be detected.

[0031] Step 102: Write the task of processing the file to be detected into the task queue to which the file type of the file to be detected belongs.

[0032] In this step, in order to improve the efficiency of virus file detection, this embodiment proposes to classify the files, and then assign tasks and task queues that are compatible with the file type to each file category. In this way, after the file type of the file to be detected is identified, a task is selected from the tasks assigned to the file type to process the file to be detected, and then the selected task for processing the file to be detected is written into the task queue corresponding to the file category.

[0033] Specifically, the virus files obtained by virus detection of files that have flowed through the network security device in the past are statistically processed by file category. The statistical file types are roughly shown in Table 1:

[0034] Table 1

[0035]

[0036]

[0037] Based on Table 1, it can be seen that the virus proportions of different file types are different. Therefore, the file type can be assigned a suitable task according to the possibility of the virus appearing in the file type to process the file to be detected of the file type. At the same time, since the network security device may receive a large number of files within a period of time, in order to prevent congestion of the network security device, this embodiment proposes to assign a corresponding task queue to the file type. In this way, when the file to be detected arrives, after the file category of the file to be detected is identified, the task for processing the file to be detected can be assigned to the file to be detected from the tasks assigned to the file category, and then the assigned task is written to the task queue corresponding to the file type.

[0038] Step 103 : according to the task processing ratio and the processing priority of each file type, a corresponding number of tasks are read from the task queue corresponding to each file type, and the to-be-detected files corresponding to the read tasks are processed.

[0039] The processing priority of each file type is related to the probability that a virus appears in a file of that file type.

[0040] In this step, Table 1 also gives the virus proportion of each file type. It can be seen that files with exe / dll / elf / pe as suffixes are executable files. It can be concluded that the proportion of executable file viruses is as high as 90.3%, that is, most of the viruses on the network appear in executable files. In addition, the proportion of compressed file viruses is also relatively high, accounting for about 4%, such as zip, rar, gzip and 7zip in Table 1, and in the network, attackers can also compress virus files and transmit them. In addition, although the proportion of office files in Table 1 is relatively small, in actual applications, there is an attack method that embeds executable virus files into office files for attack.

[0041] Based on this, a corresponding processing priority can be set for each file category according to the virus proportion of each file category and the probability that files of certain file types carry viruses. The processing priority of a file category is positively correlated with the probability that a virus exists in that file category, that is, the higher the probability of a virus appearing in a certain file type, the higher the processing priority that can be set for that file type; and for some file types, the probability of a virus appearing in that file type is very small, so a relatively low processing priority can be set for the virus file; in addition, when assigning processing priorities to file types, different file types may have the same processing priority, and the same processing priority means that the probability of a virus appearing in the aforementioned different file types is similar.

[0042] On this basis, in the process of writing the task for processing the file to be detected into the task queue corresponding to the file type to which the file to be detected belongs based on step 102, the network security device also reads the task from the task queue, and processes the file to be detected corresponding to the task based on the read task. When processing the file to be detected, the file to be detected can be identified for viruses according to the security policy to achieve the purpose of security protection. In this way, security protection such as virus detection can be more focused on file types (high processing priority) with a higher probability of virus existence, that is, the file to be detected with a high processing priority can be processed for security protection first, which not only improves the anti-virus detection capability but also improves the anti-virus detection efficiency of the network security device while improving the file processing efficiency.

[0043] When reading tasks, since viruses may exist in each file type, but the probability is different, therefore, files of each file type also need to be identified, but in order to ensure that the file types with a relatively large proportion of viruses can be quickly detected, in order to improve the processing efficiency of virus files, the present embodiment proposes that when reading tasks, they can be read according to the processing priority of each file type, for example, a first number of tasks can be read from the task queue corresponding to the file type with a high processing priority, and then a second number of tasks can be read from the task queue corresponding to the file type with a low processing priority, but the first number is greater than the second number. Then, based on the tasks of each number read out, the files to be detected pointed to by each task are processed according to the processing priority. In this way, it is possible to ensure that the files to be detected with a high processing priority are processed first, and more files to be detected with a high processing priority can be processed, so that the processing efficiency of files is improved.

[0044] In the implementation of the file processing method provided by the present application, a file to be detected is obtained; a task for processing the file to be detected is written into a task queue to which the file type of the file to be detected belongs; a corresponding number of tasks are read from the task queues corresponding to each file type according to the task processing ratio corresponding to each file type and the processing priority of each file type, and the file to be detected corresponding to the read task is processed. Since the processing priority of each file type is positively correlated with the probability of a virus appearing in a file of that file type, the greater the probability of a virus appearing in a certain file type, the higher the processing priority can be set for that file type. In this way, by processing files according to the file type and the processing priority of the file type, priority processing of files with higher processing priorities is ensured, thereby ensuring the processing efficiency of files with high processing priorities, that is, improving the processing efficiency of virus files.

[0045] Optionally, step 102 may be performed according to the following process: if the first number of tasks allocated for the file type of the file to be detected has not been used up, the number of tasks required to process the task to be detected is subtracted from the first number of tasks, and the task to process the file to be detected is written into the task queue to which the file type of the file to be detected belongs; if the first number of tasks allocated for the file type of the file to be detected has been used up, determining whether the second number of tasks corresponding to the file type with a low processing priority has been used up in order of processing priority from low to high; if the second number of tasks has not been used up, the number of tasks required to process the task to be detected is subtracted from the second number of tasks. number, write the task of processing the file to be detected into the task queue to which the file type of the file to be detected belongs; if the second number of tasks has been used up, determine whether the third number of tasks corresponding to the file type of the previous processing priority with a low processing priority has been used up; if the third number of tasks has not been used up, subtract the number of tasks required to process the task to be detected from the third number of tasks, and write the task of processing the file to be detected into the task queue to which the file type of the file to be detected belongs; if the third number of tasks has been used up, continue to execute the step of determining whether the third number of tasks corresponding to the file type of the previous processing priority with a low processing priority has been used up.

[0046] The first task number, the second task number, and the third task number in the above embodiment can be used to represent the available task number.

[0047] Specifically, in order to facilitate the management of each task, each task queue can be allocated a number of tasks that is compatible with the file type corresponding to the task queue, and the processing priority of each file type is related to the probability of the existence of a virus under that file type. The greater the probability of the existence of the virus, the higher the processing priority of that file type, and the more and more timely the files to be detected corresponding to that file type need to be processed. Based on this, a larger number of tasks can be allocated to file types with high processing priorities, and a smaller number of tasks can be allocated to file types with low processing priorities.

[0048] On this basis, when writing the task of the file to be detected, there may be a situation where the number of tasks of the file type to which the file to be detected belongs is used up, but the file to be detected with a high processing priority is processed as much as possible. Therefore, in order to achieve this purpose, this embodiment is proposed. When the number of tasks corresponding to the current processing priority is used up, the number of tasks of a processing priority lower than the processing priority can be borrowed to process the file to be detected of the current processing priority. In this way, it can be ensured that the file to be detected with a high processing priority (the probability of the presence of a virus is high) is processed first.

[0049] In order to better understand this embodiment, it can be explained in conjunction with the file types and virus ratios shown in Table 1. It should be noted that Table 1 and this example are only examples and do not constitute a specific limitation on the file types and the processing priorities of each file type. In actual applications, the processing priorities of each file type can be dynamically adjusted. In addition, the types of file types can also be dynamically adjusted, and the operation and maintenance personnel can also configure the file types according to their own needs, and the operation and maintenance personnel can also configure the processing priorities of the file types according to their own needs, so that the network security equipment performs file security protection processing according to the needs of the operation and maintenance personnel. By default, the network security device will set the default file type and the processing priority of each file type.

[0050] For example, based on Table 1, it can be learned that more than 90% of viruses exist in executable files, and the probability of compressed files and office files containing viruses is also relatively high; while the probability of other files such as text files and web page files containing viruses is relatively low, and in business traffic, file types such as text files and web page files account for the highest proportion in business traffic. Therefore, the first processing priority can be set for executable files, the second processing priority can be set for compressed files and office files (compressed files and office files can contain executable files), and the third processing priority can be set for other files, wherein the first processing priority is higher than the second processing priority, and the second processing priority is higher than the third processing priority, as shown in Table 2. In this way, the detection and processing capabilities of the antivirus engine in the network security device can be more concentrated on the files to be detected with a higher probability of viruses, that is, the files to be detected with a higher processing priority can obtain more antivirus detection capabilities, thereby improving the antivirus detection efficiency of the network security device to a certain extent.

[0051] Table 2

[0052] Priority File Type First processing priority Executable files Second processing priority Compressed files / office files Third processing priority Other files

[0053] According to the above three file types, a task queue is established for each file type, and a task number is configured for each file type. However, the total task number of each file type is fixed. For example, if the total task number is 100, the task number ratios of executable files, office / compressed files, and other files can be shown in Table 3. In Table 3, office files and compressed files share the same task number, but in actual applications, office files and compressed files can also have their own task queues and task numbers.

[0054] Table 3

[0055]

[0056] In addition, when allocating the number of tasks for each file type, it can be implemented according to the current security detection strategy, and the file types to be detected by different security detection strategies can be different; for example, the file types to be detected by different security detection strategies are given in Table 3. When all three file types need to be detected, the number of tasks can be allocated to each file type in proportion, for example, the number of tasks for executable files is 60% of the total number of tasks, the number of tasks for office files and compressed files is 30% of the total number of tasks, and the number of tasks for other files is 10% of the total number of tasks; if the security detection strategy is to detect only executable files and other files, then since the probability of other files having viruses is relatively small, more tasks can be allocated to executable files, referring to the 90% total number of tasks shown in Table 3; if the security detection process is to detect only executable files, office files and compressed files, since the probability of executable files having viruses themselves is very high, but the probability of office files and compressed files having viruses themselves is also relatively high, therefore, when allocating the number of tasks, it can be allocated with reference to Table 3. Of course, Table 3 is only an example, and other allocation methods can also be used, which is not limited in this embodiment.

[0057] Optionally, the specific value of the total number of tasks can be determined according to the performance of the network security device and the detection speed of the antivirus engine. For example, the total number of tasks can be the number of files processed by a single core of the antivirus engine in 5 minutes.

[0058] In order to facilitate understanding of this embodiment, the example of the security detection policy requiring the start of security detection of three file types is used for explanation, as shown in Table 3, assuming that the total number of tasks is 100, the number of tasks for executable files is 60, the number of tasks for office files and compressed files is 30, and the number of tasks for other files is 10. On this basis, when file 1 (file to be detected) in the business traffic reaches the network security device, the network security device can start the file type identification process according to the current security detection policy, and then implement it according to the task writing method provided above, and the situation is as follows:

[0059] Case 1: If the file type of file 1 is identified as an executable file, then the processing priority of this file type is the first processing priority; assuming that the number of tasks required to process file 1 is 1, then it can be determined whether the first number of tasks (the number of available tasks) of the executable file has been used up. If not, the first number of tasks is reduced by 1. After that, the task identifier of the task for processing file 1 can be written into the task queue corresponding to the executable file, and file 1 is written into the memory at the same time.

[0060] Specifically, a counter 1 may be set for the executable file allocation, and the counter 1 is used to record the number of available tasks. It should be noted that when 60% of the total number of tasks is allocated to the executable file, if the total number of tasks is 100, the initial value of the counter 1 may be 60 in the initial state. In this way, when a file of the executable file type is received, the counter 1 may be operated to identify whether the number of tasks of the current executable file has been used up.

[0061] If the number of tasks of the executable file has been used up, that is, the value of counter 1 is 0, then since the executable file has a high processing priority and the probability of the executable file having a virus is very high, if the executable file can no longer be processed because the number of tasks has been used up, it may cause a security threat to the network. In view of this, this embodiment proposes to borrow the number of tasks with a low processing priority. Specifically, it can be determined whether the second number of tasks (the number of available tasks) of other files corresponding to the third processing priority has been used up. If it is found that it has not been used up, the number of tasks of other files can be borrowed. For example, the number of tasks of other files is recorded by counter 2, and counter 2 is used to record the number of available tasks of other files. Then it can be determined whether the value of counter 2 is greater than or equal to 1. If it is greater than or equal to 1, it indicates that 1 task number can be borrowed from other files at present, and counter 2 is decremented by 1. After the number of tasks is borrowed, the task for processing file 1 can be written into the task queue corresponding to the executable file.

[0062] In addition, two counters can be allocated to the executable file, namely counter 3 and counter 4. Counter 3 is used to record the number of tasks borrowed from office files and compressed files for the executable file, and counter 4 is used to record the number of tasks borrowed from other files for the executable file. Based on this, counter 4 can be incremented by 1.

[0063] If it is determined that the number of tasks for other files has also been used up, it can be determined whether the number of tasks for office files and compressed files of the second processing priority has been used up. If the third number of tasks (the number of available tasks) for office files and compressed files has not been used up, one task number is borrowed from the number of tasks for office files and compressed files. For example, counter 5 is used to record the number of available tasks for office files and compressed files. It can be determined whether the value of counter 5 is greater than or equal to 1. If it is greater than or equal to 1, it indicates that one task number can be borrowed from the executable file at present, and counter 5 is decremented by 1. After that, counter 3 used to record the number of tasks borrowed from office files and compressed files for executable files is incremented by 1. After the number of tasks is borrowed, the task for processing file 1 can be written into the task queue corresponding to the executable file.

[0064] Therefore, it is ensured that files with higher processing priority are processed first, thus improving the processing efficiency of virus files. In addition, when borrowing tasks, they are executed in order of processing priority from low to high, that is, low processing priority tasks are borrowed first, and only after low processing priority tasks are used up, high processing priority tasks are borrowed, thus, the processing of high processing priority files can be minimized.

[0065] It should be noted that the length of each task queue has nothing to do with the number of tasks of the corresponding file type. The length of the task queue can be set longer so that after a new file arrives, the corresponding queue can store the task for processing the file.

[0066] Similarly, for situation 2, if the file type of file 1 is identified as an office file, it can be known that the processing priority of this file type is the second processing priority; it is also assumed that the number of tasks required to process file 1 is 1, then it can be determined whether the number of tasks (available number of tasks) for office files has been used up. If not, the counter 5 used to record the available number of tasks for office files is reduced by 1. After that, the task identifier of the task for processing file 1 can be written into the task queue corresponding to the office file, and file 1 is written into the memory at the same time. It should be noted that when 30% of the total number of tasks is allocated to office files and compressed files, if the total number of tasks is 100, the initial state value of counter 5 is 30.

[0067] If the number of tasks of the office file has been used up, that is, the value of counter 5 is 0, then since the probability of viruses appearing in the office file is very high, if the office file cannot be processed any further because the number of tasks has been used up, it may cause a security threat to the network. In view of this, the present embodiment proposes to borrow the number of tasks with a low processing priority. Based on this, it can be determined whether the number of tasks (available number of tasks) of other files corresponding to the third processing priority has been used up. If it is found that it has not been used up, the number of tasks of other files can be borrowed. For example, it can be determined whether the value of counter 2 is greater than or equal to 1. If it is greater than or equal to 1, it indicates that 1 task number can be borrowed from other files at present, and counter 2 is decremented by 1. After the number of tasks is borrowed, the task for processing file 1 can be written into the task queue corresponding to the office file.

[0068] In addition, two counters can be allocated to the office file, namely counter 6 and counter 7. Counter 6 is used to record the number of tasks borrowed from other files for the office file, and counter 7 is used to record the number of tasks borrowed from executable files for the office file. Based on this, counter 6 can be incremented by 1.

[0069] If it is determined that the number of tasks of other files has also been used up, it can be determined whether the number of tasks of the executable file with the first processing priority has been used up. If the number of tasks of the executable file (the number of available tasks) has not been used up, then one task number is borrowed from the number of tasks of the executable file, that is, it can be determined whether the value of counter 1 is greater than or equal to 1. If it is greater than or equal to 1, it indicates that one task number can be borrowed from the executable file at present, and counter 1 is reduced by 1. After that, counter 7 for recording the number of tasks borrowed from the executable file for the office file is increased by 1. After the number of tasks is borrowed, the task for processing file 1 can be written into the task queue corresponding to the office file.

[0070] Case three, if the file type of file 1 is identified as other files, then it can be known that the processing priority of this file type is the third processing priority; it is also assumed that the number of tasks required to process file 1 is 1, then it can be determined whether the number of tasks for other files (the number of available tasks) has been used up. If not, the counter 2 used to record the number of available tasks for other files will be reduced by 1. After that, the task identifier of the task for processing file 1 can be written into the task queue corresponding to other files, and file 1 can be written into the memory at the same time. It should be noted that when 10% of the total number of tasks is allocated to other files, if the total number of tasks is 100, the initial state value of counter 2 is 10.

[0071] If the number of tasks for other files has been used up, that is, the value of counter 2 is 0, then since the processing pressure of the current executable file, office file, and compressed file is not too great, there may be spare capacity to process other files. Based on this, this embodiment proposes to borrow the number of tasks with a high processing priority. Based on this, it can be determined whether the number of tasks (available number of tasks) of the office file corresponding to the second processing priority has been used up. If it is found that it has not been used up, the number of tasks of the office file can be borrowed. For example, it can be determined whether the value of counter 5 is greater than or equal to 1. If it is greater than or equal to 1, it indicates that 1 task number can be borrowed from the office file at present, and counter 5 is decremented by 1. After the number of tasks is borrowed, the task for processing file 1 can be written into the task queue corresponding to other files.

[0072] In addition, two counters can be allocated for other files, namely counter 8 and counter 9. Counter 8 is used to record the number of tasks borrowed from office files and compressed files for other files, and counter 9 is used to record the number of tasks borrowed from executable files for other files. Based on this, counter 8 can be incremented by 1.

[0073] If it is determined that the number of tasks of the office file has also been used up, it can be determined whether the number of tasks of the executable file with the first processing priority has been used up. If the number of tasks of the executable file (the number of available tasks) has not been used up, then one task number is borrowed from the number of tasks of the executable file, that is, it can be determined whether the value of counter 1 is greater than or equal to 1. If it is greater than or equal to 1, it indicates that one task number can be borrowed from the executable file at present, and counter 1 is reduced by 1. After that, counter 7 for recording the number of tasks borrowed from the executable file for other files is increased by 1. After the number of tasks is borrowed, the task for processing file 1 can be written into the task queue corresponding to other files.

[0074] In addition, there may be a situation where the number of tasks for each file type has been used up. Based on this, the present embodiment also proposes the following scheme: if the number of tasks corresponding to each file type has been used up, and when the processing priority of the file type corresponding to the file to be detected is not the lowest processing priority, delete a task from the task queue to which the file type corresponding to the lowest processing priority belongs, and update the fourth task number corresponding to the lowest processing priority; subtract the number of tasks required to process the task to be detected from the updated fourth task number, and write the task to process the file to be detected into the task queue to which the file type of the file to be detected belongs; when the processing priority of the file type corresponding to the file to be detected is the lowest processing priority, keep the task queue corresponding to the lowest processing priority unchanged.

[0075] Specifically, if the number of tasks for executable files, office files, compressed files, and other files have been used up, no matter whether the current file type of file 1 is an executable file, an office file, or a compressed file, in order to ensure the normal processing of files with these two processing priorities, the tasks of other files corresponding to the third processing priority can be deleted. For example, the oldest task can be deleted from the task queue of other files, and at the same time, counter 2 can be incremented by 1, which also indicates that other files have available tasks. Therefore, the available tasks can be lent to executable files, office files, or compressed files. In this way, the normal processing of files with high processing priorities is guaranteed.

[0076] If file 1 belongs to other files, it means that even if file 1 is not processed, the possibility of file 1 causing a security threat is not too great, so at this time, there is no need to write the task for processing file 1 into the task queue corresponding to other files.

[0077] Optionally, after reading a corresponding number of tasks from the task queues corresponding to each file type according to the task processing ratio corresponding to each file type and the processing priority of each file type, in this embodiment, the following process can also be provided: returning the borrowed number of tasks in order of processing priority from high to low; after reading the corresponding number of tasks for each task queue, updating the number of tasks corresponding to the task queue.

[0078] Specifically, when reading tasks from the task queue, the number of available tasks will be updated. In order to better understand this embodiment, the above executable file can also be used as an example for explanation. Figure 2a As shown, Figure 2a The task queues for executable files are listed in the table, which are marked as task queue 1, task queue 2 for office files, and task queue 3 for other files. The number in each box in each task queue represents a task. When reading tasks from a task queue, you can read according to the reading rules of the task queue. Generally speaking, the earlier the task is written, the earlier it is read. For example, in task queue 1, task 1 is the earliest task written, and task 9 is the task written later than task 8. When reading tasks, read task 1 first, and so on. In addition, since the processing priority of executable files is higher than that of office files, and the processing priority of office files is higher than that of other files, the ratio of the number of tasks read for executable files, office files, and other files to the ratio of the number of assigned tasks is used as an example for explanation. If three file types are currently started, it can be seen from Table 3 that the ratio of the number of reads is 6:3:1, that is, after reading six tasks from task queue 1 to detect executable files, three tasks are read from task queue 2 for security detection of office files, and finally, one task is read from task queue 3 for security detection of other files. This also ensures that files with high processing priority are processed first.

[0079] When reading tasks, the number of available tasks in each task queue will change. We will use counter 1 to record the number of available tasks for executable files, counter 2 to record the number of available tasks for other files, and counter 5 to record the number of available tasks for office files as an example. Figure 2aIt can be seen that the current task queues are not full. Therefore, when 6 tasks are read from task queue 1, counter 1 can be incremented by 6 to update the number of available tasks of the executable file, and the 6 tasks read can be used to process files 11 to 16 pointed to by each task respectively; similarly, when 3 tasks are read from task queue 2, counter 5 can be incremented by 3 to update the number of available tasks of the office file, and the 3 tasks read can be used to process files 21 to 23 pointed to by each task respectively; when 1 task is read from task queue 3, counter 2 can be incremented by 1 to update the number of available tasks of the office file, and the 1 task read can be used to process file 31 pointed to by each task respectively.

[0080] Combined with the above description, there are cases where the number of tasks borrowing other file types exists. Figure 2b As shown, the current value of counter 1 is 0, that is, the 60 available tasks of the executable file have been used up, and the value of counter 4 used to record the number of tasks borrowed from other files is 3. When reading tasks, after reading 6 tasks from task queue 1, the borrowed tasks are returned first. For example, the value of counter 4 is 3, that is, 3 tasks have been borrowed from other files, so these 3 tasks are returned at this time, that is, counter 4 is cleared, and then the value of counter 2 is added by 3 at the same time to complete the return of the borrowed tasks. In addition, since 6 tasks are currently read and 3 are returned, there are still 3 tasks available, and counter 1 can be added by 3 at this time. This also realizes the update of the corresponding number of tasks and the return of the borrowed tasks during the task reading process.

[0081] Furthermore, the present embodiment also provides the following method: counting the total number of tasks currently in use; if the total number of tasks is higher than a first threshold value but not higher than a second threshold value, writing tasks to the files to be detected with a first target processing priority level, the first target processing priority level being higher than a first set priority level; if the total number of tasks is higher than the second threshold value but not higher than a third threshold value, writing tasks to the files to be detected with a second target processing priority level, the second target processing priority level being higher than a second set priority level, the second set priority level being higher than the first set priority level; if the total number of tasks is higher than the third threshold value, suspending the writing of tasks for the files to be detected.

[0082] It should be noted that the implementation of this embodiment can be implemented before executing the step of if the first number of tasks allocated to the file type of the file to be detected has not been used up, or it can be implemented after the task of processing the file to be detected is written into the task queue to which the file type of the file to be detected belongs. The specific implementation can be determined according to actual conditions.

[0083] Specifically, when the business traffic is relatively large, more and more files will flow into the network security device, and accordingly, the total number of used tasks will also increase. As the total number of used tasks increases, the total number of used tasks will get closer and closer to the allocated total number of tasks. The closer it is to the allocated total number of tasks, the more it indicates that the number of tasks for some file types will be used up. In order to prevent the number of tasks for file types with a high probability of virus occurrence from running out, resulting in the inability to continue processing files of that type, thereby causing a greater security threat, in view of this, in order to avoid the waste of file processing performance caused by the network security device processing more low-risk files in the traffic processing, and at the same time to improve the file performance of file types with a high probability of virus occurrence in the network security device as much as possible, this embodiment proposes to set three thresholds, namely the above-mentioned first threshold, second threshold and third threshold.

[0084] Specifically, assuming that the total number of assigned tasks is 100, the first threshold is 80% of the total number of assigned tasks (the first threshold is 80), the second threshold is 90% of the total number of assigned tasks (the second threshold is 90), and the third threshold is the total number of assigned tasks (the third threshold is 100) as an example for explanation. Currently, three file types, executable files, compressed files, and other files, are set, and the first processing priority, the second processing priority, and the third processing priority are set, for a total of three processing priorities; for example, the first set priority is the third processing priority, and accordingly, the first target processing priority is the first processing priority and the second processing priority; the second set priority is the second processing priority, and accordingly, the second target processing priority is the first processing priority, then in the file processing During the process, the total number of used tasks is counted. When it is found that the total number of used tasks reaches 80, it indicates that there is a certain pressure on the current file processing. In order to ensure the processing of files with high processing priority, this embodiment proposes to enable the first processing mechanism, that is, only write tasks to files corresponding to file types higher than the third processing priority, that is, only write tasks to files of file types corresponding to the first processing priority and the second processing priority, that is, only assign tasks and write tasks to executable files and compressed files, and do not assign tasks and write tasks to other files. In this way, the processing of files with high processing priority can be guaranteed, which also ensures the detection of files with a higher probability of virus occurrence, thereby increasing the chance of virus files being identified when file processing is limited.

[0085] Furthermore, the total number of used tasks can be continuously monitored and processed. When the total number of used tasks exceeds 80 but does not exceed 90, it indicates that there is a large processing pressure in the current file processing. In this case, the second processing mechanism is initiated, that is, tasks are only written to files of a file type greater than the second processing priority. In other words, tasks are only assigned and written to executable files, and office files and other files are not assigned and written. In other words, the processing of files of file types with high processing priorities (first processing priority) is prioritized, and the probability of viruses appearing in file types corresponding to high processing priorities is high. Therefore, the use of the above-mentioned second processing mechanism can ensure file detection of files with high processing priorities.

[0086] Furthermore, it is possible that when continuing to process files with the first processing priority, the number of used tasks reaches 100, that is, it is used up, which means that it is temporarily impossible to allocate tasks and write tasks to any new files to be detected. At this time, the third processing mechanism is started, that is, the task allocation and task writing for the files to be detected are suspended.

[0087] When any task allocation and task writing are suspended, the following concentrated situations may occur for the received files to be detected: In situation one, all files to be detected are cached normally to wait for security detection; In situation two, files whose processing priority of the identified file type reaches the preset processing priority (the probability of virus occurrence meets the processing priority corresponding to the set detection condition) are cached to wait for security detection, and the files to be detected that belong to file types lower than the set processing priority are directly forwarded for processing. In other words, security detection is not performed on some files with a low probability of virus occurrence, and they are directly forwarded for processing.

[0088] It should be noted that the above is only an example. In actual applications, the first target processing priority may include multiple processing priorities. Similarly, the second target processing priority may also have multiple processing priorities, which can be set specifically according to actual conditions.

[0089] In addition, based on the above description, during the process of task allocation and task writing, task processing has also been processed in parallel. Therefore, after the task is read, there may be a change in the number of available tasks. Therefore, this embodiment proposes that after suspending the processing of the files to be detected, it also includes the following process: when the total number of tasks is not higher than the fourth threshold, the files to be detected of the second target processing priority are processed; when the total number of tasks is not higher than the fifth threshold, the files to be detected of the first target processing priority are processed; when the total number of tasks is not higher than the sixth threshold, the files to be detected of each processing priority are processed; wherein the sixth threshold is less than the fifth threshold, the fifth threshold is less than the fourth threshold, and the fourth threshold is less than the third threshold.

[0090] Specifically, after detecting that the total number of used tasks reaches the total number of allocated tasks, since the writing of all tasks has been suspended at this time, but the task reading is ongoing, the total number of used tasks will change after the task reading. Therefore, the total number of used tasks can continue to be statistically processed.

[0091] For ease of understanding, the total number of tasks allocated is 100, the fourth threshold is 95% (95) of the total number of tasks allocated, the fifth threshold is 85% (85) of the total number of tasks allocated, and the sixth threshold is 75% (75) of the total number of tasks allocated. The first target processing priority is the first processing priority and the second processing priority, and the second target processing priority is the first processing priority. When it is found that the total number of tasks used decreases from 100 to 95, files with a relatively high probability of virus occurrence pose a greater security threat. Therefore, this embodiment proposes that task allocation and writing processing for executable files can be enabled at this time; when the total number of tasks used decreases to 85, it indicates that in addition to processing executable files, there is spare capacity to process office files, so task allocation and writing processing for office files can be enabled at this time to process task allocation and task writing of executable files and office files; when the total number of tasks used decreases to 75, the processing permissions of other files can be enabled to achieve task allocation and task writing of all files.

[0092] Therefore, by implementing the above-mentioned file processing method, the detection engine in the network security device can be used more efficiently, the anti-virus detection efficiency can be improved, more virus files in the network traffic can be detected, and network security can be guaranteed.

[0093] Based on the same inventive concept, the present application also provides a file processing device corresponding to the above file processing method. The implementation of the file processing device can refer to the above description of the file processing method, which will not be discussed here one by one.

[0094] See also Figure 3 , Figure 3 A file processing device provided by an exemplary embodiment of the present application is applied to a network security device, and the device includes:

[0095] An acquisition unit 301 is used to acquire a file to be detected;

[0096] A writing unit 302 is used to write the task of processing the file to be detected into the task queue to which the file type of the file to be detected belongs;

[0097] The reading unit 303 is used to read a corresponding number of tasks from the task queue corresponding to each file type according to the task processing ratio corresponding to each file type and the processing priority of each file type;

[0098] The processing unit 304 is used to process the to-be-detected file corresponding to the read task, wherein the processing priority of each file type is positively correlated with the probability that a virus exists in the file of that type.

[0099] In this embodiment, since the processing priority of each file type is positively correlated with the probability that a virus exists in a file of that file type, the greater the probability of a virus appearing in a certain file type, the higher the processing priority can be set for that file type. In this way, files are processed according to their file types and their processing priorities, thereby ensuring that files with higher processing priorities are processed first, thereby ensuring the processing efficiency of files with high processing priorities, and also improving the processing efficiency of virus files.

[0100] Optionally, in this embodiment, the writing unit 302 is specifically used for:

[0101] If the first number of tasks allocated for the file type of the file to be detected is not used up, subtracting the number of tasks required to process the task to be detected from the first number of tasks, and writing the task to process the file to be detected into the task queue to which the file type of the file to be detected belongs;

[0102] If the number of first tasks allocated to the file type of the to-be-detected file has been used up, determining whether the number of second tasks corresponding to the file type with a low processing priority has been used up in order of processing priority from low to high;

[0103] If the second number of tasks is not used up, subtracting the number of tasks required to process the task to be detected from the second number of tasks, and writing the task of processing the file to be detected into the task queue to which the file type of the file to be detected belongs;

[0104] If the second number of tasks has been used up, determining whether the third number of tasks corresponding to the file type of the previous processing priority of the lower processing priority has been used up;

[0105] If the third number of tasks is not used up, subtracting the number of tasks required to process the task to be detected from the third number of tasks, and writing the task of processing the file to be detected into the task queue to which the file type of the file to be detected belongs;

[0106] If the third number of tasks has been used up, the step of determining whether the third number of tasks corresponding to the file type of the previous processing priority level with a lower processing priority level has been used up will continue to be executed.

[0107] Furthermore, the writing unit 302 is further used for:

[0108] If the number of tasks corresponding to each file type has been used up, and when the processing priority of the file type corresponding to the to-be-detected file is not the lowest processing priority, delete a task from the task queue to which the file type corresponding to the lowest processing priority belongs, and update the fourth task number corresponding to the lowest processing priority;

[0109] Subtracting the number of tasks required to process the task to be detected from the updated fourth number of tasks, and writing the task of processing the file to be detected into the task queue to which the file type of the file to be detected belongs;

[0110] When the processing priority of the file type corresponding to the file to be detected is the lowest processing priority, the task queue corresponding to the lowest processing priority is kept unchanged.

[0111] Optionally, the file processing device provided in this embodiment may further include:

[0112] A statistics unit (not shown in the figure) is used to count the total number of tasks currently in use;

[0113] On this basis, the above-mentioned writing unit 302 is also used to write tasks to the files to be detected with the first target processing priority if the total number of tasks counted by the statistical unit is higher than the first threshold but not higher than the second threshold, and the first target processing priority is higher than the first set priority; if the total number of tasks counted by the statistical unit is higher than the second threshold but not higher than the third threshold, then write tasks to the files to be detected with the second target processing priority, and the second target processing priority is higher than the second set priority, and the second set priority is higher than the first set priority; if the total number of tasks counted by the statistical unit is higher than the third threshold, then suspend the writing of tasks for the files to be detected.

[0114] Further, the above-mentioned writing unit 302 is also used for, after pausing the processing of the to-be-detected file, processing the to-be-detected file of the second target processing priority when the total number of tasks counted by the statistical unit is not higher than the fourth threshold; processing the to-be-detected file of the first target processing priority when the total number of tasks counted by the statistical unit is not higher than the fifth threshold; processing the to-be-detected file of each processing priority when the total number of tasks counted by the statistical unit is not higher than the sixth threshold;

[0115] The sixth threshold is smaller than the fifth threshold, the fifth threshold is smaller than the fourth threshold, and the fourth threshold is smaller than the third threshold.

[0116] Optionally, based on the above embodiment, the file processing device provided in this embodiment may further include:

[0117] An updating unit (not shown in the figure) is used to return the borrowed number of tasks in descending order of processing priority after reading a corresponding number of tasks from the task queues corresponding to each file type according to the task processing ratio corresponding to each file type and the processing priority of each file type in the reading unit; and update the number of tasks corresponding to the task queue after reading a corresponding number of tasks for each task queue.

[0118] Based on the same inventive concept, an embodiment of the present application provides an electronic device, which can be the above-mentioned network security device. Figure 4 As shown, the electronic device includes a processor 401 and a machine-readable storage medium 402, the machine-readable storage medium 402 stores a computer program that can be executed by the processor 401, and the processor 401 is prompted by the computer program to execute the file processing method provided in any embodiment of the present application. In addition, the electronic device also includes a communication interface 403 and a communication bus 404, wherein the processor 401, the communication interface 403, and the machine-readable storage medium 402 communicate with each other through the communication bus 404.

[0119] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0120] The communication interface is used for communication between the above electronic device and other devices.

[0121] The machine-readable storage medium 402 may be a memory, which may include a random access memory (RAM), a DDR SRAM (Double Data Rate Synchronous Dynamic Random Access Memory), or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the processor.

[0122] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0123] In addition, this embodiment also provides a machine-readable storage medium, which stores a computer program. When called and executed by a processor, the computer program prompts the processor to execute the method provided by any embodiment of the present application.

[0124] As for the electronic device and machine-readable storage medium embodiments, since the method contents involved are basically similar to the aforementioned method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0125] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0126] The implementation process of the functions and effects of each unit / module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0127] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can refer to the partial description of the method embodiments. The device embodiments described above are merely schematic, wherein the units / modules described as separate components may or may not be physically separated, and the components displayed as units / modules may or may not be physical units / modules, that is, they may be located in one place, or they may be distributed on multiple network units / modules. Some or all of the units / modules may be selected according to actual needs to achieve the purpose of the present application. A person of ordinary skill in the art can understand and implement it without creative work.

[0128] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A file processing method, characterized in that: Applied to a network security device, the method comprises: Get the file to be tested; Writing the task of processing the file to be detected into the task queue to which the file type of the file to be detected belongs; According to the task processing ratio corresponding to each file type and the processing priority of each file type, a corresponding number of tasks are read from the task queue corresponding to each file type, and the files to be detected corresponding to the read tasks are processed, wherein the processing priority of each file type is positively correlated with the probability that a virus exists in files of that file type.

2. The method according to claim 1, characterized in that Writing the task of processing the file to be detected into the task queue to which the file type of the file to be detected belongs includes: If the first number of tasks allocated for the file type of the file to be detected is not used up, subtracting the number of tasks required to process the task to be detected from the first number of tasks, and writing the task to process the file to be detected into the task queue to which the file type of the file to be detected belongs; If the number of first tasks allocated to the file type of the to-be-detected file has been used up, determining whether the number of second tasks corresponding to the file type with a low processing priority has been used up in order of processing priority from low to high; If the second number of tasks is not used up, subtracting the number of tasks required to process the task to be detected from the second number of tasks, and writing the task of processing the file to be detected into the task queue to which the file type of the file to be detected belongs; If the second number of tasks has been used up, determining whether the third number of tasks corresponding to the file type of the previous processing priority of the lower processing priority has been used up; If the third number of tasks is not used up, subtracting the number of tasks required to process the task to be detected from the third number of tasks, and writing the task of processing the file to be detected into the task queue to which the file type of the file to be detected belongs; If the third number of tasks has been used up, the step of determining whether the third number of tasks corresponding to the file type of the previous processing priority level with a lower processing priority level has been used up will continue to be executed.

3. The method according to claim 2, characterized in that The method further comprises: If the number of tasks corresponding to each file type has been used up, and when the processing priority of the file type corresponding to the to-be-detected file is not the lowest processing priority, delete a task from the task queue to which the file type corresponding to the lowest processing priority belongs, and update the fourth task number corresponding to the lowest processing priority; Subtracting the number of tasks required to process the task to be detected from the updated fourth number of tasks, and writing the task of processing the file to be detected into the task queue to which the file type of the file to be detected belongs; When the processing priority of the file type corresponding to the file to be detected is the lowest processing priority, the task queue corresponding to the lowest processing priority is kept unchanged.

4. The method according to claim 3, characterized in that Also includes: Count the total number of tasks currently in use; If the total number of tasks is higher than the first threshold but not higher than the second threshold, writing tasks to the to-be-detected files of the first target processing priority, the first target processing priority being higher than the first set priority; If the total number of tasks is higher than the second threshold but not higher than the third threshold, writing tasks to the files to be detected with a second target processing priority, the second target processing priority is higher than a second set priority, and the second set priority is higher than the first set priority; If the total number of tasks is higher than the third threshold, the writing of tasks of the file to be detected is suspended.

5. The method according to claim 4, characterized in that After pausing the processing of the file to be detected, the method further includes: When the total number of tasks is not higher than a fourth threshold, processing the to-be-detected files of the second target processing priority; When the total number of tasks is not higher than the fifth threshold, processing the to-be-detected files of the first target processing priority level; When the total number of tasks is not higher than a sixth threshold, the files to be detected of each processing priority are processed; The sixth threshold is smaller than the fifth threshold, the fifth threshold is smaller than the fourth threshold, and the fourth threshold is smaller than the third threshold.

6. The method according to claim 2, characterized in that After reading a corresponding number of tasks from the task queues corresponding to each file type according to the task processing ratios corresponding to each file type and the processing priorities of each file type, the method further includes: Return the number of borrowed tasks in descending order of processing priority; After reading a corresponding number of tasks for each task queue, the number of tasks corresponding to the task queue is updated.

7. A file processing device, characterized in that: Applied in network security equipment, the device comprises: An acquisition unit, used for acquiring a file to be detected; A writing unit, used for writing the task of processing the file to be detected into the task queue to which the file type of the file to be detected belongs; A reading unit, used for reading a corresponding number of tasks from a task queue corresponding to each file type according to a task processing ratio corresponding to each file type and a processing priority of each file type; The processing unit is used to process the to-be-detected file corresponding to the read task, wherein the processing priority of each file type is positively correlated with the probability that a virus exists in the file of that type.

8. The device according to claim 7, characterized in that The writing unit is specifically used for: If the first number of tasks allocated for the file type of the file to be detected is not used up, subtracting the number of tasks required to process the task to be detected from the first number of tasks, and writing the task to process the file to be detected into the task queue to which the file type of the file to be detected belongs; If the number of first tasks allocated to the file type of the to-be-detected file has been used up, determining whether the number of second tasks corresponding to the file type with a low processing priority has been used up in order of processing priority from low to high; If the second number of tasks is not used up, subtracting the number of tasks required to process the task to be detected from the second number of tasks, and writing the task of processing the file to be detected into the task queue to which the file type of the file to be detected belongs; If the second number of tasks has been used up, determining whether the third number of tasks corresponding to the file type of the previous processing priority of the lower processing priority has been used up; If the third number of tasks is not used up, subtracting the number of tasks required to process the task to be detected from the third number of tasks, and writing the task of processing the file to be detected into the task queue to which the file type of the file to be detected belongs; If the third number of tasks has been used up, the step of determining whether the third number of tasks corresponding to the file type of the previous processing priority level with a lower processing priority level has been used up will continue to be executed.

9. The device according to claim 8, characterized in that The writing unit is further used for: If the number of tasks corresponding to each file type has been used up, and when the processing priority of the file type corresponding to the to-be-detected file is not the lowest processing priority, delete a task from the task queue to which the file type corresponding to the lowest processing priority belongs, and update the fourth task number corresponding to the lowest processing priority; Subtracting the number of tasks required to process the task to be detected from the updated fourth number of tasks, and writing the task of processing the file to be detected into the task queue to which the file type of the file to be detected belongs; When the processing priority of the file type corresponding to the file to be detected is the lowest processing priority, the task queue corresponding to the lowest processing priority is kept unchanged.

10. The device according to claim 8, characterized in that Also includes: Statistics unit, used to count the total number of tasks currently used; The writing unit is also used to write tasks to the files to be detected with a first target processing priority if the total number of tasks counted by the statistical unit is higher than a first threshold but not higher than a second threshold, and the first target processing priority is higher than a first set priority; if the total number of tasks counted by the statistical unit is higher than the second threshold but not higher than a third threshold, write tasks to the files to be detected with a second target processing priority, and the second target processing priority is higher than the second set priority, and the second set priority is higher than the first set priority; if the total number of tasks counted by the statistical unit is higher than the third threshold, suspend the writing of tasks for the files to be detected.

11. The device according to claim 10, characterized in that The writing unit is further used for, after pausing the processing of the to-be-detected file, processing the to-be-detected file of the second target processing priority when the total number of tasks counted by the statistical unit is not higher than a fourth threshold; processing the to-be-detected file of the first target processing priority when the total number of tasks counted by the statistical unit is not higher than a fifth threshold; processing the to-be-detected file of each processing priority when the total number of tasks counted by the statistical unit is not higher than a sixth threshold; The sixth threshold is smaller than the fifth threshold, the fifth threshold is smaller than the fourth threshold, and the fourth threshold is smaller than the third threshold.

12. The device according to claim 8, characterized in that Also includes: An updating unit is used to return the borrowed number of tasks in descending order of processing priority after the reading unit reads a corresponding number of tasks from the task queues corresponding to each file type according to the task processing ratio corresponding to each file type and the processing priority of each file type; and to update the number of tasks corresponding to each task queue after reading a corresponding number of tasks for each task queue.