CS452 - Real-Time Programming - Fall 2008

Lecture 8 - Inter-task Communication


Questions & Comments

  1. Grad school
  2. Assignment 1 review

Debugging

Printf

Graphics Output

GRUB

Breakpoint

interactive front-end to print functionality

Autopsy

Could be Breakpoint, starting when you do NMI

Gossip

Circular buffer somewhere in memory, where log messages are placed

History buffers

Permanent versions of gossip, so must be more selective

Use Bits

Data structure somewhere in memory where bits are set when significant events occur

The Trace Bit

Causes the CPU to take an exception at the end of each instruction


Message Passing

Let's think about objects

  1. Send a message to an object, asking it to run some code for us, and return an response

We normally think about this in a single threaded way, like a procedure call

  1. Call a method and block
  2. Method is just sitting, waiting for the call and immediately starts to execute
  3. When it's finished executing ut returns a result.
  4. We are no longer blocked and continue executing.
  5. The method goes back to sitting, waiting

In an environment with multiple threads of control

  1. Several threads might call the same method

    at the same time.

  2. Then the object needs to be `thread-safe'
  3. The object worries about the details

To make the last easier we make the communnication more explicit than it is in a method call

  1. To call the method a task calls Send with an argument that indicates which code is to be executed and its environment
  2. To indicate its readiness to execute the object calls Receive, which returns which code is to be executed and its environment
  3. To indicate that the code has completed its execution the object calls Reply with an argument that indicates the result of the execution
  4. Send returns within the task, with the result of the execution

Synchronization details

  1. Send blocks the caller

    Most of the time it needs the result before it can proceed further

  2. Receive blocks the callee
  3. Reply blocks nobody

What practical things can be going on in the sender?

  1. Getting some information that's needed
  2. Making a request for a service

Waiting for something


Return to: