liveBook · Manning

Scheduling algorithm

As explained in Learn Concurrent Programming with Go

An algorithm that determines which task should be selected for execution from available tasks.

A scheduling algorithm decides which job the operating system selects from the ready queue when execution can move to another task. It helps share CPU time among competing jobs, even on a single processor. section 2.1

A typical scheduling cycle looks like this:

  • A timer tick, completed I/O operation, or software interrupt pauses the current job. section 2.1
  • The operating system returns the paused job to the ready queue. section 2.1
  • The algorithm selects another ready job, while a context switch saves and later restores execution state. section 2.1
Figure 2.1 The operating system’s job states in a single-CPU system

Trace how jobs move between operating-system states on a single-CPU system. section 2.1

How Learn Concurrent Programming with Go covers it

How deep it goes
Explains selection, interrupts, context switches, and saved process state, but does not compare specific scheduling policies.
Examples
Uses a text search of a large file to illustrate repeated job interruption, rescheduling, and completion.
What it assumes
Assumes basic awareness of programs and CPUs while defining ready queues, interrupts, context switches, and process context blocks.
What you can do after
Evaluate how interruptions and context-switch overhead affect concurrent jobs on single- and multi-CPU systems.
How it connects
Connects ready queues with interrupts, context switches, process context blocks, concurrency, and parallelism.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Concurrent Programming with Go. The section links point to the parts of the book it draws on.