Multiple-Processor Scheduling in Operating System

Last Updated : 22 Sep, 2025

CPU Scheduling is a mechanism by which an operating system decides which task or process should execute on the CPU at any given moment. When a system contains more than one CPU, Multiple-Processor Scheduling involves distributing tasks across multiple processors. This enables several tasks to be processed in parallel, improving performance significantly.

keynotes_of_multiple_processor_scheduling
Multiple Processor Scheduling

Key Challenges:

  • Deciding which CPU handles which task.
  • Balancing workloads between processors to avoid idle CPUs or overloaded processors.

Note: In multiple processor scheduling, there are cases when the processors are identical i.e. Homogenous, in terms of their functionality, we can use any processor available to run any process in the queue.

Approaches to Multiple-Processor Scheduling

Asymmetric Multiprocessing (AMP)

  • One processor acts as a Master Server handling scheduling decisions and I/O operations.
  • Other processors execute only user code.
  • Simple design, reduces data-sharing complexity.

Symmetric Multiprocessing (SMP)

  • Each processor can schedule tasks independently.
  • Two models of task queues:

Common Ready Queue: All CPUs access a shared queue of ready processes.
Private Ready Queues: Each CPU has its own queue of ready processes.

Important Concepts in Multiprocessor Scheduling

1. Processor Affinity

  • A process prefers to run on the same processor it previously ran on.
  • Benefits: Data stays in the CPU cache & reduces cache misses and improves performance.

Types of Affinity:

  • Soft Affinity: OS attempts (but does not guarantee) to keep a process on the same CPU.
  • Hard Affinity: Restricts the process to run only on a specific subset of processors using system calls (e.g., sched_setaffinity() in Linux).

2. Load Balancing

Essential to avoid:

  • Overloaded processors with long queues.
  • Idle processors while other processors are busy.

Two approaches:

  1. Push Migration: A processor actively moves tasks from itself to less busy processors to balance load.
  2. Pull Migration: An idle processor pulls tasks from busy processors to balance its workload.

3. Multicore Processors

  • Multiple processor cores on a single physical chip.
  • Each core appears as an independent processor to the OS.

Challenge: Memory Stall

  • Happens when a processor waits for data not present in cache.
  • Up to 50% of time can be wasted waiting for memory.

Solution: Multithreading within Cores

  • Coarse-Grained Multithreading: Switch thread when long latency events occur (e.g., cache miss).
  • Fine-Grained Multithreading: Switch threads every instruction cycle, keeping the pipeline filled with minimal overhead.

4. Virtualization and Threading

  • Single physical CPU appears as multiple virtual CPUs to virtual machines.
  • Host OS manages multiple guest OS instances.
  • Problem: Time-slice distortion - guest OS time slices may not match real CPU cycles due to virtualization overhead.

Impacts: Poor response times for virtualized systems & Time-of-day clocks may be inaccurate.

Pros of Multiple-Processor Scheduling

  • High throughput by parallel execution of tasks.
  • Better resource utilization.
  • Scalability for large applications and real-time systems.

Cons of Multiple-Processor Scheduling

  • Complex implementation and maintenance.
  • Difficult load balancing.
  • Increased overhead due to process migration and affinity management.
  • Virtualization may affect real-time guarantees.
Comment