Difference between Julia Coroutines, Multithreading, Multicore

Hola
what are the differences between Julias Courotines (Green Threading), Multi-Threading and Multi-Core/Distributed Processing?

Distributed is distributed over different machines. But what is the difference between courotines, multi-threading and multi-core?
Don’t they all run on different hardware threads?

Coroutines are scheduled by Julia
multi-threading is based on task corroutine, can run on different threads/cpu-cores, shared memory
multi-core, multiple processes, separate memory, can run distributed

Does this mean that normal couroutines do not run parallel? (on different threads)

how do the three variants differ? except for distributed vs. the rest, everything sounds relatively the same to me

2 Likes

The documentation on parallel programming needs to be updated, you are not the first to wonder these terms, I am still confused whenever I encounter them: Questions on parallel programming terminology

3 Likes

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).

2 Likes

This is not technically correct. Coroutines are basically concurrent tasks. But concurrency is not the same as parallelism, in that concurrency means there are multiple unfinished tasks as the same time. The task could be tackled serially or in parallel. But whether it’s sequential or parallel has nothing to do with concurrency which is what coroutines are able.

2 Likes