liveBook · Manning

Sequential processing

As explained in Grokking Simplicity

A sequential action is an action that is ordered to occur in sequence with other actions on the same execution timeline.

Sequential processing places actions on one execution timeline so they occur in order, one after another. Actions on subsequent lines commonly follow this pattern, as can left-to-right argument evaluation. The distinction matters because other actions may run in parallel and complete in an unexpected order. section 15.22 section 17.8

Use timeline diagrams to reason about sequential processing:

  • Identify every action, decomposing composite operations such as ++ and += into atomic reads and writes. section 15.22
  • Draw sequential actions on the same timeline and parallel actions on separate timelines. section 15.22
  • Simplify timelines by combining actions that cannot interleave and adding dotted lines for constrained ordering. section 15.22
  • Compare possible orders as impossible, desirable, or undesirable before changing the implementation. section 15.22

Sequential requests and faster parallel work

Suppose cost_ajax() takes three seconds and shipping_ajax() takes four. Waiting for both responses sequentially takes seven seconds because the times add. Starting them in parallel takes four seconds, but responses can return out of order and produce faulty behavior. A coordination primitive can preserve the required order while retaining the speed benefit of parallel execution. section 17.8 section 17.13

Image

Inspect the timeline figure to compare coordinated parallel work with sequential ordering and see where execution waits. section 17.13

How Grokking Simplicity covers it

How deep it goes
Defines sequential placement, decomposes actions, and gives a three-step diagramming process, but stops short of language-independent execution internals.
Examples
Uses atomic variable updates, left-to-right argument evaluation, and cost and shipping AJAX requests as ordering examples.
What you can do after
Diagnoses ordering bugs with timeline diagrams and evaluates when coordination can make parallel work both faster and correct.
How it connects
Connects sequential processing with timeline diagrams, parallel execution, asynchronous callbacks, concurrency primitives, and temporal semantics.

Also explained in

Compare how 7 books explain sequential processing →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Simplicity. The section links point to the parts of the book it draws on.