PPSS Version 2.30 Now Operates Asynchronous

September 26, 2009 Category: Uncategorized

If you background a bash or shell process, how do you determine if it has finished? Since inter process communication is not possible using shell scripts, people often refer to while loops or other polling mechanisms to determine if some process has stopped.

However, the one player that knows best if a process has finished is the process itself. So if only this process could tell the parent or other process about this...

The solution is using a FIFO or 'pipe'. A listener process reads the pipe and executes a command for every message received through this pipe. This was already build-in into PPSS. However, PPSS had this dirty while loop that polls every x seconds to determine if there are still running workers. If not, PPSS finishes itself.

However, while loops and polling mechanisms are evil, dirty and bad. The nicest solution is to make PPSS fully asynchronous. To achieve this, every job must tell PPSS that is has finished. PPSS already has this listening process that listens to the pipe for commands. If this channel is used by workers to communicate that a worker is finished, PPSS will know when all workers are finished.

This makes PPSS a lot faster and responsive.

Comments