Build a Server – Client Application in C that executes concurrently Terminal Commands

In this post we will build a server – client application that will get our hands dirty with signals, fork, named pipes and the exec command. This application has a very simple concept:

“Client creates, with a new process, the Server and sends to him terminal commands using as interprocess communication a named pipe (aka fifo pipe)”

Moreover this model must executes terminal commands concurrently and we accomplish that using a signal handler. To be more specific when a client sends through the named pipe a command, the server wakes up because the signal handler¬† receives the SIGCONT signal and changes the wake up variable from 1 to 0. This wake up variable is being used in the server to keep him in sleep mode and not busy waiting. Let’s see a simple example with just the mechanism of it: