I’m in the same situation, trying to build a decent supervision tree for the first time.
I think nearly all you need to know is in chapter 9 of “Elixir in Action” and Supervisor — Elixir v1.20.2.
I try to answer your questions, but handle with care.
a) If UART always goes down with the UARTMonitor (see (b)) then I don’t think you need that. You can start UART supervised from the monitor an get its new pid.
b) this is the point of supervision trees, see the docs.
c) if the UART is taken down by a supervisor, because a linked process failed, you have to configure the UART’s supervisor so, that the UART process has enough time to clean up. You don’t need an extra process. If you need to clean up, depends on how you access the UART. It may be enough the kill the process holding the UART (the supervisor does that). It’s surely not ok the let the process live as a zombie.
d) you need to catch exits if you want to clean up
You only need a dynamic supervisor if processes are spawned randomly. Eg if the user can open UARTs at will you need one. If there is a known set of processes you don’t.
(handle with care, just learning this)


















