Parallel and Concurrent Programming
B+
AY23/24 S2
I thought I would survive this course, but nope B+. It is a pretty tough courses teaching concurrency paradigms in three languages, being C++, Go and Rust. 6 weeks are dedicated to learning concurrency in C++, which can be done in multiple ways. The straightforward way is to use locks, which restricts access to certain resources. The more advanced way is to use atomic variables and functions. These are variables and functions that can be accessed by multiple threads at the same time, without any locks. This is a very powerful concept, but also very error-prone. You have to be very careful with how you use these atomic functions, as they can lead to very hard-to-debug errors. This topic is often merged with Memory Order, which determines how the CPU reorganises instructions to optimise the code. In a very strict mode, the CPU is not allowed to do much reshuffling of machine instructions, leading to a very predictable, yet sequential execution. The more relaxed we go, the more we allow the CPU to reshuffle its instructions, which can lead to faster execution. Of course, with reshuffling, it's your duty as the programmer to ensure that the code remains correct. This means certain key relations between variables must be maintained, using the Memory Order concept to help us reason with this behaviour.
Moving on to Go, we mainly use channels to communicate between different Goroutines (aka your different tasks). Channels allow you to pass any kind of data between two tasks. You can send over numbers, strings, structs and even other channels. Very versatile and allows for a more modular approach to concurrency. The thing you need to worry about during implementation is how to close all of the Goroutines. Who is going to coordinate everything?
Lastly, we have Rust, and the main concept here is asynchronous programming. This feels like a pipeline, where data is passed from one task to another, and each task needs to fully complete using await before it is passed to the next one.
Don't understand my explanations? It's okay. I don't understand them either. The course is full of high IQ people, I can't compete with them. I'm just a lowly CS student. But I think I did okay for the course, all things considered. I think I just did consistently average for the three assignments as well as the finals, leading to the expected B+.
By the way, the assignments were really tough. One for C++, one for Go and one for Rust. All extremely hard to debug, and hard to understand. Easily spent 4 times the time on this than I ever did with CS2030S or CS2040S.