Serial code uses a single thread of execution working on a single data item at any one time. Sorting cards using one worker is an example of serial computation. Some parts of a parallel program may still be serial code. For instance, when the manager was partitioning the data by card suit, this was like a serial code section because none of the workers could start until the partitioning was done.

Parallel code has more than one thing happening at a time. In our card sorting example, this corresponds to having multiple workers active at once. In computing this could be:

  • Multiple threads of execution in a single process (Multiple card sorters working at one table).
  • Multiple processes all working on the same problem (Multiple workers, each at their own table).
  • A single thread of execution operating on multiple data items simultaneously (e.g., by issuing vector instructions on a CPU).
  • Any combination of the above.
A timeline showing when different workers are active. In serial segments, only one worker is active while in parallel segments, two or more workers are active.
A parallel program is likely to contain some serial sections and some parallel sections.
 
©   Cornell University  |  Center for Advanced Computing  |  Copyright Statement  |  Inclusivity Statement