It depends on your business logic, but if you have a reason to worry about clogging the global realm, I suggest you consider the surveillance strategy that you are using.
What I saw in such cases when two peer processes should be connected in this way is that an additional controller process is created to control this association, and simple_one_for_one sup is used to create one of the two peer processes (most likely, gen_server) . This method, again, can be used when using process registration, is a problem, for example, when you have many instances of these gen_servers working with the same code.
Basically it will be to use the simple_one_for_one control to start your gen_server. What happens mostly is that when you start (simple_one_for_one sup), no child processes happen immediately, but only when you explicitly call supervisor:start_child(Sup, List) .
Then your child2 initialization logic (or even your business logic at some point) could generate gen_server via supervisor:start_child(Sup, List) and be served with child2 Pid so that they can communicate painlessly.
In the additional controller process, a dictation is stored between your gen_server, identified by some uniqueness, but eliminating the clogging of global space, since it is simply local to the controller. You can then ask your controller to distribute or release this connection anywhere in your logic.
The observation tree should look something like this:

You can read the code using this implementation in a tinymq project on github
If you have never used the simple_one_for_one super processor before, the specification for the child can be a little complicated, remember that you passed the child2 pid to your gen_server via a list on supervisor:start_child(Sup, List) , which is added to the Args element that you point to the child specifications.
simple_one_for_one supervisors
My two cents!