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

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 94592 917
New
cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
heathen
Quite interesting article Google brought me. Didn’t find any mentions about it here. What do you think in general? Would you use togethe...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
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
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

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
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
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
georgeguimaraes
Just published claude-code-elixir, a plugin marketplace for Claude Code with Elixir support. These are the plugins I’ve been using for my...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews