Re: Introduction to kernel threads

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi...

On 11/10/09, Kristian Evensen <kristian.evensen@xxxxxxxxx> wrote:
> Hi,
>
> Creating kernel threads is quite easy. Please have a look at this article,
>
> http://lwn.net/Articles/65178/

Nice share :)

>
> Also you can refer this simple code to create a kernel thread. Hope this
> helps.
> Sorry for poor error handling and coding style. :)

coding style can wait....however, IMO error handling should be
improved from the beginning. Just imagine if your code has null
pointer vulnerability :)

> Thank you very much for a quick and good reply.

Uhum, we must be missing something here. Could you or the one who
replied to you Cc: his/her answer to kernelnewbies list too?

>However, I guess I should
> have been more precise in my initial email. I have gotten very simple
> threads running, but am having difficulties finding information about more
> specific things. For example synchronization, why the kernel has to be
> locked when a new thread is initialized

Has to be locked? Hm, never knew about this requirement. Perhaps it's
not the kernel thread itself that needs to be synchronized, but it is
requirement from the design i.e data structure initialization must be
in atomic operation?

>and what is the preferred way of
> stopping threads. I see some people use signals, while other use the
> kthread_stop.

IIRC, nowadays kthread_stop() is preferred method. However, IIRC too,
before you do that, make sure you do the proper cleanup e.g free the
linked list you have created during kernel thread lifetime, stop and
destroy workqueues you might created, release any locks you might grab
etc.


-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux