lkml.org 
[lkml]   [2000]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 2.2.18Pre Lan Performance Rocks!

A "context" is usually assued to be a "stack". The simplest of all
context switches
is:

mov x, esp
mov esp, y

A context switch can be as short as two instructions, or as big as a TSS
with CR3 hardware switching,

i.e.

ltr ax
jmp task_gate

(500 clocks later)

ts->eip gets exec'd

you can also have a context switch that does an int X where X is a gate
or TSS.

you can also have a context switch (like linux) that does

mov x, esp
mov esp, y
mov z, CR3
mov CR3, w

etc.

In NetWare, a context switch is an in-line assembly language macro that
is 2 instructions long for a stack switch and 4 instructions for a CR3
reload -- this is a lot shorter than Linux.
Only EBX, EBP, ESI, and EDI are saved and this is never done in the
kernel, but is a natural
affect of the Watcom C compiler. There's also strict rules about
register assignments that re enforced between assembler modules in
NetWare to reduce the overhead of a context switch. The code path is
very complex in NetWare, and priorities and all this stuff exists, but
these code paths are segragated so these types of checks only happen
once in a while and check a pre-calc'd "scoreboard" that is read only
across processors and updated and recal'd by a timer every 18 ticks.

Jeff





Andi Kleen wrote:
>
> On Tue, Oct 31, 2000 at 02:52:11PM -0700, Jeff V. Merkey wrote:
> > The numbers don't lie. You know where the code is. You notice that
> > there is a version of
> > the kernel hand coded in assembly language. You'l also noticed that
> > it's SMP and takes ZERO LOCKS during context switching, in fact, most of
> > the design is completely lockless.
>
> I suspect most of the confusion in this thread comes because you seem to
> use a different definition of context switch than Ingo and others. Could
> you explain what you exactly mean with a context switch ?
>
> -Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:45    [W:0.234 / U:0.424 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site