There are a huge number of orchestration technologies out there from the trivial to the very complex (and expensive) running enterprise workloads across many other systems.
As per several of the comments, the easiest way would be to write 2 scripts:
- To run on Mac 1 that tells Macs 2, 3, and 4 to run your second script
- Runs your actual task, or, triggers and controls the app which runs your task.
The first script will run and connect via ssh, using pre-defined keys) and trigger the scripts.
It would help to have more details on the specific task you trying to run, but script 1 can be as trivial as:
#!/bin/bash ssh user@mac2 'script2.sh' ssh user@mac3 'script2.sh' ssh user@mac4 'script2.sh'
and script 2 being something like:
Your original question was just "can you do this, and what's normal" - which is described above, so I don't want to go into a treatise on good scripting practice, especially without knowing your abilities and experience here.
There are also numerous answers on how to setup SSH keys for your Macs (eg. this ). In the above you'd need DNS to work, so maybe IPs would be simpler, and obviously user needs to exist as a user on the other macs, with the keys in place.
In recent macOS version zsh is the default not bash, but bash is there and functional as a scripting shell.