...

/

Improving Performance with Parallelization

Improving Performance with Parallelization

Learn about parallelization in Elixir and how it can be incorporated into the framework defined.

Parallelization in Elixir

One of the strengths of genetic algorithms is their ability to be parallelized. Parallelism is when processes execute simultaneously on multiple cores, systems, and the like. The tasks that make up an evolution can be performed in parallel to yield significant performance gains. The BEAM is optimized for orchestrating computations in parallel. We can take advantage of this fact to improve the performance of your genetic algorithms.

The benefit of writing genetic algorithms in Elixir is the availability of a rich set of parallelization features. Parallelizing algorithms in Elixir is straightforward, thanks to modules like Task, Agent, and GenServer. We can parallelize our program in just a few lines of code and let the Erlang Scheduler handle the orchestration of computation for us.

The Erlang Scheduler is responsible for orchestrating the processes we spawn during the life cycle of your Elixir applications. Think of a scheduler like a parent who forces siblings to share toys. Each sibling (process) gets some time (runtime) to play with the toy (computing power).

We can achieve parallelization in your genetic algorithms on the BEAM in many ways. In this lesson, we’ll explore two: using the ``Task module and using Agents. However, before we begin, it’s important to understand the difference between ...

Access this course and 1400+ top-rated courses and projects.