The common styles of pseudocode are largely intelligible, and it is more or less clear how to write pseudocode for sequential programs.

But if parallelism is not hidden behind a full library and is regarded as a regular part of programming, then it should be treated as the same way in regards to pseudo-code.

Is there a consistent and widely used style of pseudocode for parallel algorithms? Are there good, practical examples of this?


2 Answers 2


It depends on what level you need to reason about the code. For low-level code you may need to describe shared resources, readers, writers, and how they cooperate to prevent starvation (see the readers-writers problems). On a higher level it may be sufficient to describe system states, tasks, and how workers are synchronized.

  • So I suppose there is no common standard for parallel algorithms yet.
    – shuhalo
    Aug 22, 2011 at 19:08
  • +1: It depends on what level you need to reason about the code. For very high level expression of parallelizability, a parallel_for maybe be all you need. Then, control dependency and data dependency can be added. At the next level of detail, the data structures and mechanisms responsible for carrying out those dependencies are specified. Finally, the state transitions for each executable core is spelled out. After several more levels (communicating sequential process) you may be able to reason about the correctness of the code. (Disclaimer: I'm not a CS major, but is in a related field)
    – rwong
    May 26, 2012 at 1:16

Fundamentally, pseudocode is about low level algorithms, and tends to be only useful when you are describing sequential operations. Parallelism tends to occur at the next level up and there are planting of diagramming tools that are better suited to that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.