Processor Management Notes

Processor Management

Overview of Processor Scheduling

  • Processor Scheduling: Refers to how CPU cores are allocated to processes, managing transitions between ready and running states for efficient resource utilization.

Common Scheduling Algorithms

  • Key Scheduling Algorithms:
    1. First Come First Served (FCFS)
    2. Round Robin (RR)
    3. Shortest Process Next (SPN)
    4. Multilevel Queuing

First Come First Served (FCFS)

  • Description: Allocates the processor based on creation time; processes are served in the order they arrive.
  • Pros:
    • No unnecessary process switching.
    • Each process is eventually allocated processing time.
  • Cons:
    • Average waiting time can be long.

Round Robin (RR)

  • Description: Similar to FCFS, but no process can use the processor for longer than a defined time quantum. Processes are either interrupted and added to the back of the queue or complete execution.
  • Pros:
    • Fair distribution of resources.
    • Fast processes can be executed quickly.
  • Cons:
    • Average waiting time increases for processes needing multiple time quanta.
    • Performance is heavily influenced by the length of the time quantum.

Shortest Process Next (SPN)

  • Description: Allocates processor time based on the shortest predicted execution time. Can be preemptive or non-preemptive.
  • Pros:
    • Minimizes average waiting time for a batch of processes.
  • Cons:
    • Requires accurate estimation of execution times.
    • Longer processes might experience extensive waiting times.

Multilevel Queuing

  • Design Choices:
    • How to map processes to queues.
    • Determining relative priority of queues.
    • Choosing scheduling algorithms for each queue.
  • Mapping Processes:
    • Different queues for:
    • Interactive processes (high I/O)
    • Normal processes (system services)
    • Batch processes (low I/O)
  • Relative Priority:
    • Fixed-priority scheduling.
    • Example: 80% CPU time for interactive, 10% for normal, 10% for batch processes.
  • Internal Scheduling Algorithms:
    • RR for interactive processes.
    • RR for normal processes.
    • FCFS for batch processes.
  • Pros:
    • Can handle diverse performance objectives.
  • Cons:
    • Complexity in setup and calibration.

Scheduling Criteria

  • User-Oriented:
    • Turnaround Time: Time from job submission to completion.
    • Response Time: Time from job submission to first response.
  • System-Oriented:
    • Throughput: Completed processes per unit time.
    • Processor Utilization: Percentage of time the processor is active.

Multiprocessor Scheduling

  • Cache Memory: Each processor/core has distinct cache memory.
  • Scheduling Approaches:
    1. Common Ready Queue: Processes assigned from a centralized queue.
    2. Private Queues: Each processor has its own queue for assignment.
Improving Multiprocessor Scheduling Performance
  1. Load Balancing: Even distribution of processes among processors; common queues facilitate this.
  2. Processor Affinity: Preference for processes to run on the same processor to utilize cache efficiently; private queues support this.
Interaction Effects
  • Load balancing and processor affinity have opposing effects; soft affinity allows for movement of processes under certain conditions for optimal performance.