0% found this document useful (0 votes)
75 views

Performance Comparison of Parallel Searching Algorithms On The Network of Workstations

This document compares the performance of parallel linear search and parallel Duplicate Element Binary Search (DEBS) algorithms on a network of workstations. It implements these two serial and parallel search algorithms using Java Remote Method Invocation (RMI). Testing is done on a book database stored in MySQL. Results show that parallel search speeds up data searching compared to serial search by reducing execution time through distributed computations across multiple processors.

Uploaded by

Phyu Too Thwe
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views

Performance Comparison of Parallel Searching Algorithms On The Network of Workstations

This document compares the performance of parallel linear search and parallel Duplicate Element Binary Search (DEBS) algorithms on a network of workstations. It implements these two serial and parallel search algorithms using Java Remote Method Invocation (RMI). Testing is done on a book database stored in MySQL. Results show that parallel search speeds up data searching compared to serial search by reducing execution time through distributed computations across multiple processors.

Uploaded by

Phyu Too Thwe
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Performance Comparison of Parallel Searching

Algorithms on the Network of Workstations


Phyu Phyu Thwe, Lai Lai Win Kyi
Department of Information Technology
Mandalay Technological University

Abstract - Over the years, computer scientists have solve the problem in a reasonable amount of time and
conducted researches on linear and binary search cost. In this paper, parallel linear search and parallel
algorithms, and concluded that binary search algorithm is DEBS algorithms are constructed on the network of
faster than linear search algorithm. But, the limitation with workstations. In order to compare, how faster the data
the Binary Search (BS) algorithm is that it can only be used
may be searched by mean of parallel computations, the
to search for one element in a given list. So this paper tends
to extend Binary Search (BS) algorithm to overcome this speedup and efficiency is computed.
limitation. On the other hand, Duplicate Element Binary To build the proposed system, many tools are available
Search (DEBS) algorithm is proposed to search duplicate in parallel and distributed processing. These tools include
elements in a given list with the same time complexity of PVM, MPI and Java. Java provides support for
classical BS algorithm. And linear search and DEBS concurrent and parallel programming through threads,
algorithms are developed using Single Instruction Multiple monitors and its socket and Remote Method Invocation
Data (SIMD) parallel computing model on the network of (RMI) classes [8]. Among them, the system has been
workstations. Then the execution time, speedup and implemented by using Java RMI. And these two
efficiency are computed for these two serial and parallel
algorithms are demonstrated on the book database in an
search algorithms. Applications of these two algorithms are
considered together with the book database in an e-library e-library system and book database is created by MySQL
system. MySQL server is used to store and retrieve the server.
book lists. This system is implemented by using RMI based The rest of this paper is organized as follows. Section
on Java threads on the network of workstations. II presents the related work for this research. Section III
presents background theory. It describes sequential and
Keywords - Binary Search, Duplicate Elements, Linear parallel search algorithms and analysing algorithms.
Search, RMI, Search Algorithms. Section IV describes the design and implementation of
the proposed system. Section V closes the paper with
I. INTRODUCTION conclusion.
Searching is one of the most important operations in
computer science. Searching an item or data from a large II. RELATED WORKS
data set efficiently gives a challenging task. There are Olabiyisi S.O and his colleagues evaluated the
number of searching algorithms available like Binary efficiency of linear and binary searching techniques in
Search, Linear Search, Depth-First Search (DFS), Best-
terms of running time, memory usage and the numbers of
First Search (BFS) and Binary Search Tree (BST) etc [1].
comparison on decision variables. Experimental results
Among them, Binary search and linear search is not only
for the decision variables were generated from a software
the basic algorithms for searching but also closely related
to other algorithms. So this system tends to develop these tool written using Java programming language in which
two searching algorithms in serial and parallel the arrays of number searched were varied for the four
environment. Linear Search algorithm can find a different searching techniques of linear and binary. The
particular item on uninformed (unsorted list) but Binary result showed that numbers of comparison contributed;
Search algorithm can find only on informed (sorted list). 84.459% and 72.876% for linear and binary searching
However, they can be used to search for one element or techniques respectively. The time taken came second,
data in a given list. So, these two algorithms are modified contributing 15.538% and 27.041% while memory used
for searching duplicate elements in this paper. was the least of all contributing 0.003% and 0 .082% for
When searching for a particular item in a list, linear and binary search respectively. It can be concluded
sequential approaches can be time consuming. Parallel that numbers of comparison is the most critical factor
search is a way to increase the search speed by using affecting the searching techniques. Binary search is the
additional processors or computer workstations [4]. Data most efficient of all the searching techniques considered
parallelism is one of the most successful efforts to [2].
introduce explicit parallelism to high level programming Asagba P. O, Osaghae E. O. and Ogheneovo E. E. tried
languages. The approach is taken because many useful to conduct experiments on the execution time of linear
computation can be framed in terms of a set of search, binary search without inclusion of sorting time,
independent sub-computations, each strongly associated and binary search with the inclusion the sorting time. This
with an element of a large data structure. The paper established the fact that execution time of binary
workstations connected via a local area network allow search algorithm is not faster than execution time of
speeding up the application processing time [7]. On the linear search algorithm, when the execution time of the
other hand, parallel computing has very high performance sorting algorithm is included to the binary search
workstations and PCs readily available at low cost. It can algorithm [3].
A. Haboush and S. Qawasmeh proposed Sequential the array, the result is returned. Otherwise, a special “Not
Parallel Search Algorithm (SPSA), in which the idea is to found” indication is returned. Time complexity of linear
eliminate the need of sorting the input array in order to search is O(n) since n comparisons are needed for the
search an item. In the proposed algorithm, the array to be number of n elements.
searched is divided into two sub-arrays and then, two
search threads are created in parallel which required Algorithm: linear search (A [0…n-1], key)
O(n/2) in the worst case, reducing the searching time in
while (low<=high) do
the worst case from O(n) to O(n/2+log n). Log n is the
if A[low] = key then
time needed to split an array of size n. To study the
return result
effectiveness of the system researchers investigated and
end if
compared the running time of the proposed algorithm
low= low + 1
SPSA with that of binary search by conducting a series of
end while
simulation experiments data to evaluate the performance
return -1
of SPSA. The experiments results confirm that the
efficiency of the proposed algorithm increases and the B. Parallel Linear Search Algorithm
time needed to search an item is reduced up to 26% for an
input size of 5000-1000000 items and up to 3.6% for Assume that N processors are available to search
large input size [4]. sequence S for a given element key, where 1<N≤ n. To
D. Clark and his colleagues studied the comparison of begin, the value of key must be made to know to all
speed of various methods of applying parallel processing processors. The sequence S is divided into N
to shortest-path search algorithms. They implemented a subsequences of length n/N and processor Pi is assigned
program to solve the puzzle game Ricochet Robots using {S(i-1)(n/N)+1,S(i-1)(n/N)+2, … , Si(n/N)}. All processors now
three different search algorithms: Iterative-Deepening perform procedure LINEAR SEARCH on their assigned
Depth-First Search, Breadth-First Search, and A* Search. subsequences. In parallel linear search algorithm, the time
Each algorithm was implemented using both sequential needed to read the search key from all processors in step
and parallel code. Test were conducted on a machine with 1 is O(log N) time. In step 2, procedure sequential search
a sixteen-core CPU, using four, eight, and sixteen cores takes O(n/N) time in the worst case. Finally, procedure to
progressively in order to examine scalability of return result in step 3 runs in O (log N) time. So, overall
algorithms. The research show that parallel searches running time is O(logN) + O(n/N) + O(logN) time and
significantly improved performance overall compared to time complexity is O(n/N) [11].
sequential searches [5].
M. Damrudi and K. Jadidy Aval implemented “A Algorithm parallel linear search (S, key)
Parallel Search on Hypercube Interconnection Network”. Step1: for i = 1 to N do in parallel
This paper introduced a new searching algorithm on Read key
hypercube architecture with tradeoff between the end for.
numbers of processor elements and the running time. The Step2: for i = 1 to N do in parallel
issued architecture for this search algorithm is a (2.1) Si = {S(i-1)(n/N)+1,S(i-1)(n/N)+2, … , Si(n/N)}
homogeneous architecture and the pipelined approach is (2.2) LINEAR SEARCH (Si,key)
also applied which leads to better results and end for
performance. This search algorithm has an acceptable Step3: for i = 1 to N do in parallel
order using an appropriate hardware cost where execution return result
time is O(logN) with fault tolerance property [6]. end for.
Above of all researches, extensive research has been
done to demonstrate effectiveness of parallel search. As C. Duplicate Elements Binary Search (DEBS)
performance of parallel search applications on networks In computer science, a binary search or half-interval
of workstations can be different, this paper tends to search algorithm finds the position of a specified value
compare the performance of parallel search algorithms to (the input “key”) within a sorted array. In each step, the
understand effective speed of search algorithms. algorithm compares the input key value with the key
value of the middle element of the array [10]. Binary
III. BACKGROUND THEORY
Search algorithm is modified for duplicate elements.
This section describes the background theory to The DEBS algorithm finds first and last occurrences of
implement parallel search algorithms. It includes about the key and stores their indexes into an array and returns
search algorithms and analysis of algorithms.
it. The search starts with the midpoint of the array. If the
key is less than or greater than middle element, the
A. Linear Search Algorithm
algorithm performs the same function of the binary
In computer science, linear search (also known as search. If the key matches the middle element, there can
sequential search) is a search algorithm that can be used be duplicate keys on both sides of the array. Therefore,
for searching an unsorted set of data for a particular the algorithm checks the sub array to the right for the last
value. It operates by checking every element of a list one occurrence whether the last index is equal to the key. If
at a time in sequence until a match is found [9]. Linear the key is not equal to the last index, the algorithm finds
search is modified by checking every element until the the midpoint again on this sub array and repeats its
end of list for duplicate elements. If the key is found in action. Then it checks again on the sub array to left for
the first occurrence whether the first index is equal to the if ((A[middle] > key and A[middle-1] = key) then
key. If the key is not equal to the first index, the return middle-1
algorithm performs action same to the right sub array. else if (A[middle] = key) then
Finally, the indexes of the first and last occurrences are low = middle + 1
returned in an array. If remaining sub array to be search else if (A[middle] > key and A[middle-1] != key) then
reaches zero and the key is not found in the array, then a high = middle – 1
special “Not found” indication is returned. end if
end while
return -1
key = G, A[0….15] findFirstIndex(A[0…n-1],key, middle, low)
high = middle - 1
A B C D E F G G G G G H I J K L if (A[low] = key) then
return low
low key=A[mid] high end if
Find last occurrence in sub array while (low <= high) do
middle = (low + high) / 2
G G G G H I J K L if ((A[middle] < key and A[middle+1] = key) then
return middle+1
else if (A[middle] = key) then
low mid key!=high
high = middle - 1
key=A[mid-1] else if (A[middle] < key and A[middle+1] != key) then
low = middle + 1
G G G G end if
Find first occurrence in sub array
end while
A B C D E F G return -1

D. Parallel DEBS Algorithm


key!=low mid high
Assume that N processors are available to search
key!=A[mid+1]
sequence S for a given element key, where 1<N≤ n. To
E F G
begin, the value of key must be made to know to all
processors. The sequence S is divided into N
subsequences of length n/N and processor Pi is assigned
G {S(i-1)(n/N)+1,S(i-1)(n/N)+2, … , Si(n/N)} [11]. All processors
low mid high
now perform procedure DUPLICATE ELEMENT
key=A[mid+1] BINARY SEARCH on their assigned subsequences.
In parallel DEBS algorithms, time needed to read key
Figure 1. Duplicate Element Binary Search Algorithm
from all processors in step 1 is O(log N) time. In step 2,
procedure sequential search takes O(log n/N) time in the
Algorithm: duplicate element binary search (A [0…n-1],
worst case. Finally, procedure to return result in step 3
key)
runs in O(log N) time. So, overall running time is
while (low <= high) do
O(logN) + O(log n/N) + O(logN) time and time
middle = (low + high) / 2
complexity is O(log n/N).
if A[middle] > key then
high = middle – 1 Algorithm: parallel duplicate element binary search (S,
else if A[middle] < key then key)
low = mid + 1 Step1: for i = 1 to N do in parallel
else if A[middle]= key then Read key
lastOccurrence = findLastIndex(A[0…n-1], key, middle, end for.
high) Step2: for i = 1 to N do in parallel
firstOccurrence = findFirstIndex(A[0…n-1],key, middle, (2.1) Si = {S(i-1)(n/N)+1,S(i-1)(n/N)+2, … , Si(n/N)}
low) (2.2) DUPLICATE ELEMENT BINARY
return result[lastOccurrence,firstOccurrence] SEARCH (Si, key)
end if end for
end while Step3: for i = 1 to N do in parallel
return -1 return result
findLastIndex(A[0…n-1], key, middle, high) end for.
low = middle
if (A[high] = key) then E. Analysing Algorithms
return high Each of the parallel algorithms stated above will be
end if compared to its sequential implementation and evaluated
while (low <= high) do in terms of its overall execution time, speedup and
middle = (low + high) / 2 efficiency. The speedup is used to measure the gain of
parallelizing an application versus running the application In this system, the book database is first created. In the
sequentially and can be expressed as: searching process, the user must input book title or author
name and choose desirable algorithms. After the desirable
 
      
  algorithm has chosen, client PC divides n/p data from the
 
 
      
  book database depend on the number of the server PCs.
Here, n is the number of books in the database and p is
On the other hand, the efficiency is used to indicate the number of PCs. Then, it sends each n/p data and
how well the multiple processors are utilized in executing query term to the server PCs. Server PCs search
the application and can be expressed as [12]:
synchronously query term in its sub-arrays and return
results to Client PC. Client PC merges the results from all
 
      
 


  servers and displays the final output.
    
 

IV. DESIGN AND IMPLEMENTATION OF THE PROPOSED B. Implementation of the Proposed System
SYSTEM This section describes the implementation results. The
This section presents the design, implementation and whole system is implemented by using RMI based on
experimental result of the proposed system. The system is java thread. To implement the proposed system, the
implemented to search the desirable books in e-library by booklist database is built by using MySQL server.
using linear search and duplicate element binary search Database is created collection of objects to find key
algorithms in sequential and parallel environment. values or to recognize that the key values do not exit in
the database. The books table is composed of the book’s
A. Design of the Proposed System
information such as Book ID, Book Title, Edition
The design of the proposed system is illustrated in number, Author name and Description of each book. In
Figure 2. The proposed system is demonstrated on the this application, these lists of items are a record in
book searching system in an e-library. database and this list is implemented as an array object.
Then each search algorithm retrieves desirable data by
Start matching input data with the data in array object.
Under this searching process, the system allows the
users to choose the following two search functions to
Input Book Title or retrieve items from the array.
Author Name
1) Searching with book title: Users must input a
book name which they want to search.
Choose Algorithms: Linear
Search (or) DEBS 2) Searching with author name: Users must input
an author name which they want to search.

Book Client Divide n/p Data And the user can also select the serial linear search and
Database serial DEBS algorithm for searching one item in the lists;
otherwise parallel linear search and parallel DEBS
Send n/p Data and Query Term algorithm are selected.
to Servers
When the system starts, the Book Searching frame will
appear as shown in Figure 3. Here, the user must choose
book title or author name for searching books. And each
PC 1 PC 2 PC 3 PC p algorithm is applied to search the books with the same
Receive n/p
Data and
Receive n/p
Data and
Receive n/p
Data and
… Receive
n/p Data
desire book title or desire author name.
Search Search Search and Search

Return Return Return Return


Results to Results to Results to Results to
Client Client Client Client

Merge and Display


Results

End

Figure 2. System Design for Proposed System Figure 3. Book Searching Frame
When the user chooses Parallel linear search algorithm Figure 7 shows results from searching process with
option, Book Searching system creates the array object of author name by applying Parallel DEBS algorithm.
book database and finds the desirable value by matching
input data with data on array object. Figure 4 shows
results from searching process with book title under
Parallel Linear Search consideration.

Figure 7. Searching Author Name by Using Parallel DEBS Algorithm

C. Experimental Result
Figure 4. Searching Book Title by Using Parallel Linear Search According to the experimental results, execution time
of serial linear search is 34.8 milliseconds and serial
Figure 5 shows results from searching process with DEBS is 27.8 milliseconds. Here, the book database is
author name under Parallel Linear Search consideration. stored over 2000 books. These results are carried out on
2, 3, 4 and 5 computers on the network of workstations.
The execution time, speedup and efficiency of these two
algorithms are mentioned in TABLE I and TABLE II.
And the comparison graphs of these two algorithms in
terms of speedup and efficiency are illustrated in Figure 9
and Figure 10.
TABLE 1
EXECUTION TIME OF LINEAR AND DEBS

