CS452 - Real-Time Programming - Spring 2008

Lecture 15 - Send-Receive-Reply

Questions & Comment

  1. Due dates now on the web.


Two ways to do this

  1. Producer Sends, consumer Receives

    After Reply buffers holding data can be overwritten at will

  2. Producer Receives and Replys

    After Reply buffers can be overwritten at will.

What is the difference?

  1. If relationship is one-to-one
  2. If relationship is many-to-one
  3. If relationship is many-to-many

int Send( Tid tid, char *arg, int arg-length, char *reply-buffer, int reply-buffer-size )

These are pretty self explanatory, except

  1. The return value is the number of characters actually returned
  2. If something goes wrong, the return value is negative, coded to indicate what went wrong

    What can go wrong

    1. Illegal tid
    2. tid not an existing task

    It's up to Send to check that the reply-buffer was big enough by looking at its return value

    It's not an error if the task to which we Send never Receives

  3. Parsing argument and reply-buffer is potentially costly and error-prone
  4. This form of message passing requires user and kernel code to cooperate to avoid malignancies

int Receive( Tid *tid, char *arg-buffer, int arg-buffer-length )

These are pretty self explanatory, except

  1. How is the task id copied form kernel to receiver?
  2. What if the buffer wasn't big enough?
  3. If several tasks have Sended, which one gets Received first?

int Reply( Tid tid, char *reply, int reply-length )

These are pretty self explanatory


Code should be constant time

Send before Receive

Receive before Send

How is the message copying done?

Return to: