Search code examples
parallel-processingoccam-pi

What are the common characteristics in occam and csp?


I saw a question while I was studying for OCCAM and CSP ( Communicating Sequential Processes ). I found some basic answers like;

  • they both for parallel programming,
  • they get input with question mark(?),
  • send output with exclamation mark(!).

But I want to find out more technical details about their common features.


Solution

  • On CSP

    Hoare's CSP was completed during 1979 ~ 1984, when his Book on CSP ( today having some 260+ pages ) was first published in 1985.

    This final version of CSP also includes channels, that allow process-to-process communication and synchronisation mechanics.

    On occam

    David May, along with Hoare's team at Oxford, has concurrently with the evolution of CSP developed occam, a language tightly knit to the InMOS very innovative and very advanced TRANSPUTER processor-networks, deliberately intended to blend CSP into a practical programming language.

    There are un-"paralleled" advanced features of the occam language concept that contemporary languages may source from.

    A funny sample code (C) 2000, Fred Barnes with some fixes/mods from Peter Welch illustrates the powers of the language/CSP channel concepts on a toy example of a Bar-simulator, serving beers, while keeping the code readable and expressive.

    -- ...(cleared for clarity >>> http://frmb.org/download/bar.occ )
    -- ..
    -- .
    --{{{
    PROC        bar.tender ( []CHAN OF BYTE  req, rsp,
                               CHAN OF INT   mode.change,
                               CHAN OF O.REQ d.chan,
                               SEMAPHORE     d.sem,
                               CHAN OF BOOL  kill
                               )
      CHAN OF BYTE spinal.chord:
      CHAN OF BOOL kill.brain, kill.body:
    
      PAR
        --{{{  terminator SEQ, BUT DECLARED TO RUN IN TRUE-PARALLEL EXEC WITH bar.brain() & bar.body()
        BOOL any:
        SEQ                   -- SEQ:
          kill ? any
          kill.brain ! any    -- order is
          kill.body ! any     -- important
        --}}}
        bar.brain ( req, spinal.chord, mode.change, kill.brain )
        bar.body  ( spinal.chord, rsp, d.chan, d.sem, kill.body )
    :
    --}}}
    

    In next waves, CSP and Occam have influenced each other ( for example in The Laws of Occam Programming ( ~90 pages, scanned copy ) ), touching as advanced topics as distributed real-time processing and many other advanced fields of interest.