Thursday, June 08, 2006

Sun T2000 Niagara Noodling Part 6

Part 5 is here

Between holidays and work commitments some time has passed since we set up the Niagara (Sun T2000) box and popped it on the network. Thankfully, I can see some light now where we can proceed to run some application tests.

First up: this is a 4 core box i.e. it has a single UntraSparc T1 processor and on that single processor there are 4 cores. Each core is basically a separate CPU (there are some subtleties here. We'll get to them later.)

So, I have a machine that the operating system will see as a 4 CPU SMP box right? Lets see...the mpstat command gives me a look at what all processors in a Solaris setup are doing. Lets try that...(abbreviated output shown)

CPU minf mjf xcal ...
0 0 0 52 ...
1 0 0 0 ...
2 0 0 0 ...
3 0 0 0 ...
4 0 0 0 ...
5 0 0 0 ...
6 0 0 0 ...
7 0 0 0 ...
8 0 0 0 ...
9 0 0 0 ...
10 0 0 0 ...
11 0 0 0 ...
12 0 0 0 ...
13 0 0 0 ...
14 0 0 0 ...
15 0 0 1 ...


16 processors! What gives? Did Sun give me a 16 core box by mistake? Is there a big gaping hole in this simple conceptual model?

The latter.

Here is the simplified scoop.

  • There is a single T1 UltraSparc Processor in the box

  • That single processor chip has 4 separate cores. The cores are *mostly* independent processors. They share a single FPU and they share an L2 cache.
  • Each core provides 4 hardware-implemented threads. Simply put, each core can switch in one instruction cycle between any of its 4 threads.
  • The hardware level threads are known as *strands*.

So, 1 T1 UltraSparc with 4 cores, each of which has 4 hardware threads (strands).

That is where the 16 processors comes from. 4 cores times 4 strands per core = 16. Solaris "sees" each strand on each core as a separate processor. When Solaris wants to schedule a lightweight process (a software thread) to run, it sees 16 virtual CPUs on which to do so.

Thats the simple version. Of course, its not that simple in practice. Getting the most out of a multi-core box requires digging down a couple of levels below this.

To see why its best to a segue into looking at the world from the perspective of one of those cores...

No comments: