So one shoudl use kernel threads if you want to do something during which you can sleep, correct ?(this is what you mean by using it in process context and not syscall). So if kernel threads are the same as a process then we can probably add them to a wait_queue and scheule them using schedule() ?, we can use wait functions like wait_event_interruptible on those, right ? thanks Amit Jan Hudec <bulb@ucw.cz>@nl.linux.org on 06/30/2004 03:01:00 PM Sent by: kernelnewbies-bounce@nl.linux.org To: Anupam Kapoor <anupam.kapoor@gmail.com> cc: Amit Kumar Singh/HSS@HSS, Anandraj <arm@tataelxsi.co.in>, kernelnewbies@nl.linux.org Subject: Re: kernel threads On Wed, Jun 30, 2004 at 14:55:43 +0530, Anupam Kapoor wrote: > also, kernel threads have their mm pointer set to NULL. That's part of what daemonize() does. If you didn't call daemonize(), it wouldn't have, but it's mandatory to call it. > kernel threads are schedulable, They would be useless otherwise. > preemptible etc. No, they are not! Just like any other process running in kernel space, they are only preemptable if it's kernel version 2.6 (or 2.4 with preempt patches), the preemption is actualy turned on with CONFIG_PREEMPT and they don't hold any spinlocks. So a kernel thread should better sleep explicitely from time to time. > just like normal processes. They ARE normal processes, actualy. They just run in kernel space all the time. ------------------------------------------------------------------------------- Jan 'Bulb' Hudec <bulb@ucw.cz> (See attached file: signature.asc)
Attachment:
signature.asc
Description: Binary data