Each node in the distributed system will need some kind of software to communicate with the other nodes. One way to do this is with the Message Passing Interface (MPI), which makes it fairly easy to allocate processes to nodes and then organize those processes as a logical ring. For example, you can use MPI to send a message around such a ring using logic like this:
id = MPI_Comm_rank()
numProcs = MPI_Comm_size();
if ( id == 0 ) { // Master
MPI_Send( originalMsg, ... 1, ...); // send a message to next proc in ring
MPI_Recv( reply, ..., numProcs - 1, ...); // receive from last proc in ring
} else { // workers
MP_Recv( msg1, ..., id-1, ...); // receive msg1 from predecessor in ring
convert( msg1, msg2); // using msg1, produce msg2
MPI_Send( msg2, ..., (id+1) % numProcs, ... ); // send msg2 to successor in ring