Re: Sleeping in the kernel

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

 



On 10/28/05, Naveed Rehman <Naveed.Rehman@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> I playing with the serial.c. The serial driver handles interrupts from the
> serial hardware. If the driver is put to sleep via the
> interruptible_sleep_on command to wait for the CTS to go high, how does it
> handle the interrupts. (as it is already been put to sleep). I thought of
> using fork to keep the parent waiting till the child wakes up or rather
> exits after an interrupt e.g when CTS goes high but fork does not work in
> kernel space.
>

I am considering that here you mean by saying driver is put to sleep
is in the ioctl function, because driver isn't any thing which can be
put to sleep rather the functions exported by the driver to the kernel
which are call-backed by the kernel runs at different contexts and if
the context is process (as in the case of ioctl) then you can put that
calling process in sleep (through the function called by kernel like
ioctl) . So if you put the process in sleep, you will still get the
interrupt because interrupt handler is on interrupt context and its
being called by the kernel and from there you can call wake_up for you
sleeping process in ioctl function. Keep in mind that the functions
called by the kernel are mostly asynchronous (in different contexts
too) means they can be called simultanously (on SMP) or one might be
doing something when it put to sleep or preempt and at that time other
function called by the kernel. (CMIIW)

You can't use fork in the kernel, rather create a kernel_thread if you
really need another process !

--
Fawad Lateef

--
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