Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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.

share|improve this answer
    
So I suppose there is no common standard for parallel algorithms yet. –  shuhalo Aug 22 '11 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 '12 at 1:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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