From: Larry McVoy (lm@slovax.Eng.Sun.COM)
Date: 08/27/92


From: lm@slovax.Eng.Sun.COM (Larry McVoy)
Subject: Re: A technical question on CONTEXT (TASK) SWITCHING by the Kernel
Date: 27 Aug 1992 06:34:46 GMT

torvalds@klaava.Helsinki.FI (Linus Benedict Torvalds) writes:
: > __asm__("cmpl %%ecx,_current\n\t"\
: > "je 1f\n\t
:
: %ecx is set up with the task we want to switch to when we enter the
: inline assembly statement, so this is obviosuly testing whether we are
: trying to switch to the current task, in which case nothing is done.
: Besides being an obvious optimization, I don't think the 386 allows a
: tss-jump to the current task (but not having my books around me, I can't
: check).

On old versions of SunOS (3.x I think) not doing this cost us quite a bit
of performance. If you dig up the old TCP mail that Van sent out about
getting to the wire speed on Sun 3/60's, you'll see him disgustedly
pointing out that useless context switching was costing us a chunk of
performance.

I'm curious: would it cost that much on the 386 to switch to yourself?
Or would it be cheap? What do context switches on Linux cost?