1 | \documentclass[a4paper,10pt]{article} |
---|
2 | \usepackage[utf8]{inputenc} |
---|
3 | |
---|
4 | \def \Bitstream{Bit Stream} |
---|
5 | \def \bitstream{bit stream} |
---|
6 | |
---|
7 | %opening |
---|
8 | \title{Fast Regular Expression Matching using Parallel \Bitstream{}s} |
---|
9 | \author{ |
---|
10 | {Robert D. Cameron} \\ |
---|
11 | \and |
---|
12 | {Kenneth S. Herdy} \\ |
---|
13 | \and |
---|
14 | {Ben Hull} \\ |
---|
15 | \and |
---|
16 | {Thomas C. Shermer} \\ |
---|
17 | \\School of Computing Science |
---|
18 | \\Simon Fraser University |
---|
19 | } |
---|
20 | \begin{document} |
---|
21 | |
---|
22 | \date{} |
---|
23 | \maketitle |
---|
24 | |
---|
25 | \begin{abstract} |
---|
26 | |
---|
27 | A data parallel regular expression matching method using the concept of bitstream technology |
---|
28 | is introduced and studied in application to the problem of fast regular expression matching. |
---|
29 | |
---|
30 | The method is based on the concept of parallel |
---|
31 | \bitstream{} technology, in which parallel streams of bits are formed such |
---|
32 | that each stream comprises bits in one-to-one correspondence with the |
---|
33 | character code units of a source data stream. |
---|
34 | |
---|
35 | On processors supporting W-bit addition operations, the method processes W source characters |
---|
36 | in parallel and performs up to W finite state transitions per clock cycle. |
---|
37 | |
---|
38 | Performance results show a dramatic speed-up over traditional and state-of-the-art alternatives. |
---|
39 | |
---|
40 | |
---|
41 | \end{abstract} |
---|
42 | |
---|
43 | \section{Introduction} |
---|
44 | \label{Introduction} |
---|
45 | %\input{introduction.tex} |
---|
46 | |
---|
47 | Given a text T$_{1..n}$ of n characters and a pattern P, the pattern matching problem can be |
---|
48 | stated as follows. Find all the text positions of T that start an occurrence of P. |
---|
49 | Alternatively, one may want all the final positions of occurrences. Some |
---|
50 | applications require slightly different output such as the line that matches the pattern. |
---|
51 | |
---|
52 | The pattern P can be just a simple string, |
---|
53 | but it can also be, for example, a regular expression. |
---|
54 | In this paper our focus is regular expression matching. |
---|
55 | |
---|
56 | A regular expression, or pattern, is an expression that specifies a set of strings. |
---|
57 | A regular expression is composed of (i) basic strings and (ii) |
---|
58 | union, concatenation and Kleene closure of other regular expressions. |
---|
59 | To avoid parentheses it is assumed that the Kleene star has the highest priority, |
---|
60 | next concatenation and then alternation, however, most formalisms provides grouping |
---|
61 | operators to allow the definition of scope and operator precedence. |
---|
62 | |
---|
63 | Readers unfamiliar with the concept of regular expression matching are referred |
---|
64 | classical texts such as \cite{aho2007}. |
---|
65 | |
---|
66 | \subsection{Grep} |
---|
67 | |
---|
68 | Regular expression matching is commonly performed using a variety of |
---|
69 | publically available software tools. Namely, the UNIX grep family, |
---|
70 | the GNU grep family, agrep, cgrep, sgrep, nrgrep, and Perl regular |
---|
71 | expressions \cite{Abou-assaleh04surveyof}. |
---|
72 | |
---|
73 | % Grep |
---|
74 | % Unix grep |
---|
75 | % Gnu grep |
---|
76 | % agrep |
---|
77 | % nrgrep |
---|
78 | |
---|
79 | Of particular interest are well-studied and performance oriented |
---|
80 | Gnu grep, agrep, and nrgrep. |
---|
81 | |
---|
82 | As such, we compare the performance of our parallel \bitstream{} techniques against |
---|
83 | various grep concentrate on the simpler case of |
---|
84 | reporting initial or final occurrence positions. |
---|
85 | |
---|
86 | % Background |
---|
87 | |
---|
88 | % History |
---|
89 | |
---|
90 | Regular expresssion matching is an extensively studied problem with a multitude |
---|
91 | of algorithms and software tools developed to the demands of particular problem contexts. |
---|
92 | |
---|
93 | Historically, the origins of regular expression matching date back to automata theory |
---|
94 | and formal language theory developed by Kleene in the 1950s \cite{kleene1951representation}. |
---|
95 | |
---|
96 | The traditional technique [16] to search a regular expression of length m in |
---|
97 | a text of length n is to first convert the expression into a non-deterministic |
---|
98 | automaton (NFA) with O(m) nodes. |
---|
99 | |
---|
100 | Thompson, in 1968, is credited with the first construction to convert regular expressions |
---|
101 | to nondeterministic finite automata (NFA) for regular expression matching. |
---|
102 | Thompsonâs publication \cite{thompson1968} marked the beginning of a long line of |
---|
103 | regular expression implementations that construct automata for pattern matching. |
---|
104 | |
---|
105 | The general process is first to build a NFA. |
---|
106 | Automaton (NFA) from the regular expression, then convert the NFA into a |
---|
107 | Deterministic Finite Automaton (DFA), and finally use the DFA to scan the text. |
---|
108 | |
---|
109 | It is possible to search the text using the NFA directly in O(mn) worst case time. |
---|
110 | |
---|
111 | The cost comes from the fact that |
---|
112 | more than one state of the NFA may be active at each step, and therefore all |
---|
113 | may need to be updated. A more effcient choice is to convert the NFA into a |
---|
114 | deterministic finite automaton (DFA). A DFA has only a single active state |
---|
115 | and allows to search the text at O(n) worst-case optimal. The problem with this |
---|
116 | approach is that the DFA may have O(2^m) states. |
---|
117 | |
---|
118 | |
---|
119 | |
---|
120 | |
---|
121 | |
---|
122 | |
---|
123 | |
---|
124 | \section{Background} |
---|
125 | \label{Background} |
---|
126 | %\input{background.tex} |
---|
127 | |
---|
128 | \section{Methodology} |
---|
129 | \label{Methodology} |
---|
130 | %\input{methodology.tex} |
---|
131 | |
---|
132 | \section{Experimental Results} |
---|
133 | \label{results} |
---|
134 | %\input{results.tex} |
---|
135 | |
---|
136 | \section{Conclusion and Future Work} |
---|
137 | \label{conclusion} |
---|
138 | %\input{conclusion.tex} |
---|
139 | |
---|
140 | { |
---|
141 | \bibliographystyle{acm} |
---|
142 | \bibliography{reference} |
---|
143 | } |
---|
144 | |
---|
145 | \end{document} |
---|