CS452 - Real-Time Programming - Fall 2008
Lecture 27 - Occam 2
Questions & Comments
- Coyotos
Hardware
Fourth Generation
- Multi-(multi-core CPUs) called servers
- communicate and synchronize using shared memory
- using techniques from CS343
- multi-core, cache, and shared memory don't play well together
- performance limited by threading
- explicit support for threading, e.g. register windows (Sun)
increases performance hugely
- communication still costly
- Multi-core microprocessors
- performance strongly hampered by lack of multi-threading
- multi-core, cache, and shared memory don't play well together
- Stream processors
- good for SIMD
- treat as co-processors
The Transputer: a Second Generation Offsoot
Use many co-operating, medium capability microCPUs to do a big job.
- An idea whose time has now come.
- Google
Problem is communication
- Big granularity
- minimizes communication
- maximizes replicated data
- The Google approach: a problem nobody thought about.
- Small granularity
- minimizes replicated data
- maximizes communication
- Your system, like threading solutions, relies on shared memory for
communication
- How would you handle caching?
Comminication requires either
- a common bus, star topology
- passing messages along
The transputer was an early, now vanished, example of the latter
- CPU, memory, switch on one chip
- chips connected in an array
- presumably a run-time system decides where tasks will go in order to
- maximize CPU throughput
- minimize communication overhead
Occam 2
Basic idea
- processes (tasks)
- may be named, take arguments and return values
- channels
- need a protocol (for type safety)
- must be named
- time
Combining processes
- sequential
- conditional
- if/then
- selection by case
- looping
- without test/break
- with test/break
- parallel
- initiated when the keyword PAR occurs.
- alternation
- guarded alternatives
- if more than one guard is true then select at random
Channels
- input
channel ? variable
- variable type must match protocol
- real-world hardware acknowledged by the anarchic protocol
- blocks when channel is empty
- output
channel ! value // the value of a variable or the result of an procedure
- variable type must match protocol
- blocks until an input process accepts the data
- input & output provide synchronization
- similar to sockets except for output blocking
Time
The Result
You can write a type-safe server, BUT
- all possible clients must be known at compile time.
Program structure is more static than is allowed in your system.
- This might be a good thing.
Return to: