public inbox for linux-newbie@vger.kernel.org
 help / color / mirror / Atom feed
From: Linda Walsh <lkml@tlinx.org>
To: Antino Kim <antinokim@gmail.com>
Cc: linux-newbie@vger.kernel.org
Subject: Re: When does bottom half get to run?
Date: Sat, 01 Dec 2007 22:54:45 -0800	[thread overview]
Message-ID: <475256B5.8010401@tlinx.org> (raw)
In-Reply-To: <f8b4363d0711071113j746b1663t496237c075e4ddfd@mail.gmail.com>

An excellent book addressing this is "Linux Kernel Development" 2nd Ed.
 by Robert Love.

BottomHalf, "per se", (BH structured handlers) went away in 2.5. 
Replacing the previous mechanisms were 3 new types:
softirq, tasklets and work queues.

Softirq's and tasklets get a chance to run after each hardware
interrupt.  That means they will generally have higher priority
than user processes.  They can't "sleep", and need to be quick
about what they do (no long routines -- long routines need to be
scheduled later).

"work queues" are run in "process context" -- generically in a kernel
thread named 'events'.  There is usually one for each cpu.  If your
driver needs alot of processing, it might use it's own "private" work
queue thread.  But these threads are scheduled in the same way as are
user-processes.  The standard kernel thread(s) to process work-queues
run at "nice -5".  If you create your own thread, you can set the
priority as you wish.

So if you do "bottom half" work in a "work queue", it may or may not
be scheduled before other user-process work depending on its scheduling
priorities.

At least this is what I "gather" from my readings in the above
mentioned book.  :-) 

Linda

Antino Kim wrote:
> Hello all,
>
> I was reading into top/bottom half handlers of interrupt processing,
> and I couldn't find an answer to my question;
>
> when does bottom half get to run?
>   
> Actually, more specific question would be, can a task (any process...)
> be running when bottom half is not empty ( i.e., there are works to be
> done on be half some interrupts that happened)?
> Or, does bottom half handler have priority over all tasks (meaning
> that all bottom half work has to be completed before a scheduler gets
> to run one of the ready processes)?
>
> Your feedback would be appreciated. Thank you.
>
>   
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

      reply	other threads:[~2007-12-02  6:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-07 19:13 When does bottom half get to run? Antino Kim
2007-12-02  6:54 ` Linda Walsh [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=475256B5.8010401@tlinx.org \
    --to=lkml@tlinx.org \
    --cc=antinokim@gmail.com \
    --cc=linux-newbie@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox