KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I always believed that a sub-shell was not a child process, but another shell environment in the same process. I use a basic set of built-ins: (echo "Hello";read) On another terminal: ps -t pts/0 PID TTY TIME CMD 20104 pts/0 00:00:00 ksh So, no child process in kornShell (ksh). Enter bash, it appears to behave differently, given the same command: PID TTY TIME CMD 3458 pts/0 00:00:00 bash 20067 pts/0 00:00:00 bash So, a child process in bash. From reading the man pages for bash, it is obvious that another process is created for a sub-shell, however it fakes $$, which is sneeky. Is this difference between bash and ksh expected, or am I reading the symptoms incorrectly? Edit: additional information: Running strace -f on bash and ksh on Linux shows that bash calls clone twice for the sample command (it does not call fork ). So bash might be using threads (I tried ltrace but it core dumped!). KornShell calls neither fork , vfork , nor clone .
Tags (comma-separated)
Save Edits
Cancel