Hello, I’m new to Elixir, and I keep thinking about a hypothetical scenario that could be problematic due to the way PIDs are generated. Let’s say that process A obtains the PID of process B and is going to send a message to process B. In the meantime, however, process B dies and process C starts with the same PID as process B. If process A sends the message to the PID that is now associated with process C, then process C will crash or cause other problems. Because of this, is there any way to prevent process C from receiving a message intended for process B?
I think that this is very hypothetical since it’s unlikely for a newly created process to have the same PID as a process that just died. However, as far as I know, the BEAM will eventually reuse PID numbers, and if many processes are running at the same time, then it seems possible that a PID belonging to a process that just died will eventually be used for a new process. Because of this, is there any way to prevent the scenario described before?
Thank you.






















