O'Reilly logo

Parallel Programming with Python by Jan Palach

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using threading to obtain the Fibonacci series term with multiple inputs

Now it is time for the truth. The mission is to parallelize the execution of the terms of the Fibonacci series when multiple input values are given. For didactical purposes, we will fix the input values in the four elements and the four threads to process each element, simulating a perfect symmetry among workers and tasks to be executed. The algorithm will work as follows:

  1. First, a list will store the four values to be calculated and the values will be sent into a structure that allows synchronized access of threads.
  2. After the values are sent to the synchronized structure, the threads that calculate the Fibonacci series need to be advised that the values are ready to be processed. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required