Re: Sleep methods in kernel

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

 



Le Wed, 27 Aug 2008 16:58:00 +0530 (IST),
r.sundar@xxxxxxxxxxxxxx a écrit :

> 1. What is the difference between schedule() and
> wait_event_interruptible_timeout execpt for the fact that
> wait_event_interruptible_timeout will also respond to a timeout
> period? Are both not meant to put to sleep the user process that call
> them until they are woken up by the event( in case of
> wait_event_interruptible_timeout) and the scheduler (in case of
> scheduler) ?

schedule() simply gives the scheduler an opportunity to schedule
another task. But the current task remains on the list of tasks ready
for execution, so you will be woken later. Or even schedule() might not
do anything if you are the only runnable task of the system, or if for
some other reason the scheduler decides that you are the task that
should be running on the CPU.

The wait_event_*() family of functions changes the task state to
TASK_INTERRUPTIBLE or TASK_UNINTERRUPTIBLE: the scheduler will not wake
up until another task or interrupt explicitly wakes you up using
wake_up().

For more details, read page 13 and following of
http://lwn.net/images/pdf/LDD3/ch06.pdf.

Sincerly,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.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