CS452 - Real-Time Programming - Winter 2017

Lecture 10 - Name Server

Public Service Annoucements

  1. Due date for kernel 2: 30 January, 2017.
  2. Updated k2.pdf
  3. Reminder about performance measurements.

Inter-task Communication


What is a server?

Servers provide data and/or synchronization to clients. A server is

How are servers implemented?

We usually try to make each service simple, so the code of the server that provides it is simple.

A typical server has a lot in common with a warehouse. (The result below assumes that content may be provided in any order.)

       Receive( *tid, request );
       switch( request.type ) {
       case PRODUCER:
	  if ( consumer-queued )
	     Reply ( producer );
	     Reply ( dequeue( consumer ), request.content );
	  if ( space-available ) 
	     insert( request.content );
	     Reply( producer );
	  queue( producer );
       case CONSUMER:
	  if ( producer-queued )
	     Reply ( consumer, producer.content );
	     Reply ( dequeue( producer ) );
	  if ( content-available ) 
	     Reply( consumer, extract( content ) );
	  queue( consumer );

Name Server

What is a name server?

Why Do We Need a Name Server

Names constant across applications
& executions
interface Associated with a set of services,
an API.
Task Ids vary across applications
& executions
implementation Associated with particular code
and data (an execution)

How do You Get the Task Id of the Name Server?

Remember what you did when you were installing Linux?

  1. You typed in the IP-address of the name server.
  2. Make it a constant across executions.
  3. Is there any other way that's not disgusting.

Name Server API

    int RegisterAs( char *name );
    int WhoIs( char *name );

Name Server Semantics




Analogy to Name Service on the Internet

Name Server Implementation

What does the client need to know in order to use the name server?

  1. its taskid
  2. the requests it services
  3. its API: function signatures and type definitions

User Pseudo-Code

First we need a struct for requests and reponses.

    struct NSreq {
		  int type;
		  char name[MAXNAMESIZE];
		  int tid;
Using this struct send to the name server looks something like
    Send( NSTid, (NSmsg *) msg, sizeof( NSmsg ), (NSmsg *) msg, sizeof ( NSmsg ) );

Name Server

  1. One service associates a taskid with a name
  2. The second service looks up the taskid and replys it to the requestor


  1. How much will this code run?
  2. What should happen when a WhoIs request is made for an unregistered name?
  3. How would you implement insert & lookup?
  4. What should be allowable as a name?

Return to: