CS452 - Real-Time Programming - Fall 2011

Lecture 33 - CSP Servers

Public Service Annoucements

  1. Final demo: Tuesday, 6 December, 2011; Wednesday, 7 December, 2011
  2. Final exam: 10.30, Friday, 9 December, 2011 to 13.30, Saturday, 10 December, 2011.

CSP

Basics

Primitives

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

  1. read
    keyboard ? ch
    ch = <- keyboard
  2. write
    keyboard ! duh
    keyboard <- duh

The communication primitives require something new, called a channel.

CHAN OF CHAR keyboard
keyboard chan char

How are these primitives provided?

The Transputer

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 a real-time system based on plentiful small granularity communication. Your kernel is another example.

Transputer hardware

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: