CS452 - Real-Time Programming - Spring 2008

Lecture 16 - NameServer


Questions & Comment

  1. Due dates now on the web.

int Send( Pid 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
    3. Too small receive buffer: this creates a little what to do question
    4. Too small reply buffer: What to do?
      • Common to put into the rply buffer what bytes can be put there and signal an error
      • Sending task might be able to do something useful

    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( Pid *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. Are errors possible?
  3. If several tasks have Sended, which one gets Received first?

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

These are pretty self explanatory


Sequence of states

Send before Receive

  1. Sender sends and becomes send-blocked
  2. Receiver receives
  3. Receiver replies

Receive before Send

  1. Receiver receives and becomes receive-blocked
  2. Sender sends
  3. Receiver replies

Implementation

Code should be constant time

Send before Receive

Receive before Send

How is the message copying done?


Nameserver

Tasks need to get the Task IDs of tasks they don't know.

Done using a task outside the kernel, called the Nameserver

Basic functionality

This creates a global name-space of task names

Semantics of name-space

Implementation

Code is trivial, and doesn't matter very much how it is written. Why?

Only used during

But do the best you can anyway.

The interesting question. How does a task find out the Pid of the NameServer?


Return to: