Saturday, March 20, 2010

Analysis of Parallelizing the Fibonacci using java executor framework

From my last post I have showed you a mechanism that we can used to parallel the Fibonacci. From this post I hope to analyse the various mechanism that can use to parallel the Fibonacci using java and I'll point out the some of the disadvantageous.

One of the famous book in parallel computing is "The Art of Multiprocessor Programming" by Maurice Herlihy and Nir Shavit. In the book we can found a one mechanism that used for parallel the fibonacci.In achieving that the author has used the java executor framework. Here is the code used in the book.

According to the algorithm it mainly focus on the finer-grained parallelism. So when the Fibonacci number increases, number of task increases. So lot of overhead will added in resource allocation for each new task. When you using java threads or the java executor framework if you targeting a performance gain then the time taking for your algorithm complexity must be above the time which require in resource allocation of threads or the executor framework. So what you should focus is achieving the coarse gain parallelism as much as you can. Also you must consider the number of processors in your machine. Your coarse grain parallelism must build around those processor. That's the thing which I did exactly in my algorithm. Which is shown below.



According to the above mechanism resource allocation happens only for two tasks. So those two task bare equal amount of load. When you fork the problem no need to fork it too much. The amount of forking level must depend on the number of processors. That will give you a big performance hit. This is a common practise that we need to adhere in parallel computing.

0 comments:

Post a Comment

Custom Search

My Video Bar

Loading...