Take the 2-minute tour ×

Maybe this is a stupid question but I am trying to gain a better understanding of hardware inner workings...

If a machine has two or more CPUs, which hardware component is actually responsible for distributing instruction execution (process- or thread-level) among different CPUs? Or another way to put it, what determines which CPU does what once an instruction set arrives? Is there something equivalent to a load balancer that distributes workload in a cluster computing environmet.


share|improve this question
Each core receives its own stream of instructions. The consecutive stream of instructions that constitutes a single thread of execution go to only a single core. If multiple cores are active at the same time, each is following its own stream of instructions that exist in the software that core is running at that time. The scheduler (part of the OS) assigns instruction streams to cores. –  David Schwartz Dec 6 '12 at 18:49

2 Answers 2

up vote 1 down vote accepted

The operating system creates "threads" or "tasks" for each sequential unit of work (ie, a simple program). The OS keeps a queue of threads/tasks that are ready to run and, each time a CPU becomes available, the OS assigns a "ready" thread/task to it.

A CPU becomes available because the previously-executing thread/task ended, or because it needs to wait for disk I/O or network response or user input or whatever. When a waiting thread/task has satisfied the reason for its wait, it gets put back in the "ready" queue.

In essence, each thread/task is a "virtual CPU", and the OS assigns these "virtual CPUs" to real CPUs.

share|improve this answer

It's a combination of the Operating System and the control unit in the CPU. The OS is responsible for creating threads and assigning them to cores. The control unit in the CPU directs the flow of data inside of the processor. It can re-order commands and dynamically assign them to different logic units.

share|improve this answer

Your Answer


