CS452 - Real-Time Programming - Spring 2011

Lecture 30 - Communicating Sequential Processes (CSP)

Pubilic Service Announcement

  1. Milestone 2
  2. Projects

Can Message Passing be Made Type Safe?

Dynamically

Yes, even including type extension and polymorphism, but

Statically

No,

CSP

To formal methods people CSP is a calculus for reasoning about the correctness of multi-process/threaded/tasking (MPTT) systems. Active research has been ongoing for forty years with several goals

For programmers the claim has been and is made that CSP provides a superior method for structuring MPTT systems.

Primitives

In CSP there are two communication primitives. In the notation of occam 2, they are

  1. read
    keyboard ? ch
  2. write
    keyboard ! duh

The communication primitives require something new, called a channel.

The Transputer: a Second Generation Offshoot

Use many co-operating, medium capability microCPUs to do a big job.

Problem is communication

Communication requires either

What about real-time?

The transputer was an early, now vanished, example of the latter

Occam 2

Basic idea

  1. processes (tasks)
  2. CSP channels
  3. time

Combining processes

  1. sequential
  2. conditional
  3. looping
  4. parallel
  5. alternation

Time

Can you Build a Server with Type-Checking?

Outer
Scope
|
| CHAN OF REQUEST request
|
| Server 
| Scope
| |
| | REQUEST sreq
| | CHAN OF REPLY srep
| |
| | request ? sreq
| | srep := sreq.reply
| |
| | srep ! sresult
| |
| |
| |
| Client
| Scope
| |
| | REQUEST creq
| | CHAN OF REPLY crep
| |
| | creq.reply := crep
| | request ! creq
| |
| | crep ? cresult
| |
 

The Result

You can write a type-safe server, BUT

BUT


Return to: