I want to improve at parallel programming

Hello. One area of my programming that I'd love to improve at is parallelization and writing multithreaded programs from the ground up.

This sounds silly, but I'm struggling to come up with consistent program ideas to practice this skill because parallelization is not the best choice for many applications, but when it's needed, it's very useful.

Essentially, this is what happens: I write single-threaded code most of the time at work and such, and then suddenly one day, I need to do something and it's a perfect candidate for parallelization... However, since this only occurs like once every 8 months and it's usually over in a week or two, I'm always "Rusty" (no pun intended) at this.

So if you could just name a few basic problems that I could solve which could leverage paralellization, that would be helpful for me to practice in my down time. One thing I did use it for successfully recently is searching large text files... I was able to cut down my search time from about 1 second to only 172ms on my machine... I had another recent thread about this.

I also decided to take a course on multithreaded programming, but again, the examples are contrived and extremely basic so I'm struggling to move past them. Obviously this is one of Rust's strongest points so I'd like to improve. Even better if the ideas involve some sort of low-level data parsing or handling tasks, such as those a database may use, etc...


1 Like

Like you my experience of parallelizing anything for performance gains is very limited.

Years ago I managed to make a parallel Fast Fourier Transform. Starting from the very simple algorithm shown in C here: OpenStax CNX

I made an integer only version of that, using fixed point math, for running on a the Parallax Inc Propeller chip which has no floating point hardware. The Propeller does however have eight 32 bit cores so I made a parallel version using OpenMP that achieved appreciable speed gains over 2 and 4 cores: fftbench/fftbench.c at master · ZiCog/fftbench · GitHub

If you want a challenge...

Earlier this year I got caught up in a challenge to find all the anagrams in the 600, 000 words of the british-english-insane dictionary file you can install to Debian. The idea of the challenge was for people to present solutions in their favorite language. More for the evaluation of readability than performance.

However...I contributed solutions in Javascript, C++ and Rust. So far the second fastest solution, as you can see in the chart linked above, is my Rust solution.

It's a single threaded solution and only narrowly beaten by a parallel solution in C.

So, if you are up to the challenge a parallel anagram finder in Rust to take the lead there would be great.

My Rust solution evolved as I started to learn Rust from scratch here:

Look forward to seeing what you can achieve.


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.