Execution Time in Execution Time in


Number of PCs Parallel Linear parallel DEBS
(milliseconds) (milliseconds)

2 24.8 18.4
Figure 5. Searching Author Name by Using Parallel Linear Search
3 19.8 15.4
If the user selects parallel DEBS algorithm, Book
Searching system will build sorted array object of book 4 18.2 15.2
database. Then parallel DEBS algorithm search the
desirable book title and author name on the sorted array 5 13.2 11.0
list. The search results of book title will be produced as
shown in Figure 6.
TABLE II
SPEEDUP AND EFFICIENCY OF LINEAR AND DEBS

Parallel Linear Parallel DEBS


Number
of PCs
Speedup Efficiency Speedup Efficiency

2 1.403 0.7015 1.510 0.755

3 1.75 0.583 1.805 0.602

4 1.912 0.478 1.829 0.457

5 2.636 0.5272 2.527 0.5054


Figure 6. Searching Book Title by Using Parallel DEBS Algorithm
two parallel algorithms will increase. In conclusion,
Execution Time in millisec
parallel linear and parallel DEBS algorithms are almost
30
two times faster than their serial algorithms and parallel
25 DEBS is faster than parallel linear search algorithm.
20
ACKNOWLEDGMENT
millisec

Linear
15
DEBS
First of all, the author is highly grateful to Dr. Myint
10 Thein, the Pro-Rector of the Mandalay Technological
5 University for his permission for completion of this
paper. The author wants to express her gratitude to Dr.
0
Lai Lai Win Kyi for her help and advice regarding of this
2 3 4 5
Number of PCs topic and excellent guidance, valuable suggestions and
advices. The author is deeply thankful to Dr. Aung Myint
Figure 8. Execution Time of the Parallel Linear and Parallel DEBS Aye, Head of Department and all teachers from
Department of Information Technology at Mandalay
3 Technological University for their overall supporting
2.5 during the writing of this paper.
Speedup T(1)/T(N)

