Difference between Julia Coroutines, Multithreading, Multicore

Okay, disclaimer here I am not a computer scientist and have really just worked this out over the course of having to work with things in my career. That said i will do my best to not butcher this explaination (this also means I stand to be corrected is necessary). I hope a laymanish explainations is clear enough.

Coroutines in julia are not parrallel computations. They are a list of scheduled operations (tasks) that happen “sequentially”. The difference here is that the computer may stop using CPU activity to do some operations (i.e. read from disk). At which point a different operation can be done on the CPU, while waiting for the first operation to complete doing non-CPU stuff. This looks like parallel computation but it is because it is using different parts of the computers infrastucture to do tasks. A good example might be something a human setting off a calculation on a computer that takes say 2 minutes and while waiting reading a blog post. The two actions do not happen at the same time.

Multithreading (I will probably mess this one up) basically if you have a multiprocessor on your computer that single multiprocessor has acess to more than one CPU (threads) and the same memory pool. So in this case you run more than one task at the same time using the same items held in memory.

Multicore This is when you computer has multiple processing units (cores). In this case you need to start a process on each core to utilize it. The cores do not share memory so you need to load items in memory for each core and send instruction on what each core should be doing. This is another form of parallel processing but has the added overhead of having to communicate instructions and essentially reconstruct items in memory on independent cores (this is why objects are seralized and transfers across cores).

3 Likes