InOut's a simple Read from Stdin then write to Stdout program.
I did a 'ps gx' while it was waiting for input to get the following.
1644 pts/3 S 0:00 java InOut
1645 pts/3 S 0:00 java InOut
1646 pts/3 S 0:00 java InOut
1647 pts/3 S 0:00 java InOut
1648 pts/3 S 0:00 java InOut
1649 pts/3 S 0:00 java InOut
1650 pts/3 S 0:00 java InOut
1651 pts/3 S 0:00 java InOut
1652 pts/3 S 0:00 java InOut
Note that each is a separate process not thread running with separate
process ids. All however belong to the same terminal. When I first
spotted this queer behaviour, I was testing the exec(). So then, I
thought it was something to do with my exec(). But adding an output
line and only getting ONE line printed instead of multiple, I was
surprised. So I did a check on my old helloworlds, etc.
In short, it runs perfectly fine. Just that you have many processes of
the same thing. And they are indeed the SAME thing. kill()ing any one
of the processes ends the program and kills all the rest.
What's going on here?