Chapter 10
Scheduling Processes on Multiprocessor Systems

We are concerned mainly with medium-grain parallelism on tightly-coupled multiprocessor systems.


Assigning processes to processors

Solution 1. Each process is assigned to a single processor when it enters the system. Operating system tries to do "load-balancing" by assigning new processsors to a processor that is not too busy. Each processor has its own scheduler.

Advantage: Simplicity. Allows gang scheduling (see below).

Disadvantage: Might be hard to keep processor load balanced.


Solution 2. Instead of a separate ready queue for each processor, have a single, global ready queue. Processes are scheduled on the next available processor.

Advantage: No load balancing problem.

Disadvantage: We may need for some processes have their own dedicated processor. The operating system for example. Where does the kernel run?


Solution 3: The master/slave approach. The kernel (the master) runs on a dedicated processor. The master is charged with scheduling jobs. Requests for service from the user processes (the slaves) are sent to the master.

Advantage: Simplicity. Requires little change from a uniprocessor multiprogramming environment.

Disadvantage: failure of the master brings down the whole system. The master can become a performance bottleneck.


Thread Scheduling

Load sharing: Processes are not assigned to a particular processor. A global queue of ready threads is maintained. When a processes arrives, its threads are placed consecutively at the end of the queue. Each processor, when idle, selects a thread from the queue on a FIFO basis.

Advantages:

Disadvantages:


Gang scheduling: A set of related threads are scheduled to run on a set of processors at the same time.

Advantages:


Dedicated processor assignment: Each process is allocated a set of processors equal in number to the set of threads of that process. The process keeps the processors until it terminates. At that point, the processors go back in the pool of available processors.

Advantage: No process switching costs.

Disadvantage: Can have wasted CPU time.


Dynamic scheduling: Alter the number of threads per process, if possible.

When a job requests one or more processors,

  1. If there are idle processors, use them to satisfy the request.

  2. Otherwise, if the job making the request is a new arrival, allocate it a single processor by taking one away from a running process.

  3. If any portion of the request cannot be satisfied, it remains outstanding until a processor becomes available or the request is withdrawn.

  4. Upon the release of a processor, assign the processor to some waiting process with no assigned processor, if one exists. Otherwise assign the processor on a FCFS basis.