2 REFERENCES
1.5 [1] Pranesh Das, P. Mohan Khilar: “A Randomized Searching
Linear Algorithm and its Performance analysis with Binary Search and
1 Linear Search Algorithms”, TIJCSA, Volume 1, No.11, January
DEBS 2013.
0.5 [2] Olabiyisi S.O, Aladesae T.S, Oyeyinka F.I. , O. Oladipo
Oluwasegun: “Evaluation of Critical Factors Affecting The
0 Efficiency of Searching Techniques”, volume 3, Issue 7, July
2 3 4 5 2013.
Number of PCs [3] Asagba P. O, Osaghae E. O. and Ogheneovo E. E: “is binary
search technique faster than linear search technique?”, Scientia
Africana, Vol.9 (No.2), December 2010.
Figure 9. Speedup of the Parallel Linear and Parallel DEBS
[4] Ahmad Haboush, Sami Qawasmeh: “Parallel Sequential Searching
Algorithm for Unsorted Array”, Research Journal of Applied
Sciences, Volume: 6 Issue 1, 2011.
0.8 [5] D. Clark, Rami-Peter Dabeet, S. Suksawat, D. Waston, S. Thede:
“Parallel Implementaion of Search Algorithms”
0.7
[6] M. Damrudi, K. Jadidy Aval: “A Parallel Search on Hypercube
0.6 Interconnection Network”, Journal of Computer Science &
Efficiency(%) S/P

