All of lore.kernel.org
 help / color / mirror / Atom feed
* what will connect the fork() with its following code ? a simple example below:
@ 2005-09-06  9:15 Sat.
  2005-09-06 10:37 ` Bernd Petrovitsch
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Sat. @ 2005-09-06  9:15 UTC (permalink / raw)
  To: linux-kernel

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-09-07  7:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-06  9:15 what will connect the fork() with its following code ? a simple example below: Sat.
2005-09-06 10:37 ` Bernd Petrovitsch
     [not found] ` <003a01c5b2d6$610d6360$6464a8c0@pc0001>
2005-09-06 11:59   ` Sat.
2005-09-06 12:41     ` linux-os (Dick Johnson)
2005-09-06 13:01     ` Dirk Gerdes
2005-09-06 16:58 ` Valdis.Kletnieks
2005-09-07  7:08   ` Bernd Petrovitsch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.