Operating system - CPU scheduling

  • basic concept
    • Process execution is composed of CPU intervals and I/O intervals. The I/O main program has more short CPU intervals, and the CPU main program has more long CPU intervals.
    • CPU scheduler: preemptive scheduling, non-preemptive scheduling
    • Dispatch program: switch context, switch to user mode, jump to appropriate location in user program, restart program
      • Dispatch Latency: Dispatcher stops the time it takes for one process to start another
  • Scheduling criteria: CPU usage, throughput, turnaround time, wait time, response time
  • Scheduling Algorithm
    • First come first served FIFO
      • Escort effect: all other small processes wait for the big process to release the CPU
    • Shortest job priority scheduling: select the CPU with the shortest interval length
      • non-preemptive

      • Preemptive

    • Priority: preemptive, non-preemptive

      • starvation/infinite blocking: low priority cannot run
        • Solution: Aging, increase process priority with waiting time length
    • Rotation method: preemptive, the time slice is too large, the same as FIFO, and the context switching burden is too small, it should be greater than 80% of the CPU interval
    • multi-level queue
      • In-queue scheduling mechanism
      • Scheduling mechanism between queues
        • Fixed Priority Preemptive Scheduling
        • Divide time slices between queues
    • Multi-level feedback queue: processes can move between multiple queues, the implementation of aging
  • multiprocessor scheduling
    • Symmetric multiprocessing: does not allow movement between multiple processors, each processor has its own scheduling algorithm
    • Asymmetric multiprocessing: allows movement between processors, only one processor schedules tasks
      • Process Soft Affinity: Allows movement between processors
      • Process Hard Affinity: Movement between processors is not allowed
    • Load Balancing: Keep all processors load balanced in SMP systems
  • Thread scheduling: The scheduling object of a multi-threaded system is a thread
    • Local scheduling: Thread competition within the same process
    • Global scheduling: all system threads
  • real-time scheduling
    • Hard real-time systems: strict deadlines
    • Soft real-time systems: no strict deadlines

Guess you like

Origin blog.csdn.net/qq_56061892/article/details/126139293