Re: kernel_thread

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

 



On Fri, 31 May 2002, Christine Ames wrote:

> --- R!SC <risc54@inwind.it> wrote:
> > hi,
> > 
> > why when i link the module it block the system?
> > int my_thread( ){
> > 
> > while(1){
> > 
> >    // do something
> > 
> > }
> > return 0;
> > 
> > }
> > 
> > 
> > init_module:
> > 
> >       kernel_thread(my_thread,NULL, CLONE_FS |CLONE_FILES |
> > CLONE_SIGNAL);
> > 
> > 
> > how can i resolve it?
> > 
> > 
> 
> Dude.  How do you exit your while(1)?  Sounds like an endless loop
> thing to me.  Put a break statement somewhere in that // do something
> code.
> 
> Hope this was actually of some use.
> 

On the newbies list I guess we need more info. Basically, if you were to
do this in a normal user context - the processor scheduling would have
ensured that your system is up and running. But inside the kernel your
process is not preempted. Which essentially means that the processor is
busy executing the while loop. You call this state as SYSTEM HANG.
Non-preemption of the kernel process is the main catch here.

I hope this helps.

Cheers
Pradeep


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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