3 – Process Scheduling

Summary

  1. Types of processing environments
  2. Types of process behaviours
  3. Preemptive vs non-preemptive algorithms
  4. Criteria for scheduling algorithms in general
    1. Fairness (no starvation)
    2. Utilization (no idle processes, minimize OS)
    3. Turnaround time, throughput (batch)
    4. Low response (interactive)
    5. Adaptivity (online scheduling)
  5. Note: you can simulate yielding a process by usleep(microsecs)

Concurrent processes

Scheduling in OS

Process Behaviour

Processing environments

Criteria for scheduling algos

For all processing environments:

When to perform scheduling:

Context switch:

Context switch (oversimplified)

Process scheduling (point 2 - 3 is described by Figure 1.)

Batch Processing

Criteria

First-come First-served (FCFS)

convoy

Shortest Job First (SJF)

Shortest Remaining Time (SRT)

Interactive environment

Periodic scheduling

Timer interrupt, that cannot be intercepted by any other program, invokes the scheduler.

Scheduling Algorithms

Round Robin

Priority Scheduling

Multi-level Feedback Queue (MLFQ)

  1. Basic rules. Let $P(A)$ be the priority of job $A$.
    1. $P(A) > P(B) \Rightarrow A$ runs
    2. $P(A) = P(B) \Rightarrow A$ and $B$ run in round-robin.
  2. Priority setting
    1. New job $\Rightarrow$ Highest priority
    2. used up time quantum $\Rightarrow$ Priority decreases
    3. gives up or blocks before quantum ends $\Rightarrow$​ Priority retained

Lottery Scheduling