Concept exercises for concurrency and parallelism?

I’m currently trying (with limited success) to add this to the Julia syllabus: tasks, threads, channels, locks, atomic operations, and all that useful-but-complicated stuff.

I’m not finding much about this on other tracks. JS has concepts for promises and callbacks, but languages with a more Julia-like approach (Go, C#, C++) don’t yet include this in their syllabus.

Does anyone know of any previous discussions about this? I’m particularly interested in ideas for concept exercises. I assume nothing got merged, but maybe some preliminary suggestions were bounced around by the maintainers?

Thanks!

Some prior discussions from search here in the forum:

Add Concurrency Concept to Go
Request for Concurrency and Goroutines

and a game that might be inspo for an exercise:
Browser Game about Concurrent Programming

and another about concurrency in Java:
Rate Limit

But AFAK, no concept or concept exercises that cover either concurrency or parallelism. Though Rust might be a place to check, just to make sure.

1 Like

Caveat: these are practice exercises, not concept exercises.

Go has a concurrency problem: https://github.com/exercism/go/tree/main/exercises/practice/parallel-letter-frequency

Bank Account in theory is supposed to support/require concurrency.

Some random-ish exercises in various languages from around the web, YMMV:

concurrent-programming includes classics like The Dining Philosophers. Downside? Appears to be all-Java, but still likely has good stuff.

Golang focused Exercises from Tiny Struggles

4 Basic Multithreading and Lockfree Programming Exercises (C++)

Concurrency in C#: Practicum

FizzBuzz Multithreaded (leetcode)

The Dining Philosophers (leetcode)

UCI Intro to Data Sci (Julia) - has problems and answers. Not everything is great, but might be some stuff here that’s usable.

Sci ML Book (possibly outdated) - might have good stuff, might not. Also link to lectures from the book

Juila for Data Analysis Exercise Repo - goes with the book published by Manning, but might still have some good ideas. From This blog post.

Think Juila I really like Allen Downey, but the TOC doesn’t look like he covers. Still might be worth flipping through.

Computing Statistics Berkeley no exercises here, but a lot of comparison between R, Julia, Python, MATLAB, C and C++.

LQ Dynamic Programming Problems WAAAAAAAY too much math here, but interesting.

MIT Class on JuliaComputation sorta crazy, but might have some good stuff.

1 Like

There is an atomics concept in the x86-64-assembly track that touches many “fundamental” ideas, but it might be too “low level”.

2 Likes

Thank you for all the suggestions, they are very helpful.

I’m already starting to work on the practice exercises: bank-account for locks and/or atomics, parallel-letter-frequency for scatter-gather algorithms across multiple threads.

The X86-64 concept exercise looks like the sort of thing we could adapt. Higher-level, of course (Julia does not encourage end-user code to concern itself with addresses), but maybe we could do a compare and contrast with both atomics and locks: different approaches to essentially the same end result.

I’m still hoping to find something in the Go world practicing goroutines and channels. Julia has a pretty close copy of this. Though it’s kind of a pity it’s Go (not a language I use or much know about).

1 Like

Sounds like a good approach. Comparing locks and atomics should make the differences much easier to understand in practice.