I don't understand, for example, why do we need the PTM (pseudoterminal Master)?. i mean, we could even link the script process directly to the slave to allow the comunication between the two processes.
Another perplexity is: Pseudoterminal and Terminal Emulator is related each other? I mean, does a terminal emulator emulates a real Terminal (a phisical terminal) using the Slave and Master pair? the question arises from the PS' output:
Yeah, the article doesn't say very much, and is implicitly misleading.
Every process gets a terminal. It uses this for I/O. However, there's only one terminal in a process group, owned by the group leader.
Someone asked about creating daemons recently. Well, one of the things a typical daemon does is discard it's terminal. It's not unusual to see daemons in development writing log messages down a network endpoint because fd(1), normally stdout had been re-bound to a tcp socket. So a deamon will only have terminal if the client functionality requires it.
If you want the server-side to run in a different context, it'll typically loose its terminal, and it has to create a new one. A typical example is using ssh to run sudo. If you want to see how it's done, check out openssh's source, it's pretty obvious once you find the code (follow the -t option).