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.
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 ).
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.
Hence i want to know how can i make a distinction between kernel and user threads . Is there any other way?
Eagerly waiting for a reply,
Thanks in advance,
Sounak