liveBook · Manning

Operating system

As explained in Learn Concurrent Programming with Go

An operating system is system software that manages computer hardware and provides services and abstractions for application programs.

An operating system is the gatekeeper for system resources. It decides which processes receive processing time, memory, and network access, making it possible for multiple jobs to coexist without every application directly controlling the hardware. section 2.0

For concurrent programming, the operating system supplies the basic model for running more than one task. Processes and threads act as concurrent actors: they can interleave their work, interact, and sometimes execute in parallel. Understanding this model helps explain where goroutines fit and why concurrent programs do not simply run in a fixed, sequential order. section 2.0 section 1.1

Multiprocessing, also called multiprogramming, lets an operating system handle more than one task at a time. Its practical purpose is to keep the CPU useful: when one job cannot proceed, such as while waiting for user input or file I/O, another ready job can run instead. section 2.1

A job commonly moves through a small set of scheduling states:

  • It enters a job queue after submission when it is not yet ready to run. section 2.1
  • It moves to the ready queue once it can run; Linux may call this the run queue. section 2.1
  • It executes when the operating system selects it for an available CPU. section 2.1
  • It waits in an I/O queue after requesting data from a device, allowing another ready job to use the CPU. section 2.1

Searching a large file

A command that searches a large file begins as a submitted job, becomes ready, and runs on the CPU. When it requests file data, it leaves the CPU for I/O waiting. The operating system can then schedule another ready job rather than leaving the processor idle. section 2.1

Figure 2.1 The operating system’s job states in a single-CPU system

Use the job-state figure to trace how a single-CPU system alternates work between ready jobs and jobs waiting for I/O. section 2.1

How Learn Concurrent Programming with Go covers it

How deep it goes
Explains resource allocation and job-state transitions without descending into operating-system internals.
Examples
Traces a UNIX string-search command through job, ready, CPU, and I/O waiting queues.
What it assumes
Assumes some Go or similar C-style language experience while introducing operating-system concurrency concepts gently.
What you can do after
Evaluate/understand how time-sharing keeps CPUs productive while concurrent jobs wait for I/O.
How it connects
Connects multiprocessing with processes, threads, goroutines, concurrency, parallelism, CPU scheduling, and I/O.

Also explained in

Compare how 4 books explain operating system →

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.