What are exactly processes?

I know basic description of processes. But i don’t know what is happening behind of scene. Elixir/erlang are famous about controlling many processes.
What are exactly processes? And what is a high level explanation for how can processes idle? As i know codes run to completion. So how can programs/processes idle without complete something and without wasting resources?

1 Like

https://www.youtube.com/watch?v=_Pwlvy3zz9M is a fantastic overview of how the BEAM works, from one of its creators! Happy to answer follow up questions, but it’ll definitely make sense to watch something like that first to get going.

5 Likes

This is very likely more detail than you need, but it’s a very thorough answer to your question:

https://blog.stenmans.org/theBeamBook/#_what_is_a_process

3 Likes

My attempt at a concise answer:

A process is like a thread in other languages, except implemented to be cheap and fast to create.

Being able to cheaply create threads makes concurrent programs simpler to implement as we don’t need to multiplex multiple items of work in a single thread, so no need for callbacks, promises, futures, or async await.

IO bound applications (like web servers for example) spend most their time waiting. To be efficient we want to be able to wait on as many items of work as possible for the smallest amount of memory.

1 Like

thank you @al2o3cr @lpil @benwilson512
I think i need to read more about computer science and operating systems. I want to understand difference of objects and processes. From my perspective a process has computation power like a living thing. A object is just collection of properties and functions. My model can be completely wrong. Maybe understanding threads clearly, helps me. Do you have any book advice to deep dive that topic?

that gave me a good direction. I will read more things about difference of concurrent solutions.

1 Like

This Reddit answer IMO provides a great simplified overview of lower-level inner workings of processes.

5 Likes

This is really great explanation. I found many computer science topics to learn.