Re: Alan Cox quote? (was: Re: accounting for threads)

David S. Miller (davem@redhat.com)
Tue, 19 Jun 2001 13:57:03 -0700 (PDT)


Jonathan Lundell writes:
> Sun (or at least SPARC) is a bit of a special case, though. SPARC's
> register-window architecture makes thread-switching (not to mention
> recursion) significantly more expensive than on most other
> architectures.

The register window flush is a relatively constant cost with a fixed
upper bound, regardless of whether you are switching threads or
processes, the process is the same.

This cost is honestly lost in the noise during a context switch. The
trap entry/exit in and out of userspace usually costs more cycles than
the window flush at schedule() time.

The worst case whole window flush to the stack can fit (several times
over) in the store cache of UltraSPARC-III.

So my basic point is that I don't want people to read what you said
and believe "oh then the difference between threads vs. different
processes under Solaris is due to Sparc hw architecture reasons
instead of sw reasons" which simply isn't true.

<axe_grind>
Solaris just simply bites it at context switching threads in the
kernel.
</axe_grind>

The same identical code flushes the register windows for processes and
threads under Linux, and there is no reason this should not be the
case.

<axe_grind>

Don't believe me that Solaris sucks here? Run this experiment under
Solaris-latest and Linux on a sparc64 system (using lmbench):

Under Solaris: ./lat_proc fork
Under Linux: strace -f ./lat_proc fork

I bet the Linux case does better than the Solaris run by some orders
of magnitude. That's how poor their fork/exit/switch code is.

</axe_grind>

Later,
David S. Miller
davem@redhat.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" 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.tux.org/lkml/