Computational Mathematics, Volume 2, Issue 1, January 2012


0.5
[7] V. Gil Costa, A. M. Printista, N. Reyes, M. Marin: “A Parallel
0.4 Linear Search Algorithm for the SAT”, JCST&T Vol. 5 No. 4, December
2005.
0.3 DEBS [8] N. C. Schaller, G. H. Hilderink, P. H. Welch: “Using Java for
Parallel Computing: JCSP versus CTJ, a Comparison”,
0.2
Communicating Process Architectures 2000.
0.1 [9] S. Chepurin, Algorithms: search and sorting, (from Wikipedia and
MSDN),2009
0
[10] Binary Search Algorithm, available at:
2 3 4 5 http://en.wikipedia.org/binary_search_algorithm.htm, (April
Number of PCs 2011).
[11] Selim G. Akl: The Design and Analysis of Parallel Algorithms,
Queen’s University, Kingston, Ontario, Canada, ISBN: 0-13-
Figure 10. Efficiency of the Parallel Linear and Parallel DEBS 200056-3
[12] Lai Lai Win Kyi, Nay Min Tun: “Implementation of Parallel
V. CONCLUSIONS Sorting Program in MPCS Workshop”, Proceedings of the second
international conference on science and engineering, Volume-1,
In this paper, the performance comparison of parallel December 2-3, 2010.
linear search and parallel DEBS algorithm is evaluated in
terms of execution time, speedup and efficiency. The
implementation of the proposed system is built with the
help of java programming language and MySQL
database. There are over 2000 books in the MySQL
database. The experimental results are carried out on two,
three, four and five PCs with on the homogeneous
network of workstations. According to these experimental
results, parallel DEBS algorithm is 1.25 times faster than
parallel linear search algorithm in the execution time.
And if the number of PCs increases, the speedup of the

You might also like