![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Can a child process return a specific value to a parent process ? | Ametis1970 | High Level Programming | 8 | 04-09-2008 11:22 PM |
| Child process is not getting started | Crab | High Level Programming | 5 | 09-17-2006 09:15 PM |
| gdb to child process | shriashishpatil | UNIX for Advanced & Expert Users | 4 | 12-12-2005 07:57 AM |
| KDM child process | larryase | UNIX for Dummies Questions & Answers | 6 | 01-24-2005 05:41 PM |
| Child Process PID | skannan | High Level Programming | 2 | 06-10-2002 07:54 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
hello every one,
i want to know more about creation of child process. UNDER WHAT CIRCUMSTANCES child process is created? WHAT ARE THE PREREQUISITES for a child process to be created? let us say we have a prog.c, prog.obj(compiled.c),.a\.out files. is any child PROCESS CREATED from the beginning to the execution of .a.out file in the above example please give me clear explanation thanks for your time |
|
||||
|
child proc.
all child processes are created in two steps:
1. system creates the exact copy of parent process (by fork) 2. the code of the parent process is substituted within a code of the child process. as a consequence the child process inherits all the environment of the parent process (all the system variables , viewable with "env" command). This scheme is universal for all versions of unix/linux. Get "UNIX Essentials and UNIX Core" DVD course if you have questions like that. |
|
|||||
|
Actually, that step 2 is describing what happens when an exec() system call is invoked. This is usually what happens. But exec() and fork() are different. Some programs fork() but then do not exec(). An example is an ftpd server not running under inetd (which is how we run pureFTPD). When it gets a connection, it forks and lets the child handle that session.
|
|
||||
|
ftpd
ftpd uses tcp and all tcp servers/deamons lunch new instances as request comes (disregarding of implementation). It does not exec not because it is exception but because it saves and extra operation as the next operation would be to load another instance of FTPd again, to save an extra step it does not exec.
|
|
||||
|
Advantage Of Child Process
when a parent process can do its job efficiently why do we need the over head to invoke some other process to perform the task on its behalf?
are there any system performance, advantages in invoking a child process? thanks for your replys in advance |
|
||||
|
here...
no, there's obviosly no system perfomance advantages sinse new process gets new resourses and take extra CPU time. Not all subsystems spawn new processes but only these that had been developed to. For example ftpd waits for connection it gets an connection and gives the way for a next connection. It does it by creating a new instance of itself while the old instance is occupied with an previos connection. If service is heavily depended on spawing there is limit in configuration for number of simultaniously working instances of one program. You can visit /etc/initd.conf or /etc/xinitd.conf and see the service "wait =no", or "respawn" for these services that will not wait for end of previos transaction to startnew one. By convension, all TCP services for example are "no wait". I learn with "UNIX Essentials and UNIX Core" DVD and with Emi Nemet book.
Hope it helps. Last edited by amro1; 03-20-2006 at 12:56 PM.. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| linux |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|