NobbZ

NobbZ

Moved from another Discussion

There is no parallelity on the BEAM, only concurrency, but don’t let us argue about the theoretical difference of both words, as its definitions seem to differ even between universities…

Anyway, if you spawn a lot of processes then your code is highly concurrent, if not then not.

But regardless of the number you put on it, it doesn’t matter if this number is high or low, it matters if the program solves your problem in a manor that is efficient enough for you in terms of CPU, memory consumption and especially wall clock time.

Showing Posts 1 to 7

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

If you have more than one scheduler and more than one CPU you get actual parallelism.

NobbZ

NobbZ OP

From the definition that I’ve learned, only if they do the same operation on different data. You can never do that on the BEAM.

hubertlepicki

hubertlepicki

Why not? Spawn the same function twice, with different data, if you have 2 CPUs it is likely to run in parallel on different cores.

peerreynders

peerreynders

That’s SIMD, (single instruction, multiple data) a particular class/type of parallelism. MIMD (multiple instruction, multiple data) also classifies as parallelism.


Erlang was initially developed for concurrency on the then common SISD (single instruction, single data) CPUs. Once multi-core CPUs became common an MIMD version (resulting in R11B) was developed.


I think it is accurate to say that there is no guaranteed parallelism. If you are running 4 schedulers on 4 separate cores, you can run no more than 4 things in parallel but there will be times where less than 4 things will be running in parallel.

Even under the best of circumstances one should expect no more than 0.75 * n speedup for n > 1 cores.

13
Post #4
rvirding

rvirding

Creator of Erlang

I don’t think you can get away from discussing about the meanings of concurrency and parallelism and how they relate to each other. Unfortunately. In my view they are two different things, though not necessarily unrelated.

I see concurrency as property of the problem or your solution to the problem. Splitting your system into multiple processes which communicate with each by messages can just be a very nice and practical way of describing the problem and hence the solution. For example if you are doing a server which has to handle multiple connections then structuring the system so that each connection has its own set of independent processes can be a very nice way of building the system.

Parallelism however, I see as a property of the underlying hardware. It is that which determines how many things I can actually do in parallel at the same time. Then it is up to me to design my system so that it can actually use this parallelism.

That is my view anyway.

So Erlang/Elixir, the language, gives me a base and a set of primitives for building concurrent systems. How I use it is up to me. The BEAM implements this base and provides the concurrency which I can use when I design my system. It provides all the processes, communication and error handling etc. It also uses the parallelism provided by the underlying system to run my concurrent processes in parallel where possible. So if it has access to six cores it can do six things at the same time, if your system design allows it.

Now things start getting tricky and we can show that concurrency and parallelism are different things. At least from my point of view.

Here is a simple examples. Suppose we build a ring processes where we can send messages around the ring. So if I send a message to the first process and the message will be sent from process to process around the the ring and finally come back to the original sender. Now we build a ring with 1000000 processes around which I will send 1000000 messages. That is a lot of concurrency!

Now I build my system so that it sends messages around the ring one message at a time, so it sends a message waits for it to go around the ring and then sends the next message and so on for all the 1000000 messages. How much parallelism do we actually have? Very little in fact. We have a very concurrent system which is basically sequential where any underlying parallelism won’t be usable.

So the language provides the concurrency, and the BEAM can provide the parallelism but it is up to you to design your system in such a way as to use this parallelism.

Sorry this became much longer than I had planned.

18
Post #5
mythicalprogrammer

mythicalprogrammer

I think concurrency is the precursor to parallel ability. While Erlang doesn’t enforce strict parallel in syntax but… if the similar jobs run concurrently in different schedulers it count as parallel right? The only problem is you can’t dictate which particular jobs should be run in parallel.

I do agree with your definition of parallel from my understanding, “…only if they do the same operation on different data. You can never do that on the BEAM.”

hauleth

hauleth

  • Concurrency is feature of algorithm.
  • Parallelism is feature of runtime.

For me this is all there.

— All posts loaded —

Where Next? Top

Trending in Discussions Top

budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
axelson
Hi there! :wave: @frigidcode and I (but mostly him) have been running an Elixir Book club, we’re almost done with Designing Elixir Syste...
New
achempion
I’ve been using Emacs as my main code editor for more than a two years. It’s a custom build version although I’ve tried doom emacs and sp...
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New
jtormey
Lately I’ve been thinking about how to organize components as a LiveView application grows. One of the pain points I’ve found (for myself...
New
Null-logic-0
What IDE or editor are you using for Elixir development? Personally, I use Zed, and I really like it, but sometimes I wish there were a ...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews