Re: what happens when i run ps command on shell prompt?
From: Philippe Amarenco (philippe_at_lse.epita.fr)
Date: 08/29/05
- Next message: Alex Fraser: "Re: How to check if a pipe is still being read, without writing anything to it?"
- Previous message: John Bokma: "Re: Jargons of Info Tech industry"
- In reply to: rahul8143_at_gmail.com: "what happens when i run ps command on shell prompt?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 29 Aug 2005 23:01:56 +0200
rahul8143@gmail.com writes:
> hello,
> I want to know what exactly happens when i type $ps -a on shell
> prompt? Does it actually forks current environment and swithes to ps
> command code? Executes and retuen to parent process that is shell
> prompt?
> regards,
> rahul.
>
when executing a command from the shell, it forks, then close/open
file descriptors for redirections and such, then it execve to the
given command so that the forked shell is replaced by the
command. the original shell calls waitpid to wait that the process
running the command finish execution, then it continues.
-- Philippe Amarenco, aka Phix epita 2007 - LSE - EpX "if new true friend not protected for explicit private union, break case and try using this." -- Nathan Myers, longest c++ sentence.
- Next message: Alex Fraser: "Re: How to check if a pipe is still being read, without writing anything to it?"
- Previous message: John Bokma: "Re: Jargons of Info Tech industry"
- In reply to: rahul8143_at_gmail.com: "what happens when i run ps command on shell prompt?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|