Most commonly used abstraction on top of Process

Hi there,

I have a curiousity question. I know there are different abstractions built on top of Process, such as Agent, GenServer, Registry, Supervisor and Task. I know each of them has their specific use-case. However, what do you think (or know) to be the most commonly used and generally most important abstraction?

On the forums I notice that the GenServer tag is tracked most often, which could be an indication this is the answer to my question. It is also my hunch that GenServers are the answer to my question. But I am curious if someone who knows Elixir better can formulate a substantiated answer.

Agent and Registry are both made of GenServers:

Supervisor uses the underlying Erlang :supervisor machinery, which… also behaves like a :gen_server:

Out of that list, Task is special because it’s intended to have a very different lifecycle.

3 Likes

The way I look at it is the gen* things are one layer on top of processes (gen_server, gen_fsm, gen_tcp) and supervisors are maybe 1/2 layer above those – they can work with “well behaved processes” which means ones that use :proc_lib and :sys modules like the gen* ones do. All the other things you mentioned are yet another Elixir-layer above (though as @al2o3cr points out Task is different, but it is “well behaved”).