Questions on parallel programming terminology

Yes, if what you mean by “real thread” is OS thread.

I think it depends. If you want to, say, implement something like pmap, you probably should. But if you just want to use pmap then it’s probably OK to forget about it.

Channels and futures in general are communication mechanisms in concurrent programming. The Julia type Channel can be used for communication within a process and RemoteChannel and Future are for communication across processes. So, Channel cannot be used with a process pool (but it can be used with thread pool; e.g., with @spawn and @threads).

(Though looking at the second question, maybe you already get this idea?)

Note my emphasis on concurrency and not parallelism. The difference is a bit subtle and I’m not sure everybody agrees with a single definition. But I like this explanation by Rob Pike:

I’m bringing it up because you may be confused that Channel is used even without threading, i.e., parallelism. Concurrency is about dealing with multiple things at once so Channel is useful even though you use only one CPU (e.g., using @async).

Future can be used for passing at most one value (or an exception) to the peer while RemoteChannel can be used for passing arbitrary number of values.

I don’t think you can do it just with Distributed. One option is to use Transducers.jl: Thread- and process-based parallelisms in Transducers.jl (+ some news)

I think we need more high-level abstractions and easy-to-use APIs, developed outside stdlib.

The documentation says

Unlike remotecall, it does not store the result of computation, nor is there a way to wait for its completion.

So, it’s just an API that does not send back the result by default. You need to use RemoteChannel etc. for communication.

9 Likes