Erlang / Erlang Basics Interview questions
What is a supervisor?
A supervisor is an OTP process whose only job is to start, monitor, and restart a set of child processes according to a restart strategy. It doesn't do business logic itself — it exists purely to keep its children alive.
init([]) -> {ok, {{one_for_one, 5, 10}, [{worker1, {my_worker, start_link, []}, permanent, 5000, worker, [my_worker]}]}}.
Common strategies include one_for_one (restart only the child that died),
one_for_all (restart every sibling if one dies), and rest_for_one (restart the failed
child and any children started after it). Chaining supervisors into a tree, with workers as leaves, is what
gives Erlang systems their self-healing behavior after a crash.
More Related questions...