Re: Tasklet vs workqueues

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

 



Hi Santosh,

On Mon, Aug 1, 2011 at 6:54 AM, santhosh kumars <karuna.linux@xxxxxxxxx> wrote:
> On Sat, Jul 30, 2011 at 10:45 PM, Dave Hylands <dhylands@xxxxxxxxx> wrote:
>> Hi Santosh,
>>
>> On Sat, Jul 30, 2011 at 5:24 AM, santhosh kumars <karuna.linux@xxxxxxxxx> wrote:
>>> Hi All,
>>> I took following lines from robert love linux kernel development.
>>> " If you need a schedulable entity to perform your bottom-half
>>> processing, you need
>>> work queues.They are the only bottom-half mechanisms that run in
>>> process context, and
>>> thus, the only ones that can sleep.This means they are useful for
>>> situations in which you
>>> need to allocate a lot of memory, obtain a semaphore, or perform block
>>> I/O. If you do
>>> not need a kernel thread to handle your deferred work, consider a
>>> tasklet instead ."
>>>
>>> Here some times tasklets also runs in kernel thread context(by
>>> ksoftirqd/n).So I want to know
>>> what is the exact difference between workqueue and tasklet.
>>
>> A tasklet is something that in some OSes, might be called a software
>> IRQ. It runs with interrupts enabled, but context switches are
>> disabled. They are normally associated with device drivers where there
>> is some extended processing that needs to be done, but perhaps not
>> from an interrupt handler.
>> http://www.xml.com/ldd/chapter/book/ch09.html#t5
>>
>> The workqueues are documented here:
>> http://lwn.net/Articles/11360/
>> Items in a workqueue are executed from a thread context (whereas
>> tasklets are sort of half way between interrupt context and thread
>> context). You can't perform blocking operations from a tasklet,
> so we can conclude like tasklets some times runs in process
> context(kthread context)
> but that time contextswtiching is disabled.

I think of them more as being interrupt context with interrupts
enabled (since you still can't call blocking functions from a tasklet
like you can from thread context).

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[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