Simulating parallel process execution in Linux Bash
Introduction The default behavior of the bash shell and the Linux operating system is to execute typed commands sequentially in serial order. So, when we type multiple commands on the terminal prompt and chain them using semicolons then the shell would first execute one command, wait for it to finish execution and then execute the next command and so on. This sequential or serial behavior is fine for most scenarios but sometimes we may have the need to execute commands in a parallel fashion. The general requirement for parallel command execution arises from the necessity to save time i.e. do more in less time. Currently, there are many automation tools and utilities available that allow users to perform tasks parallel on the same system or across different systems. But what if we want to accomplish parallel task execution without installing any additional tools? By starting multiple processes in background appending the ampersand character (“&”) to the end of your commands, we can simulate the startup of multiple processes in parallel on the command line. Although this approach is not perfect but could suffice when we need to fire numerous commands in parallel on the same or different machines. The main alternative to running a process in the foreground is to allow it to execute in the background. A background process is associated with the specific terminal that started it...
Read More