lkml.org 
[lkml]   [2005]   [Sep]   [6]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateTue, 6 Sep 2005 17:15:51 +0800
From"Sat." <>
Subjectwhat will connect the fork() with its following code ? a simple example below:
if(!(pid=fork())){
     ......
     printk("in child process");
     ......
}else{
     .....
     printk("in father process"); 
     .....
}
this is a classical example, when the fork() system call runs, it will
build a new process and active it . while the schedule() select the
new process it will run. this is rather normal.

but there is always a confusion in my minds. 
because , sys_fork() only copies father process and configure some new
values., and do nothing . so the bridge  between the new process and
its following code, printk("in child process"), seems disappear . so I
always believe that the new process should have a pointer which point
the code "printk("in child process");". except this , there are not
any connection between them ?

very confused :( 

any help will  appreciate  !



-- 
Sat.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-09-06 09:18    [from the cache]
©2003-2008