liveBook · Manning

Task

As explained in Modern C, Third Edition

A task is a distinct part of a program's work that can be performed with little or no interaction with other tasks.

A task is a distinct part of a program’s work that can proceed with little or no interaction with other tasks. Threads provide separate control flows for executing tasks concurrently, either simultaneously on multiple processors or through interleaving. section 20.0

A task can represent an independent responsibility, such as:

  • Drawing a cell matrix to a terminal. section 20.0
  • Capturing keystrokes, moving the cursor, and creating cells. section 20.0
  • Updating game state from one life cycle to the next. section 20.0
  • Counting living neighboring cells, tightly coupled with updating. section 20.0
Figure 20.1 Control flow of the five threads of B9
figure

A control-flow diagram helps show how independent task loops interact across the program’s threads. section 20.0

How Modern C, Third Edition covers it

How deep it goes
Defines task boundaries and illustrates their thread-based execution, but defers detailed synchronization mechanisms.
Examples
Uses the B9 cellular-game tasks for drawing, input, updating, and neighbor accounting.
What you can do after
Evaluate program responsibilities as candidate concurrent tasks and relate each task to a thread control flow.
How it connects
Connects tasks with threads, control flow, shared data structures, and interthread communication.

Also explained in

Compare how 10 books explain task →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Modern C, Third Edition. The section links point to the parts of the book it draws on.