> > dear sir > The number of processes that are being created in fork.c() in > function do_fork are less than the number of processes are being > terminated in exit.c in function do_exit(). > I am placing a printk() in both the above functions do_fork() > and do_exit() and thus after compiling and then restarting i am > getting exit messages of many process ids that have not yet been > formed. > Perhaps pasting the code changes here (with context) may fetch more help. > > Another question is that while we are using an AND operation > to distinguish between a process and a thread ( > if(p->flags & CLONE_VM) > in fork.c in function do_fork() in linux kernel 2.6.8 ). I dont know whether it is right to distinguish between threads and processes. Anyways the following link has Linus's thoughts on this. http://evanjones.ca/software/threading-linus-msg.html > > But if i use the above check in do_exit() , will it be able to > distinguish between a thread and a process in the same manner as > do_fork(). > If this is not the case , then plz tell where i am wrong and > rectify my mistake. > > One more problem is while p->active_mm is equal to NULL in > case of kernel threads and not NULL in case of user level threads ; > through this check we can identify kernel and user level threads in > fork.c but > in exit.c the same p->active_mm value is not NULL for kernel and > user level threads. For kernel threads p->mm is NULL. When schedule() is called, if the next preocess to be scheduled is a kernel thread then next->active_mm is made equal to prev->active_mm. The active_mm is made NULL again when the kernel thread (mm == NULL) is being scheduled out. I guess do_exit is called before the thread is scheduled out so active_mm will not be NULL. Gopu. -- ___________________________________________________________ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/