通过分析AC多模式匹配算法和正则语句搜索匹配在功能上的优劣,研究它们在生成确定性有穷自动机时的相同与差异,融合AC算法和正则语句运用于文本的多模式串匹配,使得AC算法能够识别正则语句,并且保持原有算法在匹配失败后,目标模式串指针不回退且AC自动机回退少的特点,使得算法兼有二者优点. 同时,讨论了在GPU上通过CUDA的并行程序环境实现算法的并行化,并详细比较了在GPU上利用不同类型存储器实现的算法的性能差异.
Multi-pattern matching algorithm has been widely used in text searching, intrusion detection, and some other areas. We focus on two matching algorithms, AC and regular expression. By comparing their DFA automata building process, we integrate the two processes to a new novel AC algorithm. The new AC maintains the advantages of the traditional AC when matching fails, the pointer of the target pattern does not turn back, and the AC automata pointer just moves back by a few steps. Meanwhile, we also discuss the AC parallelization based on GPU and CUDA, and compare the running performance when using GPU global memory or the texture one.
[1] Aho A V, Corasick M J. Efficient string matching: an aid to bibliographic search[J]. Communications of the ACM, 1975, 18(6):333-340.
[2] Yang W, Fang B X, Liu B, et al. Intrusion detection system for high-speed network[J]. Computer Communications, 2004, 27(13):1288-1294.
[3] Thompson K. Regular expression search algorithm[J]. Communications of the ACM, 1968, 11(6): 419-422.
[4] Baker Z K, Prasanna V K. Time and area efficient pattern matching on FPGAs[C]//Proceedings of the 2004 ACM/SIGDA 12th International Symposium on Field Programmable Gate Arrays. New York: ACM Press, 2004:223-232.
[5] Sidhu R, Prasanna V. Fast regular expression matching using FPGAs[C]//Proceedings of the 9th Annual IEEE Symposium on Field-Programmable Custom Computing Machines. Washington: IEEE Computer Society, 2001:227-238.
[6] Jacob N, Brodley C. Offloading IDS computation to the GPU[C]//Proceedings of the 22nd Annual Computer Security Applications Conference, Washington: IEEE Computer Society, 2006: 371-380.
[7] Kouzinopoulos C S, Margaritis K G. String matching on a multicore GPU using CUDA[C]//Proceedings of the 13th Panhellenic Conference on Informatics. Washington: IEEE Computer Society, 2009:14-18.
[8] Vasiliadis G, Polychronakis M, Antonatos S, et al. Regular expression matching on graphics hardware for intrusion detection[C]//Proceedings of the 12th International Symposium on Recent Advances in Intrusion Detection. Berlin: Springer-Verlag Press, 2009:265-283.
[9] Vasiliadis G, Antonatos S, Polychronakis M, et al. Gnort: High performance network intrusion detection using graphics processors[C]//Proceedings of 11th international Symposium on Recent Advances in Intrusion Detection. Berlin: Springer-Verlag Press, 2008:116-134.
[10] Sipser M. Introduction to the theory of computation[M]. Boston: Thomson Learning Press, 2006.
[11] Wikimedia Foundation Inc. Shunting-yard algorithm: USA [DB/OL]. [2013-01-20]. http://en.wikipedia.org/wiki/Shunting-yard_algorithm.
[12] Fegaras L. University of Texas at Arlington: USA, CSE 5317/4305: design and construction of compilers [EB/OL]. (2012-01-10) [2012-09-10]. http://lambda.uta.edu/cse5317/.
[13] NVIDIA Corporation. All NVIDIA related information: USA[EB/OL].[2012-09-10]. http://www.nvidia.com/object/cuda_home. html.
[14] NVIDIA Corporation. NVIDIA CUDA programming guide: USA[G/OL].[2013-09-10]. http://developer.download.nvidia.com/compute/cuda/3_0/toolkit/docs/NVIDIA_CUDA_ ProgrammingGuide.pdf.
[15] 张舒, 褚艳利. GPU高性能运算之CUDA[M]. 北京: 中国水利水电出版社, 2009.