Re: Bottom-halves ?

Andi Kleen (ak-uu@muc.de)
30 Mar 1999 20:32:25 +0200


hvarotto@cs.pitt.edu (Hugo Varotto) writes:

> Hi, this is a call for a small explanation.
>
> I'm trying to understand the scheduling part of Linux ( SMP part to be
> more precise ) and I don't understand very much the meaning of so-called
> "bottom-halves". In particular, I don't completely understand the
> relationship between the call to run_task_queue(tq_scheduler) and the
> use later of the goodness function ( in which supposedly the scheduler
> is making the decission to which task to schedule later ).

The actions run in the tq_schedule task queue are not subject to the
scheduling policies - they have higher priority than ordinary tasks
and are more like a special kind of interrupt that runs at schedule
time.

These are not bottom halves, bottom halves are run by the interrupt
dispatch code when the interrupt is finished (this includes system calls,
timer interrupts etc.). Bottom halves are not subject to the scheduler
neither, they always have higher priority than a task, but lower pri than
a interrupt. They usually contain the slow part of an interrupt. Other
remarkable thing is that they're atomic to itself (bh code does not
need to be reentrant)

So the priorities are:

1. Highest Interrupts
2. Bottom Halves.
3. Real Time Processes (ordered by rt pri)
4. Normal Processes (ordered by nice value)

The kernel internally uses cooperative multitasking, so even (soft) rt
processes cannot interrupt some other process running in kernel mode,
except when it gives up CPU (or when the task switch happens on another
CPU on a SMP system). rt/linux adds a (0) priority for its
(hard) real time tasks.

Hope this helps,

-Andi

-- 
This is like TV. I don't like TV.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/