Why the name of this strategy is "one_for_all"

83 views
Skip to first unread message

ruby...@foxmail.com

unread,
Aug 9, 2016, 11:19:23 PM8/9/16
to elixir-lang-talk

Supervisors support different supervision strategies (through the :strategy option, as seen above):

  • :one_for_one - if a child process terminates, only that process is restarted.

  • :one_for_all - if a child process terminates, all other child processes are terminated and then all child processes (including the terminated one) are restarted.

  • :rest_for_one - if a child process terminates, the “rest” of the child processes, i.e., the child processes after the terminated one in start order, are terminated. Then the terminated child process and the rest of the child processes are restarted.

  • :simple_one_for_one - similar to :one_for_one but suits better when dynamically attaching children. This strategy requires the supervisor specification to contain only one child. Many functions in this module behave slightly differently when this strategy is used.

Why the name of that strategy is `:one_for_all`, not `:all_for_one`?

Rich Morin

unread,
Aug 9, 2016, 11:54:16 PM8/9/16
to elixir-l...@googlegroups.com
> On Aug 9, 2016, at 20:19, ruby...@foxmail.com wrote:
> Why the name of that strategy is `:one_for_all`, not `:all_for_one`?

They just picked the first clause of the slogan?

Unus pro omnibus, omnes pro uno
("One for all, all for one")

-- https://en.wikipedia.org/wiki/Unus_pro_omnibus,_omnes_pro_uno

-r

--
http://www.cfcl.com/rdm Rich Morin r...@cfcl.com
http://www.cfcl.com/rdm/resume San Bruno, CA, USA +1 650-873-7841

Software system design, development, and documentation


Eric E.

unread,
Aug 10, 2016, 9:48:36 AM8/10/16
to elixir-lang-talk
To be fair, to me it would seem that to be consistent either "one_for_all" should be "all_for_one," or "rest_for_one" should be "one_for_rest." But these have been this way for probably more than 20 years, so I doubt they'll change any time soon. :)
Reply all
Reply to author
Forward
0 new messages