All the code runs inside lightweight threads of execution (called processes) that are isolated and exchange information via messages.
Due to their lightweight nature, it is not uncommon to have hundreds of thousands of processes running concurrently in the same machine. Isolation allows processes to be garbage collected independently, reducing system-wide pauses, and using all machine resources as efficiently as possible (vertical scaling).
Processes are also able to communicate with other processes running on different machines in the same network. This provides the foundation for distribution, allowing developers to coordinate work across multiple nodes (horizontal scaling).
The unavoidable truth about software running in production is that things will go wrong. Even more when we take network, file systems and other third-party resources into account.
To cope with failures, it provides supervisors which describe how to restart parts of your system when things go awry, going back to a known initial state that is guaranteed to work.