Does it mean the number of virtual processors in a physical processor?
If the number of siblings is equal to the number of cores then you have CPUs which are not hyperthreading or hyperthreading is switched off, If the number of siblings is 2x the number of cores then you have a hyperthreading CPU with hyperthreading switched on. There is a good article here.
The number of siblings on a processor is the total number of execution units within that processor. This will include both additional cores and hyperthreading.
- A Core 2 Duo will list
siblings : 2. Dual core, no hyperthreading.
- A Xeon E5420 will list
siblings : 4. Dual core, with hyperthreading.
- A Pentium 4 with hyperthreading will list
siblings : 2. Single core, with hyperthreading.
First of all understand below terms and their usage context.
- A CPU is a processing unit.
- It will have multiple components to process instructions.
- Each component is responsible for different operations like instruction fetch, decode, process, update, etc.
- One CPU may have multiple sets/unit of above mentioned components.
- If there are two set of these units, the processor can run two instructions in parallel.
- One unit is called as Core.
- A Duel-Core CPU will have two identical set of components. A Quad-core CPU will have four identical set of these components/units
- Multi-cpu / hyperthreading
- This is little tricky. It is valid only Software context.
- Whenever an instruction is waiting for an external event to be completed, the CPU will be idle. To better utilise the CPU, some vendors maintain two hardware threads and whenever one thread is blocked, hardware will switch to other thread. This kind of processors will the capability of storing and restoring CPU states
- For software, it will look like two threads are running in parallel.
- Linux considers this hyperthreading cores as multiple-cpus. Because it can run two threads in parallel. So it will see two execution units (pseudo CPUs).
- For example recent Intel CPUs are hyperthreaded, capable of running two simultaneous threads.
- Modern CPUs are having multiple set of above mentioned hardware units / Cores
- Unlike hyperthreading, they can actually execute two instructions in parallel
- Each core can be hyperthreaded too
- High performance systems like Servers, Super computers will have multiple physical CPUs.
- You can see multiple CPU sockets in their mother boards
- Each can have multiple cores. Again each core can be hyperthreaded
Modern PCs are usually coming with Multi-Core hyperthreaded processors. For example Linux running on a PC coming with quad-core hyperthreaded intel CPU, will see 8 CPUs (4 Cores x 2 hyperthreads).
Modern Servers are usually Multi-Core-Multi-Processor systems. A typical server will have two sockets, each having 24 hyperthreaded Cores. So Linux running on this system will see 96 CPUs (2 Sockets x 24 Cores x 2 hyperthreads)
Coming back to the actual question, Processors sharing cache will be called siblings. Cache organisation will be like (Though it will vary based on architecture),
- Each Core will have one L1 Instruction-cache and one L1 Data-cache
- Each Core will one Unified L2 cache
- All Cores in a Socket will have one Unified L3 cache
- No two sockets usually will share any cache
Consider a Multi-Core-Multi-Processor system with 2 sockets. Each sockets having 24 Cores with hyperthreading. In this case Linux will see total 96 CPUs numbered from 0 to 95. Socket 1 will have CPUs 0-47 and Socket 2 will have 48-95 (unlike this usually the numbers will be interleaved). For this system with above mentioned cache organisation,
- Processors 0-47 are siblings
- Processors 48-95 are siblings
The kernel uses the number of siblings to loadbalance for example;
Four tasks are running on a system having two physical packages, each having two cores (sharing last level cache) and each core having two logical threads. Load balance kicks in at the multicore domain for the first package, resulting in equal load distribution among all cores.