Re: 2.2.18Pre Lan Performance Rocks!

Daniel Phillips
2000-11-03T06:42:57Z

"Jeff V. Merkey" wrote:
> A "context" is usually assued to be a "stack". The simplest of all
> context switches is:
>
> mov x, esp
> mov esp, y

Is that your two instruction context switch? The problem is, it doesn't
transfer control anywhere. Maybe it doesn't need to. I guess you could
break your tasks up into lots of little chunks and compile each chunk
inline and use actual calls to take you off the fast path. The stack
changes are actually doing some useful work here: you might for instance
be processing a network packet whose address is on the stack. But
somehow I don't think this is your two-instruction context switch. The
only halfway flexible two-instruction context switch I can think of is:

mov esp, y
ret

where you already know the stack depth where you are so you don't have
to store it, and the task execution order is predetermined. This
switches the *two* essential ingredients of a context: control+data.
But there's a big fat AGI there and all the overhead of a jump so it
doesn't get your superscalar performance.

Now my stupid question: why on earth do you need a billion context
switches a second?

--
Daniel