wannabe programmer
wannabe programmer

Reputation: 683

difference between one CPU and multiple CPU in schedule routine - Linux kernel

In Linux kernel (2.6) is there a difference between the performance of the "schedule()" routine in a system that has only one processor than in a system with multiple processors?

I have tried to find the answer in the book "Understanding the Linux kernel (3rd ed.)" but no luck finding the answer.

Upvotes: 1

Views: 101

Answers (1)

Gil Hamilton
Gil Hamilton

Reputation: 12357

Difficult to answer this.

One simplistic answer is "yes, of course, there is a difference in performance between one cpu and multiple cpus since, when there are multiple CPUs, the kernel must lock various data structures thereby potentially encountering contention, and must decide which CPU a task can next run on, and so forth -- decisions that need not be made (or can be made trivially) when there is only a single CPU."

Another simplistic answer is, "no, the performance impact of the various decisions is minimal and represents a negligible percentage of the total combined CPU 'bandwidth'".

The full answer requires knowledge and consideration of the thousands of factors that go into the scheduling decision on all the available CPUs in any given scenario: Is there an explicit affinity mask set for each process? What interrupts and soft interrupts are being serviced by each CPU? Are the processes being scheduled on each CPU I/O-bound or CPU-bound? Are there processes communicating with other processes where both can run simultaneously on different processors? So many factors, it's impossible to enumerate all the possibilities.

Upvotes: 2

Related Questions