I am reading through the The Little Elixir and OTP GuideBook and working on the example where you create a worker pool similar to Erlang’s Poolboy library. Since the book was published before DynamicSupervisor was created, the text has you create a Supervisor with the deprecated :simple_one_for_one strategy for managing a dynamic worker pool. I decided to try to port the code in the book to Elixir 1.6 code and used a DynamicSupervisor instead.
At this point everything was making sense, use a regular Supervisor when you have a static known list of children and use a DynamicSupervisor when you want to dynamically start/stop children. However, just a couple pages later in the book the sample code has you call Supervisor.start_child from a GenServer on a supervisor that is NOT using the :simple_one_for_one strategy, but rather the :one_for_all strategy. At this point I was confused. If you can call Supervisor.start_child with an arbitrary child spec on a supervisor that is neither a DynamicSupervisor nor a :simple_one_for_one supervisor, what is the purpose of the DynamicSupervisor?
I went to the Elixir docs and the function signature for Supervisor.start_child/2 and DynamicSupervisor.start_child/2 are identical. Can someone please explain the difference between the two?