HPlogo HP-UX MultiProcessing: White Paper > Chapter 1 MultiProcessing

Processor Scheduling

» 

Technical documentation

Complete book in PDF

 » Table of Contents

One of the biggest challenges in a multiprocessing environment is to distribute evenly the work across available processors. When a process is created, it is set to run initially on the same SPU as the parent, because a forked process is likely to use some of the same context as the parent. By launching on the same processor, the system takes advantage of previously cached data and avoids cache coherency performance issues.

In a multiprocessor environment, each SPU has a separate run queue. Once a thread is put on a run queue (with setrq()) for a certain processor it remains there until removed with remrq(). When a process is ready to run, the processor to which it is scheduled is based on the kthread.kt_spu_wanted field.

Of major concern is to keep the relative load balanced among processors. To do this, each iteration of schedcpu() calls the routine mp_spu_balance().

Additionally, any spu in an idle state may attempt to steal threads from other processors. This is done by the kernel routine find_thread_other_spu().