mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Need help regarding kernel threads
@ 2005-08-02  8:57 vinay hegde
  2005-08-02  9:22 ` Keith Owens
  0 siblings, 1 reply; 2+ messages in thread
From: vinay hegde @ 2005-08-02  8:57 UTC (permalink / raw)
  To: linux-kernel; +Cc: thisismevinay

Hi,

Can sombody help me with the following:

How to differentiate kernel threads from normal
processes inside the Linux kernel code? 

I want to handle all the processes headed by "init_ 
task", in such a way that kernel threads are excluded
in the special processing. But , I am not able to find
out a kernel data structure which helps me in
identifying whether the "task_struct" is a normal
process or a kernel thread.

For ex, if i use the following snippet of code,

 for(p=&init_task; (p=next_task(p)) != &init_task;)
 {
        printk("%s\n", p->comm);
 } 

it prints all the processes running including kernel
threads(init, keventd, kswapd etc etc). Now, I want to
check whether the "task_struct" is a process or a
kernel thread? 

How do I handle processes seperately from kernel
threads??

Thank you,
Vinay.


		
_______________________________________________________
Too much spam in your inbox? Yahoo! Mail gives you the best spam protection for FREE! http://in.mail.yahoo.com

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

* Re: Need help regarding kernel threads
  2005-08-02  8:57 Need help regarding kernel threads vinay hegde
@ 2005-08-02  9:22 ` Keith Owens
  0 siblings, 0 replies; 2+ messages in thread
From: Keith Owens @ 2005-08-02  9:22 UTC (permalink / raw)
  To: vinay hegde; +Cc: linux-kernel

On Tue, 2 Aug 2005 09:57:51 +0100 (BST), 
vinay hegde <thisismevinay@yahoo.co.in> wrote:
>How to differentiate kernel threads from normal
>processes inside the Linux kernel code? 

The Linux Kernel Debugger (ftp://oss.sgi.com/projects/kdb/download/v4.4)
distinguishes between idle tasks, sleeping system daemons and the rest
(typically user tasks).  An idle task has pid 0, a sleeping system
daemon has a NULL mm field and is in S state, everything else is
treated as a normal task.

Download the latest kdb common patch and look at function
kdb_task_state_char.


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

end of thread, other threads:[~2005-08-02  9:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-02  8:57 Need help regarding kernel threads vinay hegde
2005-08-02  9:22 ` Keith Owens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome