Re: schedule function

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

 



On Tue, Jul 15, 2003 at 01:08:14AM -0700, don wrote:
> Can anyone tell me which kernel thread/function call
> schedule() all the time to schedule the process/task
> out if the task voluntarily doesnt leave the
> processor.

schedule() is the ONLY way to give up CPU. So every function that give
up CPU including when it needs to wait for something end up calling
schedule. You are free to call schedule() by hand.

For process in userland, timer interrupt in context of that process will
eventualy call schedule(). In 2.6 this is extended to _some_ parts of
kernel.

> Suppose my driver goes to deep sleep without calling
> schedule() which part of kernel will take care to
> schedule the other pending tasks.

There is no way to go to sleep but to call schedule().
In 2.4 if your driver goes into a busy loop, then you just locked up
whole system. In 2.6 if you don't hold a spinlock, timer interrupt will
eventually call schedule. But if you hold a spinlock (and/or have
interrupts cleared), you have locked up whole system.

If you wan't to wait for something in driver, sleep_on or
interruptible_sleep_on macro will do the right thing in most situation
(mind to look in it's source ;-) )

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@ucw.cz>
--
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